diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java index 0736f88..354920b 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java @@ -74,4 +74,7 @@ public class TestEntity extends BaseEntity { @Size(max = 1000, message = "考试附件字段长度不能超过1000") @ApiModelProperty("考试附件") private String filePath; + + @ApiModelProperty("考试方式") + private String testMethod; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/TestMethodEnum.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/TestMethodEnum.java new file mode 100644 index 0000000..0e39487 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/TestMethodEnum.java @@ -0,0 +1,31 @@ +package com.hnac.hzims.safeproduct.enums; + +/** + * 考试方式枚举类 + * + * @author liwen + * @date 2024-01-25 + */ +public enum TestMethodEnum { + + ONLINE("ONLINE", "线上"), + OFFLINE("OFFLINE", "线下"), + MIXED("MIXED", "线上+线下"); + + private final String value; + + private final String desc; + + TestMethodEnum(String value, String desc) { + this.value = value; + this.desc = desc; + } + + public String getValue() { + return value; + } + + public String getDesc() { + return desc; + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java index 28b8043..8bbf0ea 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java @@ -124,13 +124,14 @@ public class TrainController extends BladeController { @GetMapping("/trainRecordPage") @ApiImplicitParams({ - @ApiImplicitParam(name = "trainPlanId", value = "培训计划id", dataType = "query", paramType = "string") + @ApiImplicitParam(name = "trainPlanId", value = "培训计划id", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "startTime", value = "计划开始时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "endTime", value = "计划结束时间", dataType = "query", paramType = "string") }) @ApiOperation(value = "培训记录分页") @ApiOperationSupport(order = 10) public R> trainRecordPage(@ApiIgnore @RequestParam Map param, Query query) { - IPage page = trainRecordService.page(Condition.getPage(query), Condition.getQueryWrapper( - param, TrainRecordEntity.class).lambda().orderByDesc(TrainRecordEntity::getCreateTime)); + IPage page = trainRecordService.trainRecordPage(param, query); return R.data(page); } @@ -173,13 +174,14 @@ public class TrainController extends BladeController { @GetMapping("/testPage") @ApiImplicitParams({ @ApiImplicitParam(name = "trainPlanId", value = "培训计划id", dataType = "query", paramType = "string"), - @ApiImplicitParam(name = "trainRecordId", value = "培训记录id", dataType = "query", paramType = "string") + @ApiImplicitParam(name = "trainRecordId", value = "培训记录id", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "testName", value = "考试名称", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string") }) @ApiOperation(value = "考试记录分页") @ApiOperationSupport(order = 16) public R> testPage(@ApiIgnore @RequestParam Map param, Query query) { - IPage page = testService.page(Condition.getPage(query), Condition.getQueryWrapper(param, TestEntity.class) - .lambda().orderByDesc(TestEntity::getCreateTime)); + IPage page = testService.testPage(param, query); return R.data(page); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.java index 6d65b66..9441e30 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.java @@ -1,11 +1,13 @@ package com.hnac.hzims.safeproduct.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.safeproduct.dto.TestDTO; import com.hnac.hzims.safeproduct.entity.TestEntity; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; /** * 考试记录Mapper类 @@ -22,4 +24,12 @@ public interface TestMapper extends BaseMapper { * @return 考试记录名称列表 */ List getTestNameList(String trainPlanId); + + /** + * 考试记录分页 + * @param param 入参 + * @param page 分页类 + * @return 考试记录数据 + */ + IPage testPage(IPage page, Map param); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.xml index 7b1556d..65649d1 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.xml @@ -15,4 +15,27 @@ ORDER BY create_time DESC + + \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.java index a268688..5586ec0 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.java @@ -1,12 +1,14 @@ package com.hnac.hzims.safeproduct.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.safeproduct.dto.TrainRecordDTO; import com.hnac.hzims.safeproduct.entity.TrainRecordEntity; import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; /** * 培训记录Mapper类 @@ -30,4 +32,12 @@ public interface TrainRecordMapper extends BaseMapper { * @return 培训记录表VO类 */ TrainRecordDetailVO getTrainRecordDetailById(Long id); + + /** + * 培训记录分页 + * @param param 入参 + * @param page 分页类 + * @return 培训记录数据 + */ + IPage trainRecordPage(IPage page, Map param); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.xml index e4f15af..b4052fe 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.xml @@ -27,4 +27,24 @@ t1.is_deleted = 0 AND t1.id = #{id} + + \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java index 83eeeeb..4a59b6e 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java @@ -1,11 +1,14 @@ package com.hnac.hzims.safeproduct.service; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzims.safeproduct.dto.TestDTO; import com.hnac.hzims.safeproduct.entity.TestEntity; +import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import java.util.List; +import java.util.Map; /** * 考试记录服务类 @@ -63,4 +66,12 @@ public interface ITestService extends IService { * @return true-成功,false-失败 */ boolean updateTest(TestEntity testEntity); + + /** + * 考试记录分页 + * @param param 入参 + * @param query 分页类 + * @return 考试记录数据 + */ + IPage testPage(Map param, Query query); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java index 13d443a..57d5d62 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java @@ -1,12 +1,15 @@ package com.hnac.hzims.safeproduct.service; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzims.safeproduct.dto.TrainRecordDTO; import com.hnac.hzims.safeproduct.entity.TrainRecordEntity; import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO; +import org.springblade.core.mp.support.Query; import javax.servlet.http.HttpServletResponse; import java.util.List; +import java.util.Map; /** * 培训记录服务类 @@ -64,4 +67,12 @@ public interface ITrainRecordService extends IService { * @return 培训记录表VO类 */ TrainRecordDetailVO getTrainRecordDetailById(Long id); + + /** + * 培训记录分页 + * @param param 入参 + * @param query 分页类 + * @return 培训记录数据 + */ + IPage trainRecordPage(Map param, Query query); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java index 5573afa..c40c905 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java @@ -3,6 +3,8 @@ package com.hnac.hzims.safeproduct.service.impl; import cn.hutool.core.date.DatePattern; import com.alibaba.excel.util.CollectionUtils; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.safeproduct.constants.SafeProductConstant; import com.hnac.hzims.safeproduct.dto.TestDTO; @@ -14,6 +16,7 @@ import com.hnac.hzims.safeproduct.mapper.TrainPlanMapper; import com.hnac.hzims.safeproduct.service.ITestScoreService; import com.hnac.hzims.safeproduct.service.ITestService; import com.hnac.hzims.safeproduct.utils.BaseUtil; +import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -23,6 +26,7 @@ import javax.annotation.Resource; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -175,6 +179,15 @@ public class TestServiceImpl extends ServiceImpl impleme } /** + * 考试记录分页 + */ + @Override + public IPage testPage(Map param, Query query) { + IPage page = new Page<>(query.getCurrent(), query.getSize()); + return baseMapper.testPage(page, param); + } + + /** * 获取成绩列表 * @param testEntity 考试记录实体类 * @param person 参考人员 diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java index a065735..8311679 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java @@ -4,6 +4,8 @@ import cn.afterturn.easypoi.entity.ImageEntity; import cn.hutool.core.date.DatePattern; import com.alibaba.excel.util.CollectionUtils; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.safeproduct.constants.SafeProductConstant; @@ -18,6 +20,7 @@ import com.hnac.hzims.safeproduct.service.ITestService; import com.hnac.hzims.safeproduct.service.ITrainRecordService; import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO; +import org.springblade.core.mp.support.Query; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -180,6 +183,15 @@ public class TrainRecordServiceImpl extends ServiceImpl trainRecordPage(Map param, Query query) { + IPage page = new Page<>(query.getCurrent(), query.getSize()); + return baseMapper.trainRecordPage(page, param); + } + + /** * 查询是否存在同月编号 * @param currentMonth 当月 * @return 存在则返回上一编号,否则返回null diff --git a/hzims-service/safeproduct/src/main/resources/template/培训记录表.docx b/hzims-service/safeproduct/src/main/resources/template/培训记录表.docx index 803c532..371a227 100644 Binary files a/hzims-service/safeproduct/src/main/resources/template/培训记录表.docx and b/hzims-service/safeproduct/src/main/resources/template/培训记录表.docx differ