Add .gitignore file and remove ignored files from git

This commit is contained in:
任维炳
2025-04-18 13:49:03 +08:00
parent ad246855df
commit f7948b935f
20 changed files with 183 additions and 793 deletions

70
.idea/compiler.xml generated Normal file
View File

@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Annotation profile for exam" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="false">
<entry name="$PROJECT_DIR$/../../Java/Maven_Repo/org/springframework/boot/spring-boot-configuration-processor/3.4.1/spring-boot-configuration-processor-3.4.1.jar" />
<entry name="$PROJECT_DIR$/../../Java/Maven_Repo/org/projectlombok/lombok/1.18.36/lombok-1.18.36.jar" />
<entry name="$PROJECT_DIR$/../../Java/Maven_Repo/org/mapstruct/mapstruct-processor/1.6.3/mapstruct-processor-1.6.3.jar" />
<entry name="$PROJECT_DIR$/../../Java/Maven_Repo/org/mapstruct/mapstruct/1.6.3/mapstruct-1.6.3.jar" />
</processorPath>
<module name="exam-server" />
<module name="exam-module-system-api" />
<module name="exam-spring-boot-starter-redis" />
<module name="exam-spring-boot-starter-security" />
<module name="exam-module-system-biz" />
<module name="exam-spring-boot-starter-job" />
<module name="exam-spring-boot-starter-biz-ip" />
<module name="exam-spring-boot-starter-monitor" />
<module name="exam-spring-boot-starter-mq" />
<module name="exam-spring-boot-starter-biz-tenant" />
<module name="exam-spring-boot-starter-protection" />
<module name="exam-spring-boot-starter-mybatis" />
<module name="exam-module-judgement-api" />
<module name="exam-spring-boot-starter-websocket" />
<module name="exam-module-infra-api" />
<module name="exam-common" />
<module name="exam-spring-boot-starter-test" />
<module name="exam-module-judgement-biz" />
<module name="exam-spring-boot-starter-excel" />
<module name="exam-spring-boot-starter-biz-data-permission" />
<module name="exam-module-exam-api" />
<module name="exam-module-infra-biz" />
<module name="exam-spring-boot-starter-web" />
<module name="exam-module-exam-biz" />
</profile>
</annotationProcessing>
</component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="exam-common" options="-parameters" />
<module name="exam-module-exam-api" options="-parameters" />
<module name="exam-module-exam-biz" options="-parameters" />
<module name="exam-module-infra-api" options="-parameters" />
<module name="exam-module-infra-biz" options="-parameters" />
<module name="exam-module-judgement-api" options="-parameters" />
<module name="exam-module-judgement-biz" options="-parameters" />
<module name="exam-module-system-api" options="-parameters" />
<module name="exam-module-system-biz" options="-parameters" />
<module name="exam-server" options="-parameters" />
<module name="exam-spring-boot-starter-biz-data-permission" options="-parameters" />
<module name="exam-spring-boot-starter-biz-ip" options="-parameters" />
<module name="exam-spring-boot-starter-biz-tenant" options="-parameters" />
<module name="exam-spring-boot-starter-excel" options="-parameters" />
<module name="exam-spring-boot-starter-job" options="-parameters" />
<module name="exam-spring-boot-starter-monitor" options="-parameters" />
<module name="exam-spring-boot-starter-mq" options="-parameters" />
<module name="exam-spring-boot-starter-mybatis" options="-parameters" />
<module name="exam-spring-boot-starter-protection" options="-parameters" />
<module name="exam-spring-boot-starter-redis" options="-parameters" />
<module name="exam-spring-boot-starter-security" options="-parameters" />
<module name="exam-spring-boot-starter-test" options="-parameters" />
<module name="exam-spring-boot-starter-web" options="-parameters" />
<module name="exam-spring-boot-starter-websocket" options="-parameters" />
</option>
</component>
</project>

65
.idea/encodings.xml generated Normal file
View File

@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/exam-framework/exam-common/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-common/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-biz-data-permission/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-biz-data-permission/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-biz-ip/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-biz-ip/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-biz-tenant/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-biz-tenant/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-excel/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-excel/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-job/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-job/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-monitor/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-monitor/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-mq/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-mq/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-mybatis/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-mybatis/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-protection/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-protection/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-redis/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-redis/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-security/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-security/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-test/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-test/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-web/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-web/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-websocket/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/exam-spring-boot-starter-websocket/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-framework/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-exam/exam-module-exam-api/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-exam/exam-module-exam-api/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-exam/exam-module-exam-biz/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-exam/exam-module-exam-biz/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-exam/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-exam/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-infra/exam-module-infra-api/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-infra/exam-module-infra-api/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-infra/exam-module-infra-biz/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-infra/exam-module-infra-biz/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-infra/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-infra/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-judgement/exam-module-judgement-api/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-judgement/exam-module-judgement-api/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-judgement/exam-module-judgement-biz/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-judgement/exam-module-judgement-biz/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-judgement/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-judgement/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-system/exam-module-system-api/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-system/exam-module-system-api/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-system/exam-module-system-biz/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-system/exam-module-system-biz/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-system/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-module-system/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-server/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/exam-server/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

40
.idea/jarRepositories.xml generated Normal file
View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="aliyunmaven" />
<option name="name" value="aliyun" />
<option name="url" value="https://maven.aliyun.com/repository/public" />
</remote-repository>
<remote-repository>
<option name="id" value="spring-milestones" />
<option name="name" value="Spring Milestones" />
<option name="url" value="https://repo.spring.io/milestone" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="spring-snapshots" />
<option name="name" value="Spring Snapshots" />
<option name="url" value="https://repo.spring.io/snapshot" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="huaweicloud" />
<option name="name" value="huawei" />
<option name="url" value="https://mirrors.huaweicloud.com/repository/maven/" />
</remote-repository>
</component>
</project>

8
.idea/misc.xml generated
View File

@@ -1,5 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>

8
.idea/modules.xml generated
View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/pengchen-exam-java.iml" filepath="$PROJECT_DIR$/.idea/pengchen-exam-java.iml" />
</modules>
</component>
</project>

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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));
}
}

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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>

View File

@@ -1,100 +0,0 @@
package pc.exam.pp.module.judgement.controller.admin;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import pc.exam.pp.framework.common.pojo.CommonResult;
import pc.exam.pp.framework.common.pojo.PageResult;
import pc.exam.pp.module.judgement.controller.admin.vo.JudgementPageReqVO;
import pc.exam.pp.module.judgement.dal.dataobject.JudgementDO;
import pc.exam.pp.module.judgement.service.JudgementService;
import java.util.List;
import static pc.exam.pp.framework.common.pojo.CommonResult.success;
/**
* 管理后台 - 判题信息
*
* @author pengchen
*/
@RestController
@RequestMapping("/judgement")
public class JudgementController {
@Resource
private JudgementService judgementService;
/**
* 创建判题
*
* @param createReqVO 创建信息
* @return 判题编号
*/
@PostMapping("/create")
public CommonResult<Long> createJudgement(@Valid @RequestBody JudgementDO createReqVO) {
return success(judgementService.createJudgement(createReqVO));
}
/**
* 更新判题
*
* @param updateReqVO 更新信息
* @return 成功状态
*/
@PutMapping("/update")
public CommonResult<Boolean> updateJudgement(@Valid @RequestBody JudgementDO updateReqVO) {
judgementService.updateJudgement(updateReqVO);
return success(true);
}
/**
* 删除判题
*
* @param id 编号
* @return 成功状态
*/
@DeleteMapping("/delete")
public CommonResult<Boolean> deleteJudgement(@RequestParam("id") Long id) {
judgementService.deleteJudgement(id);
return success(true);
}
/**
* 获得判题
*
* @param id 编号
* @return 判题
*/
@GetMapping("/get")
public CommonResult<JudgementDO> getJudgement(@RequestParam("id") Long id) {
return success(judgementService.getJudgement(id));
}
/**
* 获得判题分页
*
* @param pageVO 分页查询
* @return 判题分页
*/
@GetMapping("/page")
public CommonResult<PageResult<JudgementDO>> getJudgementPage(@Valid JudgementPageReqVO pageVO) {
return success(judgementService.getJudgementPage(pageVO));
}
/**
* 获取用户在某次考试的所有判题结果
*
* @param examId 考试ID
* @param userId 用户ID
* @return 判题列表
*/
@GetMapping("/list-by-exam-and-user")
public CommonResult<List<JudgementDO>> getJudgementListByExamAndUser(
@RequestParam("examId") Long examId,
@RequestParam("userId") Long userId) {
return success(judgementService.getJudgementListByExamAndUser(examId, userId));
}
}

View File

@@ -1,48 +0,0 @@
package pc.exam.pp.module.judgement.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 JudgementPageReqVO extends PageParam {
/**
* 考试ID
*/
private Long examId;
/**
* 用户ID
*/
private Long userId;
/**
* 题目ID
*/
private Long questionId;
/**
* 判题结果
*/
private Integer result;
/**
* 创建时间
*/
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -1,68 +0,0 @@
package pc.exam.pp.module.judgement.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("judgement")
@KeySequence("judgement_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class JudgementDO extends BaseDO {
/**
* 编号
*/
@TableId
private Long id;
/**
* 考试ID
*/
private Long examId;
/**
* 用户ID
*/
private Long userId;
/**
* 题目ID
*/
private Long questionId;
/**
* 用户答案
*/
private String userAnswer;
/**
* 判题结果
*
* 枚举 {@link JudgementResultEnum}
*/
private Integer result;
/**
* 得分
*/
private Integer score;
/**
* 判题时间
*/
private LocalDateTime judgementTime;
/**
* 判题详情
*/
private String detail;
/**
* 判题类型
*/
private Integer type;
}

View File

@@ -1,29 +0,0 @@
package pc.exam.pp.module.judgement.dal.dataobject;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 判题结果枚举
*
* @author pengchen
*/
@Getter
@AllArgsConstructor
public enum JudgementResultEnum {
PENDING(0, "待判题"),
CORRECT(1, "正确"),
PARTIALLY_CORRECT(2, "部分正确"),
INCORRECT(3, "错误"),
ERROR(4, "判题出错");
/**
* 结果值
*/
private final Integer result;
/**
* 结果名
*/
private final String name;
}

View File

@@ -1,36 +0,0 @@
package pc.exam.pp.module.judgement.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.judgement.controller.admin.vo.JudgementPageReqVO;
import pc.exam.pp.module.judgement.dal.dataobject.JudgementDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 判题信息 Mapper
*
* @author pengchen
*/
@Mapper
public interface JudgementMapper extends BaseMapperX<JudgementDO> {
default PageResult<JudgementDO> selectPage(JudgementPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<JudgementDO>()
.eqIfPresent(JudgementDO::getExamId, reqVO.getExamId())
.eqIfPresent(JudgementDO::getUserId, reqVO.getUserId())
.eqIfPresent(JudgementDO::getQuestionId, reqVO.getQuestionId())
.eqIfPresent(JudgementDO::getResult, reqVO.getResult())
.betweenIfPresent(JudgementDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(JudgementDO::getId));
}
default List<JudgementDO> selectListByExamIdAndUserId(Long examId, Long userId) {
return selectList(new LambdaQueryWrapperX<JudgementDO>()
.eq(JudgementDO::getExamId, examId)
.eq(JudgementDO::getUserId, userId));
}
}

View File

@@ -1,73 +0,0 @@
package pc.exam.pp.module.judgement.service;
import pc.exam.pp.framework.common.pojo.PageResult;
import pc.exam.pp.module.judgement.controller.admin.vo.JudgementPageReqVO;
import pc.exam.pp.module.judgement.dal.dataobject.JudgementDO;
import javax.validation.Valid;
import java.util.Collection;
import java.util.List;
/**
* 判题信息 Service 接口
*
* @author pengchen
*/
public interface JudgementService {
/**
* 创建判题
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createJudgement(@Valid JudgementDO createReqVO);
/**
* 更新判题
*
* @param updateReqVO 更新信息
*/
void updateJudgement(@Valid JudgementDO updateReqVO);
/**
* 删除判题
*
* @param id 编号
*/
void deleteJudgement(Long id);
/**
* 获得判题
*
* @param id 编号
* @return 判题
*/
JudgementDO getJudgement(Long id);
/**
* 获得判题列表
*
* @param ids 编号
* @return 判题列表
*/
List<JudgementDO> getJudgementList(Collection<Long> ids);
/**
* 获得判题分页
*
* @param pageReqVO 分页查询
* @return 判题分页
*/
PageResult<JudgementDO> getJudgementPage(JudgementPageReqVO pageReqVO);
/**
* 获取用户在某次考试的所有判题结果
*
* @param examId 考试ID
* @param userId 用户ID
* @return 判题列表
*/
List<JudgementDO> getJudgementListByExamAndUser(Long examId, Long userId);
}

View File

@@ -1,77 +0,0 @@
package pc.exam.pp.module.judgement.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.judgement.controller.admin.vo.JudgementPageReqVO;
import pc.exam.pp.module.judgement.dal.dataobject.JudgementDO;
import pc.exam.pp.module.judgement.dal.mysql.JudgementMapper;
import pc.exam.pp.module.judgement.service.JudgementService;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
/**
* 判题信息 Service 实现类
*
* @author pengchen
*/
@Service
@Validated
public class JudgementServiceImpl implements JudgementService {
@Resource
private JudgementMapper judgementMapper;
@Override
public Long createJudgement(JudgementDO createReqVO) {
// 插入
judgementMapper.insert(createReqVO);
// 返回
return createReqVO.getId();
}
@Override
public void updateJudgement(JudgementDO updateReqVO) {
// 校验存在
validateJudgementExists(updateReqVO.getId());
// 更新
judgementMapper.updateById(updateReqVO);
}
@Override
public void deleteJudgement(Long id) {
// 校验存在
validateJudgementExists(id);
// 删除
judgementMapper.deleteById(id);
}
private void validateJudgementExists(Long id) {
if (judgementMapper.selectById(id) == null) {
throw new RuntimeException("判题不存在");
}
}
@Override
public JudgementDO getJudgement(Long id) {
return judgementMapper.selectById(id);
}
@Override
public List<JudgementDO> getJudgementList(Collection<Long> ids) {
return judgementMapper.selectBatchIds(ids);
}
@Override
public PageResult<JudgementDO> getJudgementPage(JudgementPageReqVO pageReqVO) {
return judgementMapper.selectPage(pageReqVO);
}
@Override
public List<JudgementDO> getJudgementListByExamAndUser(Long examId, Long userId) {
return judgementMapper.selectListByExamIdAndUserId(examId, userId);
}
}

View File

@@ -1,23 +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.judgement.dal.mysql.JudgementMapper">
<resultMap id="judgementResultMap" type="pc.exam.pp.module.judgement.dal.dataobject.JudgementDO">
<id property="id" column="id"/>
<result property="examId" column="exam_id"/>
<result property="userId" column="user_id"/>
<result property="questionId" column="question_id"/>
<result property="userAnswer" column="user_answer"/>
<result property="result" column="result"/>
<result property="score" column="score"/>
<result property="judgementTime" column="judgement_time"/>
<result property="detail" column="detail"/>
<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>