|
@@ -138,6 +138,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
where id = #{id}
|
|
|
</update>
|
|
|
|
|
|
+ <select id="getNum" parameterType="String" resultType="int">
|
|
|
+ SELECT
|
|
|
+ count( a.id )
|
|
|
+ FROM
|
|
|
+ jnb_question a
|
|
|
+ WHERE
|
|
|
+ a.whether_show = 'Y'
|
|
|
+ AND a.data_status = 1
|
|
|
+ AND a.`status` = 1
|
|
|
+ </select>
|
|
|
+
|
|
|
<delete id="deleteJnbQuestionById" parameterType="String">
|
|
|
delete from jnb_question where id = #{id}
|
|
|
</delete>
|
|
@@ -154,6 +165,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</foreach>
|
|
|
</update>
|
|
|
|
|
|
+ <select id="getShowList" parameterType="JnbQuestion" resultMap="JnbQuestionResult">
|
|
|
+ SELECT
|
|
|
+ a.id,
|
|
|
+ a.title,
|
|
|
+ a.type,
|
|
|
+ a.score,
|
|
|
+ a.browse,
|
|
|
+ GROUP_CONCAT(d.path) path,
|
|
|
+ a.create_by,
|
|
|
+ count(DISTINCT b.id) comment,
|
|
|
+ count(DISTINCT c.id) collect
|
|
|
+ FROM
|
|
|
+ jnb_question a
|
|
|
+ LEFT JOIN jnb_answer b on a.id = b.question_id and b.data_status = 1
|
|
|
+ LEFT JOIN jnb_question_collect c on a.id = c.question_id
|
|
|
+ left join jnb_question_img d on a.id = d.question_id
|
|
|
+ WHERE
|
|
|
+ a.data_status = 1
|
|
|
+ and a.status = 1
|
|
|
+ and a.whether_show ='Y'
|
|
|
+ GROUP BY a.id
|
|
|
+ order by a.create_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="getHotQuestionList" parameterType="JnbQuestion" resultMap="JnbQuestionResult">
|
|
|
SELECT
|
|
|
a.id,
|
|
@@ -170,7 +205,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
WHERE
|
|
|
a.data_status = 1
|
|
|
and a.status = 1
|
|
|
- and a.whether_show = 'Y'
|
|
|
and a.browse >= #{browse}
|
|
|
GROUP BY a.id
|
|
|
</select>
|
|
@@ -194,7 +228,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
WHERE
|
|
|
a.data_status = 1
|
|
|
and a.`status` = 1
|
|
|
- and a.whether_show = 'Y'
|
|
|
and a.type_id = #{id}
|
|
|
GROUP BY a.id
|
|
|
order by a.create_time desc
|
|
@@ -219,7 +252,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
WHERE
|
|
|
a.data_status = 1
|
|
|
and a.`status` = 1
|
|
|
- and a.whether_show = 'Y'
|
|
|
and a.type_id = #{id}
|
|
|
GROUP BY a.id
|
|
|
order by count(d.id) desc,comment desc,a.browse desc,a.create_time desc
|
|
@@ -244,7 +276,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
WHERE
|
|
|
a.data_status = 1
|
|
|
and a.`status` = 1
|
|
|
- and a.whether_show = 'Y'
|
|
|
and a.type_id = #{id}
|
|
|
GROUP BY a.id
|
|
|
order by a.score desc
|