mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-19 09:55:16 +08:00
Pre Merge pull request !584 from 流行的云/dev
This commit is contained in:
commit
4643b2b810
@ -1,9 +1,16 @@
|
|||||||
package org.dromara.system.mapper;
|
package org.dromara.system.mapper;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
import org.dromara.system.domain.SysOperLog;
|
import org.dromara.system.domain.SysOperLog;
|
||||||
|
import org.dromara.system.domain.bo.SysOperLogBo;
|
||||||
import org.dromara.system.domain.vo.SysOperLogVo;
|
import org.dromara.system.domain.vo.SysOperLogVo;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志 数据层
|
* 操作日志 数据层
|
||||||
*
|
*
|
||||||
@ -11,4 +18,21 @@ import org.dromara.system.domain.vo.SysOperLogVo;
|
|||||||
*/
|
*/
|
||||||
public interface SysOperLogMapper extends BaseMapperPlus<SysOperLog, SysOperLogVo> {
|
public interface SysOperLogMapper extends BaseMapperPlus<SysOperLog, SysOperLogVo> {
|
||||||
|
|
||||||
|
default LambdaQueryWrapper<SysOperLog> buildQuery(SysOperLogBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
return new LambdaQueryWrapper<SysOperLog>()
|
||||||
|
.like(StringUtils.isNotBlank(bo.getOperIp()), SysOperLog::getOperIp, bo.getOperIp())
|
||||||
|
.like(StringUtils.isNotBlank(bo.getTitle()), SysOperLog::getTitle, bo.getTitle())
|
||||||
|
.eq(bo.getBusinessType() != null && bo.getBusinessType() > 0,
|
||||||
|
SysOperLog::getBusinessType, bo.getBusinessType())
|
||||||
|
.func(f -> {
|
||||||
|
if (ArrayUtil.isNotEmpty(bo.getBusinessTypes())) {
|
||||||
|
f.in(SysOperLog::getBusinessType, Arrays.asList(bo.getBusinessTypes()));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.eq(bo.getStatus() != null, SysOperLog::getStatus, bo.getStatus())
|
||||||
|
.like(StringUtils.isNotBlank(bo.getOperName()), SysOperLog::getOperName, bo.getOperName())
|
||||||
|
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||||
|
SysOperLog::getOperTime, params.get("beginTime"), params.get("endTime"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,20 +1,19 @@
|
|||||||
package org.dromara.system.service.impl;
|
package org.dromara.system.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.core.utils.ip.AddressUtils;
|
import org.dromara.common.core.utils.ip.AddressUtils;
|
||||||
import org.dromara.common.log.event.OperLogEvent;
|
import org.dromara.common.log.event.OperLogEvent;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.system.domain.SysOperLog;
|
import org.dromara.system.domain.SysOperLog;
|
||||||
import org.dromara.system.domain.bo.SysOperLogBo;
|
import org.dromara.system.domain.bo.SysOperLogBo;
|
||||||
import org.dromara.system.domain.vo.SysOperLogVo;
|
import org.dromara.system.domain.vo.SysOperLogVo;
|
||||||
import org.dromara.system.mapper.SysOperLogMapper;
|
import org.dromara.system.mapper.SysOperLogMapper;
|
||||||
import org.dromara.system.service.ISysOperLogService;
|
import org.dromara.system.service.ISysOperLogService;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -22,7 +21,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志 服务层处理
|
* 操作日志 服务层处理
|
||||||
@ -51,27 +49,11 @@ public class SysOperLogServiceImpl implements ISysOperLogService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<SysOperLogVo> selectPageOperLogList(SysOperLogBo operLog, PageQuery pageQuery) {
|
public TableDataInfo<SysOperLogVo> selectPageOperLogList(SysOperLogBo operLog, PageQuery pageQuery) {
|
||||||
Map<String, Object> params = operLog.getParams();
|
|
||||||
LambdaQueryWrapper<SysOperLog> lqw = new LambdaQueryWrapper<SysOperLog>()
|
|
||||||
.like(StringUtils.isNotBlank(operLog.getOperIp()), SysOperLog::getOperIp, operLog.getOperIp())
|
|
||||||
.like(StringUtils.isNotBlank(operLog.getTitle()), SysOperLog::getTitle, operLog.getTitle())
|
|
||||||
.eq(operLog.getBusinessType() != null && operLog.getBusinessType() > 0,
|
|
||||||
SysOperLog::getBusinessType, operLog.getBusinessType())
|
|
||||||
.func(f -> {
|
|
||||||
if (ArrayUtil.isNotEmpty(operLog.getBusinessTypes())) {
|
|
||||||
f.in(SysOperLog::getBusinessType, Arrays.asList(operLog.getBusinessTypes()));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.eq(operLog.getStatus() != null,
|
|
||||||
SysOperLog::getStatus, operLog.getStatus())
|
|
||||||
.like(StringUtils.isNotBlank(operLog.getOperName()), SysOperLog::getOperName, operLog.getOperName())
|
|
||||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
|
||||||
SysOperLog::getOperTime, params.get("beginTime"), params.get("endTime"));
|
|
||||||
if (StringUtils.isBlank(pageQuery.getOrderByColumn())) {
|
if (StringUtils.isBlank(pageQuery.getOrderByColumn())) {
|
||||||
pageQuery.setOrderByColumn("oper_id");
|
pageQuery.setOrderByColumn("oper_id");
|
||||||
pageQuery.setIsAsc("desc");
|
pageQuery.setIsAsc("desc");
|
||||||
}
|
}
|
||||||
Page<SysOperLogVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<SysOperLogVo> page = baseMapper.selectVoPage(pageQuery.build(), baseMapper.buildQuery(operLog));
|
||||||
return TableDataInfo.build(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,23 +77,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysOperLogVo> selectOperLogList(SysOperLogBo operLog) {
|
public List<SysOperLogVo> selectOperLogList(SysOperLogBo operLog) {
|
||||||
Map<String, Object> params = operLog.getParams();
|
return baseMapper.selectVoList(baseMapper.buildQuery(operLog).orderByDesc(SysOperLog::getOperId));
|
||||||
return baseMapper.selectVoList(new LambdaQueryWrapper<SysOperLog>()
|
|
||||||
.like(StringUtils.isNotBlank(operLog.getOperIp()), SysOperLog::getOperIp, operLog.getOperIp())
|
|
||||||
.like(StringUtils.isNotBlank(operLog.getTitle()), SysOperLog::getTitle, operLog.getTitle())
|
|
||||||
.eq(operLog.getBusinessType() != null && operLog.getBusinessType() > 0,
|
|
||||||
SysOperLog::getBusinessType, operLog.getBusinessType())
|
|
||||||
.func(f -> {
|
|
||||||
if (ArrayUtil.isNotEmpty(operLog.getBusinessTypes())) {
|
|
||||||
f.in(SysOperLog::getBusinessType, Arrays.asList(operLog.getBusinessTypes()));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.eq(operLog.getStatus() != null && operLog.getStatus() > 0,
|
|
||||||
SysOperLog::getStatus, operLog.getStatus())
|
|
||||||
.like(StringUtils.isNotBlank(operLog.getOperName()), SysOperLog::getOperName, operLog.getOperName())
|
|
||||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
|
||||||
SysOperLog::getOperTime, params.get("beginTime"), params.get("endTime"))
|
|
||||||
.orderByDesc(SysOperLog::getOperId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user