BaseStudentAssessmentInspectionMapper.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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.total_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 NAME FROM base_class
  10. WHERE id = t.class_ids
  11. ) AS assessment_class_names,
  12. (
  13. (LENGTH(personal_student_user_ids) - LENGTH(REPLACE(personal_student_user_ids, ',', '')))
  14. ) + 1 AS student_count,t.enabled_mark,t.assessment_type
  15. FROM base_student_assessment_inspection t
  16. LEFT JOIN base_student_assessment_category t1 ON (t1.id = t.base_student_assessment_category_id)
  17. LEFT JOIN base_student_assessment_project t2 ON (t2.id = t.base_student_assessment_project_id)
  18. LEFT JOIN base_semester t3 ON t.base_semester_id = t3.id AND t3.delete_mark = 0
  19. LEFT JOIN base_grade t4 ON t.grade_id = t4.id
  20. LEFT JOIN xjr_user t5 ON t.assessment_user_id = t5.id
  21. LEFT JOIN xjr_dictionary_detail t6 ON t6.code= t.score_type
  22. WHERE t.delete_mark = 0 AND t1.delete_mark = 0 AND t2.delete_mark = 0
  23. <if test="dto.projectIds != null">
  24. and t.base_student_assessment_category_id = #{dto.projectIds}
  25. </if>
  26. <if test="dto.gradeId != null">
  27. and t.grade_id = #{dto.gradeId}
  28. </if>
  29. <if test="dto.semesterId != null">
  30. and t.base_semester_id = #{dto.semesterId}
  31. </if>
  32. <if test="dto.startDate != null">
  33. and t.assessment_date &gt;= #{dto.startDate}
  34. </if>
  35. <if test="dto.endDate != null">
  36. and t.assessment_date &lt;= #{dto.endDate}
  37. </if>
  38. <if test="dto.assessmentUserName != null and dto.assessmentUserName != ''">
  39. and t5.name like concat('%',#{dto.assessmentUserName},'%')
  40. </if>
  41. <if test="dto.assessmentType != null and dto.assessmentType != ''">
  42. and t.assessment_type like concat('%',#{dto.assessmentType},'%')
  43. </if>
  44. </select>
  45. <select id="getInfo" resultType="com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionVo">
  46. 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,
  47. 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
  48. ,t.total_score
  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;
  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 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 * (LENGTH(personal_student_user_ids) - LENGTH(REPLACE(personal_student_user_ids, ',', '')) + 1)) 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. <select id="getStudentListByInspectionId"
  300. resultType="com.xjrsoft.module.student.entity.BaseStudentAssessmentStudentRelation">
  301. SELECT t1.id,t1.user_id,t1.class_id,t3.student_id,t2.name,t6.name AS nation,t4.name AS class_name,
  302. t5.name AS major_name,t7.name as gender,t1.score
  303. FROM base_student_assessment_student_relation t1
  304. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  305. INNER JOIN base_student t3 ON t2.id = t3.user_id
  306. INNER JOIN base_class t4 ON t4.id = t1.class_id
  307. INNER JOIN base_major_set t5 ON t4.major_set_id = t5.id
  308. LEFT JOIN xjr_dictionary_detail t6 ON t3.nation = t6.code
  309. LEFT JOIN xjr_dictionary_detail t7 ON t2.gender = t7.code
  310. WHERE t1.base_student_assessment_inspection_id = #{id}
  311. </select>
  312. </mapper>