dev-tmp1
luotaiqian 2026-08-17 18:18:06 +08:00
parent 983d75efbd
commit 7941877be9
12 changed files with 314 additions and 258 deletions

View File

@ -4,22 +4,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.qinan.cedu.model.dto.PaperImportDTO;
import org.qinan.cedu.model.entity.PaperDO;
import org.qinan.cedu.model.dto.PaperPageQueryDTO;
import org.qinan.cedu.model.dto.PaperUpdateDTO;
import org.qinan.cedu.model.vo.PaperImportVO;
import org.qinan.cedu.model.vo.PaperPageVO;
import org.qinan.cedu.service.PaperService;
import org.qinan.safetyeval.client.dto.PageResponse;
import org.qinan.safetyeval.client.dto.SingleResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import org.springframework.web.bind.annotation.*;
/**
*
@ -34,49 +28,25 @@ public class PaperController {
@ApiOperation("分页查询试卷")
@GetMapping("/page")
public IPage<PaperDO> page(@RequestParam(defaultValue = "1") long current,
@RequestParam(defaultValue = "10") long size,
@RequestParam(required = false) String paperName,
@RequestParam(required = false) String status) {
return paperService.pageQuery(current, size, paperName, status);
public PageResponse<PaperPageVO> page(PaperPageQueryDTO query) {
IPage<PaperPageVO> page = paperService.pageQuery(query);
return PageResponse.of(page.getRecords(), page.getTotal());
}
@ApiOperation("查询试卷详情")
@GetMapping("/{id}")
public PaperDO getById(@PathVariable Long id) {
return paperService.getById(id);
}
@ApiOperation("新增试卷")
@PostMapping
public boolean save(@RequestBody PaperDO paperEntity) {
return paperService.savePaper(paperEntity);
}
@ApiOperation("修改试卷")
@ApiOperation("修改试卷基本信息")
@PutMapping
public boolean update(@RequestBody PaperDO paperEntity) {
return paperService.updatePaper(paperEntity);
public SingleResponse<Void> update(@Validated @RequestBody PaperUpdateDTO updateDTO) {
paperService.updatePaper(updateDTO);
return SingleResponse.success();
}
@ApiOperation("删除试卷")
@DeleteMapping("/{id}")
public boolean delete(@PathVariable Long id) {
return paperService.deleteById(id);
public SingleResponse<Void> delete(@PathVariable Long id) {
paperService.deleteById(id);
return SingleResponse.success();
}
@ApiOperation("绑定试卷试题")
@PostMapping("/{id}/questions")
public boolean bindQuestions(@PathVariable("id") Long paperId,
@RequestBody List<Long> questionIds) {
return paperService.bindQuestions(paperId, questionIds);
}
@ApiOperation("查询试卷试题id列表")
@GetMapping("/{id}/questionIds")
public List<Long> questionIds(@PathVariable("id") Long paperId) {
return paperService.getQuestionIds(paperId);
}
@ApiOperation("新建试卷-导入试题")
@PostMapping("/import")

View File

@ -1,19 +1,9 @@
package org.qinan.cedu.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.qinan.cedu.model.entity.QuestionDO;
import org.qinan.cedu.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
@ -27,36 +17,5 @@ public class QuestionController {
@Autowired
private QuestionService questionService;
@ApiOperation("分页查询试题")
@GetMapping("/page")
public IPage<QuestionDO> page(@RequestParam(defaultValue = "1") long current,
@RequestParam(defaultValue = "10") long size,
@RequestParam(required = false) String title,
@RequestParam(required = false) String questionType) {
return questionService.pageQuery(current, size, title, questionType);
}
@ApiOperation("查询试题详情(含选项)")
@GetMapping("/{id}")
public QuestionDO getDetail(@PathVariable Long id) {
return questionService.getDetail(id);
}
@ApiOperation("新增试题(含选项)")
@PostMapping
public boolean save(@RequestBody QuestionDO questionDO) {
return questionService.saveWithOptions(questionDO, questionDO.getOptions());
}
@ApiOperation("修改试题(含选项)")
@PutMapping
public boolean update(@RequestBody QuestionDO questionDO) {
return questionService.updateWithOptions(questionDO, questionDO.getOptions());
}
@ApiOperation("删除试题")
@DeleteMapping("/{id}")
public boolean delete(@PathVariable Long id) {
return questionService.deleteById(id);
}
}

View File

@ -0,0 +1,15 @@
package org.qinan.cedu.convertor;
import org.mapstruct.Mapper;
import org.qinan.cedu.model.entity.PaperDO;
import org.qinan.cedu.model.vo.PaperPageVO;
import java.util.List;
@Mapper(componentModel = "spring")
public interface PaperConvertor {
PaperPageVO convertEToVo(PaperDO entity);
List<PaperPageVO> convertEListToVoList(List<PaperDO> list);
}

View File

@ -0,0 +1,30 @@
package org.qinan.cedu.model.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.qinan.cedu.model.query.BasePageQuery;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate;
/**
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "PaperPageQueryDTO", description = "试卷分页查询请求")
public class PaperPageQueryDTO extends BasePageQuery {
@ApiModelProperty("试卷名称(模糊)")
private String paperName;
@ApiModelProperty("创建时间-开始yyyy-MM-dd含当天")
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
private LocalDate createTimeStart;
@ApiModelProperty("创建时间-结束yyyy-MM-dd含当天")
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
private LocalDate createTimeEnd;
}

View File

@ -0,0 +1,41 @@
package org.qinan.cedu.model.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
/**
*
*/
@Data
@ApiModel(value = "PaperUpdateDTO", description = "修改试卷基本信息请求")
public class PaperUpdateDTO {
@ApiModelProperty(value = "试卷id", required = true)
@NotNull(message = "试卷id不能为空")
private Long id;
@ApiModelProperty(value = "试卷名称", required = true)
@NotBlank(message = "试卷名称不能为空")
@Size(max = 128, message = "试卷名称长度不能超过128个字符")
private String paperName;
@ApiModelProperty(value = "试卷总分", required = true)
@NotNull(message = "试卷总分不能为空")
@DecimalMin(value = "0.01", message = "试卷总分必须大于0")
@DecimalMax(value = "9999.99", message = "试卷总分不能超过9999.99")
private BigDecimal paperTotalScore;
@ApiModelProperty(value = "合格分数", required = true)
@NotNull(message = "合格分数不能为空")
@DecimalMin(value = "0", message = "合格分数不能小于0")
@DecimalMax(value = "9999.99", message = "合格分数不能超过9999.99")
private BigDecimal paperPassScore;
}

View File

@ -54,8 +54,8 @@ public class QuestionDO extends BaseEntity {
@ApiModelProperty("试题号")
private Integer questionNum;
@ApiModelProperty("关联课件")
private Long coursewareId;
@ApiModelProperty("关联课件管理id")
private Long coursewareManagementId;
@ApiModelProperty("试题选项列表")
@TableField(exist = false)

View File

@ -0,0 +1,31 @@
package org.qinan.cedu.model.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
*
*/
@Data
@ApiModel(value = "PaperPageVO", description = "试卷分页查询返回")
public class PaperPageVO {
@ApiModelProperty("试卷id")
private Long id;
@ApiModelProperty("试卷名称")
private String paperName;
@ApiModelProperty("试卷总分")
private BigDecimal paperTotalScore;
@ApiModelProperty("合格分数")
private BigDecimal paperPassScore;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -3,8 +3,11 @@ package org.qinan.cedu.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.qinan.cedu.model.dto.PaperImportDTO;
import org.qinan.cedu.model.dto.PaperPageQueryDTO;
import org.qinan.cedu.model.dto.PaperUpdateDTO;
import org.qinan.cedu.model.entity.PaperDO;
import org.qinan.cedu.model.vo.PaperImportVO;
import org.qinan.cedu.model.vo.PaperPageVO;
import java.util.List;
@ -16,13 +19,10 @@ public interface PaperService extends IService<PaperDO> {
/**
*
*
* @param current
* @param size
* @param paperName
* @param status
* @param query
* @return
*/
IPage<PaperDO> pageQuery(long current, long size, String paperName, String status);
IPage<PaperPageVO> pageQuery(PaperPageQueryDTO query);
/**
*
@ -33,12 +33,12 @@ public interface PaperService extends IService<PaperDO> {
boolean savePaper(PaperDO paperEntity);
/**
*
*
*
* @param paperEntity
* @param updateDTO
* @return
*/
boolean updatePaper(PaperDO paperEntity);
boolean updatePaper(PaperUpdateDTO updateDTO);
/**
*

View File

@ -45,7 +45,7 @@ public class CoursewareManagementServiceImpl extends ServiceImpl<CoursewareManag
.page(new Page<>(query.getCurrent(), query.getSize()));
IPage<CoursewareManagementVO> convert = page.convert(coursewareManagementConvertor::convertEToVo);
for (CoursewareManagementVO record : convert.getRecords()) {
record.setExerciseCount(questionMapper.selectCount(new LambdaQueryWrapper<QuestionDO>().eq(QuestionDO::getCoursewareId, record.getId())));
record.setExerciseCount(questionMapper.selectCount(new LambdaQueryWrapper<QuestionDO>().eq(QuestionDO::getCoursewareManagementId, record.getId())));
}
return convert;
}
@ -57,7 +57,7 @@ public class CoursewareManagementServiceImpl extends ServiceImpl<CoursewareManag
.eq(CoursewareManagementDO::getDeleteEnum, DeleteEnum.FALSE.getCode())
.one();
CoursewareManagementVO coursewareManagementVO = coursewareManagementConvertor.convertEToVo(entity);
coursewareManagementVO.setExerciseCount(questionMapper.selectCount(new LambdaQueryWrapper<QuestionDO>().eq(QuestionDO::getCoursewareId, coursewareManagementVO.getId())));
coursewareManagementVO.setExerciseCount(questionMapper.selectCount(new LambdaQueryWrapper<QuestionDO>().eq(QuestionDO::getCoursewareManagementId, coursewareManagementVO.getId())));
return coursewareManagementVO;
}

View File

@ -5,19 +5,22 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import org.qinan.cedu.convertor.PaperConvertor;
import org.qinan.cedu.enums.DeleteEnum;
import org.qinan.cedu.enums.PaperStatusEnum;
import org.qinan.cedu.mapper.PaperMapper;
import org.qinan.cedu.mapper.QuestionMapper;
import org.qinan.cedu.model.dto.PaperImportDTO;
import org.qinan.cedu.model.dto.PaperPageQueryDTO;
import org.qinan.cedu.model.dto.PaperUpdateDTO;
import org.qinan.cedu.model.entity.PaperDO;
import org.qinan.cedu.model.entity.PaperQuestionRelDO;
import org.qinan.cedu.model.entity.QuestionDO;
import org.qinan.cedu.model.entity.QuestionOptionDO;
import org.qinan.cedu.model.vo.PaperImportVO;
import org.qinan.cedu.enums.DeleteEnum;
import org.qinan.cedu.enums.PaperStatusEnum;
import org.qinan.cedu.mapper.PaperMapper;
import org.qinan.cedu.model.vo.PaperPageVO;
import org.qinan.cedu.service.PaperQuestionRelService;
import org.qinan.cedu.service.PaperService;
import org.qinan.cedu.service.QuestionOptionService;
import org.qinan.cedu.service.QuestionService;
import org.qinan.cedu.service.support.QuestionExcelImporter;
import org.springframework.beans.factory.annotation.Autowired;
@ -48,14 +51,19 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperDO> implemen
@Autowired
private QuestionExcelImporter questionExcelImporter;
@Autowired
private PaperConvertor paperConvertor;
@Override
public IPage<PaperDO> pageQuery(long current, long size, String paperName, String status) {
return this.lambdaQuery()
public IPage<PaperPageVO> pageQuery(PaperPageQueryDTO query) {
IPage<PaperDO> page = this.lambdaQuery()
.eq(PaperDO::getDeleteEnum, DeleteEnum.FALSE.getCode())
.like(StringUtils.hasText(paperName), PaperDO::getPaperName, paperName)
.eq(StringUtils.hasText(status), PaperDO::getStatus, status)
.like(StringUtils.hasText(query.getPaperName()), PaperDO::getPaperName, query.getPaperName())
.ge(query.getCreateTimeStart() != null, PaperDO::getCreateTime, query.getCreateTimeStart().atStartOfDay())
.lt(query.getCreateTimeEnd() != null, PaperDO::getCreateTime, query.getCreateTimeEnd().plusDays(1).atStartOfDay())
.orderByDesc(PaperDO::getCreateTime)
.page(new Page<>(current, size));
.page(new Page<>(query.getCurrent(), query.getSize()));
return page.convert(paperConvertor::convertEToVo);
}
@Override
@ -71,9 +79,14 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperDO> implemen
}
@Override
public boolean updatePaper(PaperDO paperEntity) {
paperEntity.setUpdateTime(LocalDateTime.now());
return this.updateById(paperEntity);
public boolean updatePaper(PaperUpdateDTO updateDTO) {
PaperDO paper = new PaperDO();
paper.setId(updateDTO.getId());
paper.setPaperName(updateDTO.getPaperName().trim());
paper.setPaperTotalScore(updateDTO.getPaperTotalScore());
paper.setPaperPassScore(updateDTO.getPaperPassScore());
paper.setUpdateTime(LocalDateTime.now());
return this.updateById(paper);
}
@Override

View File

@ -22,15 +22,7 @@ import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -43,7 +35,9 @@ import java.util.stream.Collectors;
@Component
public class QuestionExcelImporter {
/** 模板前2行为说明和表头数据从第3行开始 */
/**
* 23
*/
private static final int HEAD_ROW_NUMBER = 2;
private static final int SINGLE_SHEET_NO = 0;
@ -91,12 +85,12 @@ public class QuestionExcelImporter {
errors.add(new PaperImportErrorVO(null, sheetName(sheetNames, JUDGE_SHEET_NO), "读取判断题sheet失败" + e.getMessage()));
}
Map<String, Long> coursewareIdByName = loadCoursewareIdByName(singleRows, multipleRows, judgeRows);
Map<String, Long> coursewareManagementIdByName = loadCoursewareIdByName(singleRows, multipleRows, judgeRows);
List<QuestionDO> questions = new ArrayList<>();
convertChoiceRows(singleRows, sheetName(sheetNames, SINGLE_SHEET_NO), QuestionTypeEnum.SINGLE, coursewareIdByName, questions, errors);
convertChoiceRows(multipleRows, sheetName(sheetNames, MULTIPLE_SHEET_NO), QuestionTypeEnum.MULTIPLE, coursewareIdByName, questions, errors);
convertJudgeRows(judgeRows, sheetName(sheetNames, JUDGE_SHEET_NO), coursewareIdByName, questions, errors);
convertChoiceRows(singleRows, sheetName(sheetNames, SINGLE_SHEET_NO), QuestionTypeEnum.SINGLE, coursewareManagementIdByName, questions, errors);
convertChoiceRows(multipleRows, sheetName(sheetNames, MULTIPLE_SHEET_NO), QuestionTypeEnum.MULTIPLE, coursewareManagementIdByName, questions, errors);
convertJudgeRows(judgeRows, sheetName(sheetNames, JUDGE_SHEET_NO), coursewareManagementIdByName, questions, errors);
return new ParseResult(questions, errors);
}
@ -167,7 +161,7 @@ public class QuestionExcelImporter {
* /sheet
*/
private void convertChoiceRows(List<ChoiceQuestionImportRow> rows, String sheetName, QuestionTypeEnum questionType,
Map<String, Long> coursewareIdByName, List<QuestionDO> questions,
Map<String, Long> coursewareManagementIdByName, List<QuestionDO> questions,
List<PaperImportErrorVO> errors) {
boolean single = questionType == QuestionTypeEnum.SINGLE;
for (int i = 0; i < rows.size(); i++) {
@ -222,21 +216,21 @@ public class QuestionExcelImporter {
continue;
}
// 校验关联课件名称查询到后回填coursewareId
// 校验关联课件名称查询到后回填coursewareManagementId
String coursewareName = row.getCoursewareName().trim();
Long coursewareId = coursewareIdByName.get(coursewareName);
if (coursewareId == null) {
Long coursewareManagementId = coursewareManagementIdByName.get(coursewareName);
if (coursewareManagementId == null) {
errors.add(new PaperImportErrorVO(rowIndex, sheetName, "关联课件名称[" + coursewareName + "]不存在"));
continue;
}
questions.add(buildChoiceQuestion(row, questionType, options, answerLetters, coursewareId));
questions.add(buildChoiceQuestion(row, questionType, options, answerLetters, coursewareManagementId));
}
}
private QuestionDO buildChoiceQuestion(ChoiceQuestionImportRow row, QuestionTypeEnum questionType,
Map<String, String> optionTexts, List<String> answerLetters,
Long coursewareId) {
Long coursewareManagementId) {
QuestionDO question = new QuestionDO();
question.setId(IdUtil.getSnowflakeNextId());
question.setTitle(row.getTitle().trim());
@ -245,7 +239,7 @@ public class QuestionExcelImporter {
question.setScore(row.getScore());
question.setAnalysis(row.getAnalysis().trim());
question.setTagType(row.getTagType().trim());
question.setCoursewareId(coursewareId);
question.setCoursewareManagementId(coursewareManagementId);
question.setOptions(buildOptions(question.getId(), optionTexts, answerLetters));
question.setAnswerQuestionOptionIds(joinCorrectOptionIds(question.getOptions()));
return question;
@ -255,7 +249,7 @@ public class QuestionExcelImporter {
* sheetT/F AB
*/
private void convertJudgeRows(List<JudgeQuestionImportRow> rows, String sheetName,
Map<String, Long> coursewareIdByName, List<QuestionDO> questions,
Map<String, Long> coursewareManagementIdByName, List<QuestionDO> questions,
List<PaperImportErrorVO> errors) {
for (int i = 0; i < rows.size(); i++) {
JudgeQuestionImportRow row = rows.get(i);
@ -278,8 +272,8 @@ public class QuestionExcelImporter {
}
String coursewareName = row.getCoursewareName().trim();
Long coursewareId = coursewareIdByName.get(coursewareName);
if (coursewareId == null) {
Long coursewareManagementId = coursewareManagementIdByName.get(coursewareName);
if (coursewareManagementId == null) {
errors.add(new PaperImportErrorVO(rowIndex, sheetName, "关联课件名称[" + coursewareName + "]不存在"));
continue;
}
@ -293,7 +287,7 @@ public class QuestionExcelImporter {
question.setScore(row.getScore());
question.setAnalysis(row.getAnalysis().trim());
question.setTagType(row.getTagType().trim());
question.setCoursewareId(coursewareId);
question.setCoursewareManagementId(coursewareManagementId);
Map<String, String> optionTexts = new LinkedHashMap<>();
optionTexts.put("A", "对");
optionTexts.put("B", "错");

View File

@ -15,114 +15,120 @@
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
SET
FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for paperEntity
-- ----------------------------
DROP TABLE IF EXISTS `paperEntity`;
CREATE TABLE `paperEntity` (
`id` bigint NOT NULL COMMENT 'id',
`paper_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '试卷名称',
`paper_total_score` decimal(6, 2) NOT NULL DEFAULT 0.00 COMMENT '试卷总分',
`paper_pass_score` decimal(6, 2) NOT NULL DEFAULT 0.00 COMMENT '合格分数',
`status` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '试卷试卷状态 normal 正常',
`delete_enum` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '删除标识true false',
`remarks` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
`create_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人姓名',
`update_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新人姓名',
`tenant_id` bigint NULL DEFAULT NULL COMMENT '租户id',
`version` int NULL DEFAULT NULL COMMENT '版本',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
`create_id` bigint NULL DEFAULT NULL COMMENT '创建人id',
`update_id` bigint NULL DEFAULT NULL COMMENT '修改人id',
`env` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '环境',
PRIMARY KEY (`id`) USING BTREE
CREATE TABLE `paperEntity`
(
`id` bigint NOT NULL COMMENT 'id',
`paper_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '试卷名称',
`paper_total_score` decimal(6, 2) NOT NULL DEFAULT 0.00 COMMENT '试卷总分',
`paper_pass_score` decimal(6, 2) NOT NULL DEFAULT 0.00 COMMENT '合格分数',
`status` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '试卷试卷状态 normal 正常',
`delete_enum` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '删除标识true false',
`remarks` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
`create_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人姓名',
`update_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新人姓名',
`tenant_id` bigint NULL DEFAULT NULL COMMENT '租户id',
`version` int NULL DEFAULT NULL COMMENT '版本',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
`create_id` bigint NULL DEFAULT NULL COMMENT '创建人id',
`update_id` bigint NULL DEFAULT NULL COMMENT '修改人id',
`env` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '环境',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '试卷' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for paper_question_rel
-- ----------------------------
DROP TABLE IF EXISTS `paper_question_rel`;
CREATE TABLE `paper_question_rel` (
`id` bigint NOT NULL COMMENT 'id',
`paper_id` bigint NOT NULL COMMENT '试卷id',
`question_id` bigint NOT NULL COMMENT '试题id',
`delete_enum` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '删除标识true false',
`remarks` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
`create_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人姓名',
`update_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新人姓名',
`tenant_id` bigint NULL DEFAULT NULL COMMENT '租户id',
`version` int NULL DEFAULT NULL COMMENT '版本',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
`create_id` bigint NULL DEFAULT NULL COMMENT '创建人id',
`update_id` bigint NULL DEFAULT NULL COMMENT '修改人id',
`env` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '环境',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_paper_id`(`paper_id` ASC) USING BTREE
CREATE TABLE `paper_question_rel`
(
`id` bigint NOT NULL COMMENT 'id',
`paper_id` bigint NOT NULL COMMENT '试卷id',
`question_id` bigint NOT NULL COMMENT '试题id',
`delete_enum` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '删除标识true false',
`remarks` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
`create_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人姓名',
`update_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新人姓名',
`tenant_id` bigint NULL DEFAULT NULL COMMENT '租户id',
`version` int NULL DEFAULT NULL COMMENT '版本',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
`create_id` bigint NULL DEFAULT NULL COMMENT '创建人id',
`update_id` bigint NULL DEFAULT NULL COMMENT '修改人id',
`env` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '环境',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_paper_id`(`paper_id` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '试卷试题关系表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for questionDO
-- ----------------------------
DROP TABLE IF EXISTS `questionDO`;
CREATE TABLE `questionDO` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '试题ID',
`title` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '题目内容',
`question_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'single' COMMENT '题型single单选/multiple多选/judge判断/fill填空/short简答',
`answer` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '参考答案:逗号隔开',
`answer_question_option_ids` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '答案选项id 多个逗号隔开',
`score` decimal(5, 2) NOT NULL DEFAULT 0.00 COMMENT '分值',
`analysis` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '答案解析',
`tag_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '标签类型',
`question_num` int NULL DEFAULT NULL COMMENT '试题号',
`courseware_id` bigint NULL DEFAULT NULL COMMENT '关联课件',
`delete_enum` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '删除标识true false',
`remarks` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
`create_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人姓名',
`update_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新人姓名',
`tenant_id` bigint NULL DEFAULT NULL COMMENT '租户id',
`version` int NULL DEFAULT NULL COMMENT '版本',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
`create_id` bigint NULL DEFAULT NULL COMMENT '创建人id',
`update_id` bigint NULL DEFAULT NULL COMMENT '修改人id',
`env` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '环境',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_courseware_id`(`courseware_id` ASC) USING BTREE
CREATE TABLE `questionDO`
(
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '试题ID',
`title` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '题目内容',
`question_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'single' COMMENT '题型single单选/multiple多选/judge判断/fill填空/short简答',
`answer` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '参考答案:逗号隔开',
`answer_question_option_ids` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '答案选项id 多个逗号隔开',
`score` decimal(5, 2) NOT NULL DEFAULT 0.00 COMMENT '分值',
`analysis` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '答案解析',
`tag_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '标签类型',
`question_num` int NULL DEFAULT NULL COMMENT '试题号',
`courseware_management_id` bigint NULL DEFAULT NULL COMMENT '关联课件管理id',
`delete_enum` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '删除标识true false',
`remarks` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
`create_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人姓名',
`update_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新人姓名',
`tenant_id` bigint NULL DEFAULT NULL COMMENT '租户id',
`version` int NULL DEFAULT NULL COMMENT '版本',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
`create_id` bigint NULL DEFAULT NULL COMMENT '创建人id',
`update_id` bigint NULL DEFAULT NULL COMMENT '修改人id',
`env` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '环境',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_courseware_management_id`(`courseware_management_id` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '试题表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for question_option
-- ----------------------------
DROP TABLE IF EXISTS `question_option`;
CREATE TABLE `question_option` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '选项ID',
`question_id` bigint UNSIGNED NOT NULL COMMENT '所属试题ID',
`option_key` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '选项标识A,B,C,D,E,F',
`option_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '选项标志名称',
`option_text` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '选项内容',
`is_correct` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否正确答案1是0否',
`sort_order` int NOT NULL DEFAULT 0 COMMENT '选项显示顺序',
`delete_enum` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '删除标识true false',
`remarks` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
`create_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人姓名',
`update_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新人姓名',
`tenant_id` bigint NULL DEFAULT NULL COMMENT '租户id',
`version` int NULL DEFAULT NULL COMMENT '版本',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
`create_id` bigint NULL DEFAULT NULL COMMENT '创建人id',
`update_id` bigint NULL DEFAULT NULL COMMENT '修改人id',
`env` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '环境',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_question_id`(`question_id` ASC) USING BTREE,
CONSTRAINT `fk_question_option_question` FOREIGN KEY (`question_id`) REFERENCES `questionDO` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
CREATE TABLE `question_option`
(
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '选项ID',
`question_id` bigint UNSIGNED NOT NULL COMMENT '所属试题ID',
`option_key` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '选项标识A,B,C,D,E,F',
`option_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '选项标志名称',
`option_text` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '选项内容',
`is_correct` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否正确答案1是0否',
`sort_order` int NOT NULL DEFAULT 0 COMMENT '选项显示顺序',
`delete_enum` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '删除标识true false',
`remarks` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
`create_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人姓名',
`update_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新人姓名',
`tenant_id` bigint NULL DEFAULT NULL COMMENT '租户id',
`version` int NULL DEFAULT NULL COMMENT '版本',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
`create_id` bigint NULL DEFAULT NULL COMMENT '创建人id',
`update_id` bigint NULL DEFAULT NULL COMMENT '修改人id',
`env` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '环境',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_question_id`(`question_id` ASC) USING BTREE,
CONSTRAINT `fk_question_option_question` FOREIGN KEY (`question_id`) REFERENCES `questionDO` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '试题选项表' ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
SET
FOREIGN_KEY_CHECKS = 1;
create table course_management
(
@ -130,37 +136,35 @@ create table course_management
remarks varchar(255) charset utf8mb4 null comment '备注',
create_name varchar(50) charset utf8mb4 null comment '创建人姓名',
update_name varchar(50) charset utf8mb4 null comment '更新人姓名',
tenant_id bigint null comment '租户id',
version int null comment '版本',
create_time datetime null comment '创建时间',
update_time datetime null comment '修改时间',
create_id bigint null comment '创建人id',
update_id bigint null comment '修改人id',
tenant_id bigint null comment '租户id',
version int null comment '版本',
create_time datetime null comment '创建时间',
update_time datetime null comment '修改时间',
create_id bigint null comment '创建人id',
update_id bigint null comment '修改人id',
env varchar(50) charset utf8mb4 null comment '环境',
id bigint not null comment '主键'
id bigint not null comment '主键'
primary key,
course_name varchar(200) null comment '课程名称',
training_type varchar(100) null comment '培训类型',
course_description varchar(512) null comment '课称描述',
course_cover varchar(255) null comment '课程封面',
course_name varchar(200) null comment '课程名称',
training_type varchar(100) null comment '培训类型',
course_description varchar(512) null comment '课称描述',
course_cover varchar(255) null comment '课程封面',
class_hour_duration decimal(5, 1) unsigned default 0.0 null comment '课时时长(小时)',
upload_unit varchar(200) null comment '上传单位',
status int default 0 null comment '状态1启用/0禁用',
used int default 0 null comment '是否已被使用0-未使用1-已使用)'
)
comment '课程管理';
upload_unit varchar(200) null comment '上传单位',
status int default 0 null comment '状态1启用/0禁用',
used int default 0 null comment '是否已被使用0-未使用1-已使用)'
) comment '课程管理';
create table course_rel_courseware
(
id bigint not null comment '主键'
id bigint not null comment '主键'
primary key,
courseware_name varchar(200) null comment '课件名称',
courseware_document varchar(512) null comment '课件文档(文件名或路径)',
courseware_id bigint null comment '课件id',
course_id bigint null comment '课程id',
sort int null comment '排序'
)
comment '课程关联课件表';
courseware_id bigint null comment '课件id',
course_id bigint null comment '课程id',
sort int null comment '排序'
) comment '课程关联课件表';
create table courseware_management
(
@ -168,25 +172,24 @@ create table courseware_management
remarks varchar(255) charset utf8mb4 null comment '备注',
create_name varchar(50) charset utf8mb4 null comment '创建人姓名',
update_name varchar(50) charset utf8mb4 null comment '更新人姓名',
tenant_id bigint null comment '租户id',
version int null comment '版本',
create_time datetime null comment '创建时间',
update_time datetime null comment '修改时间',
create_id bigint null comment '创建人id',
update_id bigint null comment '修改人id',
tenant_id bigint null comment '租户id',
version int null comment '版本',
create_time datetime null comment '创建时间',
update_time datetime null comment '修改时间',
create_id bigint null comment '创建人id',
update_id bigint null comment '修改人id',
env varchar(50) charset utf8mb4 null comment '环境',
id bigint not null comment '主键'
id bigint not null comment '主键'
primary key,
courseware_name varchar(200) null comment '课件名称',
training_type varchar(100) null comment '培训类型',
lecturer_name varchar(100) null comment '讲师名称',
courseware_name varchar(200) null comment '课件名称',
training_type varchar(100) null comment '培训类型',
lecturer_name varchar(100) null comment '讲师名称',
credit_hours decimal(5, 1) unsigned default 0.0 null comment '学时',
class_hour_duration decimal(5, 1) unsigned default 0.0 null comment '课时时长(小时)',
upload_unit varchar(200) null comment '上传单位',
status int default 0 null comment '状态1启用/0禁用',
courseware_type int null comment '课件类型1视频课件/2文档课件',
courseware_document varchar(512) null comment '课件文档(文件名或路径)',
courseware_description varchar(512) null comment '课件描述'
)
comment '课件表';
upload_unit varchar(200) null comment '上传单位',
status int default 0 null comment '状态1启用/0禁用',
courseware_type int null comment '课件类型1视频课件/2文档课件',
courseware_document varchar(512) null comment '课件文档(文件名或路径)',
courseware_description varchar(512) null comment '课件描述'
) comment '课件表';