- 后端:重构 oauth2 模块,方便后续 User 接入。
- 后端:重写 Admin 安全拦截器,实现类似 Shiro 的效果。
This commit is contained in:
@@ -46,6 +46,7 @@ public enum CommonStatusEnum implements IntArrayValuable {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean isValid(Integer status) {
|
||||
if (status == null) {
|
||||
return false;
|
||||
|
||||
@@ -19,10 +19,12 @@ public interface MallConstants {
|
||||
/**
|
||||
* 用户类型 - 用户
|
||||
*/
|
||||
@Deprecated
|
||||
Integer USER_TYPE_USER = 1;
|
||||
/**
|
||||
* 用户类型 - 管理员
|
||||
*/
|
||||
@Deprecated
|
||||
Integer USER_TYPE_ADMIN = 2;
|
||||
|
||||
// HTTP Request Attr
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package cn.iocoder.common.framework.constant;
|
||||
|
||||
import cn.iocoder.common.framework.core.IntArrayValuable;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 全局用户类型枚举
|
||||
*/
|
||||
public enum UserTypeEnum implements IntArrayValuable {
|
||||
|
||||
USER(1, "用户"),
|
||||
ADMIN(2, "管理员");
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(UserTypeEnum::getValue).toArray();
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private Integer value;
|
||||
/**
|
||||
* 类型名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
UserTypeEnum(Integer value, String name) {
|
||||
this.value = value;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public UserTypeEnum setValue(Integer value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public UserTypeEnum setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,4 +19,11 @@ public class QueryWrapperX<T> extends QueryWrapper<T> {
|
||||
return this;
|
||||
}
|
||||
|
||||
public QueryWrapperX<T> eqIfPresent(String column, Object val) {
|
||||
if (val != null) {
|
||||
return (QueryWrapperX<T>) super.eq(column, val);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package cn.iocoder.common.framework.util;
|
||||
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -30,4 +32,8 @@ public class CollectionUtil {
|
||||
return from.stream().collect(Collectors.toMap(keyFunc, item -> item));
|
||||
}
|
||||
|
||||
public static boolean containsAny(Collection<?> source, Collection<?> candidates) {
|
||||
return CollectionUtils.containsAny(source, candidates);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user