EvaluateResultMapper.xml 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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.xjrsoft.module.evaluate.mapper.EvaluateResultMapper">
  6. <select id="getIndexPage" parameterType="com.xjrsoft.module.evaluate.dto.EvaluateResultIndexPageDto" resultType="com.xjrsoft.module.evaluate.vo.EvaluateResultIndexPageVo">
  7. SELECT
  8. t.id AS evaluateManageId,
  9. t1.name AS semesterName,
  10. t2.name AS orgName,
  11. t4.name AS evaluateTypeCN,
  12. t.name,
  13. t.start_time,
  14. t.end_time
  15. FROM evaluate_manage t
  16. LEFT JOIN base_semester t1 ON (t1.id = t.base_semester_id)
  17. LEFT JOIN xjr_department t2 ON (t2.id = t.org_id)
  18. LEFT JOIN evaluate_template t3 ON (t3.id = t.evaluate_template_id)
  19. LEFT JOIN xjr_dictionary_detail t4 ON (t4.code = t3.evaluate_type)
  20. WHERE t.delete_mark = 0
  21. and t.status != -1
  22. <if test="dto.baseSemesterId != null and dto.baseSemesterId > 0">
  23. AND t.base_semester_id = #{dto.baseSemesterId}
  24. </if>
  25. <if test="dto.orgId != null and dto.orgId > 0">
  26. AND t.org_id = #{dto.orgId}
  27. </if>
  28. <if test="dto.evaluateType != null and dto.evaluateType != ''">
  29. AND t3.evaluate_type = #{dto.evaluateType}
  30. </if>
  31. <if test="dto.name != null and dto.name != ''">
  32. AND t.name like CONCAT('%',#{dto.name},'%')
  33. </if>
  34. <if test="dto.startTime != null and dto.startTime != ''">
  35. AND t.start_time &gt;= #{dto.startTime}
  36. </if>
  37. <if test="dto.endTime != null and dto.endTime != ''">
  38. AND t.end_time &lt;= #{dto.endTime}
  39. </if>
  40. ORDER BY t.id DESC
  41. </select>
  42. <select id="getDetailPage" parameterType="com.xjrsoft.module.evaluate.dto.EvaluateResultDetailPageDto" resultType="com.xjrsoft.module.evaluate.vo.EvaluateResultDetailPageVo">
  43. select
  44. t.evaluate_manage_id as evaluateManageId,
  45. t.evaluate_object_id as evaluatedObjectId,
  46. t.id as evaluatedExecuterId,
  47. ifnull(t1.name, t2.name) as ObjectIdCN,
  48. t4.name as userIdCN,
  49. t.status,
  50. ifnull(t5.comprehensiveScore, 0) as comprehensiveScore
  51. from evaluate_executer t
  52. left join evaluate_object t3 on t3.id = t.evaluate_object_id
  53. left join xjr_user t1 on t1.id = t3.object_id
  54. left join base_class t2 on t2.id = t3.object_id
  55. left join xjr_user t4 on t4.id = t.user_id
  56. left join (select
  57. t.evaluated_object_id, t.user_id, sum(t.score) as comprehensiveScore
  58. from evaluate_result t
  59. group by t.evaluated_object_id, t.user_id) t5 on t5.evaluated_object_id = t.evaluate_object_id and t5.user_id = t.id
  60. where t.evaluate_manage_id = #{dto.evaluateManageId}
  61. <if test="dto.baseGradeId != null and dto.baseGradeId > 0">
  62. AND t3.base_grade_id = #{dto.baseGradeId}
  63. </if>
  64. <if test="dto.status != null">
  65. AND t.status = #{dto.status}
  66. </if>
  67. <if test="dto.classId != null and dto.classId > 0">
  68. AND t3.object_id = #{dto.classId}
  69. </if>
  70. <if test="dto.teacherId != null and dto.teacherId > 0 and (dto.checkObject == null or dto.checkObject == 0)">
  71. AND (t3.object_id = #{dto.teacherId}
  72. or t.user_id = #{dto.teacherId})
  73. </if>
  74. <if test="dto.teacherId != null and dto.teacherId > 0 and dto.checkObject != null and dto.checkObject == 1">
  75. AND t3.object_id = #{dto.teacherId}
  76. </if>
  77. <if test="dto.teacherId != null and dto.teacherId > 0 and dto.checkObject != null and dto.checkObject == 2">
  78. AND t.user_id = #{dto.teacherId}
  79. </if>
  80. <if test="dto.name != null and dto.name != '' and (dto.checkObject == null or dto.checkObject == 0)">
  81. AND (t1.name like CONCAT('%',#{dto.name},'%')
  82. or t2.name like CONCAT('%',#{dto.name},'%')
  83. or t4.name like CONCAT('%',#{dto.name},'%'))
  84. </if>
  85. <if test="dto.name != null and dto.name != '' and dto.checkObject != null and dto.checkObject == 1">
  86. AND (t1.name like CONCAT('%',#{dto.name},'%')
  87. or t2.name like CONCAT('%',#{dto.name},'%'))
  88. </if>
  89. <if test="dto.name != null and dto.name != '' and dto.checkObject != null and dto.checkObject == 2">
  90. AND t4.name like CONCAT('%',#{dto.name},'%')
  91. </if>
  92. </select>
  93. <select id="getDetailPageDetail" parameterType="com.xjrsoft.module.evaluate.dto.EvaluateResultDetailPageDetailDto" resultType="com.xjrsoft.module.evaluate.vo.EvaluateResultDetailPageDetailVo">
  94. select
  95. ifnull(t1.name, t2.name) as ObjectIdCN,
  96. t4.name as userIdCN,
  97. ifnull(t5.comprehensiveScore, 0) as actulTotal,
  98. t6.name,
  99. t7.total
  100. from evaluate_object t
  101. left join xjr_user t1 on t1.id = t.object_id
  102. left join base_class t2 on t2.id = t.object_id
  103. left join evaluate_executer t3 on t3.evaluate_object_id = t.id
  104. left join xjr_user t4 on t4.id = t3.user_id
  105. left join (select
  106. t.evaluated_object_id, t.user_id, sum(t.score) as comprehensiveScore
  107. from evaluate_result t
  108. group by t.evaluated_object_id, t.user_id) t5 on t5.evaluated_object_id = t.id and t5.user_id = t3.id
  109. left join evaluate_manage t6 on t6.id = t.evaluate_manage_id
  110. left join evaluate_template t7 on t7.id = t6.evaluate_template_id
  111. where t.delete_mark = 0
  112. and t.evaluate_manage_id = #{dto.evaluateManageId}
  113. and t.id = #{dto.evaluatedObjectId}
  114. and t3.id = #{dto.evaluatedExecuterId}
  115. </select>
  116. <select id="getDetailPageDetailList" parameterType="com.xjrsoft.module.evaluate.dto.EvaluateResultDetailPageDetailDto" resultType="com.xjrsoft.module.evaluate.vo.EvaluateResultDetailPageDetailList">
  117. select
  118. t.score,
  119. t.problem,
  120. t.topic,
  121. t1.score as actualScore,
  122. t1.opinion
  123. from evaluate_manage_item t
  124. left join evaluate_result t1 on t1.evaluate_item_id = t.id
  125. where t.delete_mark = 0
  126. and t.evaluate_manage_id = #{dto.evaluateManageId}
  127. and t1.evaluated_object_id = #{dto.evaluatedObjectId}
  128. and t1.user_id = #{dto.evaluatedExecuterId}
  129. </select>
  130. <select id="listByObjectIdAndEvaluateItemId" resultType="com.xjrsoft.module.evaluate.vo.ResultViewingPageVo">
  131. select
  132. sum(t.score) as sumScore,
  133. t.evaluate_item_id as evaluateManageItemId,
  134. t1.object_id as objectId
  135. from evaluate_result t
  136. left join evaluate_object t1 on t1.id = t.evaluated_object_id
  137. where t.evaluate_item_id in
  138. <foreach item="evaluateManageItemId" index="index" collection="evaluateManageItemIdList" open="(" close=")"
  139. separator=",">
  140. #{evaluateManageItemId}
  141. </foreach>
  142. and t1.object_id in
  143. <foreach item="evaluateObjectId" index="index" collection="evaluateObjectIdList" open="(" close=")"
  144. separator=",">
  145. #{evaluateObjectId}
  146. </foreach>
  147. group by t1.object_id, t.evaluate_item_id;
  148. </select>
  149. <select id="listTopicScoreByObjectIdAndTopic" resultType="com.xjrsoft.module.evaluate.vo.ResultViewingPageVo">
  150. select sum(t.score) as topicScore,
  151. t1.object_id as objectId,
  152. t2.topic
  153. from evaluate_result t
  154. left join evaluate_object t1 on t1.id = t.evaluated_object_id
  155. left join evaluate_manage_item t2 on t2.id = t.evaluate_item_id
  156. where t.evaluate_item_id in
  157. <foreach item="evaluateManageItemId" index="index" collection="evaluateManageItemIdList" open="(" close=")"
  158. separator=",">
  159. #{evaluateManageItemId}
  160. </foreach>
  161. and t1.object_id in
  162. <foreach item="evaluateObjectId" index="index" collection="evaluateObjectIdList" open="(" close=")"
  163. separator=",">
  164. #{evaluateObjectId}
  165. </foreach>
  166. group by t1.object_id, t2.topic;
  167. </select>
  168. <select id="listSynthesisScore" resultType="com.xjrsoft.module.evaluate.vo.ResultViewingPageVo">
  169. select sum(t.score) as synthesisScore,
  170. t1.object_id as objectId
  171. from evaluate_result t
  172. left join evaluate_object t1 on t1.id = t.evaluated_object_id
  173. where t.evaluate_item_id in
  174. <foreach item="evaluateManageItemId" index="index" collection="evaluateManageItemIdList" open="(" close=")"
  175. separator=",">
  176. #{evaluateManageItemId}
  177. </foreach>
  178. and t1.object_id in
  179. <foreach item="evaluateObjectId" index="index" collection="evaluateObjectIdList" open="(" close=")"
  180. separator=",">
  181. #{evaluateObjectId}
  182. </foreach>
  183. group by t1.object_id;
  184. </select>
  185. </mapper>