ExamRepoMapper.xml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536
  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.exam.mapper.ExamRepoMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.ydl.exam.modules.exam.entity.ExamRepo">
  6. <id column="id" property="id" />
  7. <result column="exam_id" property="examId" />
  8. <result column="repo_id" property="repoId" />
  9. <result column="radio_count" property="radioCount" />
  10. <result column="radio_score" property="radioScore" />
  11. <result column="multi_count" property="multiCount" />
  12. <result column="multi_score" property="multiScore" />
  13. <result column="judge_count" property="judgeCount" />
  14. <result column="judge_score" property="judgeScore" />
  15. </resultMap>
  16. <!-- 通用查询结果列 -->
  17. <sql id="Base_Column_List">
  18. `id`,`exam_id`,`repo_id`,`radio_count`,`radio_score`,`multi_count`,`multi_score`,`judge_count`,`judge_score`
  19. </sql>
  20. <resultMap id="ExtResultMap" type="com.ydl.exam.modules.exam.dto.ext.ExamRepoExtDTO" extends="BaseResultMap">
  21. <result column="totalRadio" property="totalRadio" />
  22. <result column="totalMulti" property="totalMulti" />
  23. <result column="totalJudge" property="totalJudge" />
  24. </resultMap>
  25. <select id="listByExam" resultMap="ExtResultMap">
  26. SELECT ep.*,repo.radio_count AS totalRadio,repo.multi_count AS totalMulti,repo.judge_count AS totalJudge
  27. FROM el_exam_repo ep
  28. LEFT JOIN el_repo repo ON ep.repo_id=repo.id
  29. WHERE ep.exam_id=#{examId}
  30. </select>
  31. </mapper>