PaperMapper.xml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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.PaperMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.ydl.exam.modules.paper.entity.Paper">
  6. <id column="id" property="id" />
  7. <result column="user_id" property="userId" />
  8. <result column="depart_id" property="departId" />
  9. <result column="exam_id" property="examId" />
  10. <result column="title" property="title" />
  11. <result column="total_time" property="totalTime" />
  12. <result column="user_time" property="userTime" />
  13. <result column="total_score" property="totalScore" />
  14. <result column="qualify_score" property="qualifyScore" />
  15. <result column="obj_score" property="objScore" />
  16. <result column="subj_score" property="subjScore" />
  17. <result column="user_score" property="userScore" />
  18. <result column="has_saq" property="hasSaq" />
  19. <result column="state" property="state" />
  20. <result column="create_time" property="createTime" />
  21. <result column="update_time" property="updateTime" />
  22. <result column="limit_time" property="limitTime" />
  23. </resultMap>
  24. <!-- 通用查询结果列 -->
  25. <sql id="Base_Column_List">
  26. `id`,`user_id`,`depart_id`,`exam_id`,`title`,`total_time`,`user_time`,`total_score`,`qualify_score`,`obj_score`,`subj_score`,`user_score`,`has_saq`,`state`,`create_time`,`update_time`,`limit_time`
  27. </sql>
  28. <resultMap id="ListResultMap"
  29. extends="BaseResultMap"
  30. type="com.ydl.exam.modules.paper.dto.response.PaperListRespDTO">
  31. <result column="real_name" property="realName" />
  32. </resultMap>
  33. <select id="paging" resultMap="ListResultMap">
  34. SELECT pp.*,uc.real_name FROM el_paper pp
  35. LEFT JOIN sys_user uc ON pp.user_id=uc.id
  36. <where>
  37. <if test="query!=null">
  38. <if test="query.examId!=null and query.examId!=''">
  39. AND pp.exam_id=#{query.examId}
  40. </if>
  41. <if test="query.userId!=null and query.userId!=''">
  42. AND pp.user_id=#{query.userId}
  43. </if>
  44. <if test="query.departId!=null and query.departId!=''">
  45. AND pp.depart_id=#{query.departId}
  46. </if>
  47. <if test="query.state!=null">
  48. AND pp.state=#{query.state}
  49. </if>
  50. <if test="query.realName!=null and query.realName!=''">
  51. AND uc.real_name LIKE '%${query.realName}%'
  52. </if>
  53. </if>
  54. </where>
  55. ORDER BY create_time DESC
  56. </select>
  57. </mapper>