5 changed files with 69 additions and 4 deletions
@ -0,0 +1,20 @@ |
|||||
|
package com.ccsens.mt.persist.dao; |
||||
|
|
||||
|
import com.ccsens.mt.bean.vo.TopicVo; |
||||
|
import com.ccsens.mt.persist.mapper.MtTopicMapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.springframework.stereotype.Repository; |
||||
|
|
||||
|
/** |
||||
|
* @author 逗 |
||||
|
*/ |
||||
|
@Repository |
||||
|
public interface TopicDao extends MtTopicMapper { |
||||
|
/** |
||||
|
* 查询题目 |
||||
|
* @param linkType 答题环节类型 |
||||
|
* @param topicNum 第几道题 |
||||
|
* @return 返回题目信息 |
||||
|
*/ |
||||
|
TopicVo.TopicInfo getTopicByLink(@Param("linkType") int linkType, @Param("topicNum")int topicNum); |
||||
|
} |
@ -1,4 +1,4 @@ |
|||||
spring: |
spring: |
||||
profiles: |
profiles: |
||||
active: test |
active: dev |
||||
include: common, util-test |
include: common, util-dev |
@ -0,0 +1,32 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.ccsens.mt.persist.dao.TopicDao"> |
||||
|
|
||||
|
<resultMap id="getTopicByLink" type="com.ccsens.mt.bean.vo.TopicVo$TopicInfo"> |
||||
|
<id column="topicId" property="topicId"/> |
||||
|
<result column="description" property="description"/> |
||||
|
<result column="answersTrue" property="answersTrue"/> |
||||
|
<collection property="options" ofType="String"> |
||||
|
<id column="options"/> |
||||
|
</collection> |
||||
|
</resultMap> |
||||
|
|
||||
|
|
||||
|
<select id="getTopicByLink" parameterType="java.util.Map" resultMap="getTopicByLink"> |
||||
|
SELECT |
||||
|
t.id as topicId, |
||||
|
t.description as description, |
||||
|
t.answers as answersTrue, |
||||
|
if(o.`option` = '',o.contant , concat(o.`option` ,':' ,o.contant)) as options |
||||
|
FROM |
||||
|
t_mt_topic t LEFT JOIN t_mt_topic_option o on t.id = o.topic_id |
||||
|
WHERE |
||||
|
t.rec_status = 0 |
||||
|
and |
||||
|
t.link_type = #{linkType} |
||||
|
and |
||||
|
t.sequence = #{topicNum} |
||||
|
ORDER BY o.sequence |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue