UserPeriodStatusMapper.xml 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.zhongzheng.modules.grade.mapper.UserPeriodStatusMapper">
  6. <resultMap type="com.zhongzheng.modules.grade.domain.UserPeriodStatus" id="UserPeriodStatusResult">
  7. <result property="status" column="status"/>
  8. <result property="recordStartTime" column="record_start_time"/>
  9. <result property="recordEndTime" column="record_end_time"/>
  10. <result property="id" column="id"/>
  11. <result property="periodId" column="period_id"/>
  12. <result property="periodStatus" column="period_status"/>
  13. <result property="createTime" column="create_time"/>
  14. <result property="updateTime" column="update_time"/>
  15. <result property="auditUserName" column="audit_user_name"/>
  16. <result property="auditTime" column="audit_time"/>
  17. </resultMap>
  18. <resultMap type="com.zhongzheng.modules.grade.vo.UserPeriodStatusVo" id="UserPeriodStatusVo">
  19. <result property="status" column="status"/>
  20. <result property="recordStartTime" column="record_start_time"/>
  21. <result property="recordEndTime" column="record_end_time"/>
  22. <result property="id" column="id"/>
  23. <result property="periodId" column="period_id"/>
  24. <result property="periodStatus" column="period_status"/>
  25. <result property="auditTime" column="audit_time"/>
  26. <result property="type" column="type"/>
  27. <result property="typeName" column="type_name"/>
  28. <result property="realName" column="realname"/>
  29. <result property="performance" column="performance"/>
  30. <result property="auditUserName" column="audit_user_name"/>
  31. <result property="durationTime" column="duration_time"/>
  32. </resultMap>
  33. <select id="selectPeriodStatus" parameterType="com.zhongzheng.modules.grade.bo.UserPeriodQueryBo" resultMap="UserPeriodStatusVo">
  34. SELECT
  35. ups.*,
  36. (select realname from `user` u where up.user_id = u.user_id) as realname,
  37. <if test="examId != null ">
  38. (SELECT exam_name FROM exam e where e.exam_id= up.exam_id) as type_name
  39. </if>
  40. <if test="sectionId != null ">
  41. (SELECT name FROM course_section cs where up.section_id= cs.section_id) as type_name,
  42. (SELECT duration_time FROM course_section cs where up.section_id= cs.section_id) as duration_time
  43. </if>
  44. FROM
  45. user_period_status ups
  46. LEFT JOIN user_period up ON up.id = ups.period_id
  47. WHERE 1=1
  48. <if test="goodsId != null and goodsId != ''">
  49. and up.goods_id = #{goodsId}
  50. </if>
  51. <if test="gradeId != null and gradeId != ''">
  52. and up.grade_id = #{gradeId}
  53. </if>
  54. <if test="userId != null and userId != ''">
  55. and up.user_id = #{userId}
  56. </if>
  57. <if test="sectionId != null ">
  58. and up.section_id = #{sectionId}
  59. </if>
  60. <if test="moduleId != null ">
  61. and up.module_id = #{moduleId}
  62. </if>
  63. <if test="chapterId != null">
  64. and up.chapter_id = #{chapterId}
  65. </if>
  66. <if test="courseId != null ">
  67. and up.course_id = #{courseId}
  68. </if>
  69. <if test="examId != null ">
  70. and up.exam_id = #{examId}
  71. </if>
  72. ORDER BY
  73. ups.create_time asc
  74. </select>
  75. </mapper>