添加课程管理和试卷自动生成功能
parent
1aad0c9f8c
commit
97a1117b41
|
|
@ -5,10 +5,9 @@ import com.alibaba.cola.dto.MultiResponse;
|
|||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.Response;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||
import com.zcloud.edu.api.study.ClassServiceI;
|
||||
import com.zcloud.edu.dto.clientobject.study.ClassCO;
|
||||
import com.zcloud.edu.dto.data.study.ClassQuestionDTO;
|
||||
import com.zcloud.edu.dto.study.ClassAddCmd;
|
||||
import com.zcloud.edu.dto.study.ClassPageQry;
|
||||
import com.zcloud.edu.dto.study.ClassUpdateCmd;
|
||||
|
|
@ -36,10 +35,16 @@ public class ClassController {
|
|||
@ApiOperation("新增")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<ClassCO> add(@Validated @RequestBody ClassAddCmd cmd) {
|
||||
|
||||
return classService.add(cmd);
|
||||
}
|
||||
|
||||
@ApiOperation("查看班级可用习题数量")
|
||||
@GetMapping("/countQuestionByClassId/{id}")
|
||||
public SingleResponse<ClassQuestionDTO> countQuestionByClassId(@PathVariable("id") String id) {
|
||||
return classService.countQuestionByClassId(id);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("分页")
|
||||
@PostMapping("/list")
|
||||
public PageResponse<ClassCO> page(@RequestBody ClassPageQry qry) {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-adapter
|
||||
|
|
@ -35,9 +36,9 @@ public class ClassCurriculumController {
|
|||
|
||||
@ApiOperation("新增")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<ClassCurriculumCO> add(@Validated @RequestBody ClassCurriculumAddCmd cmd) {
|
||||
public Response add(@Validated @RequestBody List<ClassCurriculumAddCmd> cmdList) {
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
return classCurriculumService.add(cmd);
|
||||
return classCurriculumService.add(cmdList);
|
||||
}
|
||||
|
||||
@ApiOperation("分页")
|
||||
|
|
@ -55,9 +56,12 @@ public class ClassCurriculumController {
|
|||
@ApiOperation("详情")
|
||||
@GetMapping("/{id}")
|
||||
public SingleResponse<ClassCurriculumCO> getInfoById(@PathVariable("id") Long id) {
|
||||
return SingleResponse.of(new ClassCurriculumCO());
|
||||
return classCurriculumService.getInfoById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ApiOperation("删除")
|
||||
@DeleteMapping("/{id}")
|
||||
public Response remove(@PathVariable("id") Long id) {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.jjb.saas.framework.auth.utils.AuthContext;
|
|||
import com.zcloud.edu.api.study.ClassExamPaperServiceI;
|
||||
import com.zcloud.edu.dto.clientobject.study.ClassExamPaperCO;
|
||||
import com.zcloud.edu.dto.study.ClassExamPaperAddCmd;
|
||||
import com.zcloud.edu.dto.study.ClassExamPaperAutoAddCmd;
|
||||
import com.zcloud.edu.dto.study.ClassExamPaperPageQry;
|
||||
import com.zcloud.edu.dto.study.ClassExamPaperUpdateCmd;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -36,10 +37,15 @@ public class ClassExamPaperController {
|
|||
@ApiOperation("新增")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<ClassExamPaperCO> add(@Validated @RequestBody ClassExamPaperAddCmd cmd) {
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
return classExamPaperService.add(cmd);
|
||||
}
|
||||
|
||||
@ApiOperation("自动生成试卷")
|
||||
@PostMapping("/autoSave")
|
||||
public SingleResponse<ClassExamPaperCO> autoSave(@Validated @RequestBody ClassExamPaperAutoAddCmd cmd) {
|
||||
return classExamPaperService.autoSave(cmd);
|
||||
}
|
||||
|
||||
@ApiOperation("分页")
|
||||
@PostMapping("/list")
|
||||
public PageResponse<ClassExamPaperCO> page(@RequestBody ClassExamPaperPageQry qry) {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,23 @@
|
|||
package com.zcloud.edu.command.query.study;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.edu.command.convertor.study.ClassCurriculumChapterCoConvertor;
|
||||
import com.zcloud.edu.command.convertor.study.ClassCurriculumCoConvertor;
|
||||
import com.zcloud.edu.domain.gateway.study.ClassCurriculumChapterGateway;
|
||||
import com.zcloud.edu.dto.clientobject.study.ClassCurriculumCO;
|
||||
import com.zcloud.edu.dto.clientobject.study.ClassCurriculumChapterCO;
|
||||
import com.zcloud.edu.dto.study.ClassCurriculumPageQry;
|
||||
import com.zcloud.edu.persistence.dataobject.study.ClassCurriculumChapterDO;
|
||||
import com.zcloud.edu.persistence.dataobject.study.ClassCurriculumDO;
|
||||
import com.zcloud.edu.persistence.repository.study.ClassCurriculumChapterRepository;
|
||||
import com.zcloud.edu.persistence.repository.study.ClassCurriculumRepository;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -25,6 +34,8 @@ import java.util.Map;
|
|||
public class ClassCurriculumQueryExe {
|
||||
private final ClassCurriculumRepository classCurriculumRepository;
|
||||
private final ClassCurriculumCoConvertor classCurriculumCoConvertor;
|
||||
private final ClassCurriculumChapterRepository classCurriculumChapterRepository;
|
||||
private final ClassCurriculumChapterCoConvertor classCurriculumChapterCoConvertor;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
|
|
@ -38,5 +49,23 @@ public class ClassCurriculumQueryExe {
|
|||
List<ClassCurriculumCO> examCenterCOS = classCurriculumCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public SingleResponse<ClassCurriculumCO> executeGetInfoById(Long id) {
|
||||
ClassCurriculumDO classCurriculumDO = classCurriculumRepository.getInfoById(id);
|
||||
List<ClassCurriculumChapterDO> classCurriculumChapterDOList = classCurriculumChapterRepository.listByCurriculumId(classCurriculumDO.getClassCurriculumId());
|
||||
ClassCurriculumCO classCurriculumCO = new ClassCurriculumCO();
|
||||
BeanUtils.copyProperties(classCurriculumDO, classCurriculumCO);
|
||||
List<ClassCurriculumChapterCO> classCurriculumChapterCOList = classCurriculumChapterCoConvertor.converDOsToCOs(classCurriculumChapterDOList);
|
||||
long videoCount = classCurriculumChapterCOList.stream().filter(bean -> !ObjectUtils.isEmpty(bean.getVideoCoursewareId())).count();
|
||||
Tools.buildEntityTree(classCurriculumChapterCOList, "curriculumChapterId", "parentId", "children", "0");
|
||||
classCurriculumCO.setChapterList(classCurriculumChapterCOList);
|
||||
classCurriculumCO.setVideoCount(videoCount);
|
||||
return SingleResponse.of(classCurriculumCO);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
package com.zcloud.edu.command.query.study;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.edu.command.convertor.study.ClassCoConvertor;
|
||||
import com.zcloud.edu.dto.clientobject.study.ClassCO;
|
||||
import com.zcloud.edu.dto.data.study.ClassQuestionDTO;
|
||||
import com.zcloud.edu.dto.study.ClassPageQry;
|
||||
import com.zcloud.edu.persistence.dataobject.study.ClassDO;
|
||||
import com.zcloud.edu.persistence.mapper.po.study.ClassQuestionPO;
|
||||
import com.zcloud.edu.persistence.repository.study.ClassRepository;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
@ -38,5 +41,27 @@ public class ClassQueryExe {
|
|||
List<ClassCO> examCenterCOS = classCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
|
||||
public SingleResponse<ClassQuestionDTO> executeCountQuestionByClassId(String classId) {
|
||||
|
||||
List<ClassQuestionPO> questionCountList = classRepository.countQuestionByClassId(classId);
|
||||
ClassQuestionDTO classQuestionDTO = new ClassQuestionDTO();
|
||||
if (questionCountList != null && questionCountList.size() > 0){
|
||||
for (ClassQuestionPO questionPO : questionCountList){
|
||||
switch (questionPO.getQuestionType()){
|
||||
case 1:
|
||||
classQuestionDTO.setSingleCount(questionPO.getQuestionCount());
|
||||
break;
|
||||
case 2:
|
||||
classQuestionDTO.setMultipleCount(questionPO.getQuestionCount());
|
||||
break;
|
||||
case 3:
|
||||
classQuestionDTO.setJudgeCount(questionPO.getQuestionCount());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return SingleResponse.of(classQuestionDTO);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,22 @@
|
|||
package com.zcloud.edu.command.study;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.edu.domain.gateway.study.ClassCurriculumChapterGateway;
|
||||
import com.zcloud.edu.domain.gateway.study.ClassCurriculumGateway;
|
||||
import com.zcloud.edu.domain.model.study.ClassCurriculumChapterE;
|
||||
import com.zcloud.edu.domain.model.study.ClassCurriculumE;
|
||||
import com.zcloud.edu.dto.study.ClassCurriculumAddCmd;
|
||||
import com.zcloud.edu.dto.study.ClassCurriculumChapterAddCmd;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
|
|
@ -20,20 +28,51 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
@AllArgsConstructor
|
||||
public class ClassCurriculumAddExe {
|
||||
private final ClassCurriculumGateway classCurriculumGateway;
|
||||
private final ClassCurriculumChapterGateway classCurriculumChapterGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(ClassCurriculumAddCmd cmd) {
|
||||
public boolean execute(List<ClassCurriculumAddCmd> cmdList) {
|
||||
ClassCurriculumE classCurriculumE = new ClassCurriculumE();
|
||||
BeanUtils.copyProperties(cmd, classCurriculumE);
|
||||
boolean res = false;
|
||||
// cmdList 转 Elist
|
||||
List<ClassCurriculumE> classCurriculumEList = new ArrayList<>();
|
||||
for (ClassCurriculumAddCmd curCmd : cmdList){
|
||||
ClassCurriculumE curriculum = new ClassCurriculumE();
|
||||
BeanUtils.copyProperties(curCmd, curriculum);
|
||||
BigDecimal decimal = BigDecimal.valueOf(curCmd.getVideoTotalTime());
|
||||
curriculum.setVideoTotalTime(decimal);
|
||||
for (ClassCurriculumChapterAddCmd chapterCmd : curCmd.getChapterList()){
|
||||
ClassCurriculumChapterE chapter = new ClassCurriculumChapterE();
|
||||
BeanUtils.copyProperties(chapterCmd, chapter);
|
||||
if (chapterCmd.getChildren() != null && chapterCmd.getChildren().size() > 0){
|
||||
for (ClassCurriculumChapterAddCmd childChapterCmd : chapterCmd.getChildren()){
|
||||
ClassCurriculumChapterE childChapter = new ClassCurriculumChapterE();
|
||||
BeanUtils.copyProperties(childChapterCmd, childChapter);
|
||||
if (chapter.getChildren() != null){
|
||||
chapter.getChildren().add(childChapter);
|
||||
} else {
|
||||
List<ClassCurriculumChapterE> children = new ArrayList<>();
|
||||
children.add(childChapter);
|
||||
chapter.setChildren(children);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (curriculum.getChapterList() != null){
|
||||
curriculum.getChapterList().add(chapter);
|
||||
} else {
|
||||
List<ClassCurriculumChapterE> chapterList = new ArrayList<>();
|
||||
chapterList.add(chapter);
|
||||
curriculum.setChapterList(chapterList);
|
||||
}
|
||||
}
|
||||
classCurriculumEList.add(curriculum);
|
||||
}
|
||||
List<ClassCurriculumChapterE> chapterList = classCurriculumE. initCurList(classCurriculumEList);
|
||||
try {
|
||||
res = classCurriculumGateway.add(classCurriculumE);
|
||||
classCurriculumGateway.batchAdd(classCurriculumEList);
|
||||
classCurriculumChapterGateway.batchAdd(chapterList);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (!res) {
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package com.zcloud.edu.command.study;
|
|||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.edu.domain.gateway.study.ClassCurriculumGateway;
|
||||
import com.zcloud.edu.persistence.dataobject.study.ClassCurriculumDO;
|
||||
import com.zcloud.edu.persistence.repository.study.ClassCurriculumChapterRepository;
|
||||
import com.zcloud.edu.persistence.repository.study.ClassCurriculumRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -17,10 +20,14 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
@AllArgsConstructor
|
||||
public class ClassCurriculumRemoveExe {
|
||||
private final ClassCurriculumGateway classCurriculumGateway;
|
||||
private final ClassCurriculumRepository classCurriculumRepository;
|
||||
private final ClassCurriculumChapterRepository classCurriculumChapterRepository;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long id) {
|
||||
ClassCurriculumDO classCurriculumDO = classCurriculumRepository.getById(id);
|
||||
boolean res = classCurriculumGateway.deletedClassCurriculumById(id);
|
||||
classCurriculumChapterRepository.deleteByCurriculumId(classCurriculumDO.getClassCurriculumId());
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,28 @@
|
|||
package com.zcloud.edu.command.study;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||
import com.zcloud.edu.domain.gateway.resource.ExamPaperGateway;
|
||||
import com.zcloud.edu.domain.gateway.study.ClassExamPaperGateway;
|
||||
import com.zcloud.edu.domain.model.resource.ExamPaperE;
|
||||
import com.zcloud.edu.domain.model.resource.QuestionE;
|
||||
import com.zcloud.edu.domain.model.study.ClassExamPaperE;
|
||||
import com.zcloud.edu.dto.study.ClassExamPaperAddCmd;
|
||||
import com.zcloud.edu.dto.study.ClassExamPaperAutoAddCmd;
|
||||
import com.zcloud.edu.persistence.dataobject.QuestionDO;
|
||||
import com.zcloud.edu.persistence.repository.resource.QuestionRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
|
|
@ -20,11 +34,16 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
@AllArgsConstructor
|
||||
public class ClassExamPaperAddExe {
|
||||
private final ClassExamPaperGateway classExamPaperGateway;
|
||||
private final ExamPaperGateway examPaperGateway;
|
||||
private final QuestionRepository questionRepository;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(ClassExamPaperAddCmd cmd) {
|
||||
ClassExamPaperE classExamPaperE = new ClassExamPaperE();
|
||||
BeanUtils.copyProperties(cmd, classExamPaperE);
|
||||
// 初始化字段,并判断题目分数是否符合要求
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
classExamPaperE.initSave(ssoUser.getTenantId());
|
||||
boolean res = false;
|
||||
try {
|
||||
res = classExamPaperGateway.add(classExamPaperE);
|
||||
|
|
@ -36,5 +55,38 @@ public class ClassExamPaperAddExe {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean executeAutoSave(ClassExamPaperAutoAddCmd cmd) {
|
||||
ClassExamPaperE classExamPaperE = new ClassExamPaperE();
|
||||
BeanUtils.copyProperties(cmd, classExamPaperE);
|
||||
// 初始化字段,并判断题目分数是否符合要求
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
classExamPaperE.initAutoSave(ssoUser.getTenantId());
|
||||
|
||||
|
||||
// 检验习题数是否够用,并随机生成试卷
|
||||
List<QuestionDO> questionDOList = questionRepository.listByClassId(classExamPaperE.getClassId());
|
||||
List<QuestionE> questionEList = BeanUtil.copyToList(questionDOList, QuestionE.class);
|
||||
List<QuestionE> paperQuesList = classExamPaperE.automaticPaper(questionEList);
|
||||
ExamPaperE examPaperE = new ExamPaperE();
|
||||
BeanUtils.copyProperties(classExamPaperE, examPaperE);
|
||||
examPaperE.initExamPaper();
|
||||
boolean res = false;
|
||||
try {
|
||||
// 新增试卷
|
||||
res = examPaperGateway.add(examPaperE);
|
||||
// 新增习题
|
||||
res = questionRepository.saveBatch(BeanUtil.copyToList(paperQuesList, QuestionDO.class));
|
||||
// 新增班级内试卷
|
||||
res = classExamPaperGateway.add(classExamPaperE);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (!res) {
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.zcloud.edu.service.study;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.Response;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.edu.api.study.ClassCurriculumServiceI;
|
||||
import com.zcloud.edu.command.query.study.ClassCurriculumQueryExe;
|
||||
|
|
@ -14,6 +15,8 @@ import com.zcloud.edu.dto.study.ClassCurriculumUpdateCmd;
|
|||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-app
|
||||
*
|
||||
|
|
@ -35,10 +38,10 @@ public class ClassCurriculumServiceImpl implements ClassCurriculumServiceI {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse add(ClassCurriculumAddCmd cmd) {
|
||||
public Response add(List<ClassCurriculumAddCmd> cmdList) {
|
||||
|
||||
classCurriculumAddExe.execute(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
classCurriculumAddExe.execute(cmdList);
|
||||
return Response.buildSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -55,5 +58,10 @@ public class ClassCurriculumServiceImpl implements ClassCurriculumServiceI {
|
|||
public void removeBatch(Long[] ids) {
|
||||
classCurriculumRemoveExe.execute(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<ClassCurriculumCO> getInfoById(Long id) {
|
||||
return classCurriculumQueryExe.executeGetInfoById(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.zcloud.edu.command.study.ClassExamPaperRemoveExe;
|
|||
import com.zcloud.edu.command.study.ClassExamPaperUpdateExe;
|
||||
import com.zcloud.edu.dto.clientobject.study.ClassExamPaperCO;
|
||||
import com.zcloud.edu.dto.study.ClassExamPaperAddCmd;
|
||||
import com.zcloud.edu.dto.study.ClassExamPaperAutoAddCmd;
|
||||
import com.zcloud.edu.dto.study.ClassExamPaperPageQry;
|
||||
import com.zcloud.edu.dto.study.ClassExamPaperUpdateCmd;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
@ -41,6 +42,12 @@ public class ClassExamPaperServiceImpl implements ClassExamPaperServiceI {
|
|||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<ClassExamPaperCO> autoSave(ClassExamPaperAutoAddCmd cmd) {
|
||||
classExamPaperAddExe.executeAutoSave(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(ClassExamPaperUpdateCmd classExamPaperUpdateCmd) {
|
||||
classExamPaperUpdateExe.execute(classExamPaperUpdateCmd);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.zcloud.edu.command.study.ClassAddExe;
|
|||
import com.zcloud.edu.command.study.ClassRemoveExe;
|
||||
import com.zcloud.edu.command.study.ClassUpdateExe;
|
||||
import com.zcloud.edu.dto.clientobject.study.ClassCO;
|
||||
import com.zcloud.edu.dto.data.study.ClassQuestionDTO;
|
||||
import com.zcloud.edu.dto.study.ClassAddCmd;
|
||||
import com.zcloud.edu.dto.study.ClassPageQry;
|
||||
import com.zcloud.edu.dto.study.ClassUpdateCmd;
|
||||
|
|
@ -55,5 +56,11 @@ public class ClassServiceImpl implements ClassServiceI {
|
|||
public void removeBatch(Long[] ids) {
|
||||
classRemoveExe.execute(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<ClassQuestionDTO> countQuestionByClassId(String id) {
|
||||
|
||||
return classQueryExe.executeCountQuestionByClassId(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,15 @@
|
|||
package com.zcloud.edu.api.study;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.Response;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.edu.dto.clientobject.study.ClassCurriculumCO;
|
||||
import com.zcloud.edu.dto.study.ClassCurriculumAddCmd;
|
||||
import com.zcloud.edu.dto.study.ClassCurriculumPageQry;
|
||||
import com.zcloud.edu.dto.study.ClassCurriculumUpdateCmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-client
|
||||
*
|
||||
|
|
@ -16,12 +19,14 @@ import com.zcloud.edu.dto.study.ClassCurriculumUpdateCmd;
|
|||
public interface ClassCurriculumServiceI {
|
||||
PageResponse<ClassCurriculumCO> listPage(ClassCurriculumPageQry qry);
|
||||
|
||||
SingleResponse<ClassCurriculumCO> add(ClassCurriculumAddCmd cmd);
|
||||
Response add(List<ClassCurriculumAddCmd> cmdList);
|
||||
|
||||
void edit(ClassCurriculumUpdateCmd cmd);
|
||||
|
||||
void remove(Long id);
|
||||
|
||||
void removeBatch(Long[] ids);
|
||||
|
||||
SingleResponse<ClassCurriculumCO> getInfoById(Long id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.alibaba.cola.dto.PageResponse;
|
|||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.edu.dto.clientobject.study.ClassExamPaperCO;
|
||||
import com.zcloud.edu.dto.study.ClassExamPaperAddCmd;
|
||||
import com.zcloud.edu.dto.study.ClassExamPaperAutoAddCmd;
|
||||
import com.zcloud.edu.dto.study.ClassExamPaperPageQry;
|
||||
import com.zcloud.edu.dto.study.ClassExamPaperUpdateCmd;
|
||||
|
||||
|
|
@ -18,6 +19,8 @@ public interface ClassExamPaperServiceI {
|
|||
|
||||
SingleResponse<ClassExamPaperCO> add(ClassExamPaperAddCmd cmd);
|
||||
|
||||
SingleResponse<ClassExamPaperCO> autoSave(ClassExamPaperAutoAddCmd cmd);
|
||||
|
||||
void edit(ClassExamPaperUpdateCmd cmd);
|
||||
|
||||
void remove(Long id);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.zcloud.edu.api.study;
|
|||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.edu.dto.clientobject.study.ClassCO;
|
||||
import com.zcloud.edu.dto.data.study.ClassQuestionDTO;
|
||||
import com.zcloud.edu.dto.study.ClassAddCmd;
|
||||
import com.zcloud.edu.dto.study.ClassPageQry;
|
||||
import com.zcloud.edu.dto.study.ClassUpdateCmd;
|
||||
|
|
@ -23,5 +24,7 @@ public interface ClassServiceI {
|
|||
void remove(Long id);
|
||||
|
||||
void removeBatch(Long[] ids);
|
||||
|
||||
SingleResponse<ClassQuestionDTO> countQuestionByClassId(String id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,15 @@
|
|||
package com.zcloud.edu.dto.clientobject.study;
|
||||
|
||||
import com.alibaba.cola.dto.ClientObject;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.google.type.Decimal;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -32,7 +35,39 @@ public class ClassCurriculumCO extends ClientObject {
|
|||
private String curriculumName;
|
||||
//课程总时长
|
||||
@ApiModelProperty(value = "课程总时长")
|
||||
private Decimal videoTotalTime;
|
||||
private BigDecimal videoTotalTime;
|
||||
//课程总时长
|
||||
@ApiModelProperty(value = "课件数")
|
||||
@TableField(exist = false)
|
||||
private long videoCount;
|
||||
// 章节目录
|
||||
@ApiModelProperty(value = "章节目录")
|
||||
private List<ClassCurriculumChapterCO> chapterList;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "所属单位id")
|
||||
@TableField(exist = false)
|
||||
private long corpinfoId;
|
||||
@ApiModelProperty(value = "所属单位名称")
|
||||
@TableField(exist = false)
|
||||
private String corpName;
|
||||
@ApiModelProperty(value = "培训类型id")
|
||||
@TableField(exist = false)
|
||||
private String trainingTypeId;
|
||||
@ApiModelProperty(value = "培训类型名称")
|
||||
@TableField(exist = false)
|
||||
private String trainingTypeName;
|
||||
@ApiModelProperty(value = "原课程总时长")
|
||||
@TableField(exist = false)
|
||||
private BigDecimal curriculumVideoTotalTime;
|
||||
//课程描述
|
||||
@ApiModelProperty(value = "课程描述")
|
||||
@TableField(exist = false)
|
||||
private String curriculumIntroduce;
|
||||
//封面路径url
|
||||
@ApiModelProperty(value = "封面路径url")
|
||||
@TableField(exist = false)
|
||||
private String coverPath;
|
||||
//删除标识true false
|
||||
@ApiModelProperty(value = "删除标识true false")
|
||||
private String deleteEnum;
|
||||
|
|
@ -71,5 +106,6 @@ public class ClassCurriculumCO extends ClientObject {
|
|||
//环境
|
||||
@ApiModelProperty(value = "环境")
|
||||
private String env;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
package com.zcloud.edu.dto.clientobject.study;
|
||||
|
||||
import com.alibaba.cola.dto.ClientObject;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -43,6 +45,45 @@ public class ClassCurriculumChapterCO extends ClientObject {
|
|||
//上级ID
|
||||
@ApiModelProperty(value = "上级ID")
|
||||
private String parentId;
|
||||
|
||||
|
||||
|
||||
//课件名称
|
||||
@ApiModelProperty(value = "课件名称")
|
||||
private String coursewareName;
|
||||
//培训类型id
|
||||
@ApiModelProperty(value = "培训类型id")
|
||||
private String trainingTypeId;
|
||||
//教师id
|
||||
@ApiModelProperty(value = "教师id")
|
||||
@TableField(exist = false)
|
||||
private String teacherId;
|
||||
//课件文件路径
|
||||
@ApiModelProperty(value = "课件文件路径")
|
||||
@TableField(exist = false)
|
||||
private String videoFiles;
|
||||
//课件描述
|
||||
@ApiModelProperty(value = "课件描述")
|
||||
@TableField(exist = false)
|
||||
private String coursewareIntroduce;
|
||||
//课件时长(视频时间)-秒
|
||||
@ApiModelProperty(value = "课件时长(视频时间)-秒")
|
||||
@TableField(exist = false)
|
||||
private Integer videoTime;
|
||||
@ApiModelProperty(value = "课件截图url")
|
||||
@TableField(exist = false)
|
||||
private String screenshotUrl;
|
||||
@ApiModelProperty(value = "教师名称")
|
||||
@TableField(exist = false)
|
||||
private String teacherName;
|
||||
@ApiModelProperty(value = "培训类型名称")
|
||||
@TableField(exist = false)
|
||||
private String trainingTypeName;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//删除标识true false
|
||||
@ApiModelProperty(value = "删除标识true false")
|
||||
private String deleteEnum;
|
||||
|
|
@ -81,5 +122,15 @@ public class ClassCurriculumChapterCO extends ClientObject {
|
|||
//环境
|
||||
@ApiModelProperty(value = "环境")
|
||||
private String env;
|
||||
|
||||
|
||||
|
||||
|
||||
// 章节目录
|
||||
@ApiModelProperty(value = "章节目录")
|
||||
private List<ClassCurriculumChapterCO> children;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
package com.zcloud.edu.dto.data.study;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author zhangyue
|
||||
* @date 2026/1/19 15:31
|
||||
*/
|
||||
@Data
|
||||
public class ClassQuestionDTO {
|
||||
|
||||
@ApiModelProperty(value = "单选题数量")
|
||||
private Integer singleCount;
|
||||
@ApiModelProperty(value = "多选题数量")
|
||||
private Integer multipleCount;
|
||||
@ApiModelProperty(value = "判断题数量")
|
||||
private Integer judgeCount;
|
||||
|
||||
public ClassQuestionDTO() {
|
||||
this.judgeCount = 0;
|
||||
this.multipleCount = 0;
|
||||
this.singleCount = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-client
|
||||
|
|
@ -40,7 +41,12 @@ public class ClassCurriculumAddCmd extends Command {
|
|||
|
||||
@ApiModelProperty(value = "课程总时长", name = "videoTotalTime", required = true)
|
||||
@NotNull(message = "课程总时长不能为空")
|
||||
private Decimal videoTotalTime;
|
||||
private double videoTotalTime;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "课程目录", name = "curriculumChapterAddCmdList", required = true)
|
||||
@NotNull(message = "课程目录")
|
||||
private List<ClassCurriculumChapterAddCmd> chapterList;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-client
|
||||
|
|
@ -49,5 +50,9 @@ public class ClassCurriculumChapterAddCmd extends Command {
|
|||
@NotEmpty(message = "上级ID不能为空")
|
||||
private String parentId;
|
||||
|
||||
@ApiModelProperty(value = "目录课件", name = "curriculumChapterAddCmdList", required = true)
|
||||
@NotEmpty(message = "目录课件不能为空")
|
||||
private List<ClassCurriculumChapterAddCmd> children;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,5 +24,6 @@ public class ClassCurriculumPageQry extends PageQuery {
|
|||
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
||||
*/
|
||||
private String likeClassCurriculumId;
|
||||
private String eqClassId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* web-client
|
||||
|
|
@ -22,23 +23,11 @@ import javax.validation.constraints.NotNull;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ClassCurriculumUpdateCmd extends Command {
|
||||
@ApiModelProperty(value = "${column.comment}", name = "id", required = true)
|
||||
@NotNull(message = "${column.comment}不能为空")
|
||||
@ApiModelProperty(value = "主键id", name = "id", required = true)
|
||||
@NotNull(message = "主键id不能为空")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "业务id", name = "classCurriculumId", required = true)
|
||||
@NotEmpty(message = "业务id不能为空")
|
||||
private String classCurriculumId;
|
||||
@ApiModelProperty(value = "课程id", name = "curriculumId", required = true)
|
||||
@NotEmpty(message = "课程id不能为空")
|
||||
private String curriculumId;
|
||||
@ApiModelProperty(value = "班级id", name = "classId", required = true)
|
||||
@NotEmpty(message = "班级id不能为空")
|
||||
private String classId;
|
||||
@ApiModelProperty(value = "课程名称", name = "curriculumName", required = true)
|
||||
@NotEmpty(message = "课程名称不能为空")
|
||||
private String curriculumName;
|
||||
@ApiModelProperty(value = "课程总时长", name = "videoTotalTime", required = true)
|
||||
@NotNull(message = "课程总时长不能为空")
|
||||
private Decimal videoTotalTime;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* web-client
|
||||
|
|
@ -22,7 +23,6 @@ import javax.validation.constraints.NotNull;
|
|||
@AllArgsConstructor
|
||||
public class ClassExamPaperAddCmd extends Command {
|
||||
@ApiModelProperty(value = "业务id", name = "classExamPaperId", required = true)
|
||||
@NotEmpty(message = "业务id不能为空")
|
||||
private String classExamPaperId;
|
||||
|
||||
@ApiModelProperty(value = "班级id", name = "classId", required = true)
|
||||
|
|
@ -34,7 +34,6 @@ public class ClassExamPaperAddCmd extends Command {
|
|||
private String examPaperId;
|
||||
|
||||
@ApiModelProperty(value = "企业ID", name = "corpinfoId", required = true)
|
||||
@NotNull(message = "企业ID不能为空")
|
||||
private Long corpinfoId;
|
||||
|
||||
@ApiModelProperty(value = "试卷名称", name = "examName", required = true)
|
||||
|
|
@ -42,16 +41,18 @@ public class ClassExamPaperAddCmd extends Command {
|
|||
private String examName;
|
||||
|
||||
@ApiModelProperty(value = "试卷总分数", name = "examScore", required = true)
|
||||
@NotEmpty(message = "试卷总分数不能为空")
|
||||
private String examScore;
|
||||
@NotNull(message = "试卷总分数不能为空")
|
||||
private BigDecimal examScore;
|
||||
|
||||
@ApiModelProperty(value = "合格分数", name = "passScore", required = true)
|
||||
@NotEmpty(message = "合格分数不能为空")
|
||||
private String passScore;
|
||||
@NotNull(message = "合格分数不能为空")
|
||||
private BigDecimal passScore;
|
||||
|
||||
@ApiModelProperty(value = "考试时长(分钟)", name = "examTime", required = true)
|
||||
@NotEmpty(message = "考试时长(分钟)不能为空")
|
||||
private String examTime;
|
||||
@NotNull(message = "考试时长(分钟)不能为空")
|
||||
private Integer examTime;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,79 @@
|
|||
package com.zcloud.edu.dto.study;
|
||||
|
||||
import com.alibaba.cola.dto.Command;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* web-client
|
||||
*
|
||||
* @Author zhangyue
|
||||
* @Date 2026-01-13 14:18:21
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ClassExamPaperAutoAddCmd extends Command {
|
||||
@ApiModelProperty(value = "业务id", name = "classExamPaperId", required = true)
|
||||
private String classExamPaperId;
|
||||
|
||||
@ApiModelProperty(value = "班级id", name = "classId", required = true)
|
||||
@NotEmpty(message = "班级id不能为空")
|
||||
private String classId;
|
||||
|
||||
@ApiModelProperty(value = "试卷id", name = "examPaperId", required = true)
|
||||
private String examPaperId;
|
||||
|
||||
@ApiModelProperty(value = "企业ID", name = "corpinfoId", required = true)
|
||||
private Long corpinfoId;
|
||||
|
||||
@ApiModelProperty(value = "试卷名称", name = "examName", required = true)
|
||||
@NotEmpty(message = "试卷名称不能为空")
|
||||
private String examName;
|
||||
|
||||
@ApiModelProperty(value = "试卷总分数", name = "examScore", required = true)
|
||||
@NotNull(message = "试卷总分数不能为空")
|
||||
private BigDecimal examScore;
|
||||
|
||||
@ApiModelProperty(value = "合格分数", name = "passScore", required = true)
|
||||
@NotNull(message = "合格分数不能为空")
|
||||
private BigDecimal passScore;
|
||||
|
||||
@ApiModelProperty(value = "考试时长(分钟)", name = "examTime", required = true)
|
||||
@NotNull(message = "考试时长(分钟)不能为空")
|
||||
private Integer examTime;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "单选题数量", name = "singleCount", required = true)
|
||||
@NotNull(message = "单选题数量不能为空")
|
||||
private Integer singleCount;
|
||||
@ApiModelProperty(value = "单选题分数", name = "singleScore", required = true)
|
||||
@NotNull(message = "单选题分数不能为空")
|
||||
private BigDecimal singleScore;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "多选题数量", name = "multipleCount", required = true)
|
||||
@NotNull(message = "多选题数量不能为空")
|
||||
private Integer multipleCount;
|
||||
@ApiModelProperty(value = "多选题分数", name = "multipleScore", required = true)
|
||||
@NotNull(message = "多选题分数不能为空")
|
||||
private BigDecimal multipleScore;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "判断题数量", name = "judgeCount", required = true)
|
||||
@NotNull(message = "判断题数量不能为空")
|
||||
private Integer judgeCount;
|
||||
@ApiModelProperty(value = "判断题分数", name = "judgeScore", required = true)
|
||||
@NotNull(message = "判断题分数不能为空")
|
||||
private BigDecimal judgeScore;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -3,6 +3,8 @@ package com.zcloud.edu.domain.gateway.study;
|
|||
|
||||
import com.zcloud.edu.domain.model.study.ClassCurriculumChapterE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-domain
|
||||
*
|
||||
|
|
@ -27,5 +29,7 @@ public interface ClassCurriculumChapterGateway {
|
|||
Boolean deletedClassCurriculumChapterById(Long id);
|
||||
|
||||
Boolean deletedClassCurriculumChapterByIds(Long[] id);
|
||||
|
||||
void batchAdd(List<ClassCurriculumChapterE> classCurriculumChapterE);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.zcloud.edu.domain.gateway.study;
|
|||
|
||||
import com.zcloud.edu.domain.model.study.ClassCurriculumE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-domain
|
||||
*
|
||||
|
|
@ -27,5 +29,7 @@ public interface ClassCurriculumGateway {
|
|||
Boolean deletedClassCurriculumById(Long id);
|
||||
|
||||
Boolean deletedClassCurriculumByIds(Long[] id);
|
||||
|
||||
void batchAdd(List<ClassCurriculumE> classCurriculumEList);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.zcloud.edu.domain.model.resource;
|
||||
|
||||
import com.jjb.saas.framework.domain.model.BaseE;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -55,5 +56,10 @@ public class ExamPaperE extends BaseE {
|
|||
private Long updateId;
|
||||
//环境
|
||||
private String env;
|
||||
|
||||
public void initExamPaper(){
|
||||
this.sellFlag = 0;
|
||||
this.type = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.jjb.saas.framework.domain.model.BaseE;
|
|||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-domain
|
||||
|
|
@ -31,6 +32,8 @@ public class ClassCurriculumChapterE extends BaseE {
|
|||
private Integer sort;
|
||||
//上级ID
|
||||
private String parentId;
|
||||
//子集
|
||||
private List<ClassCurriculumChapterE> children;
|
||||
//删除标识true false
|
||||
private String deleteEnum;
|
||||
//备注
|
||||
|
|
|
|||
|
|
@ -2,9 +2,13 @@ package com.zcloud.edu.domain.model.study;
|
|||
|
||||
import com.google.type.Decimal;
|
||||
import com.jjb.saas.framework.domain.model.BaseE;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-domain
|
||||
|
|
@ -24,7 +28,7 @@ public class ClassCurriculumE extends BaseE {
|
|||
//课程名称
|
||||
private String curriculumName;
|
||||
//课程总时长
|
||||
private Decimal videoTotalTime;
|
||||
private BigDecimal videoTotalTime;
|
||||
//删除标识true false
|
||||
private String deleteEnum;
|
||||
//备注
|
||||
|
|
@ -33,6 +37,10 @@ public class ClassCurriculumE extends BaseE {
|
|||
private String createName;
|
||||
//更新人姓名
|
||||
private String updateName;
|
||||
|
||||
private List<ClassCurriculumChapterE> chapterList;
|
||||
|
||||
|
||||
//租户id
|
||||
private Long tenantId;
|
||||
//单位id
|
||||
|
|
@ -49,5 +57,29 @@ public class ClassCurriculumE extends BaseE {
|
|||
private Long updateId;
|
||||
//环境
|
||||
private String env;
|
||||
|
||||
public List<ClassCurriculumChapterE> initCurList(List<ClassCurriculumE> curList){
|
||||
List<ClassCurriculumChapterE> classCurriculumChapterEList = new ArrayList<ClassCurriculumChapterE>();
|
||||
for (ClassCurriculumE cur : curList){
|
||||
cur.setClassCurriculumId(Tools.get32UUID());
|
||||
for (ClassCurriculumChapterE chapter : cur.getChapterList()){
|
||||
chapter.setCurriculumChapterId(Tools.get32UUID());
|
||||
chapter.setClassId(cur.getClassId());
|
||||
chapter.setClassCurriculumId(cur.getClassCurriculumId());
|
||||
chapter.setParentId("0");
|
||||
if (chapter.getChildren() != null && chapter.getChildren().size() > 0){
|
||||
for (ClassCurriculumChapterE childChapter : chapter.getChildren()){
|
||||
childChapter.setCurriculumChapterId(Tools.get32UUID());
|
||||
childChapter.setClassId(cur.getClassId());
|
||||
childChapter.setClassCurriculumId(cur.getClassCurriculumId());
|
||||
childChapter.setParentId(chapter.getCurriculumChapterId());
|
||||
}
|
||||
classCurriculumChapterEList.addAll(chapter.getChildren());
|
||||
}
|
||||
}
|
||||
classCurriculumChapterEList.addAll(cur.getChapterList());
|
||||
}
|
||||
return classCurriculumChapterEList;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,21 @@
|
|||
package com.zcloud.edu.domain.model.study;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.jjb.saas.framework.domain.model.BaseE;
|
||||
import com.zcloud.edu.domain.model.resource.QuestionE;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipException;
|
||||
|
||||
/**
|
||||
* web-domain
|
||||
|
|
@ -25,11 +37,34 @@ public class ClassExamPaperE extends BaseE {
|
|||
//试卷名称
|
||||
private String examName;
|
||||
//试卷总分数
|
||||
private String examScore;
|
||||
private BigDecimal examScore;
|
||||
//合格分数
|
||||
private String passScore;
|
||||
private BigDecimal passScore;
|
||||
//考试时长(分钟)
|
||||
private String examTime;
|
||||
private Integer examTime;
|
||||
|
||||
|
||||
|
||||
// 单选题数量
|
||||
private Integer singleCount;
|
||||
// 单选题分数
|
||||
private BigDecimal singleScore;
|
||||
|
||||
// 多选题数量
|
||||
private Integer multipleCount;
|
||||
// 多选题分数
|
||||
private BigDecimal multipleScore;
|
||||
|
||||
// 判断题数量
|
||||
private Integer judgeCount;
|
||||
// 判断题分数
|
||||
private BigDecimal judgeScore;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//删除标识true false
|
||||
private String deleteEnum;
|
||||
//备注
|
||||
|
|
@ -54,5 +89,78 @@ public class ClassExamPaperE extends BaseE {
|
|||
private Long updateId;
|
||||
//环境
|
||||
private String env;
|
||||
|
||||
|
||||
|
||||
public void initSave(long corpinfoId){
|
||||
if (this.passScore.compareTo(this.examScore) > 0){
|
||||
throw new BizException("合格分数不能大于总分数");
|
||||
}
|
||||
this.classExamPaperId = Tools.get32UUID();
|
||||
this.corpinfoId = corpinfoId;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void initAutoSave(long corpinfoId){
|
||||
BigDecimal questionScore = this.singleScore.multiply(BigDecimal.valueOf(this.singleCount)).add(this.multipleScore.multiply(BigDecimal.valueOf(this.multipleCount))).add(this.judgeScore.multiply(BigDecimal.valueOf(this.judgeCount)));
|
||||
if (questionScore.compareTo(this.examScore) != 0){
|
||||
throw new BizException("习题总分数与试卷总分数不同,请调整");
|
||||
}
|
||||
this.classExamPaperId = Tools.get32UUID();
|
||||
this.examPaperId = Tools.get32UUID();
|
||||
this.corpinfoId = corpinfoId;
|
||||
|
||||
}
|
||||
|
||||
public List<QuestionE> automaticPaper(List<QuestionE> questionEList){
|
||||
List<QuestionE> resultQuesList = new ArrayList<QuestionE>();
|
||||
Map<Integer, List<QuestionE>> questionListMap = questionEList.stream()
|
||||
.collect(Collectors.groupingBy(QuestionE::getQuestionType));
|
||||
List<QuestionE> singleQuestionEList = questionListMap.get(1) != null ? questionListMap.get(1) : new ArrayList<QuestionE>();
|
||||
List<QuestionE> multipleQuestionEList = questionListMap.get(2) != null ? questionListMap.get(2) : new ArrayList<QuestionE>();
|
||||
List<QuestionE> judgeQuestionEList = questionListMap.get(3) != null ? questionListMap.get(3) : new ArrayList<QuestionE>();
|
||||
if (this.getSingleCount() > singleQuestionEList.size()){
|
||||
throw new BizException("单选题数量不足");
|
||||
}
|
||||
if (this.getMultipleCount() > multipleQuestionEList.size()){
|
||||
throw new BizException("多选题数量不足");
|
||||
}
|
||||
if (this.getJudgeCount() > judgeQuestionEList.size()){
|
||||
throw new BizException("判断题数量不足");
|
||||
}
|
||||
resultQuesList.addAll(Tools.getRandomElements(singleQuestionEList, this.getSingleCount()));
|
||||
resultQuesList.addAll(Tools.getRandomElements(multipleQuestionEList, this.getMultipleCount()));
|
||||
resultQuesList.addAll(Tools.getRandomElements(judgeQuestionEList, this.getJudgeCount()));
|
||||
resultQuesList.stream().forEach(questionE -> {
|
||||
questionE.setQuestionId(Tools.get32UUID());
|
||||
questionE.setExamPaperId(this.examPaperId);
|
||||
questionE.setCoursewareType(2);
|
||||
if (questionE.getQuestionType() == 1){
|
||||
questionE.setScore(this.singleScore);
|
||||
}else if (questionE.getQuestionType() == 2){
|
||||
questionE.setScore(this.multipleScore);
|
||||
}else{
|
||||
questionE.setScore(this.judgeScore);
|
||||
}
|
||||
questionE.setId(null);
|
||||
questionE.setDeleteEnum("FALSE");
|
||||
questionE.setRemarks(null);
|
||||
questionE.setCreateName(null);
|
||||
questionE.setUpdateName(null);
|
||||
questionE.setTenantId(null);
|
||||
questionE.setOrgId(null);
|
||||
questionE.setVersion(null);
|
||||
questionE.setCreateTime(null);
|
||||
questionE.setUpdateTime(null);
|
||||
questionE.setCreateId(null);
|
||||
questionE.setUpdateId(null);
|
||||
questionE.setEnv(null);
|
||||
|
||||
});
|
||||
return resultQuesList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.zcloud.edu.gatewayimpl.study;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.zcloud.edu.domain.gateway.study.ClassCurriculumChapterGateway;
|
||||
import com.zcloud.edu.domain.model.study.ClassCurriculumChapterE;
|
||||
import com.zcloud.edu.persistence.dataobject.study.ClassCurriculumChapterDO;
|
||||
|
|
@ -9,6 +10,7 @@ import org.springframework.beans.BeanUtils;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
|
|
@ -46,5 +48,11 @@ public class ClassCurriculumChapterGatewayImpl implements ClassCurriculumChapter
|
|||
public Boolean deletedClassCurriculumChapterByIds(Long[] ids) {
|
||||
return classCurriculumChapterRepository.removeByIds(Collections.singletonList(ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchAdd(List<ClassCurriculumChapterE> classCurriculumChapterE) {
|
||||
List<ClassCurriculumChapterDO> classCurriculumChapterDO = BeanUtil.copyToList(classCurriculumChapterE, ClassCurriculumChapterDO.class);
|
||||
classCurriculumChapterRepository.saveBatch(classCurriculumChapterDO);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.zcloud.edu.gatewayimpl.study;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.zcloud.edu.domain.gateway.study.ClassCurriculumGateway;
|
||||
import com.zcloud.edu.domain.model.study.ClassCurriculumE;
|
||||
import com.zcloud.edu.persistence.dataobject.study.ClassCurriculumDO;
|
||||
|
|
@ -9,6 +10,7 @@ import org.springframework.beans.BeanUtils;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
|
|
@ -46,5 +48,11 @@ public class ClassCurriculumGatewayImpl implements ClassCurriculumGateway {
|
|||
public Boolean deletedClassCurriculumByIds(Long[] ids) {
|
||||
return classCurriculumRepository.removeByIds(Collections.singletonList(ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchAdd(List<ClassCurriculumE> classCurriculumEList) {
|
||||
List<ClassCurriculumDO> curList = BeanUtil.copyToList(classCurriculumEList, ClassCurriculumDO.class);
|
||||
classCurriculumRepository.saveBatch(curList);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.zcloud.edu.persistence.dataobject.study;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.jjb.saas.framework.repository.basedo.BaseDO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
@ -7,6 +8,8 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
*
|
||||
|
|
@ -44,5 +47,51 @@ public class ClassCurriculumChapterDO extends BaseDO {
|
|||
private String parentId;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//课件名称
|
||||
@ApiModelProperty(value = "课件名称")
|
||||
@TableField(exist = false)
|
||||
private String coursewareName;
|
||||
//培训类型id
|
||||
@ApiModelProperty(value = "培训类型id")
|
||||
@TableField(exist = false)
|
||||
private String trainingTypeId;
|
||||
//教师id
|
||||
@ApiModelProperty(value = "教师id")
|
||||
@TableField(exist = false)
|
||||
private String teacherId;
|
||||
//课件文件路径
|
||||
@ApiModelProperty(value = "课件文件路径")
|
||||
@TableField(exist = false)
|
||||
private String videoFiles;
|
||||
//课件描述
|
||||
@ApiModelProperty(value = "课件描述")
|
||||
@TableField(exist = false)
|
||||
private String coursewareIntroduce;
|
||||
//课件时长(视频时间)-秒
|
||||
@ApiModelProperty(value = "课件时长(视频时间)-秒")
|
||||
@TableField(exist = false)
|
||||
private Integer videoTime;
|
||||
@ApiModelProperty(value = "课件截图url")
|
||||
@TableField(exist = false)
|
||||
private String screenshotUrl;
|
||||
@ApiModelProperty(value = "教师名称")
|
||||
@TableField(exist = false)
|
||||
private String teacherName;
|
||||
@ApiModelProperty(value = "培训类型名称")
|
||||
@TableField(exist = false)
|
||||
private String trainingTypeName;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.zcloud.edu.persistence.dataobject.study;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.google.type.Decimal;
|
||||
import com.jjb.saas.framework.repository.basedo.BaseDO;
|
||||
|
|
@ -8,6 +9,9 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
*
|
||||
|
|
@ -33,8 +37,31 @@ public class ClassCurriculumDO extends BaseDO {
|
|||
private String curriculumName;
|
||||
//课程总时长
|
||||
@ApiModelProperty(value = "课程总时长")
|
||||
private Decimal videoTotalTime;
|
||||
private BigDecimal videoTotalTime;
|
||||
|
||||
@ApiModelProperty(value = "所属单位id")
|
||||
@TableField(exist = false)
|
||||
private long corpinfoId;
|
||||
@ApiModelProperty(value = "所属单位名称")
|
||||
@TableField(exist = false)
|
||||
private String corpName;
|
||||
@ApiModelProperty(value = "培训类型id")
|
||||
@TableField(exist = false)
|
||||
private String trainingTypeId;
|
||||
@ApiModelProperty(value = "培训类型名称")
|
||||
@TableField(exist = false)
|
||||
private String trainingTypeName;
|
||||
@ApiModelProperty(value = "原课程总时长")
|
||||
@TableField(exist = false)
|
||||
private BigDecimal curriculumVideoTotalTime;
|
||||
//课程描述
|
||||
@ApiModelProperty(value = "课程描述")
|
||||
@TableField(exist = false)
|
||||
private String curriculumIntroduce;
|
||||
//封面路径url
|
||||
@ApiModelProperty(value = "封面路径url")
|
||||
@TableField(exist = false)
|
||||
private String coverPath;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
*
|
||||
|
|
@ -35,13 +37,13 @@ public class ClassExamPaperDO extends BaseDO {
|
|||
private String examName;
|
||||
//试卷总分数
|
||||
@ApiModelProperty(value = "试卷总分数")
|
||||
private String examScore;
|
||||
private BigDecimal examScore;
|
||||
//合格分数
|
||||
@ApiModelProperty(value = "合格分数")
|
||||
private String passScore;
|
||||
private BigDecimal passScore;
|
||||
//考试时长(分钟)
|
||||
@ApiModelProperty(value = "考试时长(分钟)")
|
||||
private String examTime;
|
||||
private Integer examTime;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import com.zcloud.edu.persistence.dataobject.QuestionDO;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
*
|
||||
|
|
@ -12,6 +14,6 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
*/
|
||||
@Mapper
|
||||
public interface QuestionMapper extends BaseMapper<QuestionDO> {
|
||||
|
||||
List<QuestionDO> listByClassId(String classId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package com.zcloud.edu.persistence.mapper.po.study;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author zhangyue
|
||||
* @date 2026/1/19 15:38
|
||||
*/
|
||||
@Data
|
||||
public class ClassQuestionPO {
|
||||
@ApiModelProperty(value = "题目类型")
|
||||
private Integer questionType;
|
||||
@ApiModelProperty(value = "题目数量")
|
||||
@TableField(exist = false)
|
||||
private Integer questionCount;
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.zcloud.edu.persistence.dataobject.study.ClassCurriculumChapterDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
*
|
||||
|
|
@ -12,6 +14,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
*/
|
||||
@Mapper
|
||||
public interface ClassCurriculumChapterMapper extends BaseMapper<ClassCurriculumChapterDO> {
|
||||
List<ClassCurriculumChapterDO> listByCurriculumId(String classCurriculumId);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.zcloud.edu.persistence.dataobject.study.ClassCurriculumDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
*
|
||||
|
|
@ -12,6 +14,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
*/
|
||||
@Mapper
|
||||
public interface ClassCurriculumMapper extends BaseMapper<ClassCurriculumDO> {
|
||||
ClassCurriculumDO getInfoById(long id);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.zcloud.edu.persistence.mapper.study;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zcloud.edu.persistence.dataobject.study.ClassExamPaperDO;
|
||||
import com.zcloud.edu.persistence.mapper.po.study.ClassQuestionPO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,7 +2,11 @@ package com.zcloud.edu.persistence.mapper.study;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zcloud.edu.persistence.dataobject.study.ClassDO;
|
||||
import com.zcloud.edu.persistence.mapper.po.study.ClassQuestionPO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import oshi.jna.platform.mac.SystemB;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
|
|
@ -12,6 +16,6 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
*/
|
||||
@Mapper
|
||||
public interface ClassMapper extends BaseMapper<ClassDO> {
|
||||
|
||||
List<ClassQuestionPO> countQuestionByClassId(String classId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -103,5 +103,10 @@ public class QuestionRepositoryImpl extends BaseRepositoryImpl<QuestionMapper, Q
|
|||
queryWrapper.eq("courseware_type", CoursewareTypeEnum.VIDEO_COURSEWARE.getCode());
|
||||
return count(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QuestionDO> listByClassId(String classId) {
|
||||
return questionMapper.listByClassId(classId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,12 @@ package com.zcloud.edu.persistence.repository.impl.study;
|
|||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jjb.saas.framework.repository.common.PageHelper;
|
||||
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
|
||||
import com.zcloud.edu.persistence.dataobject.study.ClassCurriculumChapterDO;
|
||||
import com.zcloud.edu.persistence.dataobject.study.ClassCurriculumDO;
|
||||
import com.zcloud.edu.persistence.mapper.study.ClassCurriculumChapterMapper;
|
||||
import com.zcloud.edu.persistence.repository.study.ClassCurriculumChapterRepository;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
|
|
@ -13,6 +15,7 @@ import com.zcloud.gbscommon.utils.Query;
|
|||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -35,5 +38,19 @@ public class ClassCurriculumChapterRepositoryImpl extends BaseRepositoryImpl<Cla
|
|||
IPage<ClassCurriculumChapterDO> result = classCurriculumChapterMapper.selectPage(iPage, queryWrapper);
|
||||
return PageHelper.pageToResponse(result, result.getRecords());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClassCurriculumChapterDO> listByCurriculumId(String classCurriculumId) {
|
||||
return classCurriculumChapterMapper.listByCurriculumId(classCurriculumId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByCurriculumId(String classCurriculumId) {
|
||||
UpdateWrapper updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("class_curriculum_id", classCurriculumId);
|
||||
updateWrapper.eq("delete_enum", "FALSE");
|
||||
updateWrapper.set("delete_enum", "TRUE");
|
||||
return classCurriculumChapterMapper.delete(updateWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,5 +50,11 @@ public class ClassCurriculumRepositoryImpl extends BaseRepositoryImpl<ClassCurri
|
|||
queryWrapper.eq("delete_enum", "FALSE");
|
||||
return classCurriculumMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassCurriculumDO getInfoById(long id) {
|
||||
|
||||
return classCurriculumMapper.getInfoById(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,12 +7,14 @@ import com.jjb.saas.framework.repository.common.PageHelper;
|
|||
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
|
||||
import com.zcloud.edu.persistence.dataobject.study.ClassDO;
|
||||
import com.zcloud.edu.persistence.mapper.study.ClassMapper;
|
||||
import com.zcloud.edu.persistence.mapper.po.study.ClassQuestionPO;
|
||||
import com.zcloud.edu.persistence.repository.study.ClassRepository;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.zcloud.gbscommon.utils.Query;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -42,5 +44,10 @@ public class ClassRepositoryImpl extends BaseRepositoryImpl<ClassMapper, ClassDO
|
|||
queryWrapper.eq("class_id", classId);
|
||||
return classMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClassQuestionPO> countQuestionByClassId(String classId) {
|
||||
return classMapper.countQuestionByClassId(classId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,5 +35,7 @@ public interface QuestionRepository extends BaseRepository<QuestionDO> {
|
|||
void removeByExampaperIdList(List<String> examPaperIdList);
|
||||
|
||||
Long getCountByVideoCoursewareList(List<String> videoCoursewareIds);
|
||||
|
||||
List<QuestionDO> listByClassId(String classId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.alibaba.cola.dto.PageResponse;
|
|||
import com.jjb.saas.framework.repository.repo.BaseRepository;
|
||||
import com.zcloud.edu.persistence.dataobject.study.ClassCurriculumChapterDO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -14,5 +15,9 @@ import java.util.Map;
|
|||
*/
|
||||
public interface ClassCurriculumChapterRepository extends BaseRepository<ClassCurriculumChapterDO> {
|
||||
PageResponse<ClassCurriculumChapterDO> listPage(Map<String, Object> params);
|
||||
|
||||
List<ClassCurriculumChapterDO> listByCurriculumId(String classCurriculumId);
|
||||
|
||||
Integer deleteByCurriculumId(String classCurriculumId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,5 +18,7 @@ public interface ClassCurriculumRepository extends BaseRepository<ClassCurriculu
|
|||
Long getCountByCurriculumId(String curriculumId);
|
||||
|
||||
Long countByClassId(String classId);
|
||||
|
||||
ClassCurriculumDO getInfoById(long id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ package com.zcloud.edu.persistence.repository.study;
|
|||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.jjb.saas.framework.repository.repo.BaseRepository;
|
||||
import com.zcloud.edu.persistence.dataobject.study.ClassDO;
|
||||
import com.zcloud.edu.persistence.mapper.po.study.ClassQuestionPO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -16,5 +18,7 @@ public interface ClassRepository extends BaseRepository<ClassDO> {
|
|||
PageResponse<ClassDO> listPage(Map<String, Object> params);
|
||||
|
||||
ClassDO getByClassId(String classId);
|
||||
|
||||
List<ClassQuestionPO> countQuestionByClassId(String classId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,5 +3,16 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.zcloud.edu.persistence.mapper.QuestionMapper">
|
||||
<select id="listByClassId" resultType="com.zcloud.edu.persistence.dataobject.QuestionDO">
|
||||
|
||||
SELECT
|
||||
q.*
|
||||
FROM
|
||||
question q
|
||||
WHERE
|
||||
q.video_courseware_id IN (SELECT ch.video_courseware_id FROM class_curriculum_chapter ch WHERE ch.delete_enum = 'FALSE' AND ch.video_courseware_id IS NOT NULL AND ch.class_id = #{classId})
|
||||
AND q.delete_enum = 'FALSE'
|
||||
and q.courseware_type = 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,31 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.zcloud.edu.persistence.mapper.study.ClassCurriculumChapterMapper">
|
||||
|
||||
<select id="listByCurriculumId" resultType="com.zcloud.edu.persistence.dataobject.study.ClassCurriculumChapterDO">
|
||||
SELECT
|
||||
c.id,
|
||||
c.curriculum_chapter_id,
|
||||
c.class_id,
|
||||
c.corpinfo_id,
|
||||
c.class_curriculum_id,
|
||||
c.name,
|
||||
c.video_courseware_id,
|
||||
c.sort,
|
||||
c.parent_id,
|
||||
v.courseware_name,
|
||||
v.video_files,
|
||||
v.courseware_introduce,
|
||||
v.video_time,
|
||||
v.screenshot_url
|
||||
FROM
|
||||
class_curriculum_chapter c
|
||||
left join video_courseware v on v.video_courseware_id = c.video_courseware_id
|
||||
WHERE
|
||||
c.class_curriculum_id = #{classCurriculumId}
|
||||
AND c.delete_enum = 'FALSE'
|
||||
ORDER BY
|
||||
c.parent_id,
|
||||
c.sort
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,28 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.zcloud.edu.persistence.mapper.study.ClassCurriculumMapper">
|
||||
<select id="getInfoById" resultType="com.zcloud.edu.persistence.dataobject.study.ClassCurriculumDO">
|
||||
select
|
||||
cc.id,
|
||||
cc.class_curriculum_id,
|
||||
cc.curriculum_id,
|
||||
cc.class_id,
|
||||
cc.curriculum_name,
|
||||
cc.video_total_time,
|
||||
c.training_type_id,
|
||||
c.corpinfo_id,
|
||||
co.corp_name,
|
||||
c.video_total_time curriculumVideoTotalTime,
|
||||
c.curriculum_introduce,
|
||||
c.cover_path
|
||||
|
||||
from
|
||||
class_curriculum cc
|
||||
left join curriculum c on c.curriculum_id = cc.curriculum_id
|
||||
left join corp_info co on co.id = c.corpinfo_id
|
||||
<where>
|
||||
cc.id = #{id}
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,19 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.zcloud.edu.persistence.mapper.study.ClassMapper">
|
||||
<select id="countQuestionByClassId" resultType="com.zcloud.edu.persistence.mapper.po.study.ClassQuestionPO">
|
||||
|
||||
SELECT
|
||||
q.question_type,
|
||||
COUNT(q.question_type) question_count
|
||||
FROM
|
||||
question q
|
||||
WHERE
|
||||
q.video_courseware_id IN (SELECT ch.video_courseware_id FROM class_curriculum_chapter ch WHERE ch.delete_enum = 'FALSE' AND ch.video_courseware_id IS NOT NULL AND ch.class_id = #{classId})
|
||||
AND q.delete_enum = 'FALSE'
|
||||
and q.courseware_type = 1
|
||||
GROUP BY
|
||||
q.question_type
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue