|
|
package com.ibeetl.jlw.dao;
|
|
|
|
|
|
import com.ibeetl.jlw.entity.TeacherOpenCourseQuestionLog;
|
|
|
import com.ibeetl.jlw.entity.TeacherOpenCourseQuestionLogScoreDetailsInfo;
|
|
|
import com.ibeetl.jlw.entity.dto.TeacherOpenCourseHomeWorkLogDTO;
|
|
|
import com.ibeetl.jlw.entity.vo.TeacherOpenCourseHomeWorkLogExportVO;
|
|
|
import com.ibeetl.jlw.enums.QuestionLogAddTypeEnum;
|
|
|
import com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum;
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseQuestionLogQuery;
|
|
|
import org.beetl.sql.core.engine.PageQuery;
|
|
|
import org.beetl.sql.core.query.LambdaQuery;
|
|
|
import org.beetl.sql.mapper.BaseMapper;
|
|
|
import org.beetl.sql.mapper.annotation.SqlResource;
|
|
|
import org.beetl.sql.mapper.annotation.Update;
|
|
|
import org.springframework.stereotype.Repository;
|
|
|
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 题目日志 Dao
|
|
|
*/
|
|
|
// 实际可以不用加Repository注解,调用的地方注入时候,Idea会报红,看着难受
|
|
|
@Repository
|
|
|
@SqlResource("jlw.teacherOpenCourseQuestionLog")
|
|
|
public interface TeacherOpenCourseQuestionLogDao extends BaseMapper<TeacherOpenCourseQuestionLog>{
|
|
|
PageQuery<TeacherOpenCourseQuestionLog> queryByCondition(PageQuery query);
|
|
|
PageQuery<TeacherOpenCourseQuestionLog> queryByConditionQuery(PageQuery query);
|
|
|
@Update
|
|
|
void deleteTeacherOpenCourseQuestionLogByIds(String ids);
|
|
|
@Update
|
|
|
void deleteByIds(String ids);
|
|
|
@Update
|
|
|
int updateGivenByIds(TeacherOpenCourseQuestionLogQuery teacherOpenCourseQuestionLogQuery);
|
|
|
List<TeacherOpenCourseQuestionLog> getByIds(String ids);
|
|
|
List<TeacherOpenCourseQuestionLog> getValuesByQuery(TeacherOpenCourseQuestionLogQuery teacherOpenCourseQuestionLogQuery);
|
|
|
List<TeacherOpenCourseQuestionLog> getValuesByQueryNotWithPermission(TeacherOpenCourseQuestionLogQuery teacherOpenCourseQuestionLogQuery);
|
|
|
|
|
|
PageQuery<TeacherOpenCourseQuestionLog> studentScoreList(PageQuery query);
|
|
|
|
|
|
/**
|
|
|
* 学生做题得分详情明细
|
|
|
* @param query
|
|
|
* @return
|
|
|
*/
|
|
|
PageQuery<TeacherOpenCourseQuestionLog> studentScoreDetailsList(PageQuery query);
|
|
|
|
|
|
/**
|
|
|
* 根据题目配置ID逻辑删除
|
|
|
* @param settingIds
|
|
|
*/
|
|
|
@Update
|
|
|
void logicDeleteBySettingIds(String settingIds);
|
|
|
|
|
|
/**
|
|
|
* 根据题目配置ID 批量真删除
|
|
|
* @param settingIds
|
|
|
*/
|
|
|
@Update
|
|
|
void deleteBySettingIds(String settingIds);
|
|
|
|
|
|
/**
|
|
|
* 查询学生详细得分信息
|
|
|
* 查询分数详细信息
|
|
|
* @param query
|
|
|
* @return
|
|
|
*/
|
|
|
PageQuery<TeacherOpenCourseQuestionLogScoreDetailsInfo> getQuestionLogScoreDetailsInfo(PageQuery query);
|
|
|
|
|
|
/**
|
|
|
* 验证前端传递过来的添加时间是否是最新的
|
|
|
* @param questionSettingId 题目配置ID
|
|
|
* @param questionSnapshotIds 题目快照ID
|
|
|
* @param studentId 学生ID
|
|
|
* @param addTime 前端传递的添加时间
|
|
|
* @return
|
|
|
*/
|
|
|
boolean validateQuestionLogAddTimeLatest(Long questionSettingId, String questionSnapshotIds, Long studentId, Date addTime);
|
|
|
|
|
|
/**
|
|
|
* 验证是否需要重新发题,则返回重新发题的标记
|
|
|
* @param questionSettingId 题目配置ID
|
|
|
* @param studentId 学生ID
|
|
|
* @param questionSettingType 题目配置类型
|
|
|
* @param questionLogAddType 题目日志添加类型(用于判断是否交卷)
|
|
|
* @return boolean
|
|
|
*/
|
|
|
boolean verifyLogAddTypeIsReSend(Long questionSettingId, Long studentId, ResourcesQuestionSnapshotFromTypeEnum questionSettingType, QuestionLogAddTypeEnum questionLogAddType);
|
|
|
|
|
|
/**
|
|
|
* 功能描述: <br>
|
|
|
* 通过题目配置ID和添加类型查询题目日志数量
|
|
|
*
|
|
|
* @param questionSettingId 题目配置ID
|
|
|
* @param studentId 学生ID
|
|
|
* @param type 题目添加类型
|
|
|
* @return {@link long}
|
|
|
* @Author: lx
|
|
|
* @Date: 2022/12/6 22:59
|
|
|
*/
|
|
|
default long getCountByQuestionLogAddType(@NotNull Long questionSettingId, Long studentId, String ...type) {
|
|
|
LambdaQuery<TeacherOpenCourseQuestionLog> lambdaQuery = createLambdaQuery();
|
|
|
LambdaQuery<TeacherOpenCourseQuestionLog> andCondition = lambdaQuery.condition();
|
|
|
|
|
|
boolean isNull = Arrays.stream(type).anyMatch(item -> item == null);
|
|
|
List<String> notNullList = Arrays.stream(type).filter(item -> item != null).collect(Collectors.toList());
|
|
|
|
|
|
// 是否添加Null条件
|
|
|
andCondition = isNull ? andCondition.andIsNull(TeacherOpenCourseQuestionLog::getQuestionLogAddType) : andCondition;
|
|
|
andCondition.orIn(TeacherOpenCourseQuestionLog::getQuestionLogAddType, notNullList);
|
|
|
|
|
|
return lambdaQuery.and(andCondition)
|
|
|
.andEq(TeacherOpenCourseQuestionLog::getTeacherOpenCourseQuestionLogStatus, 1)
|
|
|
.andEq(TeacherOpenCourseQuestionLog::getStudentId, studentId)
|
|
|
.andEq(TeacherOpenCourseQuestionLog::getTeacherOpenCourseQuestionSettingId, questionSettingId)
|
|
|
.count();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 功能描述: <br>
|
|
|
* 通过题目配置ID和添加类型查询题目日志数量
|
|
|
*
|
|
|
* @param questionSettingId 题目配置ID
|
|
|
* @param type 题目添加类型
|
|
|
* @return {@link long}
|
|
|
* @Author: lx
|
|
|
* @Date: 2022/12/6 22:59
|
|
|
*/
|
|
|
default List<TeacherOpenCourseQuestionLog> getByQuestionLogAddType(@NotNull Long questionSettingId, String ...type) {
|
|
|
LambdaQuery<TeacherOpenCourseQuestionLog> lambdaQuery = createLambdaQuery();
|
|
|
LambdaQuery<TeacherOpenCourseQuestionLog> andCondition = lambdaQuery.condition();
|
|
|
|
|
|
boolean isNull = Arrays.stream(type).anyMatch(item -> item == null);
|
|
|
List<String> notNullList = Arrays.stream(type).filter(item -> item != null).collect(Collectors.toList());
|
|
|
|
|
|
// 是否添加Null条件
|
|
|
andCondition = isNull ? andCondition.andIsNull(TeacherOpenCourseQuestionLog::getQuestionLogAddType) : andCondition;
|
|
|
andCondition.orIn(TeacherOpenCourseQuestionLog::getQuestionLogAddType, notNullList);
|
|
|
|
|
|
return lambdaQuery.and(andCondition)
|
|
|
.andEq(TeacherOpenCourseQuestionLog::getTeacherOpenCourseQuestionLogStatus, 1)
|
|
|
.andEq(TeacherOpenCourseQuestionLog::getTeacherOpenCourseQuestionSettingId, questionSettingId)
|
|
|
.select();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询未提交的试卷
|
|
|
* @param studentId
|
|
|
* @param questionSettingId
|
|
|
* @return
|
|
|
*/
|
|
|
List<TeacherOpenCourseQuestionLog> getNotSubmitQuestionLogs(Long studentId, Long questionSettingId);
|
|
|
|
|
|
/**
|
|
|
* 查询未提交试卷的题目数量
|
|
|
* @param studentId
|
|
|
* @param questionSettingId
|
|
|
* @return
|
|
|
*/
|
|
|
long getNotSubmitQuestionLogsCount(Long studentId, Long questionSettingId);
|
|
|
|
|
|
/**
|
|
|
* 查询附件作业-日志
|
|
|
* @param dto
|
|
|
* @return
|
|
|
*/
|
|
|
List<TeacherOpenCourseHomeWorkLogExportVO> getHomeWorkLogExportList(TeacherOpenCourseHomeWorkLogDTO dto);
|
|
|
|
|
|
/**
|
|
|
* 查询附件作业-日志(分页)
|
|
|
* @param pageQuery
|
|
|
* @return
|
|
|
*/
|
|
|
PageQuery<TeacherOpenCourseHomeWorkLogExportVO> getHomeWorkLogExportPageList(PageQuery pageQuery);
|
|
|
|
|
|
/**
|
|
|
* 删除题目的统计数据,附带删除题目做题日志数据
|
|
|
* 有可能只删除题目统计表,这时候需要删除做题日志相对应的数据
|
|
|
* @param questionSettingId
|
|
|
* @return
|
|
|
*/
|
|
|
boolean logicDeleteQuestionLogBySummaryQuestionIds(Long questionSettingId);
|
|
|
}
|