infra:标准化代码

This commit is contained in:
YunaiV 2023-02-04 09:15:46 +08:00
parent ec913adb20
commit 0ff786d0ea
2 changed files with 18 additions and 18 deletions

View File

@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.infra.dal.mysql.job;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO;
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO;
@ -19,24 +19,24 @@ import java.util.List;
public interface JobLogMapper extends BaseMapperX<JobLogDO> {
default PageResult<JobLogDO> selectPage(JobLogPageReqVO reqVO) {
return selectPage(reqVO, new QueryWrapperX<JobLogDO>()
.eqIfPresent("job_id", reqVO.getJobId())
.likeIfPresent("handler_name", reqVO.getHandlerName())
.geIfPresent("begin_time", reqVO.getBeginTime())
.leIfPresent("end_time", reqVO.getEndTime())
.eqIfPresent("status", reqVO.getStatus())
.orderByDesc("id") // ID 倒序
return selectPage(reqVO, new LambdaQueryWrapperX<JobLogDO>()
.eqIfPresent(JobLogDO::getJobId, reqVO.getJobId())
.likeIfPresent(JobLogDO::getHandlerName, reqVO.getHandlerName())
.geIfPresent(JobLogDO::getBeginTime, reqVO.getBeginTime())
.leIfPresent(JobLogDO::getEndTime, reqVO.getEndTime())
.eqIfPresent(JobLogDO::getStatus, reqVO.getStatus())
.orderByDesc(JobLogDO::getId) // ID 倒序
);
}
default List<JobLogDO> selectList(JobLogExportReqVO reqVO) {
return selectList(new QueryWrapperX<JobLogDO>()
.eqIfPresent("job_id", reqVO.getJobId())
.likeIfPresent("handler_name", reqVO.getHandlerName())
.geIfPresent("begin_time", reqVO.getBeginTime())
.leIfPresent("end_time", reqVO.getEndTime())
.eqIfPresent("status", reqVO.getStatus())
.orderByDesc("id") // ID 倒序
return selectList(new LambdaQueryWrapperX<JobLogDO>()
.eqIfPresent(JobLogDO::getJobId, reqVO.getJobId())
.likeIfPresent(JobLogDO::getHandlerName, reqVO.getHandlerName())
.geIfPresent(JobLogDO::getBeginTime, reqVO.getBeginTime())
.leIfPresent(JobLogDO::getEndTime, reqVO.getEndTime())
.eqIfPresent(JobLogDO::getStatus, reqVO.getStatus())
.orderByDesc(JobLogDO::getId) // ID 倒序
);
}

View File

@ -76,7 +76,7 @@ public class CodegenServiceImpl implements CodegenService {
private Long createCodegen0(Long userId, Long dataSourceConfigId, TableInfo tableInfo) {
// 校验导入的表和字段非空
checkTableInfo(tableInfo);
validateTableInfo(tableInfo);
// 校验是否已经存在
if (codegenTableMapper.selectByTableNameAndDataSourceConfigId(tableInfo.getName(),
dataSourceConfigId) != null) {
@ -100,7 +100,7 @@ public class CodegenServiceImpl implements CodegenService {
return table.getId();
}
private void checkTableInfo(TableInfo tableInfo) {
private void validateTableInfo(TableInfo tableInfo) {
if (tableInfo == null) {
throw exception(CODEGEN_IMPORT_TABLE_NULL);
}
@ -149,7 +149,7 @@ public class CodegenServiceImpl implements CodegenService {
private void syncCodegen0(Long tableId, TableInfo tableInfo) {
// 校验导入的表和字段非空
checkTableInfo(tableInfo);
validateTableInfo(tableInfo);
List<TableField> tableFields = tableInfo.getFields();
// 构建 CodegenColumnDO 数组只同步新增的字段