添加查看swagger日志的界面
This commit is contained in:
@@ -24,6 +24,7 @@ import com.nis.web.service.LogService;
|
||||
import com.nis.web.service.MenuService;
|
||||
import com.nis.web.service.OfficeService;
|
||||
import com.nis.web.service.RoleService;
|
||||
import com.nis.web.service.SwaggerLogService;
|
||||
import com.nis.web.service.SystemService;
|
||||
import com.nis.web.service.UserService;
|
||||
|
||||
@@ -50,6 +51,9 @@ public class BaseController {
|
||||
@Autowired
|
||||
protected LogService logService;
|
||||
|
||||
@Autowired
|
||||
protected SwaggerLogService swaggerLogService;
|
||||
|
||||
@Autowired
|
||||
protected ArchiveServcie archiveServcie;
|
||||
|
||||
|
||||
@@ -9,19 +9,28 @@ import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SwaggerLog;
|
||||
import com.nis.domain.SysLog;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/sys/log")
|
||||
public class SysLogController extends BaseController {
|
||||
|
||||
|
||||
@RequiresPermissions("sys:log:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
@RequestMapping(value = "list")
|
||||
public String list(SysLog sysLog, HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||
Page<SysLog> page = logService.findPage(new Page<SysLog>(request, response), sysLog);
|
||||
model.addAttribute("page", page);
|
||||
Page<SysLog> page = logService.findPage(new Page<SysLog>(request, response), sysLog);
|
||||
model.addAttribute("page", page);
|
||||
return "/sys/logList";
|
||||
}
|
||||
|
||||
@RequiresPermissions("sys:swaggerLogList:view")
|
||||
@RequestMapping(value = "swaggerLogList")
|
||||
public String swaggerLogList(SwaggerLog sysLog, HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||
Page<SwaggerLog> page = swaggerLogService.findSwaggerLogPage(new Page<SwaggerLog>(request, response), sysLog);
|
||||
model.addAttribute("page", page);
|
||||
return "/sys/swaggerLogList";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
7
src/main/java/com/nis/web/dao/SwaggerLogDao.java
Normal file
7
src/main/java/com/nis/web/dao/SwaggerLogDao.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package com.nis.web.dao;
|
||||
|
||||
import com.nis.domain.SwaggerLog;
|
||||
@MyBatisDao
|
||||
public interface SwaggerLogDao extends CrudDao<SwaggerLog>{
|
||||
|
||||
}
|
||||
46
src/main/java/com/nis/web/dao/SwaggerLogDao.xml
Normal file
46
src/main/java/com/nis/web/dao/SwaggerLogDao.xml
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.nis.web.dao.SwaggerLogDao">
|
||||
|
||||
<select id="findList" resultType="swaggerLog">
|
||||
SELECT
|
||||
a.*
|
||||
FROM services_request_log a
|
||||
WHERE a.request_time BETWEEN
|
||||
#{beginDate} AND #{endDate}
|
||||
|
||||
<if test="requestContent != null and requestContent != ''">
|
||||
AND a.request_Content LIKE
|
||||
<if test="dbName == 'oracle'">'%'||#{requestContent}||'%'</if>
|
||||
<if test="dbName == 'mssql'">'%'+#{requestContent}+'%'</if>
|
||||
<if test="dbName == 'mysql'">CONCAT('%', #{requestContent}, '%')</if>
|
||||
</if>
|
||||
|
||||
<if test="exceptionInfo != null and exceptionInfo != ''">
|
||||
AND a.exception_Info LIKE
|
||||
<if test="dbName == 'oracle'">'%'||#{exceptionInfo}||'%'</if>
|
||||
<if test="dbName == 'mssql'">'%'+#{exceptionInfo}+'%'</if>
|
||||
<if test="dbName == 'mysql'">CONCAT('%', #{exceptionInfo}, '%')</if>
|
||||
</if>
|
||||
|
||||
<if test="requestIp != null and requestIp != ''">
|
||||
AND a.request_ip like
|
||||
<if test="dbName == 'oracle'">'%'||#{requestIp}||'%'</if>
|
||||
<if test="dbName == 'mssql'">'%'+#{requestIp}+'%'</if>
|
||||
<if test="dbName == 'mysql'">CONCAT('%', #{requestIp}, '%')</if>
|
||||
</if>
|
||||
<if test="serverIp != null and serverIp != ''">
|
||||
AND a.server_Ip like
|
||||
<if test="dbName == 'oracle'">'%'||#{serverIp}||'%'</if>
|
||||
<if test="dbName == 'mssql'">'%'+#{serverIp}+'%'</if>
|
||||
<if test="dbName == 'mysql'">CONCAT('%', #{serverIp}, '%')</if>
|
||||
</if>
|
||||
<if test="exception != null and exception != ''">
|
||||
AND a.exception_Info!=''
|
||||
</if>
|
||||
ORDER BY a.request_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
25
src/main/java/com/nis/web/service/SwaggerLogService.java
Normal file
25
src/main/java/com/nis/web/service/SwaggerLogService.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.nis.web.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SwaggerLog;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.web.dao.SwaggerLogDao;
|
||||
|
||||
@Service
|
||||
public class SwaggerLogService extends CrudService<SwaggerLogDao, SwaggerLog> {
|
||||
|
||||
|
||||
public Page<SwaggerLog> findSwaggerLogPage(Page<SwaggerLog> page, SwaggerLog sysLog) {
|
||||
// 设置默认时间范围,默认当前月
|
||||
if (sysLog.getBeginDate() == null) {
|
||||
sysLog.setBeginDate(DateUtils.setDays(DateUtils.parseDate(DateUtils.getDate()), 1));
|
||||
}
|
||||
if (sysLog.getEndDate() == null) {
|
||||
sysLog.setEndDate(DateUtils.addMonths(sysLog.getBeginDate(), 1));
|
||||
}
|
||||
return super.findPage(page, sysLog);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user