Add .gitignore file and remove ignored files from git
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import pc.exam.pp.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static pc.exam.pp.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
* 考试分页查询 Request VO
|
||||
*
|
||||
* @author pengchen
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ExamPageReqVO extends PageParam {
|
||||
|
||||
/**
|
||||
* 考试名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 考试状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 考试类型
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@@ -1,72 +0,0 @@
|
||||
package pc.exam.pp.module.exam.dal.dataobject;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import pc.exam.pp.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 考试信息 DO
|
||||
*
|
||||
* @author pengchen
|
||||
*/
|
||||
@TableName("exam")
|
||||
@KeySequence("exam_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ExamDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 考试名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 考试描述
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private LocalDateTime startTime;
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private LocalDateTime endTime;
|
||||
/**
|
||||
* 考试时长,单位分钟
|
||||
*/
|
||||
private Integer duration;
|
||||
/**
|
||||
* 考试状态
|
||||
*
|
||||
* 枚举 {@link ExamStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 总分
|
||||
*/
|
||||
private Integer totalScore;
|
||||
/**
|
||||
* 及格分数
|
||||
*/
|
||||
private Integer passingScore;
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String creator;
|
||||
/**
|
||||
* 考试类型
|
||||
*/
|
||||
private Integer type;
|
||||
}
|
@@ -1,29 +0,0 @@
|
||||
package pc.exam.pp.module.exam.dal.dataobject;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 考试状态枚举
|
||||
*
|
||||
* @author pengchen
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ExamStatusEnum {
|
||||
|
||||
DRAFT(0, "草稿"),
|
||||
PUBLISHED(1, "已发布"),
|
||||
IN_PROGRESS(2, "进行中"),
|
||||
FINISHED(3, "已结束"),
|
||||
CANCELLED(4, "已取消");
|
||||
|
||||
/**
|
||||
* 状态值
|
||||
*/
|
||||
private final Integer status;
|
||||
/**
|
||||
* 状态名
|
||||
*/
|
||||
private final String name;
|
||||
}
|
@@ -1,27 +0,0 @@
|
||||
package pc.exam.pp.module.exam.dal.mysql;
|
||||
|
||||
import pc.exam.pp.framework.common.pojo.PageResult;
|
||||
import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import pc.exam.pp.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import pc.exam.pp.module.exam.controller.admin.vo.ExamPageReqVO;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.ExamDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 考试信息 Mapper
|
||||
*
|
||||
* @author pengchen
|
||||
*/
|
||||
@Mapper
|
||||
public interface ExamMapper extends BaseMapperX<ExamDO> {
|
||||
|
||||
default PageResult<ExamDO> selectPage(ExamPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ExamDO>()
|
||||
.likeIfPresent(ExamDO::getName, reqVO.getName())
|
||||
.eqIfPresent(ExamDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(ExamDO::getType, reqVO.getType())
|
||||
.betweenIfPresent(ExamDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(ExamDO::getId));
|
||||
}
|
||||
|
||||
}
|
@@ -1,64 +0,0 @@
|
||||
package pc.exam.pp.module.exam.service;
|
||||
|
||||
import pc.exam.pp.framework.common.pojo.PageResult;
|
||||
import pc.exam.pp.module.exam.controller.admin.vo.ExamPageReqVO;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.ExamDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考试信息 Service 接口
|
||||
*
|
||||
* @author pengchen
|
||||
*/
|
||||
public interface ExamService {
|
||||
|
||||
/**
|
||||
* 创建考试
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createExam(@Valid ExamDO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新考试
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateExam(@Valid ExamDO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除考试
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteExam(Long id);
|
||||
|
||||
/**
|
||||
* 获得考试
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 考试
|
||||
*/
|
||||
ExamDO getExam(Long id);
|
||||
|
||||
/**
|
||||
* 获得考试列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 考试列表
|
||||
*/
|
||||
List<ExamDO> getExamList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得考试分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 考试分页
|
||||
*/
|
||||
PageResult<ExamDO> getExamPage(ExamPageReqVO pageReqVO);
|
||||
|
||||
}
|
@@ -1,72 +0,0 @@
|
||||
package pc.exam.pp.module.exam.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import pc.exam.pp.framework.common.pojo.PageResult;
|
||||
import pc.exam.pp.module.exam.controller.admin.vo.ExamPageReqVO;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.ExamDO;
|
||||
import pc.exam.pp.module.exam.dal.mysql.ExamMapper;
|
||||
import pc.exam.pp.module.exam.service.ExamService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考试信息 Service 实现类
|
||||
*
|
||||
* @author pengchen
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ExamServiceImpl implements ExamService {
|
||||
|
||||
@Resource
|
||||
private ExamMapper examMapper;
|
||||
|
||||
@Override
|
||||
public Long createExam(ExamDO createReqVO) {
|
||||
// 插入
|
||||
examMapper.insert(createReqVO);
|
||||
// 返回
|
||||
return createReqVO.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateExam(ExamDO updateReqVO) {
|
||||
// 校验存在
|
||||
validateExamExists(updateReqVO.getId());
|
||||
// 更新
|
||||
examMapper.updateById(updateReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteExam(Long id) {
|
||||
// 校验存在
|
||||
validateExamExists(id);
|
||||
// 删除
|
||||
examMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateExamExists(Long id) {
|
||||
if (examMapper.selectById(id) == null) {
|
||||
throw new RuntimeException("考试不存在");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExamDO getExam(Long id) {
|
||||
return examMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamDO> getExamList(Collection<Long> ids) {
|
||||
return examMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ExamDO> getExamPage(ExamPageReqVO pageReqVO) {
|
||||
return examMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="pc.exam.pp.module.exam.dal.mysql.ExamMapper">
|
||||
|
||||
<resultMap id="examResultMap" type="pc.exam.pp.module.exam.dal.dataobject.ExamDO">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="description" column="description"/>
|
||||
<result property="startTime" column="start_time"/>
|
||||
<result property="endTime" column="end_time"/>
|
||||
<result property="duration" column="duration"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="totalScore" column="total_score"/>
|
||||
<result property="passingScore" column="passing_score"/>
|
||||
<result property="creator" column="creator"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="creator" column="creator"/>
|
||||
<result property="updater" column="updater"/>
|
||||
<result property="deleted" column="deleted"/>
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user