MainExamEvaluationMapper.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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="org.dromara.main.mapper.MainExamEvaluationMapper">
  6. <resultMap type="org.dromara.main.domain.MainExamEvaluation" id="MainExamEvaluationResult">
  7. <result property="id" column="id"/>
  8. <result property="evaluationName" column="evaluation_name"/>
  9. <result property="grade" column="grade"/>
  10. <result property="positionId" column="position_id"/>
  11. <result property="positionType" column="position_type"/>
  12. <result property="tags" column="tags"/>
  13. <result property="mainImage" column="main_image"/>
  14. <result property="imageAlbum" column="image_album"/>
  15. <result property="detail" column="detail"/>
  16. <result property="price" column="price"/>
  17. <result property="onTime" column="on_time"/>
  18. <result property="downTime" column="down_time"/>
  19. <result property="status" column="status"/>
  20. <result property="tenantId" column="tenant_id"/>
  21. <result property="createDept" column="create_dept"/>
  22. <result property="createBy" column="create_by"/>
  23. <result property="createTime" column="create_time"/>
  24. <result property="updateBy" column="update_by"/>
  25. <result property="updateTime" column="update_time"/>
  26. <result property="remark" column="remark"/>
  27. <result property="delFlag" column="del_flag"/>
  28. </resultMap>
  29. <resultMap type="org.dromara.main.domain.vo.MainExamEvaluationVo" id="MainExamEvaluationVoResult" extends="MainExamEvaluationResult">
  30. <result property="mainImageUrl" column="main_image_url"/>
  31. <result property="positionName" column="position_name"/>
  32. <collection property="abilityConfigs"
  33. ofType="org.dromara.main.domain.MainAbilityConfig"
  34. select="org.dromara.main.mapper.MainAbilityConfigMapper.selectByEvaluationId"
  35. column="id"/>
  36. </resultMap>
  37. <sql id="selectMainExamEvaluationVo">
  38. SELECT
  39. e.id, e.evaluation_name, e.grade, e.position_id, e.position_type,
  40. e.tags, e.main_image, e.image_album, e.detail, e.price,
  41. e.on_time, e.down_time, e.status,
  42. e.tenant_id, e.create_dept, e.create_by, e.create_time,
  43. e.update_by, e.update_time, e.remark, e.del_flag,
  44. oss.url AS main_image_url,
  45. p.post_name AS position_name
  46. FROM main_exam_evaluation e
  47. LEFT JOIN sys_oss oss ON e.main_image = oss.oss_id
  48. LEFT JOIN main_position p ON e.position_id = p.id
  49. </sql>
  50. <select id="selectVoByIdWithImages" resultMap="MainExamEvaluationVoResult">
  51. <include refid="selectMainExamEvaluationVo"/>
  52. WHERE e.id = #{id} AND e.del_flag = '0'
  53. </select>
  54. <select id="selectVoPageWithImages" resultMap="MainExamEvaluationVoResult">
  55. <include refid="selectMainExamEvaluationVo"/>
  56. ${ew.customSqlSegment}
  57. </select>
  58. <select id="selectParticipantStatsByEvaluationIds" resultType="java.util.HashMap">
  59. SELECT
  60. a.evaluation_id AS evaluationId,
  61. COUNT(DISTINCT a.id) AS totalCount,
  62. COUNT(DISTINCT CASE
  63. WHEN a.apply_status = '2' OR a.final_result IN ('1', '2')
  64. THEN a.id
  65. END) AS participantCount
  66. FROM main_exam_apply a
  67. WHERE IFNULL(a.del_flag, '0') = '0'
  68. AND a.evaluation_id IN
  69. <foreach collection="ids" item="id" open="(" separator="," close=")">
  70. #{id}
  71. </foreach>
  72. GROUP BY a.evaluation_id
  73. </select>
  74. <select id="selectApplyListByEvaluationId" resultType="org.dromara.main.domain.vo.MainExamApplyListVo">
  75. SELECT
  76. a.id,
  77. a.evaluation_id AS evaluationId,
  78. a.student_id AS studentId,
  79. s.name AS name,
  80. CASE s.gender
  81. WHEN '0' THEN '男'
  82. WHEN '1' THEN '女'
  83. ELSE '--'
  84. END AS gender,
  85. '--' AS department,
  86. s.mobile AS phone,
  87. CASE
  88. WHEN a.final_result = '1' THEN '通过'
  89. WHEN a.final_result = '2' THEN '未通过'
  90. WHEN a.apply_status = '2' THEN '待评分'
  91. WHEN a.apply_status = '1' THEN '测评中'
  92. ELSE '待测评'
  93. END AS statusText,
  94. CASE
  95. WHEN a.final_result = '1' THEN 'success'
  96. WHEN a.final_result = '2' THEN 'danger'
  97. WHEN a.apply_status IN ('1', '2') THEN 'warning'
  98. ELSE 'info'
  99. END AS statusType,
  100. DATE_FORMAT(COALESCE(a.finished_time, a.update_time, a.create_time), '%Y-%m-%d %H:%i:%s') AS evaluateTime,
  101. CASE
  102. WHEN a.final_result IN ('1', '2') OR a.apply_status IN ('1', '2') THEN 'detail'
  103. ELSE 'remove'
  104. END AS actionType
  105. FROM main_exam_apply a
  106. LEFT JOIN main_student s ON a.student_id = s.id AND IFNULL(s.del_flag, '0') = '0'
  107. WHERE IFNULL(a.del_flag, '0') = '0'
  108. AND a.evaluation_id = #{evaluationId}
  109. AND a.tenant_id = #{tenantId}
  110. <if test="keyword != null and keyword != ''">
  111. AND (
  112. s.name LIKE CONCAT('%', #{keyword}, '%')
  113. OR s.mobile LIKE CONCAT('%', #{keyword}, '%')
  114. OR a.final_result LIKE CONCAT('%', #{keyword}, '%')
  115. )
  116. </if>
  117. ORDER BY a.create_time DESC, a.id DESC
  118. </select>
  119. </mapper>