|
|
@ -10,6 +10,14 @@ |
|
|
|
<id column="options"/> |
|
|
|
</collection> |
|
|
|
</resultMap> |
|
|
|
<resultMap id="topicByLink" type="com.ccsens.mt.bean.vo.TopicVo$TopicByLink" > |
|
|
|
<id column="topicId" property="topicId"/> |
|
|
|
<result column="description" property="description"/> |
|
|
|
<result column="answersTrue" property="answersTrue"/> |
|
|
|
<result column="hasAnswers" property="hasAnswers"/> |
|
|
|
<collection property="options" ofType="String" column="topicId" select="queryOption"> |
|
|
|
</collection> |
|
|
|
</resultMap> |
|
|
|
|
|
|
|
|
|
|
|
<select id="getTopicByLink" parameterType="java.util.Map" resultMap="getTopicByLink"> |
|
|
@ -28,5 +36,33 @@ |
|
|
|
t.sequence = #{topicNum} |
|
|
|
ORDER BY o.sequence |
|
|
|
</select> |
|
|
|
<select id="queryTopicAllByLink" resultMap="topicByLink"> |
|
|
|
SELECT |
|
|
|
p.id AS topicId, |
|
|
|
p.score AS topicScore, |
|
|
|
p.description as description, |
|
|
|
p.answers as answersTrue, |
|
|
|
IF( gp.id IS NULL, 0, 1 ) as hasAnswers |
|
|
|
FROM |
|
|
|
t_mt_topic p |
|
|
|
LEFT JOIN t_mt_group_topic gp ON p.id = gp.topic_id |
|
|
|
LEFT JOIN t_mt_group g ON gp.group_id = g.id |
|
|
|
WHERE |
|
|
|
p.link_type = #{linkType} |
|
|
|
and p.rec_status = 0 |
|
|
|
and (g.project_id = #{projectId} or g.id is null) |
|
|
|
and (gp.rec_status = 0 or gp.id is null) |
|
|
|
and (g.rec_status = 0 or gp.id is null) |
|
|
|
GROUP BY p.id |
|
|
|
LIMIT ${nums} |
|
|
|
</select> |
|
|
|
<select id="queryOption" resultType="java.lang.String"> |
|
|
|
SELECT |
|
|
|
concat( o.`option`, ':', o.contant ) |
|
|
|
FROM |
|
|
|
t_mt_topic_option o |
|
|
|
WHERE |
|
|
|
o.topic_id = #{topicId} |
|
|
|
</select> |
|
|
|
|
|
|
|
</mapper> |