diff --git a/web/src/main/java/com/ibeetl/jlw/entity/GeneralQuestionLogScoreInfo.java b/web/src/main/java/com/ibeetl/jlw/entity/GeneralQuestionLogScoreInfo.java index e6426768..257df782 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/GeneralQuestionLogScoreInfo.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/GeneralQuestionLogScoreInfo.java @@ -45,13 +45,14 @@ public class GeneralQuestionLogScoreInfo extends BaseEntity { // 题目总数量 - @FetchSql("select count(1) from general_question_log t " + - "where 1 = 1 " + - "and t.general_question_log_status = 1 \n" + - "@if(!isEmpty(studentId)) { \n" + - "and t.student_id = #studentId# \n" + - "@} \n" + - "and t.general_question_setting_id = #generalQuestionSettingId# " + @FetchSql("SELECT" + + "count(DISTINCT(t.general_resources_question_snapshot_id)) " + + "FROM " + + "general_resources_question_snapshot t " + + "WHERE " + + "1 = 1 " + + "AND t.question_status = 1 " + + "AND t.general_question_setting_id = #generalQuestionSettingId# " ) private Integer questionTotalCount; diff --git a/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseQuestionLogScoreInfo.java b/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseQuestionLogScoreInfo.java index 81a95a5a..d59a10ac 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseQuestionLogScoreInfo.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseQuestionLogScoreInfo.java @@ -45,13 +45,14 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity { // 题目总数量 - @FetchSql("select count(1) from teacher_open_course_question_log t " + - "where 1 = 1 " + - "and t.teacher_open_course_question_log_status = 1 \n" + - "@if(!isEmpty(studentId)) { \n" + - "and t.student_id = #studentId# \n" + - "@} \n" + - "and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " + @FetchSql("SELECT " + + "count(DISTINCT ( t.resources_question_snapshot_id )) " + + "FROM " + + "resources_question_snapshot t " + + "WHERE " + + "1 = 1 " + + "AND t.question_status = 1 " + + "AND t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " ) private Integer questionTotalCount; diff --git a/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionSettingService.java b/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionSettingService.java index 55550787..72c5621a 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionSettingService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionSettingService.java @@ -3,6 +3,7 @@ package com.ibeetl.jlw.service; import cn.hutool.core.date.DateUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import cn.jlw.util.EnumUtil; import cn.jlw.util.ToolUtils; import cn.jlw.validate.ValidateConfig; @@ -629,25 +630,42 @@ public class GeneralQuestionSettingService extends CoreBaseService 0, nothingThrowMessage); + } + // 为空代表,试卷是完全提交的状态,这样判断比较保险一些 isZeroCount = notSubmitCount == 0; } - // 异常的消息,交给调用方来定义 - Assert.isTrue(isZeroCount, throwMessage); + + if (StrUtil.isNotBlank(notSubmitThrowMessage)) { + // 异常的消息,交给调用方来定义 + Assert.isTrue(isZeroCount, notSubmitThrowMessage); + } } } diff --git a/web/src/main/java/com/ibeetl/jlw/service/GeneralResourcesQuestionSnapshotService.java b/web/src/main/java/com/ibeetl/jlw/service/GeneralResourcesQuestionSnapshotService.java index ccf8558f..f6df08b5 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/GeneralResourcesQuestionSnapshotService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/GeneralResourcesQuestionSnapshotService.java @@ -456,7 +456,7 @@ public class GeneralResourcesQuestionSnapshotService extends CoreBaseService 0, nothingThrowMessage); + } + // 为空代表,试卷是完全提交的状态,这样判断比较保险一些 isZeroCount = notSubmitCount == 0; } - // 异常的消息,交给调用方来定义 - Assert.isTrue(isZeroCount, throwMessage); + + if (StrUtil.isNotBlank(notSubmitThrowMessage)) { + // 异常的消息,交给调用方来定义 + Assert.isTrue(isZeroCount, notSubmitThrowMessage); + } } }