user paper exam
parent
beeb4320a0
commit
36254136ad
|
|
@ -0,0 +1,74 @@
|
|||
package org.qinan.cedu.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.qinan.cedu.model.dto.PaperExamDTO;
|
||||
import org.qinan.cedu.model.dto.PaperExamPageQueryDTO;
|
||||
import org.qinan.cedu.model.vo.PaperExamVO;
|
||||
import org.qinan.cedu.service.PaperExamService;
|
||||
import org.qinan.safetyeval.client.dto.PageResponse;
|
||||
import org.qinan.safetyeval.client.dto.SingleResponse;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 考试试卷管理
|
||||
*/
|
||||
@Api(tags = "考试试卷管理")
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/safetyEval/paperExam")
|
||||
public class PaperExamController {
|
||||
|
||||
private final PaperExamService paperExamService;
|
||||
|
||||
/**
|
||||
* 分页查询考试试卷
|
||||
*/
|
||||
@ApiOperation("分页查询考试试卷")
|
||||
@GetMapping("/page")
|
||||
public PageResponse<PaperExamVO> page(PaperExamPageQueryDTO query) {
|
||||
IPage<PaperExamVO> page = paperExamService.pageQuery(query);
|
||||
return PageResponse.of(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询考试试卷详情
|
||||
*/
|
||||
@ApiOperation("考试试卷详情")
|
||||
@GetMapping("/{id}")
|
||||
public SingleResponse<PaperExamVO> get(@ApiParam("主键id") @PathVariable Long id) {
|
||||
return SingleResponse.success(paperExamService.getDetail(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增考试试卷
|
||||
*/
|
||||
@ApiOperation("新增考试试卷")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<Boolean> save(@Validated @RequestBody PaperExamDTO dto) {
|
||||
return SingleResponse.success(paperExamService.savePaperExam(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改考试试卷
|
||||
*/
|
||||
@ApiOperation("修改考试试卷")
|
||||
@PutMapping("/update")
|
||||
public SingleResponse<Boolean> update(@Validated @RequestBody PaperExamDTO dto) {
|
||||
return SingleResponse.success(paperExamService.updatePaperExam(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除考试试卷
|
||||
*/
|
||||
@ApiOperation("删除考试试卷")
|
||||
@DeleteMapping("/{id}")
|
||||
public SingleResponse<Void> delete(@ApiParam("主键id") @PathVariable Long id) {
|
||||
paperExamService.deleteById(id);
|
||||
return SingleResponse.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
package org.qinan.cedu.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.qinan.cedu.model.dto.PaperExamQuestionUserDTO;
|
||||
import org.qinan.cedu.model.dto.PaperExamQuestionUserPageQueryDTO;
|
||||
import org.qinan.cedu.model.vo.PaperExamQuestionUserVO;
|
||||
import org.qinan.cedu.service.PaperExamQuestionUserService;
|
||||
import org.qinan.safetyeval.client.dto.PageResponse;
|
||||
import org.qinan.safetyeval.client.dto.SingleResponse;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 用户试卷试题管理
|
||||
*/
|
||||
@Api(tags = "用户试卷试题管理")
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/safetyEval/paperExamQuestionUser")
|
||||
public class PaperExamQuestionUserController {
|
||||
|
||||
private final PaperExamQuestionUserService paperExamQuestionUserService;
|
||||
|
||||
/**
|
||||
* 分页查询用户试卷试题
|
||||
*/
|
||||
@ApiOperation("分页查询用户试卷试题")
|
||||
@GetMapping("/page")
|
||||
public PageResponse<PaperExamQuestionUserVO> page(PaperExamQuestionUserPageQueryDTO query) {
|
||||
IPage<PaperExamQuestionUserVO> page = paperExamQuestionUserService.pageQuery(query);
|
||||
return PageResponse.of(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户试卷试题详情
|
||||
*/
|
||||
@ApiOperation("用户试卷试题详情")
|
||||
@GetMapping("/{id}")
|
||||
public SingleResponse<PaperExamQuestionUserVO> get(@ApiParam("主键id") @PathVariable Long id) {
|
||||
return SingleResponse.success(paperExamQuestionUserService.getDetail(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户试卷试题
|
||||
*/
|
||||
@ApiOperation("新增用户试卷试题")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<Boolean> save(@Validated @RequestBody PaperExamQuestionUserDTO dto) {
|
||||
return SingleResponse.success(paperExamQuestionUserService.saveRecord(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户试卷试题
|
||||
*/
|
||||
@ApiOperation("修改用户试卷试题")
|
||||
@PutMapping("/update")
|
||||
public SingleResponse<Boolean> update(@Validated @RequestBody PaperExamQuestionUserDTO dto) {
|
||||
return SingleResponse.success(paperExamQuestionUserService.updateRecord(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户试卷试题
|
||||
*/
|
||||
@ApiOperation("删除用户试卷试题")
|
||||
@DeleteMapping("/{id}")
|
||||
public SingleResponse<Void> delete(@ApiParam("主键id") @PathVariable Long id) {
|
||||
paperExamQuestionUserService.deleteById(id);
|
||||
return SingleResponse.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package org.qinan.cedu.convertor;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.qinan.cedu.model.dto.PaperExamDTO;
|
||||
import org.qinan.cedu.model.entity.PaperExamDO;
|
||||
import org.qinan.cedu.model.vo.PaperExamVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考试试卷对象转换
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface PaperExamConvertor {
|
||||
|
||||
PaperExamDO convertDtoToE(PaperExamDTO dto);
|
||||
|
||||
PaperExamVO convertEToVo(PaperExamDO entity);
|
||||
|
||||
List<PaperExamDO> convertDtoListToEList(List<PaperExamDTO> list);
|
||||
|
||||
List<PaperExamVO> convertEListToVoList(List<PaperExamDO> list);
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package org.qinan.cedu.convertor;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.qinan.cedu.model.dto.PaperExamQuestionUserDTO;
|
||||
import org.qinan.cedu.model.entity.PaperExamQuestionUserDO;
|
||||
import org.qinan.cedu.model.vo.PaperExamQuestionUserVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户试卷试题对象转换
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface PaperExamQuestionUserConvertor {
|
||||
|
||||
PaperExamQuestionUserDO convertDtoToE(PaperExamQuestionUserDTO dto);
|
||||
|
||||
PaperExamQuestionUserVO convertEToVo(PaperExamQuestionUserDO entity);
|
||||
|
||||
List<PaperExamQuestionUserDO> convertDtoListToEList(List<PaperExamQuestionUserDTO> list);
|
||||
|
||||
List<PaperExamQuestionUserVO> convertEListToVoList(List<PaperExamQuestionUserDO> list);
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package org.qinan.cedu.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.qinan.cedu.model.entity.PaperExamDO;
|
||||
|
||||
/**
|
||||
* 考试试卷 Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface PaperExamMapper extends BaseMapper<PaperExamDO> {
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package org.qinan.cedu.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.qinan.cedu.model.entity.PaperExamQuestionUserDO;
|
||||
|
||||
/**
|
||||
* 用户试卷试题 Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface PaperExamQuestionUserMapper extends BaseMapper<PaperExamQuestionUserDO> {
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package org.qinan.cedu.model.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 考试试卷新增/修改入参
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "PaperExamDTO", description = "考试试卷新增/修改入参")
|
||||
public class PaperExamDTO {
|
||||
|
||||
@ApiModelProperty("主键(修改时必填)")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "试卷id", required = true)
|
||||
@NotNull(message = "试卷id不能为空")
|
||||
private Long paperId;
|
||||
|
||||
@ApiModelProperty("试卷名称")
|
||||
private String paperName;
|
||||
|
||||
@ApiModelProperty("试卷总分")
|
||||
private BigDecimal paperTotalScore;
|
||||
|
||||
@ApiModelProperty("合格分数")
|
||||
private BigDecimal paperPassScore;
|
||||
|
||||
@ApiModelProperty(value = "考试时长(分钟)", required = true)
|
||||
@NotNull(message = "考试时长不能为空")
|
||||
private Integer examTime;
|
||||
|
||||
@ApiModelProperty("交卷时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime submitTime;
|
||||
|
||||
@ApiModelProperty("考试成绩")
|
||||
private BigDecimal examScore;
|
||||
|
||||
@ApiModelProperty("考试是否通过 1是 0否")
|
||||
private Integer passed;
|
||||
|
||||
@ApiModelProperty(value = "用户id", required = true)
|
||||
@NotNull(message = "用户id不能为空")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "考试状态 non_start 未开始, doing 进行中, finished 已完成", required = true)
|
||||
@NotBlank(message = "考试状态不能为空")
|
||||
private String paperExamStatus;
|
||||
|
||||
@ApiModelProperty("考试试卷状态 normal 正常")
|
||||
private String status;
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* 考试试卷分页查询请求
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "PaperExamPageQueryDTO", description = "考试试卷分页查询请求")
|
||||
public class PaperExamPageQueryDTO extends BasePageQuery {
|
||||
|
||||
@ApiModelProperty("试卷id")
|
||||
private Long paperId;
|
||||
|
||||
@ApiModelProperty("试卷名称(模糊)")
|
||||
private String paperName;
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("考试状态 non_start 未开始, doing 进行中, finished 已完成")
|
||||
private String paperExamStatus;
|
||||
|
||||
@ApiModelProperty("考试是否通过 1是 0否")
|
||||
private Integer passed;
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package org.qinan.cedu.model.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 用户试卷试题新增/修改入参
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "PaperExamQuestionUserDTO", description = "用户试卷试题新增/修改入参")
|
||||
public class PaperExamQuestionUserDTO {
|
||||
|
||||
@ApiModelProperty("主键(修改时必填)")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "考试试卷id", required = true)
|
||||
@NotNull(message = "考试试卷id不能为空")
|
||||
private Long paperExamId;
|
||||
|
||||
@ApiModelProperty(value = "用户id", required = true)
|
||||
@NotNull(message = "用户id不能为空")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "试卷id", required = true)
|
||||
@NotNull(message = "试卷id不能为空")
|
||||
private Long paperId;
|
||||
|
||||
@ApiModelProperty(value = "试题id", required = true)
|
||||
@NotNull(message = "试题id不能为空")
|
||||
private Long questionId;
|
||||
|
||||
@ApiModelProperty("答案:逗号隔开")
|
||||
private String answer;
|
||||
|
||||
@ApiModelProperty("答案选项id 多个逗号隔开")
|
||||
private String answerQuestionOptionIds;
|
||||
|
||||
@ApiModelProperty(value = "试题分数", required = true)
|
||||
@NotNull(message = "试题分数不能为空")
|
||||
private BigDecimal questionScore;
|
||||
|
||||
@ApiModelProperty("作答得分")
|
||||
private BigDecimal answerScore;
|
||||
|
||||
@ApiModelProperty("子题信息")
|
||||
private String childrenQuestionInfo;
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* 用户试卷试题分页查询请求
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "PaperExamQuestionUserPageQueryDTO", description = "用户试卷试题分页查询请求")
|
||||
public class PaperExamQuestionUserPageQueryDTO extends BasePageQuery {
|
||||
|
||||
@ApiModelProperty("考试试卷id")
|
||||
private Long paperExamId;
|
||||
|
||||
@ApiModelProperty("试卷id")
|
||||
private Long paperId;
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("试题id")
|
||||
private Long questionId;
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package org.qinan.cedu.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 考试试卷
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("paper_exam")
|
||||
@ApiModel(value = "PaperExam", description = "考试试卷")
|
||||
public class PaperExamDO extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("试卷id")
|
||||
private Long paperId;
|
||||
|
||||
@ApiModelProperty("试卷名称")
|
||||
private String paperName;
|
||||
|
||||
@ApiModelProperty("试卷总分")
|
||||
private BigDecimal paperTotalScore;
|
||||
|
||||
@ApiModelProperty("合格分数")
|
||||
private BigDecimal paperPassScore;
|
||||
|
||||
@ApiModelProperty("考试时长(分钟)")
|
||||
private Integer examTime;
|
||||
|
||||
@ApiModelProperty("交卷时间")
|
||||
private LocalDateTime submitTime;
|
||||
|
||||
@ApiModelProperty("考试成绩")
|
||||
private BigDecimal examScore;
|
||||
|
||||
@ApiModelProperty("考试是否通过 1是 0否")
|
||||
private Integer passed;
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("考试状态 non_start 未开始, doing 进行中, finished 已完成")
|
||||
private String paperExamStatus;
|
||||
|
||||
@ApiModelProperty("考试试卷状态 normal 正常")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* paper_exam 表无 org_id 列,排除字段映射,避免生成 SQL 报错
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("机构id")
|
||||
private Long orgId;
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package org.qinan.cedu.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 用户试卷试题
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("paper_exam_question_user")
|
||||
@ApiModel(value = "PaperExamQuestionUser", description = "用户试卷试题")
|
||||
public class PaperExamQuestionUserDO extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("考试试卷id")
|
||||
private Long paperExamId;
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("试卷id")
|
||||
private Long paperId;
|
||||
|
||||
@ApiModelProperty("试题id")
|
||||
private Long questionId;
|
||||
|
||||
@ApiModelProperty("答案:逗号隔开")
|
||||
private String answer;
|
||||
|
||||
@ApiModelProperty("答案选项id 多个逗号隔开")
|
||||
private String answerQuestionOptionIds;
|
||||
|
||||
@ApiModelProperty("试题分数")
|
||||
private BigDecimal questionScore;
|
||||
|
||||
@ApiModelProperty("作答得分")
|
||||
private BigDecimal answerScore;
|
||||
|
||||
@ApiModelProperty("子题信息")
|
||||
private String childrenQuestionInfo;
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package org.qinan.cedu.model.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 用户试卷试题
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel(value = "PaperExamQuestionUserVO", description = "用户试卷试题")
|
||||
public class PaperExamQuestionUserVO extends BaseVO {
|
||||
|
||||
@ApiModelProperty("考试试卷id")
|
||||
private String paperExamId;
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty("试卷id")
|
||||
private String paperId;
|
||||
|
||||
@ApiModelProperty("试题id")
|
||||
private String questionId;
|
||||
|
||||
@ApiModelProperty("答案:逗号隔开")
|
||||
private String answer;
|
||||
|
||||
@ApiModelProperty("答案选项id 多个逗号隔开")
|
||||
private String answerQuestionOptionIds;
|
||||
|
||||
@ApiModelProperty("试题分数")
|
||||
private BigDecimal questionScore;
|
||||
|
||||
@ApiModelProperty("作答得分")
|
||||
private BigDecimal answerScore;
|
||||
|
||||
@ApiModelProperty("子题信息")
|
||||
private String childrenQuestionInfo;
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package org.qinan.cedu.model.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 考试试卷
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel(value = "PaperExamVO", description = "考试试卷")
|
||||
public class PaperExamVO extends BaseVO {
|
||||
|
||||
@ApiModelProperty("试卷id")
|
||||
private String paperId;
|
||||
|
||||
@ApiModelProperty("试卷名称")
|
||||
private String paperName;
|
||||
|
||||
@ApiModelProperty("试卷总分")
|
||||
private BigDecimal paperTotalScore;
|
||||
|
||||
@ApiModelProperty("合格分数")
|
||||
private BigDecimal paperPassScore;
|
||||
|
||||
@ApiModelProperty("考试时长(分钟)")
|
||||
private Integer examTime;
|
||||
|
||||
@ApiModelProperty("交卷时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime submitTime;
|
||||
|
||||
@ApiModelProperty("考试成绩")
|
||||
private BigDecimal examScore;
|
||||
|
||||
@ApiModelProperty("考试是否通过 1是 0否")
|
||||
private Integer passed;
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty("考试状态 non_start 未开始, doing 进行中, finished 已完成")
|
||||
private String paperExamStatus;
|
||||
|
||||
@ApiModelProperty("考试试卷状态 normal 正常")
|
||||
private String status;
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
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.PaperExamQuestionUserDTO;
|
||||
import org.qinan.cedu.model.dto.PaperExamQuestionUserPageQueryDTO;
|
||||
import org.qinan.cedu.model.entity.PaperExamQuestionUserDO;
|
||||
import org.qinan.cedu.model.vo.PaperExamQuestionUserVO;
|
||||
|
||||
/**
|
||||
* 用户试卷试题服务接口
|
||||
*/
|
||||
public interface PaperExamQuestionUserService extends IService<PaperExamQuestionUserDO> {
|
||||
|
||||
/**
|
||||
* 分页查询用户试卷试题
|
||||
*
|
||||
* @param query 分页查询条件
|
||||
* @return 分页结果
|
||||
*/
|
||||
IPage<PaperExamQuestionUserVO> pageQuery(PaperExamQuestionUserPageQueryDTO query);
|
||||
|
||||
/**
|
||||
* 查询用户试卷试题详情
|
||||
*
|
||||
* @param id 主键id
|
||||
* @return 用户试卷试题详情
|
||||
*/
|
||||
PaperExamQuestionUserVO getDetail(Long id);
|
||||
|
||||
/**
|
||||
* 新增用户试卷试题
|
||||
*
|
||||
* @param dto 新增入参
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean saveRecord(PaperExamQuestionUserDTO dto);
|
||||
|
||||
/**
|
||||
* 修改用户试卷试题
|
||||
*
|
||||
* @param dto 修改入参(id必填)
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean updateRecord(PaperExamQuestionUserDTO dto);
|
||||
|
||||
/**
|
||||
* 删除用户试卷试题(逻辑删除)
|
||||
*
|
||||
* @param id 主键id
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Long id);
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
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.PaperExamDTO;
|
||||
import org.qinan.cedu.model.dto.PaperExamPageQueryDTO;
|
||||
import org.qinan.cedu.model.entity.PaperExamDO;
|
||||
import org.qinan.cedu.model.vo.PaperExamVO;
|
||||
|
||||
/**
|
||||
* 考试试卷服务接口
|
||||
*/
|
||||
public interface PaperExamService extends IService<PaperExamDO> {
|
||||
|
||||
/**
|
||||
* 分页查询考试试卷
|
||||
*
|
||||
* @param query 分页查询条件
|
||||
* @return 分页结果
|
||||
*/
|
||||
IPage<PaperExamVO> pageQuery(PaperExamPageQueryDTO query);
|
||||
|
||||
/**
|
||||
* 查询考试试卷详情
|
||||
*
|
||||
* @param id 主键id
|
||||
* @return 考试试卷详情
|
||||
*/
|
||||
PaperExamVO getDetail(Long id);
|
||||
|
||||
/**
|
||||
* 新增考试试卷
|
||||
*
|
||||
* @param dto 新增入参
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean savePaperExam(PaperExamDTO dto);
|
||||
|
||||
/**
|
||||
* 修改考试试卷
|
||||
*
|
||||
* @param dto 修改入参(id必填)
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean updatePaperExam(PaperExamDTO dto);
|
||||
|
||||
/**
|
||||
* 删除考试试卷(逻辑删除)
|
||||
*
|
||||
* @param id 主键id
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Long id);
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package org.qinan.cedu.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.qinan.cedu.convertor.PaperExamQuestionUserConvertor;
|
||||
import org.qinan.cedu.enums.DeleteEnum;
|
||||
import org.qinan.cedu.mapper.PaperExamQuestionUserMapper;
|
||||
import org.qinan.cedu.model.dto.PaperExamQuestionUserDTO;
|
||||
import org.qinan.cedu.model.dto.PaperExamQuestionUserPageQueryDTO;
|
||||
import org.qinan.cedu.model.entity.PaperExamQuestionUserDO;
|
||||
import org.qinan.cedu.model.vo.PaperExamQuestionUserVO;
|
||||
import org.qinan.cedu.service.PaperExamQuestionUserService;
|
||||
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 用户试卷试题服务实现
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PaperExamQuestionUserServiceImpl extends ServiceImpl<PaperExamQuestionUserMapper, PaperExamQuestionUserDO>
|
||||
implements PaperExamQuestionUserService {
|
||||
|
||||
private final PaperExamQuestionUserConvertor paperExamQuestionUserConvertor;
|
||||
|
||||
@Override
|
||||
public IPage<PaperExamQuestionUserVO> pageQuery(PaperExamQuestionUserPageQueryDTO query) {
|
||||
return this.lambdaQuery()
|
||||
.eq(PaperExamQuestionUserDO::getDeleteEnum, DeleteEnum.FALSE.getCode())
|
||||
.eq(query.getPaperExamId() != null, PaperExamQuestionUserDO::getPaperExamId, query.getPaperExamId())
|
||||
.eq(query.getPaperId() != null, PaperExamQuestionUserDO::getPaperId, query.getPaperId())
|
||||
.eq(query.getUserId() != null, PaperExamQuestionUserDO::getUserId, query.getUserId())
|
||||
.eq(query.getQuestionId() != null, PaperExamQuestionUserDO::getQuestionId, query.getQuestionId())
|
||||
.orderByAsc(PaperExamQuestionUserDO::getId)
|
||||
.page(new Page<>(query.getCurrent(), query.getSize()))
|
||||
.convert(paperExamQuestionUserConvertor::convertEToVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaperExamQuestionUserVO getDetail(Long id) {
|
||||
PaperExamQuestionUserDO entity = this.lambdaQuery()
|
||||
.eq(PaperExamQuestionUserDO::getId, id)
|
||||
.eq(PaperExamQuestionUserDO::getDeleteEnum, DeleteEnum.FALSE.getCode())
|
||||
.one();
|
||||
return paperExamQuestionUserConvertor.convertEToVo(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveRecord(PaperExamQuestionUserDTO dto) {
|
||||
PaperExamQuestionUserDO entity = paperExamQuestionUserConvertor.convertDtoToE(dto);
|
||||
InsertFieldDefaults.apply(entity);
|
||||
return this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateRecord(PaperExamQuestionUserDTO dto) {
|
||||
if (dto.getId() == null) {
|
||||
throw new IllegalArgumentException("主键id不能为空");
|
||||
}
|
||||
PaperExamQuestionUserDO entity = paperExamQuestionUserConvertor.convertDtoToE(dto);
|
||||
InsertFieldDefaults.applyForUpdate(entity);
|
||||
return this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteById(Long id) {
|
||||
return this.lambdaUpdate()
|
||||
.set(PaperExamQuestionUserDO::getDeleteEnum, DeleteEnum.TRUE.getCode())
|
||||
.set(PaperExamQuestionUserDO::getUpdateTime, LocalDateTime.now())
|
||||
.eq(PaperExamQuestionUserDO::getId, id)
|
||||
.eq(PaperExamQuestionUserDO::getDeleteEnum, DeleteEnum.FALSE.getCode())
|
||||
.update();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package org.qinan.cedu.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.qinan.cedu.convertor.PaperExamConvertor;
|
||||
import org.qinan.cedu.enums.DeleteEnum;
|
||||
import org.qinan.cedu.mapper.PaperExamMapper;
|
||||
import org.qinan.cedu.model.dto.PaperExamDTO;
|
||||
import org.qinan.cedu.model.dto.PaperExamPageQueryDTO;
|
||||
import org.qinan.cedu.model.entity.PaperExamDO;
|
||||
import org.qinan.cedu.model.vo.PaperExamVO;
|
||||
import org.qinan.cedu.service.PaperExamService;
|
||||
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 考试试卷服务实现
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PaperExamServiceImpl extends ServiceImpl<PaperExamMapper, PaperExamDO> implements PaperExamService {
|
||||
|
||||
private static final String STATUS_NORMAL = "normal";
|
||||
|
||||
private final PaperExamConvertor paperExamConvertor;
|
||||
|
||||
@Override
|
||||
public IPage<PaperExamVO> pageQuery(PaperExamPageQueryDTO query) {
|
||||
return this.lambdaQuery()
|
||||
.eq(PaperExamDO::getDeleteEnum, DeleteEnum.FALSE.getCode())
|
||||
.eq(query.getPaperId() != null, PaperExamDO::getPaperId, query.getPaperId())
|
||||
.like(StringUtils.hasText(query.getPaperName()), PaperExamDO::getPaperName, query.getPaperName())
|
||||
.eq(query.getUserId() != null, PaperExamDO::getUserId, query.getUserId())
|
||||
.eq(StringUtils.hasText(query.getPaperExamStatus()), PaperExamDO::getPaperExamStatus, query.getPaperExamStatus())
|
||||
.eq(query.getPassed() != null, PaperExamDO::getPassed, query.getPassed())
|
||||
.orderByDesc(PaperExamDO::getId)
|
||||
.page(new Page<>(query.getCurrent(), query.getSize()))
|
||||
.convert(paperExamConvertor::convertEToVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaperExamVO getDetail(Long id) {
|
||||
PaperExamDO entity = this.lambdaQuery()
|
||||
.eq(PaperExamDO::getId, id)
|
||||
.eq(PaperExamDO::getDeleteEnum, DeleteEnum.FALSE.getCode())
|
||||
.one();
|
||||
return paperExamConvertor.convertEToVo(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean savePaperExam(PaperExamDTO dto) {
|
||||
PaperExamDO entity = paperExamConvertor.convertDtoToE(dto);
|
||||
if (!StringUtils.hasText(entity.getStatus())) {
|
||||
entity.setStatus(STATUS_NORMAL);
|
||||
}
|
||||
// paper_exam 表无 org_id 列,插入前不填充机构id
|
||||
InsertFieldDefaults.applyIgnoreOrgId(entity);
|
||||
return this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updatePaperExam(PaperExamDTO dto) {
|
||||
if (dto.getId() == null) {
|
||||
throw new IllegalArgumentException("主键id不能为空");
|
||||
}
|
||||
PaperExamDO entity = paperExamConvertor.convertDtoToE(dto);
|
||||
InsertFieldDefaults.applyForUpdateIgnoreOrgId(entity);
|
||||
return this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteById(Long id) {
|
||||
return this.lambdaUpdate()
|
||||
.set(PaperExamDO::getDeleteEnum, DeleteEnum.TRUE.getCode())
|
||||
.set(PaperExamDO::getUpdateTime, LocalDateTime.now())
|
||||
.eq(PaperExamDO::getId, id)
|
||||
.eq(PaperExamDO::getDeleteEnum, DeleteEnum.FALSE.getCode())
|
||||
.update();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue