EvaluateManageMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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.EvaluateManageMapper">
  6. <select id="getPage" parameterType="com.xjrsoft.module.evaluate.dto.EvaluateManagePageDto" resultType="com.xjrsoft.module.evaluate.vo.EvaluateManagePageVo">
  7. SELECT t1.id,t2.name AS semester_name,t4.name AS org_name,t3.evaluate_type,t5.name AS evaluate_type_cn,t1.name,t1.start_time,t1.end_time,t1.status FROM evaluate_manage t1
  8. LEFT JOIN base_semester t2 ON t2.id = t1.base_semester_id
  9. LEFT JOIN evaluate_template t3 ON t3.id = t1.evaluate_template_id
  10. LEFT JOIN xjr_department t4 ON t4.id = t1.org_id
  11. LEFT JOIN xjr_dictionary_detail t5 ON t5.code = t3.evaluate_type AND t5.item_id = 1746831039385366530
  12. WHERE t1.delete_mark = 0
  13. <if test="dto.semesterId != null">
  14. and t1.base_semester_id = #{dto.semesterId}
  15. </if>
  16. <if test="dto.orgId != null">
  17. and t1.org_id = #{dto.orgId}
  18. </if>
  19. <if test="dto.evaluateType != null and dto.evaluateType != ''">
  20. and t3.evaluate_type = #{dto.evaluateType}
  21. </if>
  22. <if test="dto.status != null">
  23. and t1.status = #{dto.status}
  24. </if>
  25. <if test="dto.startTime != null">
  26. and t1.start_time >= #{dto.startTime}
  27. </if>
  28. <if test="dto.endTime != null">
  29. and #{dto.endTime} >= t1.end_time
  30. </if>
  31. <if test="dto.name != null and dto.name != ''">
  32. and t1.name like concat('%', #{dto.name}, '%')
  33. </if>
  34. ORDER BY t1.create_date DESC
  35. </select>
  36. <select id="getList" parameterType="com.xjrsoft.module.room.dto.RoomPageDto" resultType="com.xjrsoft.module.room.vo.RoomExcelVo">
  37. </select>
  38. <select id="getMaxSortCode" resultType="java.lang.Integer">
  39. SELECT IFNULL(MAX(sort_code),1) FROM evaluate_manage WHERE delete_mark = 0
  40. </select>
  41. <select id="getMobileIndexPage" parameterType="com.xjrsoft.module.evaluate.dto.MobileIndexPageDto" resultType="com.xjrsoft.module.evaluate.vo.MobileIndexPageVo">
  42. select
  43. distinct
  44. t.id as evaluateManageId,
  45. t.name,
  46. t2.evaluate_type,
  47. t4.name as evaluateTypeCn,
  48. (select
  49. count(tb3.status)
  50. from evaluate_manage tb1
  51. left join evaluate_executer tb3 on tb3.evaluate_manage_id = tb1.id
  52. where tb1.delete_mark = 0
  53. and tb1.status &lt;&gt; -1
  54. and tb3.status = 0
  55. and tb3.user_id = t3.user_id
  56. and tb1.id = t.id) as ratedCount
  57. from evaluate_manage t
  58. left join evaluate_template t2 on t2.id = t.evaluate_template_id
  59. left join evaluate_executer t3 on t3.evaluate_manage_id = t.id
  60. left join xjr_dictionary_detail t4 on t4.code = t2.evaluate_type
  61. where t.delete_mark = 0
  62. and t.status &lt;&gt; -1
  63. and t3.user_id = #{dto.loginUserId}
  64. <if test="dto.keyword != null and dto.keyword != ''">
  65. and (t.name like concat('%', #{dto.keyword}, '%')
  66. or t4.name like concat('%', #{dto.keyword}, '%'))
  67. </if>
  68. </select>
  69. <select id="getMobileResultPage" parameterType="com.xjrsoft.module.evaluate.dto.MobileResultPageDto" resultType="com.xjrsoft.module.evaluate.vo.MobileResultPageVo">
  70. select
  71. t.id as evaluateSubmitRecordId,
  72. t.evaluate_manage_id as evaluateManageId,
  73. t1.name,
  74. t.evaluated_object_id as evaluateObjectId,
  75. t3.object_id as objectId,
  76. ifnull(t4.name, t5.name) as objectIdCn,
  77. t2.id as evaluateUserId,
  78. t2.user_id as userId,
  79. t6.name as userIdCn,
  80. t.create_date as startTime,
  81. t.status as evaluateStatus,
  82. t7.evaluate_type as evaluateType,
  83. t8.name as evaluateTypeCn
  84. from evaluate_submit_record t
  85. left join evaluate_manage t1 on t1.id = t.evaluate_manage_id
  86. left join evaluate_executer t2 on t2.id = t.evaluate_executer_id
  87. left join evaluate_object t3 on t3.id = t.evaluated_object_id
  88. left join xjr_user t4 on t4.id = t3.object_id
  89. left join base_class t5 on t5.id = t3.object_id
  90. left join xjr_user t6 on t6.id = t2.user_id
  91. left join evaluate_template t7 on t7.id = t1.evaluate_template_id
  92. left join xjr_dictionary_detail t8 on t8.code = t7.evaluate_type
  93. where t2.user_id = #{dto.loginUserId}
  94. and t.evaluate_manage_id = #{dto.evaluateManageId}
  95. <if test="dto.status != null">
  96. and t.status = #{dto.status}
  97. </if>
  98. <if test="dto.startTime != null and dto.startTime != ''">
  99. and t1.start_time >= #{dto.startTime}
  100. </if>
  101. <if test="dto.endTime != null and dto.startTime != ''">
  102. and #{dto.endTime} >= t1.end_time
  103. </if>
  104. order by t.status;
  105. </select>
  106. <select id="getDrillEvaluateClassList" parameterType="com.xjrsoft.module.evaluate.dto.DrillEvaluateClassListDto" resultType="com.xjrsoft.module.evaluate.vo.DrillEvaluateClassListVo">
  107. select
  108. t.id as evaluateSubmitRecordId,
  109. t.evaluate_manage_id as evaluateManageId,
  110. t1.name,
  111. t.evaluated_object_id as evaluateObjectId,
  112. t3.object_id as objectId,
  113. ifnull(t4.name, t5.name) as objectIdCn,
  114. t2.id as evaluateUserId,
  115. t2.user_id as userId,
  116. t6.name as userIdCn,
  117. t1.start_time,
  118. t1.end_time,
  119. t.status as evaluateStatus,
  120. t7.evaluate_type as evaluateType,
  121. t8.name as evaluateTypeCn
  122. from evaluate_submit_record t
  123. left join evaluate_manage t1 on t1.id = t.evaluate_manage_id
  124. left join evaluate_executer t2 on t2.id = t.evaluate_executer_id
  125. left join evaluate_object t3 on t3.id = t.evaluated_object_id
  126. left join xjr_user t4 on t4.id = t3.object_id
  127. left join base_class t5 on t5.id = t3.object_id
  128. left join xjr_user t6 on t6.id = t2.user_id
  129. left join evaluate_template t7 on t7.id = t1.evaluate_template_id
  130. left join xjr_dictionary_detail t8 on t8.code = t7.evaluate_type
  131. left join base_classroom t9 on t9.id = t5.classroom_id
  132. left join base_class_major_set t10 on t10.class_id = t5.id
  133. left join base_major_set t11 on t11.id = t10.major_set_id
  134. where t.create_date like concat('%', #{dto.todayDate}, '%')
  135. and t2.user_id = #{dto.loginUserId}
  136. and t.evaluate_manage_id = #{dto.evaluateManageId}
  137. <if test="dto.majorId != null and dto.majorId > 0">
  138. and t10.major_id = #{dto.majorId}
  139. </if>
  140. <if test="dto.officeBuildId != null and dto.officeBuildId > 0">
  141. and t8.officeBuildId = #{dto.officeBuildId}
  142. </if>
  143. order by t.status;
  144. </select>
  145. <select id="getWriteInfo" parameterType="com.xjrsoft.module.evaluate.dto.EvaluateWritePageDto" resultType="com.xjrsoft.module.evaluate.vo.EvaluateWriteVo">
  146. select t1.id, t1.name,t2.total as sumScore,t1.start_time,t1.end_time,
  147. (SELECT COUNT(id) FROM evaluate_manage_item a WHERE t1.delete_mark = 0 AND a.evaluate_manage_id = t1.id) AS item_count
  148. from evaluate_manage t1
  149. left join evaluate_template t2 on t2.id = t1.evaluate_template_id
  150. where t1.delete_mark = 0
  151. and t1.id = #{id}
  152. </select>
  153. <select id="getItemList" resultType="com.xjrsoft.module.evaluate.vo.EvaluateManageItemVo">
  154. SELECT * FROM evaluate_manage_item WHERE delete_mark = 0 AND evaluate_manage_id = #{id} ORDER BY sort_code
  155. </select>
  156. <select id="getResultList" parameterType="com.xjrsoft.module.evaluate.dto.ResultListDto" resultType="com.xjrsoft.module.evaluate.vo.EvaluateManageItemVo">
  157. SELECT t1.id,
  158. t1.sort_code,
  159. t1.evaluate_manage_id,
  160. t1.topic,
  161. t1.problem,
  162. t1.score,
  163. t2.score AS actualScore,
  164. t2.opinion,
  165. t1.input_not_null
  166. FROM evaluate_submit_record t
  167. LEFT JOIN evaluate_result t2 ON t2.submit_record_id = t.id
  168. left join evaluate_manage_item t1 on t1.id = t2.evaluate_item_id
  169. LEFT JOIN evaluate_executer t3 ON t3.id = t.evaluate_executer_id
  170. WHERE t1.delete_mark = 0
  171. AND t.id = #{dto.evaluateSubmitRecordId}
  172. ORDER BY t1.sort_code
  173. </select>
  174. <select id="getScoreList" parameterType="com.xjrsoft.module.evaluate.dto.EvaluateManageScoreDto" resultType="com.xjrsoft.module.evaluate.vo.EvaluateManageScoreVo">
  175. select t.submit_record_id as submitRecordId,
  176. sum(t.score) as totalScore,
  177. count(t.score) as itemCount
  178. from evaluate_result t
  179. left join evaluate_submit_record t3 on t3.id = t.submit_record_id
  180. where t.delete_mark = 0
  181. and t.submit_record_id in
  182. <foreach item="submitRecordId" index="index" collection="dto.submitRecordIdList" open="(" close=")"
  183. separator=",">
  184. #{submitRecordId}
  185. </foreach>
  186. group by t.submit_record_id;
  187. </select>
  188. <insert id="insertEvaluateSubmitRecord" parameterType="java.lang.Long">
  189. insert into evaluate_submit_record (id, evaluate_manage_id, evaluate_executer_id, create_date, evaluated_object, evaluated_object_id, status)
  190. (SELECT
  191. UUID(),
  192. t.evaluate_manage_id,
  193. t.id,
  194. NOW(),
  195. if(t2.evaluate_type='dm_evaluate_class', 'class', 'teacher'),
  196. t.evaluate_object_id,
  197. 0
  198. FROM evaluate_executer t
  199. LEFT JOIN evaluate_manage t1 ON (t1.id = t.evaluate_manage_id)
  200. LEFT JOIN evaluate_template t2 ON (t2.id = t1.evaluate_template_id)
  201. WHERE t.delete_mark = 0
  202. AND t.evaluate_manage_id = #{evaluateManageId})
  203. </insert>
  204. </mapper>