mirror of https://gitee.com/stylefeng/roses
【8.1.9】【安全日志】更新安全日志的查询条件
parent
7e83fc7d4f
commit
8fa49f07a7
|
@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
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.page.PageResult;
|
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||||
import cn.stylefeng.roses.kernel.log.api.pojo.security.LogSecurityRequest;
|
import cn.stylefeng.roses.kernel.log.api.pojo.security.LogSecurityRequest;
|
||||||
import cn.stylefeng.roses.kernel.log.security.entity.LogSecurity;
|
import cn.stylefeng.roses.kernel.log.security.entity.LogSecurity;
|
||||||
|
@ -107,33 +108,24 @@ public class LogSecurityServiceImpl extends ServiceImpl<LogSecurityMapper, LogSe
|
||||||
private LambdaQueryWrapper<LogSecurity> createWrapper(LogSecurityRequest logSecurityRequest) {
|
private LambdaQueryWrapper<LogSecurity> createWrapper(LogSecurityRequest logSecurityRequest) {
|
||||||
LambdaQueryWrapper<LogSecurity> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<LogSecurity> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
Long securityLogId = logSecurityRequest.getSecurityLogId();
|
// 根据请求URL查询
|
||||||
queryWrapper.eq(ObjectUtil.isNotNull(securityLogId), LogSecurity::getSecurityLogId, securityLogId);
|
|
||||||
|
|
||||||
String requestUrl = logSecurityRequest.getRequestUrl();
|
String requestUrl = logSecurityRequest.getRequestUrl();
|
||||||
queryWrapper.like(ObjectUtil.isNotEmpty(requestUrl), LogSecurity::getRequestUrl, requestUrl);
|
queryWrapper.like(ObjectUtil.isNotEmpty(requestUrl), LogSecurity::getRequestUrl, requestUrl);
|
||||||
|
|
||||||
String requestParams = logSecurityRequest.getRequestParams();
|
// 根据客户端IP查询
|
||||||
queryWrapper.like(ObjectUtil.isNotEmpty(requestParams), LogSecurity::getRequestParams, requestParams);
|
|
||||||
|
|
||||||
String serverIp = logSecurityRequest.getServerIp();
|
|
||||||
queryWrapper.like(ObjectUtil.isNotEmpty(serverIp), LogSecurity::getServerIp, serverIp);
|
|
||||||
|
|
||||||
String clientIp = logSecurityRequest.getClientIp();
|
String clientIp = logSecurityRequest.getClientIp();
|
||||||
queryWrapper.like(ObjectUtil.isNotEmpty(clientIp), LogSecurity::getClientIp, clientIp);
|
queryWrapper.like(ObjectUtil.isNotEmpty(clientIp), LogSecurity::getClientIp, clientIp);
|
||||||
|
|
||||||
|
// 根据HTTP请求方式查询
|
||||||
String httpMethod = logSecurityRequest.getHttpMethod();
|
String httpMethod = logSecurityRequest.getHttpMethod();
|
||||||
queryWrapper.like(ObjectUtil.isNotEmpty(httpMethod), LogSecurity::getHttpMethod, httpMethod);
|
queryWrapper.like(ObjectUtil.isNotEmpty(httpMethod), LogSecurity::getHttpMethod, httpMethod);
|
||||||
|
|
||||||
String clientBrowser = logSecurityRequest.getClientBrowser();
|
// 根据请求内容查询
|
||||||
queryWrapper.like(ObjectUtil.isNotEmpty(clientBrowser), LogSecurity::getClientBrowser, clientBrowser);
|
|
||||||
|
|
||||||
String clientOs = logSecurityRequest.getClientOs();
|
|
||||||
queryWrapper.like(ObjectUtil.isNotEmpty(clientOs), LogSecurity::getClientOs, clientOs);
|
|
||||||
|
|
||||||
String logContent = logSecurityRequest.getLogContent();
|
String logContent = logSecurityRequest.getLogContent();
|
||||||
queryWrapper.like(ObjectUtil.isNotEmpty(logContent), LogSecurity::getLogContent, logContent);
|
queryWrapper.like(ObjectUtil.isNotEmpty(logContent), LogSecurity::getLogContent, logContent);
|
||||||
|
|
||||||
|
// 请求时间倒序排列
|
||||||
|
queryWrapper.orderByDesc(BaseEntity::getCreateTime);
|
||||||
|
|
||||||
return queryWrapper;
|
return queryWrapper;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue