Commit e7d28375 by s_guodong

BigDecimal整数部分长度校验

parent a9ca9687
...@@ -62,6 +62,14 @@ public class ValidatorUtil { ...@@ -62,6 +62,14 @@ public class ValidatorUtil {
if (substring.length() > annotation.value()) { if (substring.length() > annotation.value()) {
return "参数校验错误[" + annotation.message() + "]"; return "参数校验错误[" + annotation.message() + "]";
} }
String integerString = bigDecimal.substring(0, i);
if (integerString.length() > annotation.value1()) {
return "参数校验错误[" + annotation.message1() + "]";
}
} else {
if (bigDecimal.length() > annotation.value1()) {
return "参数校验错误[" + annotation.message1() + "]";
}
} }
} }
......
...@@ -8,6 +8,10 @@ import java.lang.annotation.*; ...@@ -8,6 +8,10 @@ import java.lang.annotation.*;
public @interface DecimalLength { public @interface DecimalLength {
int value() default 0; int value() default 0;
int value1() default 0;
String message1() default "";
String message() default ""; String message() default "";
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment