BaseStudentAssessmentInspectionMapper.xml 18 KB

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