Commit 01b796a5 by fsn

日志详情的展示

parent 75cb219b
......@@ -3,6 +3,7 @@ package com.stylefeng.guns.modular.system.controller;
import com.baomidou.mybatisplus.plugins.Page;
import com.stylefeng.guns.common.constant.factory.PageFactory;
import com.stylefeng.guns.common.controller.BaseController;
import com.stylefeng.guns.core.support.BeanKit;
import com.stylefeng.guns.modular.system.warpper.LogWarpper;
import com.stylefeng.guns.persistence.dao.OperationLogMapper;
import com.stylefeng.guns.persistence.model.OperationLog;
......@@ -56,6 +57,8 @@ public class LogController extends BaseController {
@RequestMapping("/detail/{id}")
@ResponseBody
public Object detail(@PathVariable Integer id){
return operationLogMapper.selectById(id);
OperationLog operationLog = operationLogMapper.selectById(id);
Map<String, Object> stringObjectMap = BeanKit.beanToMap(operationLog);
return super.warpObject(new LogWarpper(stringObjectMap));
}
}
package com.stylefeng.guns.modular.system.warpper;
import com.stylefeng.guns.common.warpper.BaseControllerWarpper;
import com.stylefeng.guns.core.util.Contrast;
import com.stylefeng.guns.core.util.ToolUtil;
import java.util.List;
import java.util.Map;
/**
......@@ -14,18 +14,26 @@ import java.util.Map;
*/
public class LogWarpper extends BaseControllerWarpper {
public LogWarpper(List<Map<String, Object>> list) {
public LogWarpper(Object list) {
super(list);
}
@Override
public void warpTheMap(Map<String, Object> map) {
String message = (String) map.get("message");
//如果信息过长,则只截取前100位字符串
if (ToolUtil.isNotEmpty(message) && message.length() >= 100) {
message = message.substring(0, 100) + "...";
map.put("message", message);
} else {
return;
String subMessage = message.substring(0, 100) + "...";
map.put("message", subMessage);
}
//如果信息中包含分割符号;;; 则分割字符串返给前台
if (message.indexOf(Contrast.separator) != -1) {
String[] msgs = message.split(Contrast.separator);
map.put("regularMessage",msgs);
}else{
map.put("regularMessage",message);
}
}
......
......@@ -23,12 +23,23 @@ var Feng = {
Feng.alert(info, 2);
},
infoDetail: function (title, info) {
var display = "";
if (typeof info == "string") {
display = info;
} else {
if (info instanceof Array) {
for (var i = 0; i < info.length; i++) {
display = display + info[i] + "<br/>";
}
}
}
var index = parent.layer.open({
title: title,
type: 1,
skin: 'layui-layer-rim', //加上边框
area: ['950px', '600px'], //宽高
content: '<div style="padding: 20px;">' + info + '</div>'
content: '<div style="padding: 20px;">' + display + '</div>'
});
},
writeObj: function (obj) {
......
......@@ -51,7 +51,7 @@ OptLog.check = function () {
OptLog.detail = function () {
if (this.check()) {
var ajax = new $ax(Feng.ctxPath + "/log/detail/" + this.seItem.id, function (data) {
Feng.infoDetail("日志详情", data.message);
Feng.infoDetail("日志详情", data.regularMessage);
}, function (data) {
Feng.error("获取详情失败!");
});
......
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