mirror of https://gitee.com/stylefeng/roses
【8.0】【log】更新分页获取业务日志详情
parent
89803da797
commit
77652db0ff
|
@ -32,6 +32,7 @@ import cn.stylefeng.roses.kernel.log.business.entity.SysLogBusiness;
|
|||
import cn.stylefeng.roses.kernel.log.business.service.SysLogBusinessService;
|
||||
import cn.stylefeng.roses.kernel.rule.annotation.BizLog;
|
||||
import cn.stylefeng.roses.kernel.rule.util.HttpServletUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
|
@ -112,6 +113,9 @@ public class BusinessLogRecordAop implements Ordered {
|
|||
|
||||
SysLogBusiness sysLogBusiness = new SysLogBusiness();
|
||||
|
||||
// 设置主键
|
||||
sysLogBusiness.setBusinessLogId(IdWorker.getId());
|
||||
|
||||
// 设置业务日志的类型编码
|
||||
sysLogBusiness.setLogTypeCode(bizLog.logTypeCode());
|
||||
|
||||
|
|
|
@ -15,52 +15,6 @@ import java.util.List;
|
|||
*/
|
||||
public interface SysLogBusinessContentService extends IService<SysLogBusinessContent> {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param sysLogBusinessContentRequest 请求参数
|
||||
* @author fengshuonan
|
||||
* @date 2023/07/21 19:02
|
||||
*/
|
||||
void add(SysLogBusinessContentRequest sysLogBusinessContentRequest);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param sysLogBusinessContentRequest 请求参数
|
||||
* @author fengshuonan
|
||||
* @date 2023/07/21 19:02
|
||||
*/
|
||||
void del(SysLogBusinessContentRequest sysLogBusinessContentRequest);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sysLogBusinessContentRequest 请求参数
|
||||
* @author fengshuonan
|
||||
* @date 2023/07/21 19:02
|
||||
*/
|
||||
void edit(SysLogBusinessContentRequest sysLogBusinessContentRequest);
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
*
|
||||
* @param sysLogBusinessContentRequest 请求参数
|
||||
* @author fengshuonan
|
||||
* @date 2023/07/21 19:02
|
||||
*/
|
||||
SysLogBusinessContent detail(SysLogBusinessContentRequest sysLogBusinessContentRequest);
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*
|
||||
* @param sysLogBusinessContentRequest 请求参数
|
||||
* @return List<SysLogBusinessContent> 返回结果
|
||||
* @author fengshuonan
|
||||
* @date 2023/07/21 19:02
|
||||
*/
|
||||
List<SysLogBusinessContent> findList(SysLogBusinessContentRequest sysLogBusinessContentRequest);
|
||||
|
||||
/**
|
||||
* 获取列表(带分页)
|
||||
*
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
package cn.stylefeng.roses.kernel.log.business.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.pojo.page.PageResult;
|
||||
import cn.stylefeng.roses.kernel.log.business.entity.SysLogBusinessContent;
|
||||
import cn.stylefeng.roses.kernel.log.business.enums.SysLogBusinessContentExceptionEnum;
|
||||
import cn.stylefeng.roses.kernel.log.business.mapper.SysLogBusinessContentMapper;
|
||||
import cn.stylefeng.roses.kernel.log.business.pojo.request.SysLogBusinessContentRequest;
|
||||
import cn.stylefeng.roses.kernel.log.business.service.SysLogBusinessContentService;
|
||||
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
@ -28,34 +25,13 @@ import java.util.List;
|
|||
public class SysLogBusinessContentServiceImpl extends ServiceImpl<SysLogBusinessContentMapper, SysLogBusinessContent> implements
|
||||
SysLogBusinessContentService {
|
||||
|
||||
@Override
|
||||
public void add(SysLogBusinessContentRequest sysLogBusinessContentRequest) {
|
||||
SysLogBusinessContent sysLogBusinessContent = new SysLogBusinessContent();
|
||||
BeanUtil.copyProperties(sysLogBusinessContentRequest, sysLogBusinessContent);
|
||||
this.save(sysLogBusinessContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void del(SysLogBusinessContentRequest sysLogBusinessContentRequest) {
|
||||
SysLogBusinessContent sysLogBusinessContent = this.querySysLogBusinessContent(sysLogBusinessContentRequest);
|
||||
this.removeById(sysLogBusinessContent.getContentId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(SysLogBusinessContentRequest sysLogBusinessContentRequest) {
|
||||
SysLogBusinessContent sysLogBusinessContent = this.querySysLogBusinessContent(sysLogBusinessContentRequest);
|
||||
BeanUtil.copyProperties(sysLogBusinessContentRequest, sysLogBusinessContent);
|
||||
this.updateById(sysLogBusinessContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysLogBusinessContent detail(SysLogBusinessContentRequest sysLogBusinessContentRequest) {
|
||||
return this.querySysLogBusinessContent(sysLogBusinessContentRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<SysLogBusinessContent> findPage(SysLogBusinessContentRequest sysLogBusinessContentRequest) {
|
||||
LambdaQueryWrapper<SysLogBusinessContent> wrapper = createWrapper(sysLogBusinessContentRequest);
|
||||
|
||||
// 只查询详情内容
|
||||
wrapper.select(SysLogBusinessContent::getLogContent);
|
||||
|
||||
Page<SysLogBusinessContent> sysRolePage = this.page(PageFactory.defaultPage(), wrapper);
|
||||
return PageResultFactory.createPageResult(sysRolePage);
|
||||
}
|
||||
|
@ -65,26 +41,6 @@ public class SysLogBusinessContentServiceImpl extends ServiceImpl<SysLogBusiness
|
|||
this.getBaseMapper().insertBatchSomeColumn(sysLogBusinessContentList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysLogBusinessContent> findList(SysLogBusinessContentRequest sysLogBusinessContentRequest) {
|
||||
LambdaQueryWrapper<SysLogBusinessContent> wrapper = this.createWrapper(sysLogBusinessContentRequest);
|
||||
return this.list(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2023/07/21 19:02
|
||||
*/
|
||||
private SysLogBusinessContent querySysLogBusinessContent(SysLogBusinessContentRequest sysLogBusinessContentRequest) {
|
||||
SysLogBusinessContent sysLogBusinessContent = this.getById(sysLogBusinessContentRequest.getContentId());
|
||||
if (ObjectUtil.isEmpty(sysLogBusinessContent)) {
|
||||
throw new ServiceException(SysLogBusinessContentExceptionEnum.SYS_LOG_BUSINESS_CONTENT_NOT_EXISTED);
|
||||
}
|
||||
return sysLogBusinessContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建查询wrapper
|
||||
*
|
||||
|
@ -94,13 +50,13 @@ public class SysLogBusinessContentServiceImpl extends ServiceImpl<SysLogBusiness
|
|||
private LambdaQueryWrapper<SysLogBusinessContent> createWrapper(SysLogBusinessContentRequest sysLogBusinessContentRequest) {
|
||||
LambdaQueryWrapper<SysLogBusinessContent> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
Long contentId = sysLogBusinessContentRequest.getContentId();
|
||||
// 根据业务日志主键id查询
|
||||
Long businessLogId = sysLogBusinessContentRequest.getBusinessLogId();
|
||||
String logContent = sysLogBusinessContentRequest.getLogContent();
|
||||
|
||||
queryWrapper.eq(ObjectUtil.isNotNull(contentId), SysLogBusinessContent::getContentId, contentId);
|
||||
queryWrapper.eq(ObjectUtil.isNotNull(businessLogId), SysLogBusinessContent::getBusinessLogId, businessLogId);
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(logContent), SysLogBusinessContent::getLogContent, logContent);
|
||||
|
||||
// 根据搜索条件查询
|
||||
String searchText = sysLogBusinessContentRequest.getSearchText();
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(searchText), SysLogBusinessContent::getLogContent, searchText);
|
||||
|
||||
return queryWrapper;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue