| | |
| | | import com.ruoyi.common.core.utils.ip.AddressUtils; |
| | | import com.ruoyi.common.log.event.OperLogEvent; |
| | | import com.ruoyi.system.domain.SysOperLog; |
| | | import com.ruoyi.system.domain.bo.SysOperLogBo; |
| | | import com.ruoyi.system.domain.vo.SysOperLogVo; |
| | | import com.ruoyi.system.mapper.SysOperLogMapper; |
| | | import com.ruoyi.system.service.ISysOperLogService; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | @Async |
| | | @EventListener |
| | | public void recordOper(OperLogEvent operLogEvent) { |
| | | SysOperLog operLog = BeanUtil.toBean(operLogEvent, SysOperLog.class); |
| | | SysOperLogBo operLog = BeanUtil.toBean(operLogEvent, SysOperLogBo.class); |
| | | // 远程查询操作地点 |
| | | operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp())); |
| | | insertOperlog(operLog); |
| | | } |
| | | |
| | | @Override |
| | | public TableDataInfo<SysOperLog> selectPageOperLogList(SysOperLog 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.getTitle()), SysOperLog::getTitle, operLog.getTitle()) |
| | |
| | | pageQuery.setOrderByColumn("oper_id"); |
| | | pageQuery.setIsAsc("desc"); |
| | | } |
| | | Page<SysOperLog> page = baseMapper.selectPage(pageQuery.build(), lqw); |
| | | Page<SysOperLogVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增操作日志 |
| | | * |
| | | * @param operLog 操作日志对象 |
| | | * @param bo 操作日志对象 |
| | | */ |
| | | @Override |
| | | public void insertOperlog(SysOperLog operLog) { |
| | | public void insertOperlog(SysOperLogBo bo) { |
| | | SysOperLog operLog = BeanUtil.toBean(bo, SysOperLog.class); |
| | | operLog.setOperTime(new Date()); |
| | | baseMapper.insert(operLog); |
| | | } |
| | |
| | | * @return 操作日志集合 |
| | | */ |
| | | @Override |
| | | public List<SysOperLog> selectOperLogList(SysOperLog operLog) { |
| | | public List<SysOperLogVo> selectOperLogList(SysOperLogBo operLog) { |
| | | Map<String, Object> params = operLog.getParams(); |
| | | return baseMapper.selectList(new LambdaQueryWrapper<SysOperLog>() |
| | | return baseMapper.selectVoList(new LambdaQueryWrapper<SysOperLog>() |
| | | .like(StringUtils.isNotBlank(operLog.getTitle()), SysOperLog::getTitle, operLog.getTitle()) |
| | | .eq(operLog.getBusinessType() != null && operLog.getBusinessType() > 0, |
| | | SysOperLog::getBusinessType, operLog.getBusinessType()) |
| | |
| | | * @return 操作日志对象 |
| | | */ |
| | | @Override |
| | | public SysOperLog selectOperLogById(Long operId) { |
| | | return baseMapper.selectById(operId); |
| | | public SysOperLogVo selectOperLogById(Long operId) { |
| | | return baseMapper.selectVoById(operId); |
| | | } |
| | | |
| | | /** |