Commit 0ff786d0eadc86f03e0a661901c23b62fd9713f7

Authored by YunaiV
1 parent ec913adb

infra:标准化代码

yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/JobLogMapper.java
@@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.infra.dal.mysql.job; @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.infra.dal.mysql.job;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; 4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
5 -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; 5 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
6 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO; 6 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO;
7 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO; 7 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO;
8 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO; 8 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO;
@@ -19,24 +19,24 @@ import java.util.List; @@ -19,24 +19,24 @@ import java.util.List;
19 public interface JobLogMapper extends BaseMapperX<JobLogDO> { 19 public interface JobLogMapper extends BaseMapperX<JobLogDO> {
20 20
21 default PageResult<JobLogDO> selectPage(JobLogPageReqVO reqVO) { 21 default PageResult<JobLogDO> selectPage(JobLogPageReqVO reqVO) {
22 - return selectPage(reqVO, new QueryWrapperX<JobLogDO>()  
23 - .eqIfPresent("job_id", reqVO.getJobId())  
24 - .likeIfPresent("handler_name", reqVO.getHandlerName())  
25 - .geIfPresent("begin_time", reqVO.getBeginTime())  
26 - .leIfPresent("end_time", reqVO.getEndTime())  
27 - .eqIfPresent("status", reqVO.getStatus())  
28 - .orderByDesc("id") // ID 倒序 22 + return selectPage(reqVO, new LambdaQueryWrapperX<JobLogDO>()
  23 + .eqIfPresent(JobLogDO::getJobId, reqVO.getJobId())
  24 + .likeIfPresent(JobLogDO::getHandlerName, reqVO.getHandlerName())
  25 + .geIfPresent(JobLogDO::getBeginTime, reqVO.getBeginTime())
  26 + .leIfPresent(JobLogDO::getEndTime, reqVO.getEndTime())
  27 + .eqIfPresent(JobLogDO::getStatus, reqVO.getStatus())
  28 + .orderByDesc(JobLogDO::getId) // ID 倒序
29 ); 29 );
30 } 30 }
31 31
32 default List<JobLogDO> selectList(JobLogExportReqVO reqVO) { 32 default List<JobLogDO> selectList(JobLogExportReqVO reqVO) {
33 - return selectList(new QueryWrapperX<JobLogDO>()  
34 - .eqIfPresent("job_id", reqVO.getJobId())  
35 - .likeIfPresent("handler_name", reqVO.getHandlerName())  
36 - .geIfPresent("begin_time", reqVO.getBeginTime())  
37 - .leIfPresent("end_time", reqVO.getEndTime())  
38 - .eqIfPresent("status", reqVO.getStatus())  
39 - .orderByDesc("id") // ID 倒序 33 + return selectList(new LambdaQueryWrapperX<JobLogDO>()
  34 + .eqIfPresent(JobLogDO::getJobId, reqVO.getJobId())
  35 + .likeIfPresent(JobLogDO::getHandlerName, reqVO.getHandlerName())
  36 + .geIfPresent(JobLogDO::getBeginTime, reqVO.getBeginTime())
  37 + .leIfPresent(JobLogDO::getEndTime, reqVO.getEndTime())
  38 + .eqIfPresent(JobLogDO::getStatus, reqVO.getStatus())
  39 + .orderByDesc(JobLogDO::getId) // ID 倒序
40 ); 40 );
41 } 41 }
42 42
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/CodegenServiceImpl.java
@@ -76,7 +76,7 @@ public class CodegenServiceImpl implements CodegenService { @@ -76,7 +76,7 @@ public class CodegenServiceImpl implements CodegenService {
76 76
77 private Long createCodegen0(Long userId, Long dataSourceConfigId, TableInfo tableInfo) { 77 private Long createCodegen0(Long userId, Long dataSourceConfigId, TableInfo tableInfo) {
78 // 校验导入的表和字段非空 78 // 校验导入的表和字段非空
79 - checkTableInfo(tableInfo); 79 + validateTableInfo(tableInfo);
80 // 校验是否已经存在 80 // 校验是否已经存在
81 if (codegenTableMapper.selectByTableNameAndDataSourceConfigId(tableInfo.getName(), 81 if (codegenTableMapper.selectByTableNameAndDataSourceConfigId(tableInfo.getName(),
82 dataSourceConfigId) != null) { 82 dataSourceConfigId) != null) {
@@ -100,7 +100,7 @@ public class CodegenServiceImpl implements CodegenService { @@ -100,7 +100,7 @@ public class CodegenServiceImpl implements CodegenService {
100 return table.getId(); 100 return table.getId();
101 } 101 }
102 102
103 - private void checkTableInfo(TableInfo tableInfo) { 103 + private void validateTableInfo(TableInfo tableInfo) {
104 if (tableInfo == null) { 104 if (tableInfo == null) {
105 throw exception(CODEGEN_IMPORT_TABLE_NULL); 105 throw exception(CODEGEN_IMPORT_TABLE_NULL);
106 } 106 }
@@ -149,7 +149,7 @@ public class CodegenServiceImpl implements CodegenService { @@ -149,7 +149,7 @@ public class CodegenServiceImpl implements CodegenService {
149 149
150 private void syncCodegen0(Long tableId, TableInfo tableInfo) { 150 private void syncCodegen0(Long tableId, TableInfo tableInfo) {
151 // 校验导入的表和字段非空 151 // 校验导入的表和字段非空
152 - checkTableInfo(tableInfo); 152 + validateTableInfo(tableInfo);
153 List<TableField> tableFields = tableInfo.getFields(); 153 List<TableField> tableFields = tableInfo.getFields();
154 154
155 // 构建 CodegenColumnDO 数组,只同步新增的字段 155 // 构建 CodegenColumnDO 数组,只同步新增的字段