PaperQuAnswerMapper.xml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.ydl.exam.modules.paper.mapper.PaperQuAnswerMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.ydl.exam.modules.paper.entity.PaperQuAnswer">
  6. <id column="id" property="id" />
  7. <result column="paper_id" property="paperId" />
  8. <result column="answer_id" property="answerId" />
  9. <result column="qu_id" property="quId" />
  10. <result column="is_right" property="isRight" />
  11. <result column="checked" property="checked" />
  12. <result column="sort" property="sort" />
  13. <result column="abc" property="abc" />
  14. </resultMap>
  15. <!-- 通用查询结果列 -->
  16. <sql id="Base_Column_List">
  17. `id`,`paper_id`,`answer_id`,`qu_id`,`is_right`,`checked`,`sort`,`abc`
  18. </sql>
  19. <resultMap id="ListResultMap"
  20. type="com.ydl.exam.modules.paper.dto.ext.PaperQuAnswerExtDTO"
  21. extends="BaseResultMap">
  22. <result column="image" property="image" />
  23. <result column="content" property="content" />
  24. </resultMap>
  25. <select id="list" resultMap="ListResultMap">
  26. SELECT pa.`id`,pa.`paper_id`,pa.`answer_id`,pa.`qu_id`,pa.`checked`,pa.`sort`,pa.`abc`,qa.content,qa.image
  27. FROM el_paper_qu_answer pa
  28. LEFT JOIN el_qu_answer qa ON pa.answer_id=qa.id
  29. WHERE pa.paper_id=#{paperId} AND pa.qu_id=#{quId}
  30. ORDER BY pa.sort ASC
  31. </select>
  32. <select id="listForShow" resultMap="ListResultMap">
  33. SELECT pa.`id`,pa.`paper_id`,pa.`answer_id`,pa.`qu_id`,pa.`checked`,pa.`sort`,pa.`abc`,qa.content,qa.is_right,qa.image
  34. FROM el_paper_qu_answer pa
  35. LEFT JOIN el_qu_answer qa ON pa.answer_id=qa.id
  36. WHERE pa.paper_id=#{paperId} AND pa.qu_id=#{quId}
  37. ORDER BY pa.sort ASC
  38. </select>
  39. </mapper>