| | |
| | | drop table if exists sys_ctrl_log; |
| | | create table sys_ctrl_log ( |
| | | log_id bigint(20) not null auto_increment comment '日志ID', |
| | | title varchar(100) not null comment '标题', |
| | | type char(1) default '0' comment '类型', |
| | | tab_id bigint(20) comment '表ID', |
| | | title varchar(200) not null comment '标题', |
| | | type char(1) comment '类型(n-正常,e-错误)', |
| | | ip varchar(50) comment 'IP', |
| | | url varchar(4000) comment 'URL', |
| | | method varchar(20) comment '方法', |
| | | method varchar(50) comment '方法', |
| | | args varchar(4000) comment '参数', |
| | | msg varchar(2000) comment '消息', |
| | | oper varchar(50) comment '操作员', |
| | | msg varchar(4000) comment '消息', |
| | | oper varchar(100) comment '操作员', |
| | | time datetime default now() comment '操作时间', |
| | | remark varchar(500) default '' comment '备注', |
| | | remark varchar(500) comment '备注', |
| | | primary key (log_id) |
| | | ) engine=innodb auto_increment=1 comment = '控制日志表'; |
| | | select * from sys_ctrl_log order by log_id; |
| | |
| | | import com.se.common.core.utils.poi.ExcelUtil; |
| | | import com.se.common.core.web.page.TableDataInfo; |
| | | |
| | | |
| | | /** |
| | | * 控制日志Controller |
| | | * |
| | | * @author se |
| | | * @date 2024-11-22 |
| | | * @date 2024-12-13 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/ctrlLog") |
| | | public class SysCtrlLogController extends BaseController |
| | | { |
| | | public class SysCtrlLogController extends BaseController { |
| | | @Autowired |
| | | private ISysCtrlLogService sysCtrlLogService; |
| | | |
| | |
| | | */ |
| | | @RequiresPermissions("system:ctrlLog:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysCtrlLog sysCtrlLog) |
| | | { |
| | | public TableDataInfo list(SysCtrlLog sysCtrlLog) { |
| | | startPage(); |
| | | List<SysCtrlLog> list = sysCtrlLogService.selectSysCtrlLogList(sysCtrlLog); |
| | | return getDataTable(list); |
| | |
| | | @RequiresPermissions("system:ctrlLog:export") |
| | | @Log(title = "控制日志", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysCtrlLog sysCtrlLog) |
| | | { |
| | | public void export(HttpServletResponse response, SysCtrlLog sysCtrlLog) { |
| | | List<SysCtrlLog> list = sysCtrlLogService.selectSysCtrlLogList(sysCtrlLog); |
| | | ExcelUtil<SysCtrlLog> util = new ExcelUtil<SysCtrlLog>(SysCtrlLog.class); |
| | | util.exportExcel(response, list, "控制日志数据"); |
| | |
| | | */ |
| | | @RequiresPermissions("system:ctrlLog:query") |
| | | @GetMapping(value = "/{logId}") |
| | | public AjaxResult getInfo(@PathVariable("logId") Long logId) |
| | | { |
| | | public AjaxResult getInfo(@PathVariable("logId") Long logId) { |
| | | return success(sysCtrlLogService.selectSysCtrlLogByLogId(logId)); |
| | | } |
| | | |
| | |
| | | @RequiresPermissions("system:ctrlLog:add") |
| | | @Log(title = "控制日志", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody SysCtrlLog sysCtrlLog) |
| | | { |
| | | public AjaxResult add(@RequestBody SysCtrlLog sysCtrlLog) { |
| | | return toAjax(sysCtrlLogService.insertSysCtrlLog(sysCtrlLog)); |
| | | } |
| | | |
| | |
| | | @RequiresPermissions("system:ctrlLog:edit") |
| | | @Log(title = "控制日志", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody SysCtrlLog sysCtrlLog) |
| | | { |
| | | public AjaxResult edit(@RequestBody SysCtrlLog sysCtrlLog) { |
| | | return toAjax(sysCtrlLogService.updateSysCtrlLog(sysCtrlLog)); |
| | | } |
| | | |
| | |
| | | @RequiresPermissions("system:ctrlLog:remove") |
| | | @Log(title = "控制日志", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{logIds}") |
| | | public AjaxResult remove(@PathVariable Long[] logIds) |
| | | { |
| | | public AjaxResult remove(@PathVariable Long[] logIds) { |
| | | return toAjax(sysCtrlLogService.deleteSysCtrlLogByLogIds(logIds)); |
| | | } |
| | | } |
| | |
| | | import java.util.Date; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.se.common.core.annotation.Excel; |
| | | import com.se.common.core.web.domain.BaseEntity; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | |
| | | * 控制日志对象 sys_ctrl_log |
| | | * |
| | | * @author se |
| | | * @date 2024-11-22 |
| | | * @date 2024-12-13 |
| | | */ |
| | | public class SysCtrlLog { |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | private Long logId; |
| | | |
| | | /** |
| | | * 表ID |
| | | */ |
| | | @Excel(name = "表ID") |
| | | private Long tabId; |
| | | |
| | | /** |
| | | * 标题 |
| | | */ |
| | | @Excel(name = "标题") |
| | | private String title; |
| | | |
| | | /** |
| | | * 类型 |
| | | * 类型(n-正常,e-错误) |
| | | */ |
| | | @Excel(name = "类型") |
| | | @Excel(name = "类型", readConverterExp = "n=-正常,e-错误") |
| | | private String type; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @Excel(name = "备注") |
| | | private String remark; |
| | | |
| | | public void setLogId(Long logId) { |
| | |
| | | |
| | | public Long getLogId() { |
| | | return logId; |
| | | } |
| | | |
| | | public void setTabId(Long tabId) { |
| | | this.tabId = tabId; |
| | | } |
| | | |
| | | public Long getTabId() { |
| | | return tabId; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | |
| | | public String toString() { |
| | | return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("logId", getLogId()) |
| | | .append("tabId", getTabId()) |
| | | .append("title", getTitle()) |
| | | .append("type", getType()) |
| | | .append("ip", getIp()) |
| | |
| | | |
| | | <resultMap type="SysCtrlLog" id="SysCtrlLogResult"> |
| | | <result property="logId" column="log_id" /> |
| | | <result property="tabId" column="tab_id" /> |
| | | <result property="title" column="title" /> |
| | | <result property="type" column="type" /> |
| | | <result property="ip" column="ip" /> |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="selectSysCtrlLogVo"> |
| | | select log_id, title, type, ip, url, method, args, msg, oper, time, remark from sys_ctrl_log |
| | | select log_id, tab_id, title, type, ip, url, method, args, msg, oper, time, remark from sys_ctrl_log |
| | | </sql> |
| | | |
| | | <select id="selectSysCtrlLogList" parameterType="SysCtrlLog" resultMap="SysCtrlLogResult"> |
| | | <include refid="selectSysCtrlLogVo"/> |
| | | <where> |
| | | <if test="tabId != null "> and tab_id = #{tabId}</if> |
| | | <if test="title != null and title != ''"> and title = #{title}</if> |
| | | <if test="type != null and type != ''"> and type = #{type}</if> |
| | | <if test="ip != null and ip != ''"> and ip = #{ip}</if> |
| | |
| | | <insert id="insertSysCtrlLog" parameterType="SysCtrlLog" useGeneratedKeys="true" keyProperty="logId"> |
| | | insert into sys_ctrl_log |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="tabId != null">tab_id,</if> |
| | | <if test="title != null and title != ''">title,</if> |
| | | <if test="type != null">type,</if> |
| | | <if test="ip != null">ip,</if> |
| | |
| | | <if test="remark != null">remark,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="tabId != null">#{tabId},</if> |
| | | <if test="title != null and title != ''">#{title},</if> |
| | | <if test="type != null">#{type},</if> |
| | | <if test="ip != null">#{ip},</if> |
| | |
| | | <update id="updateSysCtrlLog" parameterType="SysCtrlLog"> |
| | | update sys_ctrl_log |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="tabId != null">tab_id = #{tabId},</if> |
| | | <if test="title != null and title != ''">title = #{title},</if> |
| | | <if test="type != null">type = #{type},</if> |
| | | <if test="ip != null">ip = #{ip},</if> |