19 changed files with 1123 additions and 0 deletions
@ -0,0 +1,67 @@ |
|||||
|
-- 通用密评敏感字段密文存储表 |
||||
|
CREATE TABLE crypto_sensitive_data ( |
||||
|
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '主键ID', |
||||
|
table_name VARCHAR(64) NOT NULL COMMENT '业务表名,如 sys_user', |
||||
|
biz_id VARCHAR(128) NOT NULL COMMENT '业务表主键ID,字符串兼容数字/UUID主键', |
||||
|
field_code VARCHAR(64) NOT NULL COMMENT '业务字段编码,username/id_card/phone/password', |
||||
|
field_value VARCHAR(512) DEFAULT NULL COMMENT '字段原始值', |
||||
|
cipher_text TEXT COMMENT 'SM4-CBC密文Base64;password单向哈希场景此字段为空', |
||||
|
field_iv VARCHAR(64) COMMENT 'SM4-CBC初始化向量,16字节随机值Base64;password此字段为空', |
||||
|
plain_hash VARCHAR(128) COMMENT '明文SM3哈希,仅用于等值查询,不可逆', |
||||
|
field_salt VARCHAR(64) COMMENT '哈希盐值,仅password单向哈希字段使用', |
||||
|
encrypt_alg VARCHAR(32) NOT NULL DEFAULT 'SM4-CBC' COMMENT '加密算法:SM4-CBC / SM3', |
||||
|
key_version VARCHAR(32) NOT NULL COMMENT '密钥版本号,用于密钥轮换,密评必查', |
||||
|
is_active TINYINT NOT NULL DEFAULT 1 COMMENT '是否为当前有效密文:1有效,0历史旧密文(密钥轮换保留)', |
||||
|
is_deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除:0未删除,1已删除', |
||||
|
create_by BIGINT COMMENT '创建人ID', |
||||
|
update_by BIGINT COMMENT '更新人ID', |
||||
|
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
||||
|
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
||||
|
UNIQUE KEY uk_table_biz_field (table_name, biz_id, field_code, is_active, is_deleted), |
||||
|
KEY idx_table_bizid (table_name, biz_id), |
||||
|
KEY idx_plain_hash (plain_hash), |
||||
|
KEY idx_key_version (key_version), |
||||
|
KEY idx_field_code (field_code) |
||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='密评敏感字段密文存储表'; |
||||
|
|
||||
|
-- 密评敏感操作审计表(记录解密、新增、修改、密钥轮换,满足密码应用审计) |
||||
|
CREATE TABLE crypto_operation_audit ( |
||||
|
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '主键ID', |
||||
|
sensitive_data_id BIGINT COMMENT '关联 crypto_sensitive_data 主键ID', |
||||
|
table_name VARCHAR(64) NOT NULL COMMENT '业务表名', |
||||
|
biz_id VARCHAR(128) NOT NULL COMMENT '业务记录主键', |
||||
|
field_code VARCHAR(64) NOT NULL COMMENT '敏感字段编码', |
||||
|
operate_type TINYINT NOT NULL COMMENT '操作类型:1新增密文 2解密查看 3修改密文 4密钥轮换', |
||||
|
operator_id BIGINT COMMENT '操作人ID(系统用户ID)', |
||||
|
operator_ip VARCHAR(64) COMMENT '操作客户端IP地址', |
||||
|
operate_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '操作发生时间', |
||||
|
remark TEXT COMMENT '操作备注信息', |
||||
|
is_deleted TINYINT DEFAULT 0 COMMENT '逻辑删除', |
||||
|
KEY idx_sensitive_data_id (sensitive_data_id), |
||||
|
KEY idx_table_bizid (table_name, biz_id), |
||||
|
KEY idx_operate_time (operate_time), |
||||
|
KEY idx_operator_id (operator_id) |
||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='密评敏感字段操作审计表'; |
||||
|
|
||||
|
-- 通用数据完整性校验表(密评 GB/T 39786 数据完整性) |
||||
|
CREATE TABLE crypto_integrity_data ( |
||||
|
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '主键ID', |
||||
|
table_name VARCHAR(64) NOT NULL COMMENT '业务表名,如 sys_user', |
||||
|
biz_id VARCHAR(128) NOT NULL COMMENT '业务记录主键,字符串兼容数字/UUID', |
||||
|
field_list TEXT NOT NULL COMMENT '参与完整性摘要的字段列表,逗号分隔:username,id_card,phone', |
||||
|
sm3_hash VARCHAR(128) NOT NULL COMMENT '业务字段拼接明文的SM3摘要值,用于完整性校验', |
||||
|
hash_alg VARCHAR(32) NOT NULL DEFAULT 'SM3' COMMENT '完整性哈希算法:SM3', |
||||
|
generate_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '摘要生成时间', |
||||
|
last_verify_time DATETIME NULL COMMENT '最近一次完整性校验时间', |
||||
|
verify_result TINYINT NULL COMMENT '校验结果:0未校验 1校验通过 2校验失败(篡改)', |
||||
|
is_deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除', |
||||
|
create_by BIGINT COMMENT '创建人ID', |
||||
|
update_by BIGINT COMMENT '更新人ID', |
||||
|
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '记录创建时间', |
||||
|
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '记录更新时间', |
||||
|
-- 唯一约束:一张业务表,一条业务记录,仅保留一条有效完整性摘要 |
||||
|
UNIQUE KEY uk_table_biz (table_name, biz_id, is_deleted), |
||||
|
KEY idx_table_bizid (table_name, biz_id), |
||||
|
KEY idx_verify_result (verify_result), |
||||
|
KEY idx_generate_time (generate_time) |
||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据完整性校验表'; |
||||
@ -0,0 +1,75 @@ |
|||||
|
package com.zdxt.enforcementcode.domain.bean; |
||||
|
|
||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity; |
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 数据完整性校验对象 crypto_integrity_data |
||||
|
* |
||||
|
* @author vincent |
||||
|
* @date 2026-09-28 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@TableName("crypto_integrity_data") |
||||
|
public class CryptoIntegrityData extends BaseEntity { |
||||
|
|
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 主键ID |
||||
|
*/ |
||||
|
@TableId(value = "id") |
||||
|
private Long id; |
||||
|
|
||||
|
/** |
||||
|
* 业务表名,如 sys_user |
||||
|
*/ |
||||
|
private String tableName; |
||||
|
|
||||
|
/** |
||||
|
* 业务记录主键,字符串兼容数字/UUID |
||||
|
*/ |
||||
|
private String bizId; |
||||
|
|
||||
|
/** |
||||
|
* 参与完整性摘要的字段列表,逗号分隔:username,id_card,phone |
||||
|
*/ |
||||
|
private String fieldList; |
||||
|
|
||||
|
/** |
||||
|
* 业务字段拼接明文的SM3摘要值,用于完整性校验 |
||||
|
*/ |
||||
|
private String sm3Hash; |
||||
|
|
||||
|
/** |
||||
|
* 完整性哈希算法:SM3 |
||||
|
*/ |
||||
|
private String hashAlg; |
||||
|
|
||||
|
/** |
||||
|
* 摘要生成时间 |
||||
|
*/ |
||||
|
private Date generateTime; |
||||
|
|
||||
|
/** |
||||
|
* 最近一次完整性校验时间 |
||||
|
*/ |
||||
|
private Date lastVerifyTime; |
||||
|
|
||||
|
/** |
||||
|
* 校验结果:0未校验 1校验通过 2校验失败(篡改) |
||||
|
*/ |
||||
|
private Integer verifyResult; |
||||
|
|
||||
|
/** |
||||
|
* 逻辑删除 |
||||
|
*/ |
||||
|
private Integer isDeleted; |
||||
|
} |
||||
@ -0,0 +1,80 @@ |
|||||
|
package com.zdxt.enforcementcode.domain.bean; |
||||
|
|
||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity; |
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 密评敏感字段操作审计对象 crypto_operation_audit |
||||
|
* |
||||
|
* @author vincent |
||||
|
* @date 2026-09-28 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@TableName("crypto_operation_audit") |
||||
|
public class CryptoOperationAudit extends BaseEntity { |
||||
|
|
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 主键ID |
||||
|
*/ |
||||
|
@TableId(value = "id") |
||||
|
private Long id; |
||||
|
|
||||
|
/** |
||||
|
* 关联 crypto_sensitive_data 主键ID |
||||
|
*/ |
||||
|
private Long sensitiveDataId; |
||||
|
|
||||
|
/** |
||||
|
* 业务表名 |
||||
|
*/ |
||||
|
private String tableName; |
||||
|
|
||||
|
/** |
||||
|
* 业务记录主键 |
||||
|
*/ |
||||
|
private String bizId; |
||||
|
|
||||
|
/** |
||||
|
* 敏感字段编码 |
||||
|
*/ |
||||
|
private String fieldCode; |
||||
|
|
||||
|
/** |
||||
|
* 操作类型:1新增密文 2解密查看 3修改密文 4密钥轮换 |
||||
|
*/ |
||||
|
private Integer operateType; |
||||
|
|
||||
|
/** |
||||
|
* 操作人ID(系统用户ID) |
||||
|
*/ |
||||
|
private Long operatorId; |
||||
|
|
||||
|
/** |
||||
|
* 操作客户端IP地址 |
||||
|
*/ |
||||
|
private String operatorIp; |
||||
|
|
||||
|
/** |
||||
|
* 操作发生时间 |
||||
|
*/ |
||||
|
private Date operateTime; |
||||
|
|
||||
|
/** |
||||
|
* 操作备注信息 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
|
||||
|
/** |
||||
|
* 逻辑删除 |
||||
|
*/ |
||||
|
private Integer isDeleted; |
||||
|
} |
||||
@ -0,0 +1,89 @@ |
|||||
|
package com.zdxt.enforcementcode.domain.bean; |
||||
|
|
||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity; |
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
|
||||
|
/** |
||||
|
* 密评敏感字段密文存储对象 crypto_sensitive_data |
||||
|
* |
||||
|
* @author vincent |
||||
|
* @date 2026-09-28 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@TableName("crypto_sensitive_data") |
||||
|
public class CryptoSensitiveData extends BaseEntity { |
||||
|
|
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 主键ID |
||||
|
*/ |
||||
|
@TableId(value = "id") |
||||
|
private Long id; |
||||
|
|
||||
|
/** |
||||
|
* 业务表名,如 sys_user |
||||
|
*/ |
||||
|
private String tableName; |
||||
|
|
||||
|
/** |
||||
|
* 业务表主键ID,字符串兼容数字/UUID主键 |
||||
|
*/ |
||||
|
private String bizId; |
||||
|
|
||||
|
/** |
||||
|
* 业务字段编码,username/id_card/phone/password |
||||
|
*/ |
||||
|
private String fieldCode; |
||||
|
|
||||
|
/** |
||||
|
* 字段原始值 |
||||
|
*/ |
||||
|
private String fieldValue; |
||||
|
|
||||
|
/** |
||||
|
* SM4-CBC密文Base64;password单向哈希场景此字段为空 |
||||
|
*/ |
||||
|
private String cipherText; |
||||
|
|
||||
|
/** |
||||
|
* SM4-CBC初始化向量,16字节随机值Base64;password此字段为空 |
||||
|
*/ |
||||
|
private String fieldIv; |
||||
|
|
||||
|
/** |
||||
|
* 明文SM3哈希,仅用于等值查询,不可逆 |
||||
|
*/ |
||||
|
private String plainHash; |
||||
|
|
||||
|
/** |
||||
|
* 哈希盐值,仅password单向哈希字段使用 |
||||
|
*/ |
||||
|
private String fieldSalt; |
||||
|
|
||||
|
/** |
||||
|
* 加密算法:SM4-CBC / SM3 |
||||
|
*/ |
||||
|
private String encryptAlg; |
||||
|
|
||||
|
/** |
||||
|
* 密钥版本号,用于密钥轮换,密评必查 |
||||
|
*/ |
||||
|
private String keyVersion; |
||||
|
|
||||
|
/** |
||||
|
* 是否为当前有效密文:1有效,0历史旧密文(密钥轮换保留) |
||||
|
*/ |
||||
|
private Integer isActive; |
||||
|
|
||||
|
/** |
||||
|
* 逻辑删除:0未删除,1已删除 |
||||
|
*/ |
||||
|
private Integer isDeleted; |
||||
|
} |
||||
@ -0,0 +1,78 @@ |
|||||
|
package com.zdxt.enforcementcode.domain.bo; |
||||
|
|
||||
|
import com.zdxt.enforcementcode.domain.bean.CryptoIntegrityData; |
||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity; |
||||
|
import org.dromara.common.core.validate.AddGroup; |
||||
|
import org.dromara.common.core.validate.EditGroup; |
||||
|
import io.github.linpeilie.annotations.AutoMapper; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import jakarta.validation.constraints.*; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 数据完整性校验业务对象 crypto_integrity_data |
||||
|
* |
||||
|
* @author vincent |
||||
|
* @date 2026-09-28 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@AutoMapper(target = CryptoIntegrityData.class, reverseConvertGenerate = false) |
||||
|
public class CryptoIntegrityDataBo extends BaseEntity { |
||||
|
|
||||
|
/** |
||||
|
* 主键ID |
||||
|
*/ |
||||
|
@NotNull(message = "主键ID不能为空", groups = { EditGroup.class }) |
||||
|
private Long id; |
||||
|
|
||||
|
/** |
||||
|
* 业务表名,如 sys_user |
||||
|
*/ |
||||
|
@NotBlank(message = "业务表名不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private String tableName; |
||||
|
|
||||
|
/** |
||||
|
* 业务记录主键,字符串兼容数字/UUID |
||||
|
*/ |
||||
|
@NotBlank(message = "业务记录主键不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private String bizId; |
||||
|
|
||||
|
/** |
||||
|
* 参与完整性摘要的字段列表,逗号分隔:username,id_card,phone |
||||
|
*/ |
||||
|
@NotBlank(message = "参与完整性摘要的字段列表不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private String fieldList; |
||||
|
|
||||
|
/** |
||||
|
* 业务字段拼接明文的SM3摘要值,用于完整性校验 |
||||
|
*/ |
||||
|
@NotBlank(message = "SM3摘要值不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private String sm3Hash; |
||||
|
|
||||
|
/** |
||||
|
* 完整性哈希算法:SM3 |
||||
|
*/ |
||||
|
private String hashAlg; |
||||
|
|
||||
|
/** |
||||
|
* 摘要生成时间 |
||||
|
*/ |
||||
|
private Date generateTime; |
||||
|
|
||||
|
/** |
||||
|
* 最近一次完整性校验时间 |
||||
|
*/ |
||||
|
private Date lastVerifyTime; |
||||
|
|
||||
|
/** |
||||
|
* 校验结果:0未校验 1校验通过 2校验失败(篡改) |
||||
|
*/ |
||||
|
private Integer verifyResult; |
||||
|
|
||||
|
/** |
||||
|
* 逻辑删除 |
||||
|
*/ |
||||
|
private Integer isDeleted; |
||||
|
} |
||||
@ -0,0 +1,83 @@ |
|||||
|
package com.zdxt.enforcementcode.domain.bo; |
||||
|
|
||||
|
import com.zdxt.enforcementcode.domain.bean.CryptoOperationAudit; |
||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity; |
||||
|
import org.dromara.common.core.validate.AddGroup; |
||||
|
import org.dromara.common.core.validate.EditGroup; |
||||
|
import io.github.linpeilie.annotations.AutoMapper; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import jakarta.validation.constraints.*; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 密评敏感字段操作审计业务对象 crypto_operation_audit |
||||
|
* |
||||
|
* @author vincent |
||||
|
* @date 2026-09-28 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@AutoMapper(target = CryptoOperationAudit.class, reverseConvertGenerate = false) |
||||
|
public class CryptoOperationAuditBo extends BaseEntity { |
||||
|
|
||||
|
/** |
||||
|
* 主键ID |
||||
|
*/ |
||||
|
@NotNull(message = "主键ID不能为空", groups = { EditGroup.class }) |
||||
|
private Long id; |
||||
|
|
||||
|
/** |
||||
|
* 关联 crypto_sensitive_data 主键ID |
||||
|
*/ |
||||
|
private Long sensitiveDataId; |
||||
|
|
||||
|
/** |
||||
|
* 业务表名 |
||||
|
*/ |
||||
|
@NotBlank(message = "业务表名不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private String tableName; |
||||
|
|
||||
|
/** |
||||
|
* 业务记录主键 |
||||
|
*/ |
||||
|
@NotBlank(message = "业务记录主键不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private String bizId; |
||||
|
|
||||
|
/** |
||||
|
* 敏感字段编码 |
||||
|
*/ |
||||
|
@NotBlank(message = "敏感字段编码不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private String fieldCode; |
||||
|
|
||||
|
/** |
||||
|
* 操作类型:1新增密文 2解密查看 3修改密文 4密钥轮换 |
||||
|
*/ |
||||
|
@NotNull(message = "操作类型不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private Integer operateType; |
||||
|
|
||||
|
/** |
||||
|
* 操作人ID(系统用户ID) |
||||
|
*/ |
||||
|
private Long operatorId; |
||||
|
|
||||
|
/** |
||||
|
* 操作客户端IP地址 |
||||
|
*/ |
||||
|
private String operatorIp; |
||||
|
|
||||
|
/** |
||||
|
* 操作发生时间 |
||||
|
*/ |
||||
|
private Date operateTime; |
||||
|
|
||||
|
/** |
||||
|
* 操作备注信息 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
|
||||
|
/** |
||||
|
* 逻辑删除 |
||||
|
*/ |
||||
|
private Integer isDeleted; |
||||
|
} |
||||
@ -0,0 +1,92 @@ |
|||||
|
package com.zdxt.enforcementcode.domain.bo; |
||||
|
|
||||
|
import com.zdxt.enforcementcode.domain.bean.CryptoSensitiveData; |
||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity; |
||||
|
import org.dromara.common.core.validate.AddGroup; |
||||
|
import org.dromara.common.core.validate.EditGroup; |
||||
|
import io.github.linpeilie.annotations.AutoMapper; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import jakarta.validation.constraints.*; |
||||
|
|
||||
|
/** |
||||
|
* 密评敏感字段密文存储业务对象 crypto_sensitive_data |
||||
|
* |
||||
|
* @author vincent |
||||
|
* @date 2026-09-28 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@AutoMapper(target = CryptoSensitiveData.class, reverseConvertGenerate = false) |
||||
|
public class CryptoSensitiveDataBo extends BaseEntity { |
||||
|
|
||||
|
/** |
||||
|
* 主键ID |
||||
|
*/ |
||||
|
@NotNull(message = "主键ID不能为空", groups = { EditGroup.class }) |
||||
|
private Long id; |
||||
|
|
||||
|
/** |
||||
|
* 业务表名,如 sys_user |
||||
|
*/ |
||||
|
@NotBlank(message = "业务表名不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private String tableName; |
||||
|
|
||||
|
/** |
||||
|
* 业务表主键ID,字符串兼容数字/UUID主键 |
||||
|
*/ |
||||
|
@NotBlank(message = "业务表主键ID不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private String bizId; |
||||
|
|
||||
|
/** |
||||
|
* 业务字段编码,username/id_card/phone/password |
||||
|
*/ |
||||
|
@NotBlank(message = "业务字段编码不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private String fieldCode; |
||||
|
|
||||
|
/** |
||||
|
* 字段原始值 |
||||
|
*/ |
||||
|
private String fieldValue; |
||||
|
|
||||
|
/** |
||||
|
* SM4-CBC密文Base64;password单向哈希场景此字段为空 |
||||
|
*/ |
||||
|
private String cipherText; |
||||
|
|
||||
|
/** |
||||
|
* SM4-CBC初始化向量,16字节随机值Base64;password此字段为空 |
||||
|
*/ |
||||
|
private String fieldIv; |
||||
|
|
||||
|
/** |
||||
|
* 明文SM3哈希,仅用于等值查询,不可逆 |
||||
|
*/ |
||||
|
private String plainHash; |
||||
|
|
||||
|
/** |
||||
|
* 哈希盐值,仅password单向哈希字段使用 |
||||
|
*/ |
||||
|
private String fieldSalt; |
||||
|
|
||||
|
/** |
||||
|
* 加密算法:SM4-CBC / SM3 |
||||
|
*/ |
||||
|
private String encryptAlg; |
||||
|
|
||||
|
/** |
||||
|
* 密钥版本号,用于密钥轮换,密评必查 |
||||
|
*/ |
||||
|
@NotBlank(message = "密钥版本号不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private String keyVersion; |
||||
|
|
||||
|
/** |
||||
|
* 是否为当前有效密文:1有效,0历史旧密文(密钥轮换保留) |
||||
|
*/ |
||||
|
private Integer isActive; |
||||
|
|
||||
|
/** |
||||
|
* 逻辑删除:0未删除,1已删除 |
||||
|
*/ |
||||
|
private Integer isDeleted; |
||||
|
} |
||||
@ -0,0 +1,62 @@ |
|||||
|
package com.zdxt.enforcementcode.domain.vo; |
||||
|
|
||||
|
import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
||||
|
import cn.idev.excel.annotation.ExcelProperty; |
||||
|
import com.zdxt.enforcementcode.domain.bean.CryptoIntegrityData; |
||||
|
import io.github.linpeilie.annotations.AutoMapper; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
@Data |
||||
|
@ExcelIgnoreUnannotated |
||||
|
@AutoMapper(target = CryptoIntegrityData.class) |
||||
|
public class CryptoIntegrityDataVo implements Serializable { |
||||
|
|
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
@ExcelProperty(value = "主键ID") |
||||
|
private Long id; |
||||
|
|
||||
|
@ExcelProperty(value = "业务表名") |
||||
|
private String tableName; |
||||
|
|
||||
|
@ExcelProperty(value = "业务记录主键") |
||||
|
private String bizId; |
||||
|
|
||||
|
@ExcelProperty(value = "参与完整性摘要的字段列表") |
||||
|
private String fieldList; |
||||
|
|
||||
|
@ExcelProperty(value = "SM3摘要值") |
||||
|
private String sm3Hash; |
||||
|
|
||||
|
@ExcelProperty(value = "完整性哈希算法") |
||||
|
private String hashAlg; |
||||
|
|
||||
|
@ExcelProperty(value = "摘要生成时间") |
||||
|
private Date generateTime; |
||||
|
|
||||
|
@ExcelProperty(value = "最近一次完整性校验时间") |
||||
|
private Date lastVerifyTime; |
||||
|
|
||||
|
@ExcelProperty(value = "校验结果") |
||||
|
private Integer verifyResult; |
||||
|
|
||||
|
@ExcelProperty(value = "逻辑删除") |
||||
|
private Integer isDeleted; |
||||
|
|
||||
|
@ExcelProperty(value = "创建人ID") |
||||
|
private Long createBy; |
||||
|
|
||||
|
@ExcelProperty(value = "更新人ID") |
||||
|
private Long updateBy; |
||||
|
|
||||
|
@ExcelProperty(value = "创建时间") |
||||
|
private Date createTime; |
||||
|
|
||||
|
@ExcelProperty(value = "更新时间") |
||||
|
private Date updateTime; |
||||
|
} |
||||
@ -0,0 +1,53 @@ |
|||||
|
package com.zdxt.enforcementcode.domain.vo; |
||||
|
|
||||
|
import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
||||
|
import cn.idev.excel.annotation.ExcelProperty; |
||||
|
import com.zdxt.enforcementcode.domain.bean.CryptoOperationAudit; |
||||
|
import io.github.linpeilie.annotations.AutoMapper; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
@Data |
||||
|
@ExcelIgnoreUnannotated |
||||
|
@AutoMapper(target = CryptoOperationAudit.class) |
||||
|
public class CryptoOperationAuditVo implements Serializable { |
||||
|
|
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
@ExcelProperty(value = "主键ID") |
||||
|
private Long id; |
||||
|
|
||||
|
@ExcelProperty(value = "关联敏感数据ID") |
||||
|
private Long sensitiveDataId; |
||||
|
|
||||
|
@ExcelProperty(value = "业务表名") |
||||
|
private String tableName; |
||||
|
|
||||
|
@ExcelProperty(value = "业务记录主键") |
||||
|
private String bizId; |
||||
|
|
||||
|
@ExcelProperty(value = "敏感字段编码") |
||||
|
private String fieldCode; |
||||
|
|
||||
|
@ExcelProperty(value = "操作类型") |
||||
|
private Integer operateType; |
||||
|
|
||||
|
@ExcelProperty(value = "操作人ID") |
||||
|
private Long operatorId; |
||||
|
|
||||
|
@ExcelProperty(value = "操作人IP") |
||||
|
private String operatorIp; |
||||
|
|
||||
|
@ExcelProperty(value = "操作时间") |
||||
|
private Date operateTime; |
||||
|
|
||||
|
@ExcelProperty(value = "操作备注") |
||||
|
private String remark; |
||||
|
|
||||
|
@ExcelProperty(value = "逻辑删除") |
||||
|
private Integer isDeleted; |
||||
|
} |
||||
@ -0,0 +1,72 @@ |
|||||
|
package com.zdxt.enforcementcode.domain.vo; |
||||
|
|
||||
|
|
||||
|
import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
||||
|
import cn.idev.excel.annotation.ExcelProperty; |
||||
|
import com.zdxt.enforcementcode.domain.bean.CryptoSensitiveData; |
||||
|
import io.github.linpeilie.annotations.AutoMapper; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
@Data |
||||
|
@ExcelIgnoreUnannotated |
||||
|
@AutoMapper(target = CryptoSensitiveData.class) |
||||
|
public class CryptoSensitiveDataVo implements Serializable { |
||||
|
|
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
@ExcelProperty(value = "主键ID") |
||||
|
private Long id; |
||||
|
|
||||
|
@ExcelProperty(value = "业务表名") |
||||
|
private String tableName; |
||||
|
|
||||
|
@ExcelProperty(value = "业务表主键ID") |
||||
|
private String bizId; |
||||
|
|
||||
|
@ExcelProperty(value = "业务字段编码") |
||||
|
private String fieldCode; |
||||
|
|
||||
|
@ExcelProperty(value = "字段原始值") |
||||
|
private String fieldValue; |
||||
|
|
||||
|
@ExcelProperty(value = "SM4-CBC密文") |
||||
|
private String cipherText; |
||||
|
|
||||
|
@ExcelProperty(value = "SM4-CBC初始化向量") |
||||
|
private String fieldIv; |
||||
|
|
||||
|
@ExcelProperty(value = "明文SM3哈希") |
||||
|
private String plainHash; |
||||
|
|
||||
|
@ExcelProperty(value = "哈希盐值") |
||||
|
private String fieldSalt; |
||||
|
|
||||
|
@ExcelProperty(value = "加密算法") |
||||
|
private String encryptAlg; |
||||
|
|
||||
|
@ExcelProperty(value = "密钥版本号") |
||||
|
private String keyVersion; |
||||
|
|
||||
|
@ExcelProperty(value = "是否有效密文") |
||||
|
private Integer isActive; |
||||
|
|
||||
|
@ExcelProperty(value = "逻辑删除") |
||||
|
private Integer isDeleted; |
||||
|
|
||||
|
@ExcelProperty(value = "创建人ID") |
||||
|
private Long createBy; |
||||
|
|
||||
|
@ExcelProperty(value = "更新人ID") |
||||
|
private Long updateBy; |
||||
|
|
||||
|
@ExcelProperty(value = "创建时间") |
||||
|
private Date createTime; |
||||
|
|
||||
|
@ExcelProperty(value = "更新时间") |
||||
|
private Date updateTime; |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
package com.zdxt.enforcementcode.mapper; |
||||
|
|
||||
|
|
||||
|
import com.zdxt.enforcementcode.domain.bean.CryptoIntegrityData; |
||||
|
import com.zdxt.enforcementcode.domain.vo.CryptoIntegrityDataVo; |
||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
||||
|
|
||||
|
public interface CryptoIntegrityDataMapper extends BaseMapperPlus<CryptoIntegrityData, CryptoIntegrityDataVo> { |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
package com.zdxt.enforcementcode.mapper; |
||||
|
|
||||
|
|
||||
|
import com.zdxt.enforcementcode.domain.bean.CryptoOperationAudit; |
||||
|
import com.zdxt.enforcementcode.domain.vo.CryptoOperationAuditVo; |
||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
||||
|
|
||||
|
public interface CryptoOperationAuditMapper extends BaseMapperPlus<CryptoOperationAudit, CryptoOperationAuditVo> { |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
package com.zdxt.enforcementcode.mapper; |
||||
|
|
||||
|
import com.zdxt.enforcementcode.domain.bean.CryptoSensitiveData; |
||||
|
import com.zdxt.enforcementcode.domain.vo.CryptoSensitiveDataVo; |
||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
||||
|
|
||||
|
public interface CryptoSensitiveDataMapper extends BaseMapperPlus<CryptoSensitiveData, CryptoSensitiveDataVo> { |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.zdxt.enforcementcode.service; |
||||
|
|
||||
|
import com.zdxt.enforcementcode.domain.vo.CryptoIntegrityDataVo; |
||||
|
import com.zdxt.enforcementcode.domain.bo.CryptoIntegrityDataBo; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
|
||||
|
import java.util.Collection; |
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface ICryptoIntegrityDataService { |
||||
|
|
||||
|
CryptoIntegrityDataVo queryById(Long id); |
||||
|
|
||||
|
TableDataInfo<CryptoIntegrityDataVo> queryPageList(CryptoIntegrityDataBo bo, PageQuery pageQuery); |
||||
|
|
||||
|
List<CryptoIntegrityDataVo> queryList(CryptoIntegrityDataBo bo); |
||||
|
|
||||
|
Boolean insertByBo(CryptoIntegrityDataBo bo); |
||||
|
|
||||
|
Boolean updateByBo(CryptoIntegrityDataBo bo); |
||||
|
|
||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.zdxt.enforcementcode.service; |
||||
|
|
||||
|
import com.zdxt.enforcementcode.domain.vo.CryptoOperationAuditVo; |
||||
|
import com.zdxt.enforcementcode.domain.bo.CryptoOperationAuditBo; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
|
||||
|
import java.util.Collection; |
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface ICryptoOperationAuditService { |
||||
|
|
||||
|
CryptoOperationAuditVo queryById(Long id); |
||||
|
|
||||
|
TableDataInfo<CryptoOperationAuditVo> queryPageList(CryptoOperationAuditBo bo, PageQuery pageQuery); |
||||
|
|
||||
|
List<CryptoOperationAuditVo> queryList(CryptoOperationAuditBo bo); |
||||
|
|
||||
|
Boolean insertByBo(CryptoOperationAuditBo bo); |
||||
|
|
||||
|
Boolean updateByBo(CryptoOperationAuditBo bo); |
||||
|
|
||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.zdxt.enforcementcode.service; |
||||
|
|
||||
|
import com.zdxt.enforcementcode.domain.vo.CryptoSensitiveDataVo; |
||||
|
import com.zdxt.enforcementcode.domain.bo.CryptoSensitiveDataBo; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
|
||||
|
import java.util.Collection; |
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface ICryptoSensitiveDataService { |
||||
|
|
||||
|
CryptoSensitiveDataVo queryById(Long id); |
||||
|
|
||||
|
TableDataInfo<CryptoSensitiveDataVo> queryPageList(CryptoSensitiveDataBo bo, PageQuery pageQuery); |
||||
|
|
||||
|
List<CryptoSensitiveDataVo> queryList(CryptoSensitiveDataBo bo); |
||||
|
|
||||
|
Boolean insertByBo(CryptoSensitiveDataBo bo); |
||||
|
|
||||
|
Boolean updateByBo(CryptoSensitiveDataBo bo); |
||||
|
|
||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
||||
|
} |
||||
@ -0,0 +1,89 @@ |
|||||
|
package com.zdxt.enforcementcode.service.impl; |
||||
|
|
||||
|
import com.zdxt.enforcementcode.domain.bean.CryptoIntegrityData; |
||||
|
import org.dromara.common.core.utils.MapstructUtils; |
||||
|
import org.dromara.common.core.utils.StringUtils; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.zdxt.enforcementcode.domain.bo.CryptoIntegrityDataBo; |
||||
|
import com.zdxt.enforcementcode.domain.vo.CryptoIntegrityDataVo; |
||||
|
import com.zdxt.enforcementcode.mapper.CryptoIntegrityDataMapper; |
||||
|
import com.zdxt.enforcementcode.service.ICryptoIntegrityDataService; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.Collection; |
||||
|
|
||||
|
@Slf4j |
||||
|
@RequiredArgsConstructor |
||||
|
@Service |
||||
|
public class CryptoIntegrityDataServiceImpl implements ICryptoIntegrityDataService { |
||||
|
|
||||
|
private final CryptoIntegrityDataMapper baseMapper; |
||||
|
|
||||
|
@Override |
||||
|
public CryptoIntegrityDataVo queryById(Long id) { |
||||
|
return baseMapper.selectVoById(id); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public TableDataInfo<CryptoIntegrityDataVo> queryPageList(CryptoIntegrityDataBo bo, PageQuery pageQuery) { |
||||
|
LambdaQueryWrapper<CryptoIntegrityData> lqw = buildQueryWrapper(bo); |
||||
|
Page<CryptoIntegrityDataVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
||||
|
return TableDataInfo.build(result); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<CryptoIntegrityDataVo> queryList(CryptoIntegrityDataBo bo) { |
||||
|
LambdaQueryWrapper<CryptoIntegrityData> lqw = buildQueryWrapper(bo); |
||||
|
return baseMapper.selectVoList(lqw); |
||||
|
} |
||||
|
|
||||
|
private LambdaQueryWrapper<CryptoIntegrityData> buildQueryWrapper(CryptoIntegrityDataBo bo) { |
||||
|
Map<String, Object> params = bo.getParams(); |
||||
|
LambdaQueryWrapper<CryptoIntegrityData> lqw = Wrappers.lambdaQuery(); |
||||
|
lqw.orderByAsc(CryptoIntegrityData::getId); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getTableName()), CryptoIntegrityData::getTableName, bo.getTableName()); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getBizId()), CryptoIntegrityData::getBizId, bo.getBizId()); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getHashAlg()), CryptoIntegrityData::getHashAlg, bo.getHashAlg()); |
||||
|
lqw.eq(bo.getVerifyResult() != null, CryptoIntegrityData::getVerifyResult, bo.getVerifyResult()); |
||||
|
lqw.eq(bo.getIsDeleted() != null, CryptoIntegrityData::getIsDeleted, bo.getIsDeleted()); |
||||
|
return lqw; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean insertByBo(CryptoIntegrityDataBo bo) { |
||||
|
CryptoIntegrityData add = MapstructUtils.convert(bo, CryptoIntegrityData.class); |
||||
|
validEntityBeforeSave(add); |
||||
|
boolean flag = baseMapper.insert(add) > 0; |
||||
|
if (flag) { |
||||
|
bo.setId(add.getId()); |
||||
|
} |
||||
|
return flag; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean updateByBo(CryptoIntegrityDataBo bo) { |
||||
|
CryptoIntegrityData update = MapstructUtils.convert(bo, CryptoIntegrityData.class); |
||||
|
validEntityBeforeSave(update); |
||||
|
return baseMapper.updateById(update) > 0; |
||||
|
} |
||||
|
|
||||
|
private void validEntityBeforeSave(CryptoIntegrityData entity) { |
||||
|
//TODO 做一些数据校验,如唯一约束
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
||||
|
if (isValid) { |
||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
} |
||||
|
return baseMapper.deleteByIds(ids) > 0; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,91 @@ |
|||||
|
package com.zdxt.enforcementcode.service.impl; |
||||
|
|
||||
|
import com.zdxt.enforcementcode.domain.bean.CryptoOperationAudit; |
||||
|
import org.dromara.common.core.utils.MapstructUtils; |
||||
|
import org.dromara.common.core.utils.StringUtils; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.zdxt.enforcementcode.domain.bo.CryptoOperationAuditBo; |
||||
|
import com.zdxt.enforcementcode.domain.vo.CryptoOperationAuditVo; |
||||
|
import com.zdxt.enforcementcode.mapper.CryptoOperationAuditMapper; |
||||
|
import com.zdxt.enforcementcode.service.ICryptoOperationAuditService; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.Collection; |
||||
|
|
||||
|
@Slf4j |
||||
|
@RequiredArgsConstructor |
||||
|
@Service |
||||
|
public class CryptoOperationAuditServiceImpl implements ICryptoOperationAuditService { |
||||
|
|
||||
|
private final CryptoOperationAuditMapper baseMapper; |
||||
|
|
||||
|
@Override |
||||
|
public CryptoOperationAuditVo queryById(Long id) { |
||||
|
return baseMapper.selectVoById(id); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public TableDataInfo<CryptoOperationAuditVo> queryPageList(CryptoOperationAuditBo bo, PageQuery pageQuery) { |
||||
|
LambdaQueryWrapper<CryptoOperationAudit> lqw = buildQueryWrapper(bo); |
||||
|
Page<CryptoOperationAuditVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
||||
|
return TableDataInfo.build(result); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<CryptoOperationAuditVo> queryList(CryptoOperationAuditBo bo) { |
||||
|
LambdaQueryWrapper<CryptoOperationAudit> lqw = buildQueryWrapper(bo); |
||||
|
return baseMapper.selectVoList(lqw); |
||||
|
} |
||||
|
|
||||
|
private LambdaQueryWrapper<CryptoOperationAudit> buildQueryWrapper(CryptoOperationAuditBo bo) { |
||||
|
Map<String, Object> params = bo.getParams(); |
||||
|
LambdaQueryWrapper<CryptoOperationAudit> lqw = Wrappers.lambdaQuery(); |
||||
|
lqw.orderByAsc(CryptoOperationAudit::getId); |
||||
|
lqw.eq(bo.getSensitiveDataId() != null, CryptoOperationAudit::getSensitiveDataId, bo.getSensitiveDataId()); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getTableName()), CryptoOperationAudit::getTableName, bo.getTableName()); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getBizId()), CryptoOperationAudit::getBizId, bo.getBizId()); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getFieldCode()), CryptoOperationAudit::getFieldCode, bo.getFieldCode()); |
||||
|
lqw.eq(bo.getOperateType() != null, CryptoOperationAudit::getOperateType, bo.getOperateType()); |
||||
|
lqw.eq(bo.getOperatorId() != null, CryptoOperationAudit::getOperatorId, bo.getOperatorId()); |
||||
|
lqw.eq(bo.getIsDeleted() != null, CryptoOperationAudit::getIsDeleted, bo.getIsDeleted()); |
||||
|
return lqw; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean insertByBo(CryptoOperationAuditBo bo) { |
||||
|
CryptoOperationAudit add = MapstructUtils.convert(bo, CryptoOperationAudit.class); |
||||
|
validEntityBeforeSave(add); |
||||
|
boolean flag = baseMapper.insert(add) > 0; |
||||
|
if (flag) { |
||||
|
bo.setId(add.getId()); |
||||
|
} |
||||
|
return flag; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean updateByBo(CryptoOperationAuditBo bo) { |
||||
|
CryptoOperationAudit update = MapstructUtils.convert(bo, CryptoOperationAudit.class); |
||||
|
validEntityBeforeSave(update); |
||||
|
return baseMapper.updateById(update) > 0; |
||||
|
} |
||||
|
|
||||
|
private void validEntityBeforeSave(CryptoOperationAudit entity) { |
||||
|
//TODO 做一些数据校验,如唯一约束
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
||||
|
if (isValid) { |
||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
} |
||||
|
return baseMapper.deleteByIds(ids) > 0; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,91 @@ |
|||||
|
package com.zdxt.enforcementcode.service.impl; |
||||
|
|
||||
|
import com.zdxt.enforcementcode.domain.bean.CryptoSensitiveData; |
||||
|
import org.dromara.common.core.utils.MapstructUtils; |
||||
|
import org.dromara.common.core.utils.StringUtils; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.zdxt.enforcementcode.domain.bo.CryptoSensitiveDataBo; |
||||
|
import com.zdxt.enforcementcode.domain.vo.CryptoSensitiveDataVo; |
||||
|
import com.zdxt.enforcementcode.mapper.CryptoSensitiveDataMapper; |
||||
|
import com.zdxt.enforcementcode.service.ICryptoSensitiveDataService; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.Collection; |
||||
|
|
||||
|
@Slf4j |
||||
|
@RequiredArgsConstructor |
||||
|
@Service |
||||
|
public class CryptoSensitiveDataServiceImpl implements ICryptoSensitiveDataService { |
||||
|
|
||||
|
private final CryptoSensitiveDataMapper baseMapper; |
||||
|
|
||||
|
@Override |
||||
|
public CryptoSensitiveDataVo queryById(Long id) { |
||||
|
return baseMapper.selectVoById(id); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public TableDataInfo<CryptoSensitiveDataVo> queryPageList(CryptoSensitiveDataBo bo, PageQuery pageQuery) { |
||||
|
LambdaQueryWrapper<CryptoSensitiveData> lqw = buildQueryWrapper(bo); |
||||
|
Page<CryptoSensitiveDataVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
||||
|
return TableDataInfo.build(result); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<CryptoSensitiveDataVo> queryList(CryptoSensitiveDataBo bo) { |
||||
|
LambdaQueryWrapper<CryptoSensitiveData> lqw = buildQueryWrapper(bo); |
||||
|
return baseMapper.selectVoList(lqw); |
||||
|
} |
||||
|
|
||||
|
private LambdaQueryWrapper<CryptoSensitiveData> buildQueryWrapper(CryptoSensitiveDataBo bo) { |
||||
|
Map<String, Object> params = bo.getParams(); |
||||
|
LambdaQueryWrapper<CryptoSensitiveData> lqw = Wrappers.lambdaQuery(); |
||||
|
lqw.orderByAsc(CryptoSensitiveData::getId); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getTableName()), CryptoSensitiveData::getTableName, bo.getTableName()); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getBizId()), CryptoSensitiveData::getBizId, bo.getBizId()); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getFieldCode()), CryptoSensitiveData::getFieldCode, bo.getFieldCode()); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getEncryptAlg()), CryptoSensitiveData::getEncryptAlg, bo.getEncryptAlg()); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getKeyVersion()), CryptoSensitiveData::getKeyVersion, bo.getKeyVersion()); |
||||
|
lqw.eq(bo.getIsActive() != null, CryptoSensitiveData::getIsActive, bo.getIsActive()); |
||||
|
lqw.eq(bo.getIsDeleted() != null, CryptoSensitiveData::getIsDeleted, bo.getIsDeleted()); |
||||
|
return lqw; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean insertByBo(CryptoSensitiveDataBo bo) { |
||||
|
CryptoSensitiveData add = MapstructUtils.convert(bo, CryptoSensitiveData.class); |
||||
|
validEntityBeforeSave(add); |
||||
|
boolean flag = baseMapper.insert(add) > 0; |
||||
|
if (flag) { |
||||
|
bo.setId(add.getId()); |
||||
|
} |
||||
|
return flag; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean updateByBo(CryptoSensitiveDataBo bo) { |
||||
|
CryptoSensitiveData update = MapstructUtils.convert(bo, CryptoSensitiveData.class); |
||||
|
validEntityBeforeSave(update); |
||||
|
return baseMapper.updateById(update) > 0; |
||||
|
} |
||||
|
|
||||
|
private void validEntityBeforeSave(CryptoSensitiveData entity) { |
||||
|
//TODO 做一些数据校验,如唯一约束
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
||||
|
if (isValid) { |
||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
} |
||||
|
return baseMapper.deleteByIds(ids) > 0; |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue