mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、新增贴皮管理增删改、上传图片、分页/单个查询接口;2、整理对应参数校验国际化;
This commit is contained in:
+2
@@ -28,6 +28,8 @@ public @interface InEnum {
|
||||
|
||||
String message() default "inEnum.message";
|
||||
|
||||
String fieldName() default "";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
|
||||
+4
-1
@@ -18,8 +18,11 @@ public class InEnumValidator implements ConstraintValidator<InEnum, Integer> {
|
||||
|
||||
private List<Integer> values;
|
||||
|
||||
private String fieldName;
|
||||
|
||||
@Override
|
||||
public void initialize(InEnum annotation) {
|
||||
fieldName = annotation.fieldName();
|
||||
IntArrayValuable[] values = annotation.value().getEnumConstants();
|
||||
if (values.length == 0) {
|
||||
this.values = Collections.emptyList();
|
||||
@@ -44,7 +47,7 @@ public class InEnumValidator implements ConstraintValidator<InEnum, Integer> {
|
||||
|
||||
// 校验不通过,自定义提示语句(因为,注解上的 value 是枚举类,无法获得枚举类的实际值)
|
||||
context.disableDefaultConstraintViolation(); // 禁用默认的 message 的值
|
||||
context.buildConstraintViolationWithTemplate(defaultConstraintMessageTemplate).addConstraintViolation(); // 重新添加错误提示语句
|
||||
context.buildConstraintViolationWithTemplate(fieldName + defaultConstraintMessageTemplate).addConstraintViolation(); // 重新添加错误提示语句
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user