From 08e1c69d10a5c946ab9d32d7d605fe7ffc93c96f Mon Sep 17 00:00:00 2001 From: zhougang <921366807@qq.com> Date: Wed, 31 Jul 2024 22:43:48 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=84=B1=E6=95=8F=E6=94=AF=E6=8C=81=20Spring=20el=20?= =?UTF-8?q?=E8=A1=A8=E8=BE=BE=E5=BC=8F=EF=BC=8C=E6=94=AF=E6=8C=81=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6=E8=84=B1=E6=95=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../util/spring/SpringExpressionUtils.java | 21 +++++++++++++++++++ .../yudao-spring-boot-starter-web/pom.xml | 5 +++++ .../regex/annotation/EmailDesensitize.java | 6 ++++++ .../regex/annotation/RegexDesensitize.java | 6 ++++++ .../AbstractRegexDesensitizationHandler.java | 14 +++++++++++++ .../DefaultRegexDesensitizationHandler.java | 6 ++++++ .../handler/EmailDesensitizationHandler.java | 5 +++++ .../annotation/BankCardDesensitize.java | 5 +++++ .../annotation/CarLicenseDesensitize.java | 5 +++++ .../annotation/ChineseNameDesensitize.java | 5 +++++ .../annotation/FixedPhoneDesensitize.java | 5 +++++ .../slider/annotation/IdCardDesensitize.java | 5 +++++ .../slider/annotation/MobileDesensitize.java | 5 +++++ .../annotation/PasswordDesensitize.java | 5 +++++ .../slider/annotation/SliderDesensitize.java | 6 ++++++ .../AbstractSliderDesensitizationHandler.java | 14 +++++++++++++ .../handler/BankCardDesensitization.java | 5 +++++ .../handler/CarLicenseDesensitization.java | 6 ++++++ .../handler/ChineseNameDesensitization.java | 5 +++++ .../DefaultDesensitizationHandler.java | 6 ++++++ .../handler/FixedPhoneDesensitization.java | 6 ++++++ .../slider/handler/IdCardDesensitization.java | 6 ++++++ .../slider/handler/MobileDesensitization.java | 6 ++++++ .../handler/PasswordDesensitization.java | 6 ++++++ 24 files changed, 164 insertions(+) diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/spring/SpringExpressionUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/spring/SpringExpressionUtils.java index 9a7f8812b..e9670d88d 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/spring/SpringExpressionUtils.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/spring/SpringExpressionUtils.java @@ -3,11 +3,15 @@ package cn.iocoder.yudao.framework.common.util.spring; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.StrUtil; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.context.expression.BeanFactoryResolver; import org.springframework.core.DefaultParameterNameDiscoverer; import org.springframework.core.ParameterNameDiscoverer; import org.springframework.expression.EvaluationContext; +import org.springframework.expression.Expression; import org.springframework.expression.ExpressionParser; import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.expression.spel.support.StandardEvaluationContext; @@ -86,4 +90,21 @@ public class SpringExpressionUtils { return result; } + /** + * 从 Bean 工厂,解析 EL 表达式的结果 + * + * @param beanFactory Bean 工程 + * @param expressionString EL 表达式 + * @return 执行界面 + */ + public static Object parseExpression(BeanFactory beanFactory, String expressionString) { + if (StrUtil.isBlank(expressionString)) { + return null; + } + Expression expression = EXPRESSION_PARSER.parseExpression(expressionString); + StandardEvaluationContext context = new StandardEvaluationContext(); + context.setBeanResolver(new BeanFactoryResolver(beanFactory)); + return expression.getValue(context); + } + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/pom.xml b/yudao-framework/yudao-spring-boot-starter-web/pom.xml index b5d0aa84d..5861f198f 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/pom.xml +++ b/yudao-framework/yudao-spring-boot-starter-web/pom.xml @@ -32,6 +32,11 @@ spring-boot-configuration-processor true + + org.aspectj + aspectjweaver + provided + com.github.xiaoymin diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/annotation/EmailDesensitize.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/annotation/EmailDesensitize.java index 227f25499..5485c194e 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/annotation/EmailDesensitize.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/annotation/EmailDesensitize.java @@ -33,4 +33,10 @@ public @interface EmailDesensitize { * 比如:example@gmail.com 脱敏之后为 e****@gmail.com */ String replacer() default "$1****$2"; + + /** + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 + */ + String condition() default ""; + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/annotation/RegexDesensitize.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/annotation/RegexDesensitize.java index 4ab7c7415..9b0a3fa38 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/annotation/RegexDesensitize.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/annotation/RegexDesensitize.java @@ -35,4 +35,10 @@ public @interface RegexDesensitize { * 脱敏后字符串 ******456789 */ String replacer() default "******"; + + /** + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 + */ + String condition() default ""; + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/handler/AbstractRegexDesensitizationHandler.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/handler/AbstractRegexDesensitizationHandler.java index f43431b1d..11d3dc23b 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/handler/AbstractRegexDesensitizationHandler.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/handler/AbstractRegexDesensitizationHandler.java @@ -1,5 +1,7 @@ package cn.iocoder.yudao.framework.desensitize.core.regex.handler; +import cn.hutool.extra.spring.SpringUtil; +import cn.iocoder.yudao.framework.common.util.spring.SpringExpressionUtils; import cn.iocoder.yudao.framework.desensitize.core.base.handler.DesensitizationHandler; import java.lang.annotation.Annotation; @@ -14,6 +16,10 @@ public abstract class AbstractRegexDesensitizationHandler @Override public String desensitize(String origin, T annotation) { + Object expressionResult = SpringExpressionUtils.parseExpression(SpringUtil.getApplicationContext(), getCondition(annotation)); + if (expressionResult instanceof Boolean && (Boolean) expressionResult) { + return origin; + } String regex = getRegex(annotation); String replacer = getReplacer(annotation); return origin.replaceAll(regex, replacer); @@ -35,4 +41,12 @@ public abstract class AbstractRegexDesensitizationHandler */ abstract String getReplacer(T annotation); + /** + * el 表达式 + * + * @param annotation 注解信息 + * @return el 表达式 + */ + abstract String getCondition(T annotation); + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/handler/DefaultRegexDesensitizationHandler.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/handler/DefaultRegexDesensitizationHandler.java index f92414e0c..75fa8895d 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/handler/DefaultRegexDesensitizationHandler.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/handler/DefaultRegexDesensitizationHandler.java @@ -18,4 +18,10 @@ public class DefaultRegexDesensitizationHandler extends AbstractRegexDesensitiza String getReplacer(RegexDesensitize annotation) { return annotation.replacer(); } + + @Override + String getCondition(RegexDesensitize annotation) { + return annotation.condition(); + } + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/handler/EmailDesensitizationHandler.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/handler/EmailDesensitizationHandler.java index 8d1867a64..fec46d449 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/handler/EmailDesensitizationHandler.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/handler/EmailDesensitizationHandler.java @@ -19,4 +19,9 @@ public class EmailDesensitizationHandler extends AbstractRegexDesensitizationHan return annotation.replacer(); } + @Override + String getCondition(EmailDesensitize annotation) { + return annotation.condition(); + } + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/BankCardDesensitize.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/BankCardDesensitize.java index 19ad54e25..f512f4c9e 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/BankCardDesensitize.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/BankCardDesensitize.java @@ -37,4 +37,9 @@ public @interface BankCardDesensitize { */ String replacer() default "*"; + /** + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 + */ + String condition() default ""; + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/CarLicenseDesensitize.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/CarLicenseDesensitize.java index 9000e1ec4..93e895bf4 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/CarLicenseDesensitize.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/CarLicenseDesensitize.java @@ -37,4 +37,9 @@ public @interface CarLicenseDesensitize { */ String replacer() default "*"; + /** + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 + */ + String condition() default ""; + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/ChineseNameDesensitize.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/ChineseNameDesensitize.java index 73a0d0ee5..05c22dd77 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/ChineseNameDesensitize.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/ChineseNameDesensitize.java @@ -37,4 +37,9 @@ public @interface ChineseNameDesensitize { */ String replacer() default "*"; + /** + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 + */ + String condition() default ""; + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/FixedPhoneDesensitize.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/FixedPhoneDesensitize.java index 862235346..ade43793b 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/FixedPhoneDesensitize.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/FixedPhoneDesensitize.java @@ -37,4 +37,9 @@ public @interface FixedPhoneDesensitize { */ String replacer() default "*"; + /** + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 + */ + String condition() default ""; + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/IdCardDesensitize.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/IdCardDesensitize.java index 8a654c915..b3bbb45e8 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/IdCardDesensitize.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/IdCardDesensitize.java @@ -37,4 +37,9 @@ public @interface IdCardDesensitize { */ String replacer() default "*"; + /** + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 + */ + String condition() default ""; + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/MobileDesensitize.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/MobileDesensitize.java index f0c42f192..9a8c55708 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/MobileDesensitize.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/MobileDesensitize.java @@ -37,4 +37,9 @@ public @interface MobileDesensitize { */ String replacer() default "*"; + /** + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 + */ + String condition() default ""; + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/PasswordDesensitize.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/PasswordDesensitize.java index 6a3b2694f..f4c6bac98 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/PasswordDesensitize.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/PasswordDesensitize.java @@ -39,4 +39,9 @@ public @interface PasswordDesensitize { */ String replacer() default "*"; + /** + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 + */ + String condition() default ""; + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/SliderDesensitize.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/SliderDesensitize.java index ec79635b9..13a5becfa 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/SliderDesensitize.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/SliderDesensitize.java @@ -40,4 +40,10 @@ public @interface SliderDesensitize { * 前缀保留长度 */ int prefixKeep() default 0; + + /** + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 + */ + String condition() default ""; + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/AbstractSliderDesensitizationHandler.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/AbstractSliderDesensitizationHandler.java index 7dd2a7fd1..b3b076984 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/AbstractSliderDesensitizationHandler.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/AbstractSliderDesensitizationHandler.java @@ -1,5 +1,7 @@ package cn.iocoder.yudao.framework.desensitize.core.slider.handler; +import cn.hutool.extra.spring.SpringUtil; +import cn.iocoder.yudao.framework.common.util.spring.SpringExpressionUtils; import cn.iocoder.yudao.framework.desensitize.core.base.handler.DesensitizationHandler; import java.lang.annotation.Annotation; @@ -14,6 +16,10 @@ public abstract class AbstractSliderDesensitizationHandler @Override public String desensitize(String origin, T annotation) { + Object expressionResult = SpringExpressionUtils.parseExpression(SpringUtil.getApplicationContext(), getCondition(annotation)); + if (expressionResult instanceof Boolean && (Boolean) expressionResult) { + return origin; + } int prefixKeep = getPrefixKeep(annotation); int suffixKeep = getSuffixKeep(annotation); String replacer = getReplacer(annotation); @@ -75,4 +81,12 @@ public abstract class AbstractSliderDesensitizationHandler */ abstract String getReplacer(T annotation); + /** + * el 表达式 + * + * @param annotation 注解信息 + * @return el 表达式 + */ + abstract String getCondition(T annotation); + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/BankCardDesensitization.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/BankCardDesensitization.java index e1d90ea6d..c56edc78d 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/BankCardDesensitization.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/BankCardDesensitization.java @@ -24,4 +24,9 @@ public class BankCardDesensitization extends AbstractSliderDesensitizationHandle return annotation.replacer(); } + @Override + String getCondition(BankCardDesensitize annotation) { + return annotation.condition(); + } + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/CarLicenseDesensitization.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/CarLicenseDesensitization.java index 34b3e9a69..6829c0688 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/CarLicenseDesensitization.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/CarLicenseDesensitization.java @@ -22,4 +22,10 @@ public class CarLicenseDesensitization extends AbstractSliderDesensitizationHand String getReplacer(CarLicenseDesensitize annotation) { return annotation.replacer(); } + + @Override + String getCondition(CarLicenseDesensitize annotation) { + return annotation.condition(); + } + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/ChineseNameDesensitization.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/ChineseNameDesensitization.java index f71dac0e0..e9be53176 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/ChineseNameDesensitization.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/ChineseNameDesensitization.java @@ -24,4 +24,9 @@ public class ChineseNameDesensitization extends AbstractSliderDesensitizationHan return annotation.replacer(); } + @Override + String getCondition(ChineseNameDesensitize annotation) { + return annotation.condition(); + } + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/DefaultDesensitizationHandler.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/DefaultDesensitizationHandler.java index 8b0adaeab..4fdadf3b7 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/DefaultDesensitizationHandler.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/DefaultDesensitizationHandler.java @@ -22,4 +22,10 @@ public class DefaultDesensitizationHandler extends AbstractSliderDesensitization String getReplacer(SliderDesensitize annotation) { return annotation.replacer(); } + + @Override + String getCondition(SliderDesensitize annotation) { + return annotation.condition(); + } + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/FixedPhoneDesensitization.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/FixedPhoneDesensitization.java index 6e2326171..6a566f4df 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/FixedPhoneDesensitization.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/FixedPhoneDesensitization.java @@ -22,4 +22,10 @@ public class FixedPhoneDesensitization extends AbstractSliderDesensitizationHand String getReplacer(FixedPhoneDesensitize annotation) { return annotation.replacer(); } + + @Override + String getCondition(FixedPhoneDesensitize annotation) { + return annotation.condition(); + } + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/IdCardDesensitization.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/IdCardDesensitization.java index 9d525b34c..b85c9a16c 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/IdCardDesensitization.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/IdCardDesensitization.java @@ -22,4 +22,10 @@ public class IdCardDesensitization extends AbstractSliderDesensitizationHandler< String getReplacer(IdCardDesensitize annotation) { return annotation.replacer(); } + + @Override + String getCondition(IdCardDesensitize annotation) { + return annotation.condition(); + } + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/MobileDesensitization.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/MobileDesensitization.java index 582900ad4..102d07e35 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/MobileDesensitization.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/MobileDesensitization.java @@ -23,4 +23,10 @@ public class MobileDesensitization extends AbstractSliderDesensitizationHandler< String getReplacer(MobileDesensitize annotation) { return annotation.replacer(); } + + @Override + String getCondition(MobileDesensitize annotation) { + return annotation.condition(); + } + } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/PasswordDesensitization.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/PasswordDesensitization.java index 1bccaa2a4..1ebaca2e9 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/PasswordDesensitization.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/PasswordDesensitization.java @@ -22,4 +22,10 @@ public class PasswordDesensitization extends AbstractSliderDesensitizationHandle String getReplacer(PasswordDesensitize annotation) { return annotation.replacer(); } + + @Override + String getCondition(PasswordDesensitize annotation) { + return annotation.condition(); + } + }