4 changed files with 162 additions and 0 deletions
-
15src/main/java/com/gaotao/modules/system/dao/SensitiveFieldChangeLogMapper.java
-
90src/main/java/com/gaotao/modules/system/entity/SensitiveFieldChangeLog.java
-
20src/main/java/com/gaotao/modules/system/service/SensitiveFieldChangeLogService.java
-
37src/main/java/com/gaotao/modules/system/service/impl/SensitiveFieldChangeLogServiceImpl.java
@ -0,0 +1,15 @@ |
|||||
|
package com.gaotao.modules.system.dao; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.gaotao.modules.system.entity.SensitiveFieldChangeLog; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* @Description 敏感字段变更记录Mapper - rqrq |
||||
|
* @Author rqrq |
||||
|
* @Date 2025/11/15 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface SensitiveFieldChangeLogMapper extends BaseMapper<SensitiveFieldChangeLog> { |
||||
|
} |
||||
|
|
||||
@ -0,0 +1,90 @@ |
|||||
|
package com.gaotao.modules.system.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* @Description 敏感字段变更记录表实体类 - rqrq |
||||
|
* @Author rqrq |
||||
|
* @Date 2025/11/15 |
||||
|
*/ |
||||
|
@Data |
||||
|
@TableName("sensitive_field_change_log") |
||||
|
public class SensitiveFieldChangeLog { |
||||
|
|
||||
|
/** |
||||
|
* 主键,自增 - rqrq |
||||
|
*/ |
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Long id; |
||||
|
|
||||
|
/** |
||||
|
* 工厂编码 - rqrq |
||||
|
*/ |
||||
|
private String site; |
||||
|
|
||||
|
/** |
||||
|
* 功能页面 - rqrq |
||||
|
*/ |
||||
|
private String functionPage; |
||||
|
|
||||
|
/** |
||||
|
* 操作名称 - rqrq |
||||
|
*/ |
||||
|
private String operationName; |
||||
|
|
||||
|
/** |
||||
|
* 操作对象 - rqrq |
||||
|
*/ |
||||
|
private String operationObject; |
||||
|
|
||||
|
/** |
||||
|
* 表名 - rqrq |
||||
|
*/ |
||||
|
private String tableName; |
||||
|
|
||||
|
/** |
||||
|
* 字段名 - rqrq |
||||
|
*/ |
||||
|
private String fieldName; |
||||
|
|
||||
|
/** |
||||
|
* 原数值 - rqrq |
||||
|
*/ |
||||
|
private String oldValue; |
||||
|
|
||||
|
/** |
||||
|
* 新数值 - rqrq |
||||
|
*/ |
||||
|
private String newValue; |
||||
|
|
||||
|
/** |
||||
|
* 操作人 - rqrq |
||||
|
*/ |
||||
|
private String operator; |
||||
|
|
||||
|
/** |
||||
|
* 操作时间 - rqrq |
||||
|
*/ |
||||
|
private Date operationTime; |
||||
|
|
||||
|
/** |
||||
|
* 关联表的主键ID - rqrq |
||||
|
*/ |
||||
|
private Long recordId; |
||||
|
|
||||
|
/** |
||||
|
* 操作类型(UPDATE/INSERT/DELETE)- rqrq |
||||
|
*/ |
||||
|
private String operationType; |
||||
|
|
||||
|
/** |
||||
|
* 操作人IP地址 - rqrq |
||||
|
*/ |
||||
|
private String ipAddress; |
||||
|
} |
||||
|
|
||||
@ -0,0 +1,20 @@ |
|||||
|
package com.gaotao.modules.system.service; |
||||
|
|
||||
|
import com.gaotao.modules.system.entity.SensitiveFieldChangeLog; |
||||
|
|
||||
|
/** |
||||
|
* @Description 敏感字段变更记录服务接口 - rqrq |
||||
|
* @Author rqrq |
||||
|
* @Date 2025/11/15 |
||||
|
*/ |
||||
|
public interface SensitiveFieldChangeLogService { |
||||
|
|
||||
|
/** |
||||
|
* @Description 记录字段变更 - rqrq |
||||
|
* @param log 变更日志 |
||||
|
* @author rqrq |
||||
|
* @date 2025/11/15 |
||||
|
*/ |
||||
|
void recordFieldChange(SensitiveFieldChangeLog log); |
||||
|
} |
||||
|
|
||||
@ -0,0 +1,37 @@ |
|||||
|
package com.gaotao.modules.system.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.gaotao.modules.system.dao.SensitiveFieldChangeLogMapper; |
||||
|
import com.gaotao.modules.system.entity.SensitiveFieldChangeLog; |
||||
|
import com.gaotao.modules.system.service.SensitiveFieldChangeLogService; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* @Description 敏感字段变更记录服务实现类 - rqrq |
||||
|
* @Author rqrq |
||||
|
* @Date 2025/11/15 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class SensitiveFieldChangeLogServiceImpl |
||||
|
extends ServiceImpl<SensitiveFieldChangeLogMapper, SensitiveFieldChangeLog> |
||||
|
implements SensitiveFieldChangeLogService { |
||||
|
|
||||
|
/** |
||||
|
* @Description 记录字段变更 - rqrq |
||||
|
* @param log 变更日志 |
||||
|
* @author rqrq |
||||
|
* @date 2025/11/15 |
||||
|
*/ |
||||
|
@Override |
||||
|
public void recordFieldChange(SensitiveFieldChangeLog log) { |
||||
|
System.out.println("开始记录敏感字段变更 - rqrq:表=" + log.getTableName() |
||||
|
+ ", 字段=" + log.getFieldName() |
||||
|
+ ", 原值=" + log.getOldValue() |
||||
|
+ ", 新值=" + log.getNewValue()); |
||||
|
|
||||
|
this.save(log); |
||||
|
|
||||
|
System.out.println("敏感字段变更记录完成 - rqrq"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue