|
@@ -1,13 +1,31 @@
|
|
|
package com.huimv.common.validate;
|
|
|
|
|
|
+import javax.validation.Constraint;
|
|
|
+import javax.validation.Payload;
|
|
|
+import java.lang.annotation.Documented;
|
|
|
+import java.lang.annotation.Retention;
|
|
|
+import java.lang.annotation.Target;
|
|
|
+
|
|
|
+import static java.lang.annotation.ElementType.*;
|
|
|
+import static java.lang.annotation.ElementType.TYPE_USE;
|
|
|
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|
|
+
|
|
|
/**
|
|
|
- * <p>
|
|
|
- *
|
|
|
- * </p>
|
|
|
+ * 自定义校验注解
|
|
|
*
|
|
|
* @author yinhao
|
|
|
- * @date 2021/5/14 16:28
|
|
|
+ * @date 2021/5/15 16:00
|
|
|
*/
|
|
|
+@Documented
|
|
|
+@Constraint(validatedBy = { ListValueConstraintValidator.class })
|
|
|
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE })
|
|
|
+@Retention(RUNTIME)
|
|
|
+public @interface ListValue {
|
|
|
+ String message() default "出栏状态必须是1(正常出栏) or 2(弃养出栏) or 3(死亡出栏)";
|
|
|
+
|
|
|
+ Class<?>[] groups() default { };
|
|
|
+
|
|
|
+ Class<? extends Payload>[] payload() default { };
|
|
|
|
|
|
-public class ListValue {
|
|
|
+ int[] vals() default { };
|
|
|
}
|