更新日志查询方法

pull/3/head
fengshuonan 2021-01-13 13:12:13 +08:00
parent d3ddac3935
commit 905b30f531
1 changed files with 3 additions and 29 deletions

View File

@ -3,6 +3,7 @@ package cn.stylefeng.roses.kernel.log.db;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory; import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult; import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.log.api.LogManagerApi; import cn.stylefeng.roses.kernel.log.api.LogManagerApi;
@ -18,9 +19,6 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import static cn.stylefeng.roses.kernel.log.api.constants.LogConstants.DEFAULT_BEGIN_PAGE_NO;
import static cn.stylefeng.roses.kernel.log.api.constants.LogConstants.DEFAULT_PAGE_SIZE;
/** /**
* *
* *
@ -48,17 +46,14 @@ public class DbLogManagerServiceImpl implements LogManagerApi {
return new PageResult<>(); return new PageResult<>();
} }
// 创建默认的请求方法
createDefaultLogManagerParam(logManagerParam);
LambdaQueryWrapper<SysLog> sysLogLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SysLog> sysLogLambdaQueryWrapper = new LambdaQueryWrapper<>();
// 创建查询条件 // 创建查询条件
createQueryCondition(logManagerParam, sysLogLambdaQueryWrapper); createQueryCondition(logManagerParam, sysLogLambdaQueryWrapper);
// 查询分页结果 // 查询分页结果
Page<SysLog> sysLogPage = new Page<>(logManagerParam.getPageNo(), logManagerParam.getPageSize()); Page<SysLog> objectPage = PageFactory.defaultPage();
Page<SysLog> page = sysLogService.page(sysLogPage, sysLogLambdaQueryWrapper); Page<SysLog> page = sysLogService.page(objectPage, sysLogLambdaQueryWrapper);
PageResult<SysLog> pageResult = PageResultFactory.createPageResult(page); PageResult<SysLog> pageResult = PageResultFactory.createPageResult(page);
PageResult<LogRecordDTO> logRecordDtoPageResult = new PageResult<>(); PageResult<LogRecordDTO> logRecordDtoPageResult = new PageResult<>();
@ -160,25 +155,4 @@ public class DbLogManagerServiceImpl implements LogManagerApi {
sysLogLambdaQueryWrapper.orderByDesc(SysLog::getCreateTime); sysLogLambdaQueryWrapper.orderByDesc(SysLog::getCreateTime);
} }
/**
*
*
* @param logManagerParam
* @author luojie
* @date 2020/11/3 11:20
*/
private void createDefaultLogManagerParam(LogManagerParam logManagerParam) {
// 默认从第一页开始
if (logManagerParam.getPageNo() == null) {
logManagerParam.setPageNo(DEFAULT_BEGIN_PAGE_NO);
}
// 默认每页10条
if (logManagerParam.getPageSize() == null) {
logManagerParam.setPageSize(DEFAULT_PAGE_SIZE);
}
}
} }