|
|
@ -15,6 +15,7 @@ import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDate; |
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -47,9 +48,24 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public IPage<SysLog> selectPage(Page<SysLog> page1, SysLogVo sysLog) { |
|
|
|
public IPage<SysLog> selectPage(Page<SysLog> page1, SysLogVo sysLog) { |
|
|
|
|
|
|
|
QueryWrapper<SysLog> queryWrapper = getSysLogQueryWrapper(sysLog); |
|
|
|
|
|
|
|
IPage<SysLog> statisticsPage = baseMapper.selectPage(page1, queryWrapper); |
|
|
|
|
|
|
|
return statisticsPage; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 日志查询接口 |
|
|
|
|
|
|
|
* @param sysLog |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private static QueryWrapper<SysLog> getSysLogQueryWrapper(SysLogVo sysLog) { |
|
|
|
String keyword = sysLog.getKeyword(); |
|
|
|
String keyword = sysLog.getKeyword(); |
|
|
|
LocalDate createTime = sysLog.getCreateTime(); |
|
|
|
LocalDateTime createTime = sysLog.getCreateTime(); |
|
|
|
LocalDate endTime = sysLog.getEndTime(); |
|
|
|
LocalDateTime endTime = sysLog.getEndTime(); |
|
|
|
|
|
|
|
String dateCalculated = sysLog.getDateCalculated(); |
|
|
|
|
|
|
|
String moduleName = sysLog.getModuleName(); |
|
|
|
|
|
|
|
String path = sysLog.getPath(); |
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<SysLog> queryWrapper = new QueryWrapper<>(); |
|
|
|
QueryWrapper<SysLog> queryWrapper = new QueryWrapper<>(); |
|
|
|
if (StringUtils.isNotEmpty(sysLog.getKeyword())) { |
|
|
|
if (StringUtils.isNotEmpty(sysLog.getKeyword())) { |
|
|
@ -58,16 +74,28 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme |
|
|
|
queryWrapper.lambda().or().like(SysLog::getAction, keyword); |
|
|
|
queryWrapper.lambda().or().like(SysLog::getAction, keyword); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//请求地址
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(path)) { |
|
|
|
|
|
|
|
queryWrapper.lambda().eq(SysLog::getPath, path); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (ObjectUtils.isNotEmpty(createTime)){ |
|
|
|
//开始时间
|
|
|
|
queryWrapper.lambda().ge(SysLog::getOperationTime,createTime); |
|
|
|
if (ObjectUtils.isNotEmpty(createTime)) { |
|
|
|
|
|
|
|
queryWrapper.lambda().ge(SysLog::getOperationTime, createTime); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//结束时间
|
|
|
|
if (ObjectUtils.isNotEmpty(endTime)){ |
|
|
|
if (ObjectUtils.isNotEmpty(endTime)){ |
|
|
|
queryWrapper.lambda().le(SysLog::getOperationTime,endTime); |
|
|
|
queryWrapper.lambda().le(SysLog::getOperationTime,endTime); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
IPage<SysLog> statisticsPage = baseMapper.selectPage(page1, queryWrapper); |
|
|
|
//根据操作时间和功能模块查询
|
|
|
|
return statisticsPage; |
|
|
|
if (StringUtils.isNotEmpty(dateCalculated) && StringUtils.isNotEmpty(moduleName)){ |
|
|
|
|
|
|
|
queryWrapper.lambda().eq(SysLog::getModuleName,moduleName); |
|
|
|
|
|
|
|
queryWrapper.eq("date_format(operation_time,'%Y-%m')",dateCalculated); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return queryWrapper; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|