为swagger日志界面添加操作行为查询条件

This commit is contained in:
RenKaiGe-Office
2018-08-07 16:57:46 +08:00
parent 8b47d39ae7
commit c02eb6fc3a
4 changed files with 31 additions and 24 deletions

View File

@@ -4,7 +4,6 @@ import java.util.Date;
public class SwaggerLog extends BaseEntity<SwaggerLog> { public class SwaggerLog extends BaseEntity<SwaggerLog> {
private static final long serialVersionUID = 5351369774420087482L; private static final long serialVersionUID = 5351369774420087482L;
private Long id;
private String operator; private String operator;
private String version; private String version;
private Integer opAction; private Integer opAction;
@@ -23,13 +22,6 @@ public class SwaggerLog extends BaseEntity<SwaggerLog> {
private Date beginDate; // 开始日期 private Date beginDate; // 开始日期
private Date endDate; // 结束日期 private Date endDate; // 结束日期
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getOperator() { public String getOperator() {
return operator; return operator;

View File

@@ -27,8 +27,8 @@ public class SysLogController extends BaseController {
@RequiresPermissions("sys:swaggerLogList:view") @RequiresPermissions("sys:swaggerLogList:view")
@RequestMapping(value = "swaggerLogList") @RequestMapping(value = "swaggerLogList")
public String swaggerLogList(SwaggerLog sysLog, HttpServletRequest request, HttpServletResponse response, Model model) { public String swaggerLogList(SwaggerLog swaggerLog, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<SwaggerLog> page = swaggerLogService.findSwaggerLogPage(new Page<SwaggerLog>(request, response), sysLog); Page<SwaggerLog> page = swaggerLogService.findSwaggerLogPage(new Page<SwaggerLog>(request, response), swaggerLog);
model.addAttribute("page", page); model.addAttribute("page", page);
return "/sys/swaggerLogList"; return "/sys/swaggerLogList";
} }

View File

@@ -41,6 +41,9 @@
<if test="exception != null and exception != ''"> <if test="exception != null and exception != ''">
AND a.exception_Info!='' AND a.exception_Info!=''
</if> </if>
<if test="opAction != null and opAction != ''">
AND a.opAction=#{opAction}
</if>
ORDER BY a.request_time DESC ORDER BY a.request_time DESC
</select> </select>

View File

@@ -22,7 +22,15 @@
<form:form id="searchForm" action="${ctx}/sys/log/swaggerLogList" method="post" class="breadcrumb form-search"> <form:form id="searchForm" action="${ctx}/sys/log/swaggerLogList" method="post" class="breadcrumb form-search">
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/> <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/> <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
<div> <div>
<label>操作行为:</label>
<select name="opAction" class="input-medium">
<option value="" selected="selected">请选择</option>
<option value="1">插入</option>
<option value="2">更新</option>
<option value="3">删除</option>
<option value="4">查询</option>
</select>
<label>traceCode</label><input id="traceCode" name="traceCode" type="text" maxlength="30" class="input-mini" value="${swaggerLog.traceCode}"/> <label>traceCode</label><input id="traceCode" name="traceCode" type="text" maxlength="30" class="input-mini" value="${swaggerLog.traceCode}"/>
<label>异常信息:</label><input id="exceptionInfo" name="exceptionInfo" type="text" maxlength="500" class="input-mini" value="${swaggerLog.exceptionInfo}"/> <label>异常信息:</label><input id="exceptionInfo" name="exceptionInfo" type="text" maxlength="500" class="input-mini" value="${swaggerLog.exceptionInfo}"/>
<label>请求ip</label><input id="requestIp" name="requestIp" type="text" maxlength="50" class="input-mini" value="${swaggerLog.requestIp}"/> <label>请求ip</label><input id="requestIp" name="requestIp" type="text" maxlength="50" class="input-mini" value="${swaggerLog.requestIp}"/>
@@ -41,26 +49,30 @@
</form:form> </form:form>
<sys:message content="${message}"/> <sys:message content="${message}"/>
<table id="contentTable" class="table table-striped table-bordered table-condensed"> <table id="contentTable" class="table table-striped table-bordered table-condensed">
<thead><tr><th>请求内容</th><th>traceCode</th><th>请求方式</th><th>请求ip</th><th>服务端ip</th><th>请求时间</th></thead> <thead><tr><th>请求内容</th><th>traceCode</th><th>操作行为</th><th>请求ip</th><th>服务端ip</th><th>请求时间</th></thead>
<tbody><%request.setAttribute("strEnter", "\n");request.setAttribute("strTab", "\t");%> <tbody><%request.setAttribute("strEnter", "\n");request.setAttribute("strTab", "\t");%>
<c:forEach items="${page.list}" var="log"> <c:forEach items="${page.list}" var="swaggerLog">
<tr> <tr>
<td> <td>
<a data-original-title="${fn:escapeXml(log.requestContent) }" class="tooltips" data-flag="false" <a data-original-title="${fn:escapeXml(swaggerLog.requestContent) }" class="tooltips" data-flag="false"
data-html="true" data-placement="top"> ${fn:substring(log.requestContent,0,20) }</a> data-html="true" data-placement="top"> ${fn:substring(swaggerLog.requestContent,0,20) }</a>
</td> </td>
<td>${log.traceCode}</td> <td>${swaggerLog.traceCode}</td>
<td>${log.opAction}</td> <td>
<td><strong>${log.requestIp}</strong></td> <c:if test="${swaggerLog.opAction eq 1}">插入</c:if>
<td>${log.serverIp}</td> <c:if test="${swaggerLog.opAction eq 2}">更新</c:if>
<td><fmt:formatDate value="${log.requestTime}" type="both"/></td> <c:if test="${swaggerLog.opAction eq 3}">删除</c:if>
<c:if test="${swaggerLog.opAction eq 4}">查询</c:if>
</td>
<td><strong>${swaggerLog.requestIp}</strong></td>
<td>${swaggerLog.serverIp}</td>
<td><fmt:formatDate value="${swaggerLog.requestTime}" type="both"/></td>
</tr> </tr>
<c:if test="${not empty log.exceptionInfo}"><tr> <c:if test="${not empty swaggerLog.exceptionInfo}"><tr>
<td colspan="8" style="word-wrap:break-word;word-break:break-all;"> <td colspan="8" style="word-wrap:break-word;word-break:break-all;">
<%-- 用户代理: ${log.userAgent}<br/> --%>
<%-- 提交参数: ${fns:escapeHtml(log.params)} <br/> --%>
异常信息: <br/> 异常信息: <br/>
${fn:replace(fn:replace(fns:escapeHtml(log.exceptionInfo), strEnter, '<br/>'), strTab, '&nbsp; &nbsp; ')}</td> ${fn:replace(fn:replace(fns:escapeHtml(swaggerLog.exceptionInfo), strEnter, '<br/>'), strTab, '&nbsp; &nbsp; ')}</td>
</tr></c:if> </tr></c:if>
</c:forEach> </c:forEach>
</tbody> </tbody>