| package com.dy.common.aop; | 
|   | 
| import jakarta.validation.Constraint; | 
| import jakarta.validation.Payload; | 
| import java.lang.annotation.*; | 
|   | 
| @Documented | 
| @Constraint(validatedBy = CheckLengthValidator.class) | 
| @Target({ElementType.FIELD, ElementType.METHOD}) | 
| @Retention(RetentionPolicy.RUNTIME) | 
| public @interface CheckLength { | 
|   | 
|     int min() default 11; | 
|     int max() default 12; | 
|   | 
|     String message() default "手机号长度必须是11位"; | 
|   | 
|     Class<?>[] groups() default {}; | 
|   | 
|     Class<? extends Payload>[] payload() default {}; | 
| } |