mirror of
https://gitee.com/gz-yami/mall4j.git
synced 2026-10-06 14:13:10 +08:00
PrincipalUtil和PageParam判断和常量优化
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user