Sfoglia il codice sorgente

选做题未选做旧数据处理脚本

xiatian 1 anno fa
parent
commit
9fc9adf05d

+ 17 - 1
install/mysql/upgrade/1.3.15.sql

@@ -6,4 +6,20 @@ ALTER TABLE m_reject_history ADD INDEX index2(`library_id`);
 ALTER TABLE eb_inspect_history MODIFY column inspector_id INT (11) NOT NULL COMMENT '复核人ID';
 ALTER TABLE eb_inspect_history MODIFY column  student_id INT (11) NOT NULL COMMENT '考生ID';
 ALTER TABLE eb_selective_group MODIFY column score_policy	varchar(64) NOT NULL COMMENT '合分方式';
-ALTER TABLE eb_selective_student ADD COLUMN `not_selective`	tinyint(1) NOT NULL COMMENT '是否未选做';
+ALTER TABLE eb_selective_student ADD COLUMN `not_selective`	tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否未选做';
+-- 更新选做题未选做数据
+update eb_selective_student set not_selective=1 where student_id 
+in(
+	select tem.student_id from 
+	(
+		select 
+		e.student_id,
+		sg.selective_index,
+		sum(case when e.group_score != -1 then 1 else 0 end) cc
+		from eb_subjective_score e 
+		left join eb_mark_group mg on e.exam_id=mg.exam_id and e.subject_code=mg.subject_code and e.group_number=mg.number
+		left join eb_selective_group sg on sg.exam_id=e.exam_id and sg.subject_code=e.subject_code and sg.main_number=e.main_number 
+		where mg.is_selective=1
+		GROUP BY e.student_id,sg.selective_index
+	)tem where tem.cc=0
+);

+ 2 - 2
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/exam/service/impl/InspectedServiceImpl.java

@@ -173,9 +173,9 @@ public class InspectedServiceImpl extends BaseQueryService<ExamStudent> implemen
         // +StringUtils.join(groupNumbers,",")+") and e.group_score != -1 )");
         // }
         if (SelectiveStatus.UN_SELECTIVE.equals(selectiveStatus)) {
-//            whereSql.append(" and exists (select 1 from eb_subjective_score e left join eb_mark_group mg "
+//            whereSql.append(" and not exists (select 1 from eb_subjective_score e left join eb_mark_group mg "
 //                    + " on e.exam_id=mg.exam_id and e.subject_code=mg.subject_code and e.group_number=mg.number"
-//                    + " where e.student_id = s.id  and e.group_score = -1 and mg.is_selective=1)"
+//                    + " where e.student_id = s.id  and e.group_score != -1 and mg.is_selective=1)"
 //                    + " and es.selective=1");
             whereSql.append(" and exists (select ss.student_id from eb_selective_student ss where ss.student_id = s.id and ss.not_selective=1)");
         }