Commit b291c2cd by fsn

添加对业务日志的分类查询

parent e0d68299
package com.stylefeng.guns.common.constant.state;
/**
* 业务日志类型
*
* @author fengshuonan
* @Date 2017年1月22日 下午12:14:59
*/
public enum BizLogType {
ALL(0, null),//全部日志
BUSSINESS(1, "业务日志"),
EXCEPTION(2, "异常日志");
Integer val;
String message;
BizLogType(Integer val, String message) {
this.val = val;
this.message = message;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Integer getVal() {
return val;
}
public void setVal(Integer val) {
this.val = val;
}
public static String valueOf(Integer value) {
if (value == null) {
return null;
} else {
for (BizLogType bizLogType : BizLogType.values()) {
if (bizLogType.getVal().equals(value)) {
return bizLogType.getMessage();
}
}
return null;
}
}
}
...@@ -3,6 +3,7 @@ package com.stylefeng.guns.modular.system.controller; ...@@ -3,6 +3,7 @@ package com.stylefeng.guns.modular.system.controller;
import com.baomidou.mybatisplus.mapper.SqlRunner; import com.baomidou.mybatisplus.mapper.SqlRunner;
import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.plugins.Page;
import com.stylefeng.guns.common.constant.factory.PageFactory; import com.stylefeng.guns.common.constant.factory.PageFactory;
import com.stylefeng.guns.common.constant.state.BizLogType;
import com.stylefeng.guns.common.controller.BaseController; import com.stylefeng.guns.common.controller.BaseController;
import com.stylefeng.guns.core.support.BeanKit; import com.stylefeng.guns.core.support.BeanKit;
import com.stylefeng.guns.modular.system.dao.LogDao; import com.stylefeng.guns.modular.system.dao.LogDao;
...@@ -50,9 +51,9 @@ public class LogController extends BaseController { ...@@ -50,9 +51,9 @@ public class LogController extends BaseController {
*/ */
@RequestMapping("/list") @RequestMapping("/list")
@ResponseBody @ResponseBody
public Object list(@RequestParam(required = false) String beginTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String logName) { public Object list(@RequestParam(required = false) String beginTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String logName, @RequestParam(required = false) Integer logType) {
Page<OperationLog> page = new PageFactory<OperationLog>().defaultPage(); Page<OperationLog> page = new PageFactory<OperationLog>().defaultPage();
List<Map<String, Object>> result = logDao.getOperationLogs(page, beginTime, endTime, logName); List<Map<String, Object>> result = logDao.getOperationLogs(page, beginTime, endTime, logName, BizLogType.valueOf(logType));
page.setRecords((List<OperationLog>) new LogWarpper(result).warp()); page.setRecords((List<OperationLog>) new LogWarpper(result).warp());
return super.packForBT(page); return super.packForBT(page);
} }
......
...@@ -13,7 +13,7 @@ import java.util.Map; ...@@ -13,7 +13,7 @@ import java.util.Map;
* @author stylefeng * @author stylefeng
* @Date 2017/4/16 23:44 * @Date 2017/4/16 23:44
*/ */
public interface LogDao{ public interface LogDao {
/** /**
* 获取操作日志 * 获取操作日志
...@@ -21,7 +21,7 @@ public interface LogDao{ ...@@ -21,7 +21,7 @@ public interface LogDao{
* @author stylefeng * @author stylefeng
* @Date 2017/4/16 23:48 * @Date 2017/4/16 23:48
*/ */
List<Map<String, Object>> getOperationLogs(Page<OperationLog> page, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("logName") String logName); List<Map<String, Object>> getOperationLogs(Page<OperationLog> page, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("logName") String logName, @Param("logType") String logType);
/** /**
* 获取登录日志 * 获取登录日志
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
<if test="logName != null and logName !=''"> <if test="logName != null and logName !=''">
and logname like CONCAT('%',#{logName},'%') and logname like CONCAT('%',#{logName},'%')
</if> </if>
<if test="logType != null and logType !=''">
and logtype like CONCAT('%',#{logType},'%')
</if>
order by createTime DESC order by createTime DESC
</select> </select>
......
@/*
选择查询条件标签的参数说明:
name : 查询条件的名称
id : 查询内容的input框id
@*/
<div class="input-group">
<div class="input-group-btn">
<button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">
${name}
</button>
</div>
<select class="form-control" id="${id}">
${tagBody!}
</select>
</div>
\ No newline at end of file
...@@ -9,16 +9,23 @@ ...@@ -9,16 +9,23 @@
<div class="row row-lg"> <div class="row row-lg">
<div class="col-sm-12"> <div class="col-sm-12">
<div class="row"> <div class="row">
<div class="col-sm-3"> <div class="col-sm-2">
<#TimeCon id="beginTime" name="开始时间" isTime="false" pattern="YYYY-MM-DD" /> <#TimeCon id="beginTime" name="开始时间" isTime="false" pattern="YYYY-MM-DD" />
</div> </div>
<div class="col-sm-3"> <div class="col-sm-2">
<#TimeCon id="endTime" name="结束时间" isTime="false" pattern="YYYY-MM-DD" /> <#TimeCon id="endTime" name="结束时间" isTime="false" pattern="YYYY-MM-DD" />
</div> </div>
<div class="col-sm-3"> <div class="col-sm-2">
<#NameCon id="logName" name="日志名称" /> <#NameCon id="logName" name="日志名称" />
</div> </div>
<div class="col-sm-3"> <div class="col-sm-2">
<#SelectCon id="logType" name="日志类型" >
<option value="0">全部</option>
<option value="1">业务日志</option>
<option value="2">异常日志</option>
</#SelectCon>
</div>
<div class="col-sm-2">
<#button name="搜索" icon="fa-search" clickFun="OptLog.search()"/> <#button name="搜索" icon="fa-search" clickFun="OptLog.search()"/>
</div> </div>
</div> </div>
......
...@@ -73,6 +73,7 @@ OptLog.search = function () { ...@@ -73,6 +73,7 @@ OptLog.search = function () {
queryData['logName'] = $("#logName").val(); queryData['logName'] = $("#logName").val();
queryData['beginTime'] = $("#beginTime").val(); queryData['beginTime'] = $("#beginTime").val();
queryData['endTime'] = $("#endTime").val(); queryData['endTime'] = $("#endTime").val();
queryData['logType'] = $("#logType").val();
OptLog.table.refresh({query: queryData}); OptLog.table.refresh({query: queryData});
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment