dzx пре 2 месеци
родитељ
комит
1363a085e0

+ 17 - 15
src/main/resources/mapper/student/BaseStudentAssessmentInspectionMapper.xml

@@ -4,23 +4,25 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.xjrsoft.module.student.mapper.BaseStudentAssessmentInspectionMapper">
     <select id="getPage" parameterType="com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionPageVo">
-        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,
+        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,
         (
-            select group_concat(b.name) from base_student_assessment_class_relation a
-            left join base_class b on a.class_id=b.id
-            where a.base_student_assessment_inspection_id=t.id group by a.base_student_assessment_inspection_id
-        ) as assessment_class_names,
+        SELECT GROUP_CONCAT(b.name) FROM base_student_assessment_class_relation a
+        LEFT JOIN base_class b ON a.class_id=b.id
+        WHERE a.base_student_assessment_inspection_id=t.id GROUP BY a.base_student_assessment_inspection_id
+        ) AS assessment_class_names,
         (
-            SELECT count(*) FROM base_student_assessment_student_relation WHERE base_student_assessment_inspection_id = t.id
-        ) as student_count
-        from base_student_assessment_inspection t
-        left join base_student_assessment_category t1 on (t1.id = t.base_student_assessment_category_id)
-        left join base_student_assessment_project t2 on (t2.id = t.base_student_assessment_project_id)
-        left join base_semester t3 on t.base_semester_id=t3.id
-        left join base_grade t4 on t.grade_id=t4.id
-        left join xjr_user t5 on t.assessment_user_id=t5.id
-        left join xjr_dictionary_detail t6 on t6.code=t.score_type
-        where t.delete_mark = 0 and t1.delete_mark = 0  and t2.delete_mark = 0  and t3.delete_mark = 0
+        SELECT COUNT(*) FROM base_student_assessment_student_relation WHERE base_student_assessment_inspection_id = t.id
+        ) AS student_count
+        FROM base_student_assessment_inspection t
+        INNER JOIN xjr_workflow_form_relation t7 ON t1.id = t7.form_key_value
+        LEFT JOIN base_student_assessment_category t1 ON (t1.id = t.base_student_assessment_category_id)
+        LEFT JOIN base_student_assessment_project t2 ON (t2.id = t.base_student_assessment_project_id)
+        LEFT JOIN base_semester t3 ON t.base_semester_id=t3.id
+        LEFT JOIN base_grade t4 ON t.grade_id=t4.id
+        LEFT JOIN xjr_user t5 ON t.assessment_user_id=t5.id
+        LEFT JOIN xjr_dictionary_detail t6 ON t6.code=t.score_type
+        WHERE  t.delete_mark = 0 AND t1.delete_mark = 0  AND t2.delete_mark = 0  AND t3.delete_mark = 0
+        AND t7.current_state = 'COMPLETED'
         <if test="dto.projectIds != null and dto.projectIds.size() > 0">
             and t.base_student_assessment_project_id in
             <foreach item="projectId" index="index" collection="dto.projectIds" open="(" close=")" separator=",">