mirror of https://gitee.com/stylefeng/roses
【8.1.9】日志查询,更新日期的格式化
parent
8fa49f07a7
commit
10a29fc3d5
|
@ -46,6 +46,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统应用service接口实现类
|
* 系统应用service接口实现类
|
||||||
|
@ -166,8 +167,10 @@ public class SysLoginLogServiceImpl extends ServiceImpl<SysLoginLogMapper, SysLo
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据【创建时间】筛选
|
// 根据【创建时间】筛选
|
||||||
if (ObjectUtil.isNotEmpty(sysLoginLogRequest.getBeginTime()) && ObjectUtil.isNotEmpty(sysLoginLogRequest.getEndTime())) {
|
Date beginTime = sysLoginLogRequest.getBeginTime();
|
||||||
queryWrapper.between(SysLoginLog::getCreateTime, sysLoginLogRequest.getBeginTime(), sysLoginLogRequest.getEndTime());
|
Date endTime = sysLoginLogRequest.getEndTime();
|
||||||
|
if (ObjectUtil.isNotEmpty(beginTime) && ObjectUtil.isNotEmpty(endTime)) {
|
||||||
|
queryWrapper.between(SysLoginLog::getCreateTime, beginTime + " 00:00:00", endTime + " 23:59:59");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据【日志名称】筛选,名称只有登录和退出日志两种
|
// 根据【日志名称】筛选,名称只有登录和退出日志两种
|
||||||
|
|
|
@ -2,6 +2,7 @@ package cn.stylefeng.roses.kernel.log.security.service.impl;
|
||||||
|
|
||||||
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.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
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.entity.BaseEntity;
|
import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
|
||||||
|
@ -124,6 +125,13 @@ public class LogSecurityServiceImpl extends ServiceImpl<LogSecurityMapper, LogSe
|
||||||
String logContent = logSecurityRequest.getLogContent();
|
String logContent = logSecurityRequest.getLogContent();
|
||||||
queryWrapper.like(ObjectUtil.isNotEmpty(logContent), LogSecurity::getLogContent, logContent);
|
queryWrapper.like(ObjectUtil.isNotEmpty(logContent), LogSecurity::getLogContent, logContent);
|
||||||
|
|
||||||
|
// 根据时间范围
|
||||||
|
String searchBeginTime = logSecurityRequest.getSearchBeginTime();
|
||||||
|
String searchEndTime = logSecurityRequest.getSearchEndTime();
|
||||||
|
if (StrUtil.isNotBlank(searchBeginTime) && StrUtil.isNotBlank(searchEndTime)) {
|
||||||
|
queryWrapper.between(BaseEntity::getCreateTime, searchBeginTime + " 00:00:00", searchEndTime + " 23:59:59");
|
||||||
|
}
|
||||||
|
|
||||||
// 请求时间倒序排列
|
// 请求时间倒序排列
|
||||||
queryWrapper.orderByDesc(BaseEntity::getCreateTime);
|
queryWrapper.orderByDesc(BaseEntity::getCreateTime);
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class SysLogBusinessServiceImpl extends ServiceImpl<SysLogBusinessMapper,
|
||||||
String searchBeginTime = sysLogBusinessRequest.getSearchBeginTime();
|
String searchBeginTime = sysLogBusinessRequest.getSearchBeginTime();
|
||||||
String searchEndTime = sysLogBusinessRequest.getSearchEndTime();
|
String searchEndTime = sysLogBusinessRequest.getSearchEndTime();
|
||||||
if (StrUtil.isNotBlank(searchBeginTime) && StrUtil.isNotBlank(searchEndTime)) {
|
if (StrUtil.isNotBlank(searchBeginTime) && StrUtil.isNotBlank(searchEndTime)) {
|
||||||
queryWrapper.between(SysLogBusiness::getCreateTime, searchBeginTime, searchEndTime);
|
queryWrapper.between(SysLogBusiness::getCreateTime, searchBeginTime + " 00:00:00", searchEndTime + " 23:59:59");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 填充搜索名称和排序
|
// 填充搜索名称和排序
|
||||||
|
|
Loading…
Reference in New Issue