From e5ab9b71b65c11c7ad300c2b225d98a19348b349 Mon Sep 17 00:00:00 2001 From: gaibu <1016771049@qq.com> Date: Mon, 16 Jan 2023 21:50:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/regex/annotation/EmailDesensitize.java | 9 +++------ .../desensitize/core/slider/annotation/BankCard.java | 7 ++----- .../desensitize/core/slider/annotation/CarLicense.java | 7 ++----- .../desensitize/core/slider/annotation/ChineseName.java | 7 ++----- .../desensitize/core/slider/annotation/FixedPhone.java | 7 ++----- .../desensitize/core/slider/annotation/IdCard.java | 7 ++----- .../desensitize/core/slider/annotation/Password.java | 7 ++----- .../desensitize/core/slider/annotation/PhoneNumber.java | 7 ++----- 8 files changed, 17 insertions(+), 41 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/annotation/EmailDesensitize.java b/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/annotation/EmailDesensitize.java index 746e5503b..ebd754b1e 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/annotation/EmailDesensitize.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/annotation/EmailDesensitize.java @@ -17,18 +17,15 @@ import java.lang.annotation.Target; @Target({ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotationsInside -@Desensitize(desensitizationBy = EmailDesensitizationHandler.class) // 邮箱;比如:example@gmail.com脱敏之后为e****@gmail.com +@Desensitize(desensitizationBy = EmailDesensitizationHandler.class) public @interface EmailDesensitize { /** - * 匹配的正则表达式(默认匹配所有) + * 匹配的正则表达式 */ String regex() default "(^.)[^@]*(@.*$)"; /** - * 替换规则,会将匹配到的字符串全部替换成 replacer - * 例如:regex=123; replacer=****** - * 原始字符串 123456789 - * 脱敏后字符串 ******456789 + * 替换规则,邮箱;比如:example@gmail.com脱敏之后为e****@gmail.com */ String replacer() default "$1****$2"; } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/BankCard.java b/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/BankCard.java index 4402ab7d6..4c41569e8 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/BankCard.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/BankCard.java @@ -17,7 +17,7 @@ import java.lang.annotation.Target; @Target({ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotationsInside -@Desensitize(desensitizationBy = BankCardDesensitization.class)// 银行卡号;比如:9988002866797031脱敏之后为998800********31 +@Desensitize(desensitizationBy = BankCardDesensitization.class) public @interface BankCard { /** @@ -31,10 +31,7 @@ public @interface BankCard { int suffixKeep() default 2; /** - * 替换规则,会将前缀后缀保留后,全部替换成 replacer - * 例如:prefixKeep = 1; suffixKeep = 2; replacer = "*"; - * 原始字符串 123456 - * 脱敏后 1***56 + * 替换规则,银行卡号;比如:9988002866797031脱敏之后为998800********31 */ String replacer() default "*"; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/CarLicense.java b/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/CarLicense.java index 898c9d4a7..fb89ddb08 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/CarLicense.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/CarLicense.java @@ -17,7 +17,7 @@ import java.lang.annotation.Target; @Target({ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotationsInside -@Desensitize(desensitizationBy = CarLicenseDesensitization.class) // 车牌号;比如:粤A66666脱敏之后为粤A6***6 +@Desensitize(desensitizationBy = CarLicenseDesensitization.class) public @interface CarLicense { /** @@ -31,10 +31,7 @@ public @interface CarLicense { int suffixKeep() default 1; /** - * 替换规则,会将前缀后缀保留后,全部替换成 replacer - * 例如:prefixKeep = 1; suffixKeep = 2; replacer = "*"; - * 原始字符串 123456 - * 脱敏后 1***56 + * 替换规则,车牌号;比如:粤A66666脱敏之后为粤A6***6 */ String replacer() default "*"; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/ChineseName.java b/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/ChineseName.java index 5b7e7e638..3b4a1a530 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/ChineseName.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/ChineseName.java @@ -17,7 +17,7 @@ import java.lang.annotation.Target; @Target({ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotationsInside -@Desensitize(desensitizationBy = ChineseNameDesensitization.class) // 中文名;比如:刘子豪脱敏之后为刘** +@Desensitize(desensitizationBy = ChineseNameDesensitization.class) public @interface ChineseName { /** @@ -31,10 +31,7 @@ public @interface ChineseName { int suffixKeep() default 0; /** - * 替换规则,会将前缀后缀保留后,全部替换成 replacer - * 例如:prefixKeep = 1; suffixKeep = 2; replacer = "*"; - * 原始字符串 123456 - * 脱敏后 1***56 + * 替换规则,中文名;比如:刘子豪脱敏之后为刘** */ String replacer() default "*"; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/FixedPhone.java b/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/FixedPhone.java index 7833377c4..663388d89 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/FixedPhone.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/FixedPhone.java @@ -17,7 +17,7 @@ import java.lang.annotation.Target; @Target({ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotationsInside -@Desensitize(desensitizationBy = FixedPhoneDesensitization.class) // 固定电话;比如:01086551122脱敏之后为0108*****22 +@Desensitize(desensitizationBy = FixedPhoneDesensitization.class) public @interface FixedPhone { /** @@ -31,10 +31,7 @@ public @interface FixedPhone { int suffixKeep() default 2; /** - * 替换规则,会将前缀后缀保留后,全部替换成 replacer - * 例如:prefixKeep = 1; suffixKeep = 2; replacer = "*"; - * 原始字符串 123456 - * 脱敏后 1***56 + * 替换规则,固定电话;比如:01086551122脱敏之后为0108*****22 */ String replacer() default "*"; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/IdCard.java b/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/IdCard.java index 1f8c7a489..ac2ba9cd3 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/IdCard.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/IdCard.java @@ -17,7 +17,7 @@ import java.lang.annotation.Target; @Target({ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotationsInside -@Desensitize(desensitizationBy = IdCardDesensitization.class) // 身份证号码;比如:530321199204074611脱敏之后为530321**********11 +@Desensitize(desensitizationBy = IdCardDesensitization.class) public @interface IdCard { /** @@ -31,10 +31,7 @@ public @interface IdCard { int suffixKeep() default 2; /** - * 替换规则,会将前缀后缀保留后,全部替换成 replacer - * 例如:prefixKeep = 1; suffixKeep = 2; replacer = "*"; - * 原始字符串 123456 - * 脱敏后 1***56 + * 替换规则,身份证号码;比如:530321199204074611脱敏之后为530321**********11 */ String replacer() default "*"; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/Password.java b/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/Password.java index 148189ffe..c4bb6e1eb 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/Password.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/Password.java @@ -17,7 +17,7 @@ import java.lang.annotation.Target; @Target({ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotationsInside -@Desensitize(desensitizationBy = PasswordDesensitization.class) // 密码;比如:123456脱敏之后为****** +@Desensitize(desensitizationBy = PasswordDesensitization.class) public @interface Password { /** @@ -31,10 +31,7 @@ public @interface Password { int suffixKeep() default 0; /** - * 替换规则,会将前缀后缀保留后,全部替换成 replacer - * 例如:prefixKeep = 1; suffixKeep = 2; replacer = "*"; - * 原始字符串 123456 - * 脱敏后 1***56 + * 替换规则,密码;比如:123456脱敏之后为****** */ String replacer() default "*"; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/PhoneNumber.java b/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/PhoneNumber.java index 2ad620c0e..c78354d15 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/PhoneNumber.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-desensitize/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/PhoneNumber.java @@ -17,7 +17,7 @@ import java.lang.annotation.Target; @Target({ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotationsInside -@Desensitize(desensitizationBy = PhoneNumberDesensitization.class) // 手机号;比如:13248765917脱敏之后为132****5917 +@Desensitize(desensitizationBy = PhoneNumberDesensitization.class) public @interface PhoneNumber { /** @@ -31,10 +31,7 @@ public @interface PhoneNumber { int suffixKeep() default 4; /** - * 替换规则,会将前缀后缀保留后,全部替换成 replacer - * 例如:prefixKeep = 1; suffixKeep = 2; replacer = "*"; - * 原始字符串 123456 - * 脱敏后 1***56 + * 替换规则,手机号;比如:13248765917脱敏之后为132****5917 */ String replacer() default "*";