diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/SystemLogController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/SystemLogController.java index 0c81d1f..2d42cd4 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/SystemLogController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/SystemLogController.java @@ -2,8 +2,17 @@ package com.hxhq.business.controller; import java.util.List; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.hxhq.business.form.systemlog.SystemLogSearchForm; +import com.hxhq.common.core.utils.DateUtils; +import com.hxhq.common.core.utils.ServletUtils; +import com.hxhq.common.core.utils.StringUtils; +import com.hxhq.common.core.utils.poi.ExcelUtil; +import com.hxhq.common.core.web.domain.AjaxResult; import com.hxhq.common.security.annotation.RequiresPermissions; +import com.hxhq.system.api.domain.SysRole; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import com.hxhq.business.domain.SystemLog; @@ -11,6 +20,8 @@ import com.hxhq.business.service.ISystemLogService; import com.hxhq.common.core.web.controller.BaseController; import com.hxhq.common.core.web.page.TableDataInfo; +import javax.servlet.http.HttpServletResponse; + /** * 系统日志Controller @@ -36,4 +47,59 @@ public class SystemLogController extends BaseController List list = systemLogService.queryList(form); return getDataTable(list); } + + /** + * 查询系统日志列表 + */ + @GetMapping("/czlxList") + @RequiresPermissions("business:systemLog:operate") + public AjaxResult czlxList() + { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.select("distinct jcmc,jcmc_en"); + List list = systemLogService.list(queryWrapper); + return AjaxResult.success(list); + } + + /** + * 查询系统日志列表 + */ + @PostMapping("/export") + @RequiresPermissions("business:systemLog:operate:export") + public void export(HttpServletResponse response, SystemLogSearchForm form) + { + List list = systemLogService.queryList(form); + for(SystemLog l : list){ + l.setCzsj(DateUtils.parseDateToStr(l.getCreateTime()==null?"": DateUtils.YYYY_MM_DD_HH_MM_SS,l.getCreateTime())); + l.setCzlx(ServletUtils.getRequest().getHeader("lang").equals("zh_CN")?l.getJcmc():l.getJcmcEn()); + String czxq = ""; + if(ServletUtils.getRequest().getHeader("lang").equals("zh_CN")){ + try{ + JSONArray jsonArray = JSONArray.parseArray(l.getJcnr()); + for(int i=0;i util = new ExcelUtil(SystemLog.class); + util.exportExcel(response, list, "操作日志"); + } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SystemLog.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SystemLog.java index 964a31e..f459136 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SystemLog.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SystemLog.java @@ -1,6 +1,8 @@ package com.hxhq.business.domain; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; +import com.hxhq.common.core.annotation.Excel; import com.hxhq.common.core.domain.MpBaseEntity; @@ -37,11 +39,28 @@ public class SystemLog extends MpBaseEntity private Long qmrId; /** 操作人名称 */ + @Excel(name = "操作人",nameEn = "User",sort = 1) private String qmrMc; /** 操作人名称-英文 */ private String qmrMcEn; + + /** 操作类型 */ + @TableField(exist = false) + @Excel(name = "操作类型",nameEn = "Action",sort = 2) + private String czlx; + + /** 操作详情 */ + @TableField(exist = false) + @Excel(name = "操作详情",nameEn = "Detail",sort = 3) + private String czxq; + + /** 操作时间 */ + @TableField(exist = false) + @Excel(name = "操作时间",nameEn = "Datetime",sort = 4) + private String czsj; + public String getName() { return name; } @@ -128,4 +147,27 @@ public class SystemLog extends MpBaseEntity return qmrMcEn; } + public String getCzlx() { + return czlx; + } + + public void setCzlx(String czlx) { + this.czlx = czlx; + } + + public String getCzxq() { + return czxq; + } + + public void setCzxq(String czxq) { + this.czxq = czxq; + } + + public String getCzsj() { + return czsj; + } + + public void setCzsj(String czsj) { + this.czsj = czsj; + } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SystemLogServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SystemLogServiceImpl.java index aab911c..3083d8f 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SystemLogServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SystemLogServiceImpl.java @@ -40,8 +40,8 @@ public class SystemLogServiceImpl extends ServiceImplq.like("jcmc",form.getJcmc()) - .or().like("jcmc_en",form.getJcmc())); + queryWrapper.and(q->q.eq("jcmc",form.getJcmc()) + .or().eq("jcmc_en",form.getJcmc())); } if(StringUtils.isNoneBlank(form.getJcnr())){ queryWrapper.and(q->q.like("jcnr",form.getJcnr())