章节练习

beetlsql3-dev
Mlxa0324 2 years ago
parent 0aca48dad3
commit dfa1eda3a5

@ -24,10 +24,10 @@ import javax.validation.constraints.NotNull;
public class TeacherOpenCourseQuestionTestSimpleInfoDTO extends PageParam { public class TeacherOpenCourseQuestionTestSimpleInfoDTO extends PageParam {
/** /**
* ID * ID
*/ */
@NotNull(message = "题目配置ID不能为空", groups = ValidateConfig.ADD.class) @NotNull(message = "开课ID不能为空", groups = ValidateConfig.ADD.class)
private Long questionSettingId; private Long teacherOpenCourseId;
} }

@ -1,6 +1,7 @@
package com.ibeetl.jlw.service; package com.ibeetl.jlw.service;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.jlw.util.ToolUtils; import cn.jlw.util.ToolUtils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
@ -41,8 +42,10 @@ import java.util.function.Consumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static cn.hutool.core.util.ArrayUtil.join; import static cn.hutool.core.util.ArrayUtil.join;
import static cn.jlw.util.CacheUserUtil.getStudent;
import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser; import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser;
import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUserId; import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUserId;
import static com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum.CHAPTER_EXERCISE;
/** /**
* Service * Service
@ -475,7 +478,11 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
* @return * @return
*/ */
public PageQuery<TeacherOpenCourseQuestionTestSimpleInfoVO> getQuestionTestSimpleInfo(PageQuery query) { public PageQuery<TeacherOpenCourseQuestionTestSimpleInfoVO> getQuestionTestSimpleInfo(PageQuery query) {
return resourcesQuestionSnapshotDao.getQuestionTestSimpleInfo(query); Student student = getStudent();
Assert.notNull(student, "该接口只允许学生访问");
query.setPara("studentId", student.getStudentId());
query.setPara("teacherOpenCourseQuestionSettingType", CHAPTER_EXERCISE.name());
return resourcesQuestionSnapshotDao.getQuestionTestSimpleInfo(query);
} }
/** /**

@ -570,13 +570,43 @@ getValuesByQueryNotWithPermission
getQuestionTestSimpleInfo getQuestionTestSimpleInfo
=== ===
* 学生端- 题目的简单信息 * 学生端- 题目的简单信息
select SELECT
@pageTag(){ @pageTag(){
t.* t.*,
@} (
from resources_question_snapshot t SELECT
where 1 = 1 sum(
@ // TODO 理想 这里还没写完 IFNULL( ta.student_score, 0 ))
FROM
teacher_open_course_question_log ta
WHERE
ta.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
and ta.teacher_open_course_question_log_status = 1
AND t.teacher_open_course_question_setting_status = 1
AND t.teacher_open_course_question_setting_push_status = 1
AND t.student_id = #studentId#
) AS my_score,
(
SELECT
count( 1 )
FROM
resources_question_snapshot tb
WHERE
tb.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
AND tb.question_status = 1
AND t.teacher_open_course_question_setting_status = 1
AND t.teacher_open_course_question_setting_push_status = 1
) AS question_total_count
@}
FROM
teacher_open_course_question_setting t
WHERE
1 = 1
AND t.teacher_open_course_question_setting_type = #teacherOpenCourseQuestionSettingType#
AND t.teacher_open_course_question_setting_push_status = 1
AND t.teacher_open_course_question_setting_status = 1
AND t.teacher_open_course_id = #teacherOpenCourseId#
order by t.teacher_open_course_question_setting_name asc
questionTestResults questionTestResults

@ -39,7 +39,7 @@ class TeacherOpenCourseStudentSigninLogControllerTest extends BaseTest {
TeacherOpenCourseStudentSigninLogSigninDTO ipSignInDTO = new TeacherOpenCourseStudentSigninLogSigninDTO(); TeacherOpenCourseStudentSigninLogSigninDTO ipSignInDTO = new TeacherOpenCourseStudentSigninLogSigninDTO();
ipSignInDTO.setTeacherOpenCourseStudentSigninLogType(ip_signin); ipSignInDTO.setTeacherOpenCourseStudentSigninLogType(ip_signin);
// 懒得写动态数据,直接取表数据 teacher_open_course_merge_student // 懒得写动态数据,直接取表数据 teacher_open_course_merge_student
ipSignInDTO.setStudentId(33L); // ipSignInDTO.setStudentId(33L);
// teacher_open_course_student_signin_setting 查找teacher_open_course_id // teacher_open_course_student_signin_setting 查找teacher_open_course_id
ipSignInDTO.setTeacherOpenCourseStudentSigninSettingId(1L); ipSignInDTO.setTeacherOpenCourseStudentSigninSettingId(1L);
signinAction(ipSignInDTO); signinAction(ipSignInDTO);
@ -49,7 +49,7 @@ class TeacherOpenCourseStudentSigninLogControllerTest extends BaseTest {
TeacherOpenCourseStudentSigninLogSigninDTO manualSigninDTO = new TeacherOpenCourseStudentSigninLogSigninDTO(); TeacherOpenCourseStudentSigninLogSigninDTO manualSigninDTO = new TeacherOpenCourseStudentSigninLogSigninDTO();
manualSigninDTO.setTeacherOpenCourseStudentSigninLogType(code_signin); manualSigninDTO.setTeacherOpenCourseStudentSigninLogType(code_signin);
// 懒得写动态数据,直接取表数据 teacher_open_course_merge_student // 懒得写动态数据,直接取表数据 teacher_open_course_merge_student
manualSigninDTO.setStudentId(33L); // manualSigninDTO.setStudentId(33L);
manualSigninDTO.setVerificationCode("123qwe"); manualSigninDTO.setVerificationCode("123qwe");
// teacher_open_course_student_signin_setting 查找teacher_open_course_id // teacher_open_course_student_signin_setting 查找teacher_open_course_id
manualSigninDTO.setTeacherOpenCourseStudentSigninSettingId(2L); manualSigninDTO.setTeacherOpenCourseStudentSigninSettingId(2L);
@ -60,7 +60,7 @@ class TeacherOpenCourseStudentSigninLogControllerTest extends BaseTest {
TeacherOpenCourseStudentSigninLogSigninDTO codeSignInDTO = new TeacherOpenCourseStudentSigninLogSigninDTO(); TeacherOpenCourseStudentSigninLogSigninDTO codeSignInDTO = new TeacherOpenCourseStudentSigninLogSigninDTO();
codeSignInDTO.setTeacherOpenCourseStudentSigninLogType(manual_signin); codeSignInDTO.setTeacherOpenCourseStudentSigninLogType(manual_signin);
// 懒得写动态数据,直接取表数据 teacher_open_course_merge_student // 懒得写动态数据,直接取表数据 teacher_open_course_merge_student
codeSignInDTO.setStudentId(33L); // codeSignInDTO.setStudentId(33L);
// teacher_open_course_student_signin_setting 查找teacher_open_course_id // teacher_open_course_student_signin_setting 查找teacher_open_course_id
codeSignInDTO.setTeacherOpenCourseStudentSigninSettingId(3L); codeSignInDTO.setTeacherOpenCourseStudentSigninSettingId(3L);
codeSignInDTO.setIsAbsent(true); codeSignInDTO.setIsAbsent(true);

Loading…
Cancel
Save