diff --git a/src/main/java/cn/iocoder/dashboard/framework/validator/custom/CustomConstraintDescriptor.java b/src/main/java/cn/iocoder/dashboard/framework/validator/custom/CustomConstraintDescriptor.java
new file mode 100644
index 0000000000..407c779351
--- /dev/null
+++ b/src/main/java/cn/iocoder/dashboard/framework/validator/custom/CustomConstraintDescriptor.java
@@ -0,0 +1,83 @@
+package cn.iocoder.dashboard.framework.validator.custom;
+
+import javax.validation.ConstraintTarget;
+import javax.validation.ConstraintValidator;
+import javax.validation.Payload;
+import javax.validation.metadata.ConstraintDescriptor;
+import javax.validation.metadata.ValidateUnwrappedValue;
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ *
自定义约束描述符
+ *
+ * @author zzf
+ * @date 2021/5/19
+ */
+public class CustomConstraintDescriptor implements ConstraintDescriptor {
+
+ private final R annotation;
+
+ public CustomConstraintDescriptor(R annotation) {
+ this.annotation = annotation;
+ }
+
+ @Override
+ public R getAnnotation() {
+ return annotation;
+ }
+
+ @Override
+ public String getMessageTemplate() {
+ return null;
+ }
+
+ @Override
+ public Set> getGroups() {
+ return null;
+ }
+
+ @Override
+ public Set> getPayload() {
+ return null;
+ }
+
+ @Override
+ public ConstraintTarget getValidationAppliesTo() {
+ return null;
+ }
+
+ @Override
+ public List>> getConstraintValidatorClasses() {
+ return null;
+ }
+
+ @Override
+ public Map getAttributes() {
+ return new HashMap<>();
+ }
+
+ @Override
+ public Set> getComposingConstraints() {
+ return null;
+ }
+
+ @Override
+ public boolean isReportAsSingleViolation() {
+ return false;
+ }
+
+ @Override
+ public ValidateUnwrappedValue getValueUnwrapping() {
+ return null;
+ }
+
+ @Override
+ public U unwrap(Class type) {
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/cn/iocoder/dashboard/framework/validator/custom/CustomConstraintViolation.java b/src/main/java/cn/iocoder/dashboard/framework/validator/custom/CustomConstraintViolation.java
new file mode 100644
index 0000000000..8ec809ea58
--- /dev/null
+++ b/src/main/java/cn/iocoder/dashboard/framework/validator/custom/CustomConstraintViolation.java
@@ -0,0 +1,123 @@
+package cn.iocoder.dashboard.framework.validator.custom;
+
+import lombok.Setter;
+import org.hibernate.validator.internal.engine.path.PathImpl;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Path;
+import javax.validation.metadata.ConstraintDescriptor;
+
+/**
+ * 校验不通过的返回值对象
+ *
+ * @author zzf
+ * @date 2021/5/19
+ * 需要校验的方法所在的类
+ */
+public class CustomConstraintViolation implements ConstraintViolation {
+
+ @Setter
+ private String message;
+
+ @Setter
+ private T rootBean;
+
+ @Setter
+ private Path propertyPath;
+
+ @Setter
+ private Object invalidValue;
+
+ @Setter
+ private ConstraintDescriptor> constraintDescriptor;
+
+ @Override
+ public String getMessage() {
+ return message;
+ }
+
+ @Override
+ public String getMessageTemplate() {
+ return null;
+ }
+
+ @Override
+ public T getRootBean() {
+ return rootBean;
+ }
+
+ @Override
+ public Class getRootBeanClass() {
+ return null;
+ }
+
+ @Override
+ public Object getLeafBean() {
+ return null;
+ }
+
+ @Override
+ public Object[] getExecutableParameters() {
+ return new Object[0];
+ }
+
+ @Override
+ public Object getExecutableReturnValue() {
+ return null;
+ }
+
+ @Override
+ public Path getPropertyPath() {
+ return propertyPath;
+ }
+
+ @Override
+ public Object getInvalidValue() {
+ return invalidValue;
+ }
+
+ @Override
+ public ConstraintDescriptor> getConstraintDescriptor() {
+ return constraintDescriptor;
+ }
+
+ @Override
+ public U unwrap(Class type) {
+ return null;
+ }
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return super.equals(obj);
+ }
+
+ /**
+ * 校验字段值是否合法
+ * @param rootBean 需要校验的方法所在的类对象
+ * @param msg 校验错误信息
+ * @param path 属性路径
+ * @param invalidValue 校验失败的属性值
+ * @param constraintDescriptor CustomConstraintDescriptor
+ * @param 泛型
+ * @return CustomConstraintViolation
+ */
+ public static CustomConstraintViolation of(T rootBean,
+ String msg,
+ String path,
+ Object invalidValue,
+ ConstraintDescriptor> constraintDescriptor) {
+ CustomConstraintViolation constraintViolation = new CustomConstraintViolation<>();
+ constraintViolation.setMessage(msg);
+ constraintViolation.setRootBean(rootBean);
+ constraintViolation.setPropertyPath(PathImpl.createPathFromString(path));
+ constraintViolation.setInvalidValue(invalidValue);
+ constraintViolation.setConstraintDescriptor(constraintDescriptor);
+ return constraintViolation;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/cn/iocoder/dashboard/framework/validator/custom/CustomValidator.java b/src/main/java/cn/iocoder/dashboard/framework/validator/custom/CustomValidator.java
index 1f0cd29322..8cb53b5d83 100644
--- a/src/main/java/cn/iocoder/dashboard/framework/validator/custom/CustomValidator.java
+++ b/src/main/java/cn/iocoder/dashboard/framework/validator/custom/CustomValidator.java
@@ -1,7 +1,6 @@
package cn.iocoder.dashboard.framework.validator.custom;
import cn.hutool.core.util.ArrayUtil;
-import cn.iocoder.dashboard.framework.validator.custom.handler.ValidateHandlerHelper;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.SneakyThrows;
diff --git a/src/main/java/cn/iocoder/dashboard/framework/validator/custom/ValidateAnnotationEnum.java b/src/main/java/cn/iocoder/dashboard/framework/validator/custom/ValidateAnnotationEnum.java
deleted file mode 100644
index c4688aad02..0000000000
--- a/src/main/java/cn/iocoder/dashboard/framework/validator/custom/ValidateAnnotationEnum.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package cn.iocoder.dashboard.framework.validator.custom;
-
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.StrUtil;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.extern.slf4j.Slf4j;
-import org.slf4j.helpers.MessageFormatter;
-
-import javax.validation.constraints.*;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.math.BigDecimal;
-import java.util.Date;
-import java.util.function.BiFunction;
-import java.util.function.Function;
-
-/**
- * 校验注解枚举
- *
- * @author zzf
- * @date 2021/4/13 11:35
- */
-@Slf4j
-@Getter
-@AllArgsConstructor
-public enum ValidateAnnotationEnum {
-
- NOT_NULL(NotNull.class,
- "必传!",
- (object, param) -> {
- return ObjectUtil.isNotNull(object);
- }
- ),
-
- NOT_EMPTY(NotEmpty.class,
- "内容不能为空!",
- (object, param) -> {
- return ObjectUtil.isNotEmpty(object);
- }
- ),
-
- NOT_BLANK(NotBlank.class,
- "内容需包含有效字符!",
- (object, param) -> {
- if (object instanceof String) {
- return StrUtil.isNotBlank(String.valueOf(object));
- }
- return false;
- }
- ),
-
- MAX(true,
- Max.class,
- "不能超过{}",
- (object, param) -> {
- if (object instanceof Integer) {
- return param > (Integer) object;
- }
- if (object instanceof BigDecimal | object instanceof Double | object instanceof Short) {
- return new BigDecimal(String.valueOf(param)).compareTo(new BigDecimal(String.valueOf(object))) > 0;
- }
- if (object instanceof Long) {
- return param > (Long) object;
- }
- if (object instanceof Date) {
- return param > ((Date) object).getTime();
- }
- return false;
- }
- ),
-
- MIN(true,
- Min.class,
- "不能小于{}",
- (object, param) -> {
- if (object instanceof Integer) {
- return param < (Integer) object;
- }
- if (object instanceof BigDecimal | object instanceof Double | object instanceof Short) {
- return new BigDecimal(String.valueOf(param)).compareTo(new BigDecimal(String.valueOf(object))) < 0;
- }
- if (object instanceof Long) {
- return param < (Long) object;
- }
- if (object instanceof Date) {
- return param < ((Date) object).getTime();
- }
- return false;
- });
-
- private final boolean hadParam;
-
- private final Class extends Annotation> annotation;
-
- private final String msg;
-
- private final BiFunction