PrincipalUtil和PageParam判断和常量优化

This commit is contained in:
lhd
2026-07-16 18:02:08 +08:00
parent 34877c5ed7
commit d0acc0a55c
2 changed files with 5 additions and 11 deletions
@@ -24,6 +24,7 @@ import java.util.List;
@ParameterObject
public class PageParam<T> extends Page<T> {
private static final long MAX_SIZE = 100;
/**
* 每页显示条数,默认 10
@@ -105,9 +106,8 @@ public class PageParam<T> extends Page<T> {
@Override
public Page<T> setSize(long size) {
int maxSize = 100;
if (size > maxSize) {
this.size = maxSize;
if (size > MAX_SIZE) {
this.size = MAX_SIZE;
} else {
this.size = size;
}
@@ -26,17 +26,11 @@ public class PrincipalUtil {
public static final String SIMPLE_CHAR_REGEXP = "([a-z0-9]+)";
public static boolean isMobile(String value) {
if(StrUtil.isBlank(value)) {
return false;
}
return Pattern.matches(MOBILE_REGEXP, value);
return isMatching(MOBILE_REGEXP, value);
}
public static boolean isUserName(String value) {
if(StrUtil.isBlank(value)) {
return false;
}
return Pattern.matches(USER_NAME_REGEXP, value);
return isMatching(USER_NAME_REGEXP, value);
}
public static boolean isMatching(String regexp, String value) {