This commit is contained in:
xd 2024-07-26 16:36:06 +08:00
parent 9f059a097a
commit cce4173093
5 changed files with 13 additions and 1 deletions

View File

@ -112,6 +112,7 @@ public class ChangeRecordAspect {
changeRecord.setAfterChange(String.valueOf(dataMap.get("newValue"))); changeRecord.setAfterChange(String.valueOf(dataMap.get("newValue")));
changeRecord.setTypeId(String.valueOf(dataMap.get(operateLog.tableId()))); changeRecord.setTypeId(String.valueOf(dataMap.get(operateLog.tableId())));
changeRecord.setCodeName(String.valueOf(dataMap.get(operateLog.codeName()))); changeRecord.setCodeName(String.valueOf(dataMap.get(operateLog.codeName())));
changeRecord.setTitle(operateLog.title());
changeRecordMapper.insertChangeRecord(changeRecord); changeRecordMapper.insertChangeRecord(changeRecord);
} }
} }

View File

@ -31,4 +31,7 @@ public @interface ChangeRecordLog {
//操作类型 //操作类型
String type() default "update"; String type() default "update";
//操作事件
String title() default "";
} }

View File

@ -8,6 +8,7 @@ public class SysChangeRecord {
private String afterChange; private String afterChange;
private String typeId; private String typeId;
private String codeName; private String codeName;
private String title;
public String getChangeTime() { public String getChangeTime() {
return changeTime; return changeTime;
@ -60,4 +61,8 @@ public class SysChangeRecord {
public String getCodeName() { return codeName; } public String getCodeName() { return codeName; }
public void setCodeName(String codeName) { this.codeName = codeName; } public void setCodeName(String codeName) { this.codeName = codeName; }
public String getTitle() { return title; }
public void setTitle(String title) { this.title = title; }
} }

View File

@ -13,6 +13,7 @@
<if test="afterChange != null and afterChange != ''">afterChange,</if> <if test="afterChange != null and afterChange != ''">afterChange,</if>
<if test="typeId != null and typeId != ''">typeId,</if> <if test="typeId != null and typeId != ''">typeId,</if>
<if test="codeName != null and codeName != ''">codeName,</if> <if test="codeName != null and codeName != ''">codeName,</if>
<if test="title != null and title != ''">title,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="changeTime != null">#{changeTime},</if> <if test="changeTime != null">#{changeTime},</if>
@ -22,12 +23,13 @@
<if test="afterChange != null and afterChange != ''">#{afterChange},</if> <if test="afterChange != null and afterChange != ''">#{afterChange},</if>
<if test="typeId != null and typeId != ''">#{typeId},</if> <if test="typeId != null and typeId != ''">#{typeId},</if>
<if test="codeName != null and codeName != ''">#{codeName},</if> <if test="codeName != null and codeName != ''">#{codeName},</if>
<if test="title != null and title != ''">#{title},</if>
</trim> </trim>
</insert> </insert>
<select id="recordsList" resultType="SysChangeRecord" parameterType="SysChangeRecord"> <select id="recordsList" resultType="SysChangeRecord" parameterType="SysChangeRecord">
select a.changeTime,b.nick_name createName,a.changeField, select a.changeTime,b.nick_name createName,a.changeField,
a.beforeChange,a.afterChange,a.typeId,a.codeName a.beforeChange,a.afterChange,a.typeId,a.codeName,a.title
from sys_change_record a from sys_change_record a
left join sys_user b on a.createName = b.user_name left join sys_user b on a.createName = b.user_name
where a.typeId = #{typeId} where a.typeId = #{typeId}

View File

@ -1,6 +1,7 @@
<template> <template>
<el-table height="500" v-loading="loading" :data="records" :span-method="objectSpanMethod"> <el-table height="500" v-loading="loading" :data="records" :span-method="objectSpanMethod">
<el-table-column label="变更日期" align="center" prop="changeTime"/> <el-table-column label="变更日期" align="center" prop="changeTime"/>
<el-table-column label="变更事件" align="center" prop="title"/>
<el-table-column label="变更字段" align="center" prop="changeField"/> <el-table-column label="变更字段" align="center" prop="changeField"/>
<el-table-column label="变更前" align="center" prop="beforeChange"/> <el-table-column label="变更前" align="center" prop="beforeChange"/>
<el-table-column label="变更后" align="center" prop="afterChange"/> <el-table-column label="变更后" align="center" prop="afterChange"/>