查询题目简单信息,接口入参修改

beetlsql3-dev
Mlxa0324
parent 1666ecda1c
commit c67c422ea7

@ -3,6 +3,7 @@ package com.ibeetl.jlw.entity.dto;
import cn.jlw.validate.ValidateConfig;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.ibeetl.admin.core.web.query.PageParam;
import com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum;
import lombok.*;
import lombok.experimental.Accessors;
@ -28,6 +29,15 @@ public class TeacherOpenCourseQuestionTestSimpleInfoDTO extends PageParam {
*/
@NotNull(message = "开课ID不能为空", groups = ValidateConfig.ADD.class)
private Long teacherOpenCourseId;
/**
*
*/
@NotNull(message = "题目配置类型不能为空!", groups = ValidateConfig.ADD.class)
private ResourcesQuestionSnapshotFromTypeEnum teacherOpenCourseQuestionSettingType;
}

@ -1,6 +1,9 @@
package com.ibeetl.jlw.entity.vo;
import cn.hutool.core.date.DateTime;
import com.ibeetl.admin.core.annotation.DictEnum;
import com.ibeetl.admin.core.entity.BaseEntity;
import com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -21,6 +24,19 @@ public class TeacherOpenCourseQuestionTestSimpleInfoVO extends BaseEntity {
private String teacherOpenCourseQuestionSettingName;
// 题目配置的类型
@DictEnum
private ResourcesQuestionSnapshotFromTypeEnum teacherOpenCourseQuestionSettingType;
// 开始时间
private DateTime teacherOpenCourseQuestionStartTime;
// 结束时间
private DateTime teacherOpenCourseQuestionEndTime;
// 我的分数
private String myScore;
@ -37,4 +53,12 @@ public class TeacherOpenCourseQuestionTestSimpleInfoVO extends BaseEntity {
private String finishTime;
// 完成用时(秒)
private String finishSecondTime;
// 正确率 最大100
private Float correctRate;
}

@ -15,6 +15,7 @@ import com.ibeetl.jlw.dao.StudentDao;
import com.ibeetl.jlw.dao.TeacherOpenCourseMergeResourcesQuestionDao;
import com.ibeetl.jlw.entity.*;
import com.ibeetl.jlw.entity.dto.QuestionSettingDTO;
import com.ibeetl.jlw.entity.dto.TeacherOpenCourseQuestionTestSimpleInfoDTO;
import com.ibeetl.jlw.entity.vo.TeacherOpenCourseQuestionTestDetailVO;
import com.ibeetl.jlw.entity.vo.TeacherOpenCourseQuestionTestSimpleInfoVO;
import com.ibeetl.jlw.web.query.ResourcesQuestionSnapshotQuery;
@ -42,7 +43,6 @@ import java.util.stream.Collectors;
import static cn.hutool.core.util.ArrayUtil.join;
import static cn.jlw.util.CacheUserUtil.getStudent;
import static com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum.CHAPTER_EXERCISE;
/**
* Service
@ -471,12 +471,13 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
* @param query ID
* @return
*/
public PageQuery<TeacherOpenCourseQuestionTestSimpleInfoVO> getQuestionTestSimpleInfo(PageQuery query) {
public PageQuery<TeacherOpenCourseQuestionTestSimpleInfoVO> getQuestionTestSimpleInfo(TeacherOpenCourseQuestionTestSimpleInfoDTO query) {
Student student = getStudent();
Assert.notNull(student, "该接口只允许学生访问");
query.setPara("studentId", student.getStudentId());
query.setPara("teacherOpenCourseQuestionSettingType", CHAPTER_EXERCISE.name());
return resourcesQuestionSnapshotDao.getQuestionTestSimpleInfo(query);
PageQuery pageQuery = query.getPageQuery(); pageQuery.setPara("studentId", student.getStudentId());
PageQuery<TeacherOpenCourseQuestionTestSimpleInfoVO> questionTestSimpleInfo = resourcesQuestionSnapshotDao.getQuestionTestSimpleInfo(pageQuery);
dictParser(questionTestSimpleInfo.getList());
return questionTestSimpleInfo;
}
/**

@ -176,7 +176,7 @@ public class ResourcesQuestionSnapshotController extends BaseController {
@SCoreUser CoreUser coreUser) {
Assert.isTrue(coreUser.isStudent(), "非学生身份,无法获取数据!");
return JsonResult.success(resourcesQuestionSnapshotService.getQuestionTestSimpleInfo(dto.getPageQuery()));
return JsonResult.success(resourcesQuestionSnapshotService.getQuestionTestSimpleInfo(dto));
}

@ -628,16 +628,39 @@ getQuestionTestSimpleInfo
LIMIT 1
) AS is_finished,
(
SELECT max(TIMEDIFF( t.teacher_open_course_question_log_update_time , t.teacher_open_course_question_log_add_time )) as finish_time
FROM teacher_open_course_question_log t
WHERE t.teacher_open_course_question_log_status = 1
SELECT max(TIMEDIFF( td.teacher_open_course_question_log_update_time , td.teacher_open_course_question_log_add_time )) as finish_time
FROM teacher_open_course_question_log td
WHERE td.teacher_open_course_question_log_status = 1
@if(!isEmpty(studentId)) {
and t.student_id = #studentId#
and td.student_id = #studentId#
@}
and t.question_log_add_type = 'FINALLY_SUBMIT'
and t.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
AND t.teacher_open_course_question_log_update_time IS NOT NULL
) as finish_time
and td.question_log_add_type = 'FINALLY_SUBMIT'
and td.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
AND td.teacher_open_course_question_log_update_time IS NOT NULL
) as finish_time,
(
SELECT max(TIMESTAMPDIFF(SECOND, te.teacher_open_course_question_log_update_time , te.teacher_open_course_question_log_add_time )) as finish_second_time
FROM teacher_open_course_question_log te
WHERE te.teacher_open_course_question_log_status = 1
@if(!isEmpty(studentId)) {
and te.student_id = #studentId#
@}
and te.question_log_add_type = 'FINALLY_SUBMIT'
and te.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
AND te.teacher_open_course_question_log_update_time IS NOT NULL
) as finish_second_time,
(
SELECT round(sum(case when tf.question_score = tf.student_score then 1 else 0 end)
/ ifnull(count(distinct(tf.resources_question_snapshot_id)), 0) * 100, 2) as finish_second_time
FROM teacher_open_course_question_log tf
WHERE tf.teacher_open_course_question_log_status = 1
@if(!isEmpty(studentId)) {
and tf.student_id = #studentId#
@}
and tf.question_log_add_type = 'FINALLY_SUBMIT'
and tf.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
AND tf.teacher_open_course_question_log_update_time IS NOT NULL
) as correct_rate
@}
FROM
teacher_open_course_question_setting t

Loading…
Cancel
Save