BaseStudentAssessmentInspectionMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  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.student.mapper.BaseStudentAssessmentInspectionMapper">
  6. <select id="getPage" parameterType="com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionPageVo">
  7. SELECT t.id,t.score,t.score_type,t.create_date AS assessment_date,t.reason,t1.name AS assessment_category_name,t2.name AS assessment_project_name,t3.name AS semester_name,t4.name AS grade_name,t5.name AS assessment_user_name,t6.name AS score_type_cn,
  8. (
  9. SELECT NAME FROM base_class
  10. WHERE id = t.class_ids
  11. ) AS assessment_class_names,
  12. (
  13. (LENGTH(class_student_user_ids) - LENGTH(REPLACE(class_student_user_ids, ',', '')))
  14. ) + 1 AS student_count
  15. FROM base_student_assessment_inspection t
  16. INNER JOIN xjr_workflow_form_relation t7 ON t.id = t7.form_key_value
  17. LEFT JOIN base_student_assessment_category t1 ON (t1.id = t.base_student_assessment_category_id)
  18. LEFT JOIN base_student_assessment_project t2 ON (t2.id = t.base_student_assessment_project_id)
  19. LEFT JOIN base_semester t3 ON t.base_semester_id=t3.id
  20. LEFT JOIN base_grade t4 ON t.grade_id=t4.id
  21. LEFT JOIN xjr_user t5 ON t.create_user_id=t5.id
  22. LEFT JOIN xjr_dictionary_detail t6 ON t6.code=t.score_type
  23. WHERE t.delete_mark = 0 AND t1.delete_mark = 0 AND t2.delete_mark = 0 AND t3.delete_mark = 0
  24. AND t7.current_state = 'COMPLETED'
  25. <if test="dto.projectIds != null and dto.projectIds.size() > 0">
  26. and t.base_student_assessment_project_id in
  27. <foreach item="projectId" index="index" collection="dto.projectIds" open="(" close=")" separator=",">
  28. #{projectId}
  29. </foreach>
  30. </if>
  31. <if test="dto.gradeId != null">
  32. and t.grade_id = #{dto.gradeId}
  33. </if>
  34. <if test="dto.semesterId != null">
  35. and t.base_semester_id = #{dto.semesterId}
  36. </if>
  37. <if test="dto.startDate != null">
  38. and t.assessment_date &gt;= #{dto.startDate}
  39. </if>
  40. <if test="dto.endDate != null">
  41. and t.assessment_date &lt;= #{dto.endDate}
  42. </if>
  43. <if test="dto.assessmentUserName != null and dto.assessmentUserName != ''">
  44. and t5.name like concat('%',#{dto.assessmentUserName},'%')
  45. </if>
  46. </select>
  47. <select id="getInfo" resultType="com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionVo">
  48. select t.id,t.score,t.score_type,t.assessment_date,t.reason,t1.name as assessment_category_name,t2.name as assessment_project_name,
  49. t3.name as semester_name,t4.name as grade_name,t5.name as assessment_user_name,t6.name as score_type_cn,t.file_id,t7.name as create_user_name
  50. from base_student_assessment_inspection t
  51. left join base_student_assessment_category t1 on (t1.id = t.base_student_assessment_category_id)
  52. left join base_student_assessment_project t2 on (t2.id = t.base_student_assessment_project_id)
  53. left join base_semester t3 on t.base_semester_id=t3.id
  54. left join base_grade t4 on t.grade_id=t4.id
  55. left join xjr_user t5 on t.assessment_user_id=t5.id
  56. left join xjr_dictionary_detail t6 on t6.code=t.score_type
  57. left join xjr_user t7 on t.create_user_id=t7.id
  58. where t.id=#{id} and t.delete_mark=0 and t1.delete_mark=0 and t2.delete_mark=0 and t3.delete_mark=0;
  59. </select>
  60. <select id="getMobilePage" parameterType="com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionMobilePageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionMobilePageVo">
  61. select t.id,t1.assessment_date,t2.name as assessment_category_name,t3.name as assessment_project_name,t5.name as
  62. assessment_class_name,t1.reason,t1.score,t1.score_type,t4.name as score_type_cn,
  63. (
  64. SELECT count(*) FROM base_student_assessment_student_relation WHERE base_student_assessment_inspection_id =
  65. t1.id and class_id=t.class_id
  66. ) as student_count
  67. from base_student_assessment_class_relation t
  68. left join base_student_assessment_inspection t1 on t1.id=t.base_student_assessment_inspection_id
  69. left join base_student_assessment_category t2 on (t2.id = t1.base_student_assessment_category_id)
  70. left join base_student_assessment_project t3 on (t3.id = t1.base_student_assessment_project_id)
  71. left join xjr_dictionary_detail t4 on t4.code=t1.score_type
  72. left join base_class t5 on t5.id=t.class_id
  73. where t1.delete_mark = 0 and t.class_id in
  74. <foreach item="classId" index="index" collection="dto.classIds" open="(" close=")" separator=",">
  75. #{classId}
  76. </foreach>
  77. <if test="dto.projectIds != null and dto.projectIds.size() > 0">
  78. and t1.base_student_assessment_project_id in
  79. <foreach item="projectId" index="index" collection="dto.projectIds" open="(" close=")" separator=",">
  80. #{projectId}
  81. </foreach>
  82. </if>
  83. <if test="dto.startDate != null and dto.startDate != ''">
  84. and t1.assessment_date &gt;= #{dto.startDate}
  85. </if>
  86. <if test="dto.endDate != null and dto.endDate != ''">
  87. and t1.assessment_date &lt;= #{dto.endDate}
  88. </if>
  89. </select>
  90. <select id="getMobileInfo" resultType="com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionMobileVo">
  91. select t.id,t.class_id,t.base_student_assessment_inspection_id,t1.score,t5.name as assessment_class_name,t2.name as assessment_category_name,t3.name as assessment_project_name,t1.assessment_date,t1.reason,
  92. t6.name as assessment_user_name,t7.name as create_user_name,t1.create_date,t1.file_id,t1.score_type,t4.name as score_type_cn
  93. from base_student_assessment_class_relation t
  94. left join base_student_assessment_inspection t1 on t1.id=t.base_student_assessment_inspection_id
  95. left join base_student_assessment_category t2 on (t2.id = t1.base_student_assessment_category_id)
  96. left join base_student_assessment_project t3 on (t3.id = t1.base_student_assessment_project_id)
  97. left join xjr_dictionary_detail t4 on t4.code=t1.score_type
  98. left join base_class t5 on t5.id=t.class_id
  99. left join xjr_user t6 on t1.assessment_user_id=t6.id
  100. left join xjr_user t7 on t1.create_user_id=t7.id
  101. where t.id=#{id};
  102. </select>
  103. <select id="getStudentIndividualBehaviorExcelVoList" parameterType="com.xjrsoft.module.student.dto.QuantitativeAssessmentExcelDto" resultType="com.xjrsoft.module.student.vo.QuantitativeAssessmentSubTableExcelVo">
  104. with total_score as (
  105. select
  106. t.user_id as studentUserId,
  107. sum(if(t1.score_type = 'score_add', t1.score, -1 * t1.score)) as finalScore
  108. from base_student_assessment_student_relation t
  109. left join base_student_assessment_inspection t1 on t1.id = t.base_student_assessment_inspection_id
  110. where t1.delete_mark = 0
  111. <if test="dto.yearAndMonth != null and dto.yearAndMonth != ''">
  112. and date_format(t1.assessment_date, '%Y-%m') = #{dto.yearAndMonth}
  113. </if>
  114. group by t.user_id
  115. )
  116. select
  117. t4.id as headTeacherUserId,
  118. t4.user_name as headTeacherUserName,
  119. t4.name as headTeacherName,
  120. t.class_id as classId,
  121. t.class_name as className,
  122. t.user_id as studentUserId,
  123. t.student_id as studentId,
  124. t.name as studentName,
  125. t5.base_score as baseScore,
  126. t2.id as baseStudentAssessmentProjectId,
  127. t2.name as baseStudentAssessmentProjectIdCN,
  128. t1.assessment_date as assessmentDate,
  129. if(t1.score_type = 'score_add', t1.score, -1 * t1.score) as projectScore,
  130. t5.base_score + t6.finalScore as finalScore
  131. from base_student_assessment_student_relation t
  132. left join base_student_assessment_inspection t1 on t1.id = t.base_student_assessment_inspection_id
  133. left join base_student_assessment_project t2 on t2.id = t1.base_student_assessment_project_id
  134. left join base_class t3 on t3.id = t.class_id
  135. left join xjr_user t4 on t4.id = t3.teacher_id
  136. left join base_student_assessment_base_score t5 on t5.base_semester_id = t1.base_semester_id
  137. left join total_score t6 on t6.studentUserId = t.user_id
  138. where t1.delete_mark = 0
  139. <if test="dto.yearAndMonth != null and dto.yearAndMonth != ''">
  140. and date_format(t1.assessment_date, '%Y-%m') = #{dto.yearAndMonth}
  141. </if>
  142. order by t.class_id, t.user_id
  143. </select>
  144. <select id="getQuantitativeAssessmentSubTableExcelVoList" parameterType="com.xjrsoft.module.student.dto.QuantitativeAssessmentExcelDto" resultType="com.xjrsoft.module.student.vo.QuantitativeAssessmentSubTableExcelVo">
  145. with total_score as (select t.user_id as studentUserId,
  146. sum(if(t1.score_type = 'score_add', t1.score, -1 * t1.score)) as finalScore
  147. from base_student_assessment_student_relation t
  148. left join base_student_assessment_inspection t1
  149. on t1.id = t.base_student_assessment_inspection_id
  150. where t1.delete_mark = 0
  151. and t1.base_student_assessment_category_id = #{dto.baseStudentAssessmentCategoryId}
  152. <if test="dto.classIdList != null and !dto.classIdList.isEmpty()">
  153. and t1.class_ids in
  154. <foreach item="classId" index="index" collection="dto.classIdList" open="(" close=")" separator=",">
  155. #{classId}
  156. </foreach>
  157. </if>
  158. <if test="dto.baseStudentAssessmentCategoryId != null and dto.baseStudentAssessmentCategoryId > 0">
  159. and t1.base_student_assessment_category_id = #{dto.baseStudentAssessmentCategoryId}
  160. </if>
  161. <if test="dto.baseSemesterId != null and dto.baseSemesterId > 0">
  162. and t1.base_semester_id &gt; #{dto.baseSemesterId}
  163. </if>
  164. <if test="dto.startTime != null">
  165. and t1.create_date &gt; #{dto.startTime}
  166. </if>
  167. <if test="dto.endTime != null">
  168. and t1.create_date &lt; #{dto.endTime}
  169. </if>
  170. group by t.user_id)
  171. select t4.id as headTeacherUserId,
  172. t4.user_name as headTeacherUserName,
  173. t4.name as headTeacherName,
  174. t.class_id as classId,
  175. t.class_name as className,
  176. t.user_id as studentUserId,
  177. t.student_id as studentId,
  178. t.name as studentName,
  179. t5.base_score as baseScore,
  180. t2.id as baseStudentAssessmentProjectId,
  181. t2.name as baseStudentAssessmentProjectIdCN,
  182. t1.assessment_date as assessmentDate,
  183. if(t1.score_type = 'score_add', t1.score, -1 * t1.score) as projectScore,
  184. t5.base_score + t6.finalScore as finalScore
  185. from base_student_assessment_student_relation t
  186. left join base_student_assessment_inspection t1 on t1.id = t.base_student_assessment_inspection_id
  187. left join base_student_assessment_project t2 on t2.id = t1.base_student_assessment_project_id
  188. left join base_class t3 on t3.id = t.class_id
  189. left join xjr_user t4 on t4.id = t3.teacher_id
  190. left join base_student_assessment_base_score t5 on t5.base_semester_id = t1.base_semester_id
  191. left join total_score t6 on t6.studentUserId = t.user_id
  192. where t1.delete_mark = 0
  193. and t1.base_student_assessment_category_id = #{dto.baseStudentAssessmentCategoryId}
  194. <if test="dto.classIdList != null and !dto.classIdList.isEmpty()">
  195. and t1.class_ids in
  196. <foreach item="classId" index="index" collection="dto.classIdList" open="(" close=")" separator=",">
  197. #{classId}
  198. </foreach>
  199. </if>
  200. <if test="dto.baseStudentAssessmentCategoryId != null and dto.baseStudentAssessmentCategoryId > 0">
  201. and t1.base_student_assessment_category_id = #{dto.baseStudentAssessmentCategoryId}
  202. </if>
  203. <if test="dto.baseSemesterId != null and dto.baseSemesterId > 0">
  204. and t1.base_semester_id &gt; #{dto.baseSemesterId}
  205. </if>
  206. <if test="dto.startTime != null">
  207. and t1.create_date &gt; #{dto.startTime}
  208. </if>
  209. <if test="dto.endTime != null">
  210. and t1.create_date &lt; #{dto.endTime}
  211. </if>
  212. order by t.class_id, t.user_id
  213. </select>
  214. <select id="getAssessmentInspectionByClassIdList" parameterType="com.xjrsoft.module.student.dto.QuantitativeAssessmentSingleScoreDto" resultType="com.xjrsoft.module.student.vo.QuantitativeAssessmentSingleScoreVo">
  215. select
  216. t.class_ids as class_id,
  217. SUM(t.score * (LENGTH(personal_student_user_ids) - LENGTH(REPLACE(personal_student_user_ids, ',', '')) + 1)) AS sumScore
  218. from base_student_assessment_inspection t
  219. where t.delete_mark = 0
  220. <if test="dto.classIdList != null and !dto.classIdList.isEmpty()">
  221. and t.class_ids in
  222. <foreach item="classId" index="index" collection="dto.classIdList" open="(" close=")" separator=",">
  223. #{classId}
  224. </foreach>
  225. </if>
  226. <if test="dto.baseStudentAssessmentCategoryId != null and dto.baseStudentAssessmentCategoryId > 0">
  227. and t.base_student_assessment_category_id = #{dto.baseStudentAssessmentCategoryId}
  228. </if>
  229. <if test="dto.baseSemesterId != null and dto.baseSemesterId > 0">
  230. and t.base_semester_id &gt; #{dto.baseSemesterId}
  231. </if>
  232. <if test="dto.startTime != null">
  233. and t.create_date &gt; #{dto.startTime}
  234. </if>
  235. <if test="dto.endTime != null">
  236. and t.create_date &lt; #{dto.endTime}
  237. </if>
  238. group by t.class_ids;
  239. </select>
  240. <select id="getConventionalManagementList" parameterType="com.xjrsoft.module.student.dto.QuantitativeAssessmentSingleScoreDto" resultType="com.xjrsoft.module.student.vo.QuantitativeAssessmentSingleScoreVo">
  241. select
  242. t.class_id as classId,
  243. sum(t1.score) as score
  244. from base_student_assessment_class_relation t
  245. left join base_student_assessment_inspection t1 on t1.id = t.base_student_assessment_inspection_id
  246. left join base_student_assessment_category t2 on t2.id = t1.base_student_assessment_category_id
  247. where t1.base_student_assessment_category_id = 1754411705233838080
  248. and t.class_id in
  249. <foreach item="classId" index="index" collection="dto.classIdList" open="(" close=")" separator=",">
  250. #{classId}
  251. </foreach>
  252. <if test="dto.startTime != null">
  253. and t1.create_date &gt; #{dto.startTime}
  254. </if>
  255. <if test="dto.endTime != null">
  256. and t1.create_date &lt; #{dto.endTime}
  257. </if>
  258. group by t.class_id;
  259. </select>
  260. <select id="getAwardsAndHonorList" parameterType="com.xjrsoft.module.student.dto.QuantitativeAssessmentSingleScoreDto" resultType="com.xjrsoft.module.student.vo.QuantitativeAssessmentSingleScoreVo">
  261. select
  262. t.class_id as classId,
  263. sum(t1.score) as score
  264. from base_student_assessment_student_relation t
  265. left join base_student_assessment_inspection t1 on t1.id = t.base_student_assessment_inspection_id
  266. left join base_student_assessment_category t2 on t2.id = t1.base_student_assessment_category_id
  267. where t1.base_student_assessment_category_id = 1754412347985760256
  268. and t.class_id in
  269. <foreach item="classId" index="index" collection="dto.classIdList" open="(" close=")" separator=",">
  270. #{classId}
  271. </foreach>
  272. <if test="dto.startTime != null">
  273. and t1.create_date &gt; #{dto.startTime}
  274. </if>
  275. <if test="dto.endTime != null">
  276. and t1.create_date &lt; #{dto.endTime}
  277. </if>
  278. group by t.class_id;
  279. </select>
  280. <select id="getParamilitaryList" parameterType="com.xjrsoft.module.student.dto.QuantitativeAssessmentSingleScoreDto" resultType="com.xjrsoft.module.student.vo.QuantitativeAssessmentSingleScoreVo">
  281. select
  282. t.class_id as classId,
  283. sum(t1.score) as score
  284. from base_student_assessment_student_relation t
  285. left join base_student_assessment_inspection t1 on t1.id = t.base_student_assessment_inspection_id
  286. left join base_student_assessment_category t2 on t2.id = t1.base_student_assessment_category_id
  287. where t1.base_student_assessment_category_id = 1754412347985760256
  288. and t.class_id in
  289. <foreach item="classId" index="index" collection="dto.classIdList" open="(" close=")" separator=",">
  290. #{classId}
  291. </foreach>
  292. <if test="dto.startTime != null">
  293. and t1.create_date &gt; #{dto.startTime}
  294. </if>
  295. <if test="dto.endTime != null">
  296. and t1.create_date &lt; #{dto.endTime}
  297. </if>
  298. group by t.class_id;
  299. </select>
  300. </mapper>