refactor: 重构目录结构统一规范
- shared/ → common/(constant、enums、model) - framework/cache/config/ → framework/cache/(扁平化) - framework/integration/captcha/ → framework/captcha/ - config/property/ → 各模块 config/ 下 - interfaces/ → module/(sse、mail、sms) - 移除冗余枚举 LogModuleEnum
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package com.youlai.boot.common.constant;
|
||||
|
||||
/**
|
||||
* 系统常量
|
||||
*
|
||||
* @author Ray.Hao
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public interface SystemConstants {
|
||||
|
||||
/**
|
||||
* 根节点ID
|
||||
*/
|
||||
Long ROOT_NODE_ID = 0L;
|
||||
|
||||
/**
|
||||
* 系统默认密码
|
||||
*/
|
||||
String DEFAULT_PASSWORD = "123456";
|
||||
|
||||
/**
|
||||
* 超级管理员角色编码
|
||||
*/
|
||||
String ROOT_ROLE_CODE = "ROOT";
|
||||
|
||||
|
||||
/**
|
||||
* 系统配置 IP的QPS限流的KEY
|
||||
*/
|
||||
String SYSTEM_CONFIG_IP_QPS_LIMIT_KEY = "IP_QPS_THRESHOLD_LIMIT";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.youlai.boot.common.enums;
|
||||
|
||||
import com.youlai.boot.common.base.IBaseEnum;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 数据权限枚举
|
||||
* <p>
|
||||
* 多角色数据权限合并策略:取并集(OR),即用户能看到所有角色权限范围内的数据。
|
||||
* 如果任一角色是 ALL,则直接跳过数据权限过滤。
|
||||
*
|
||||
* @author Ray.Hao
|
||||
* @since 2.3.0
|
||||
*/
|
||||
@Getter
|
||||
public enum DataScopeEnum implements IBaseEnum<Integer> {
|
||||
|
||||
/**
|
||||
* 所有数据权限 - 最高权限,可查看所有数据
|
||||
*/
|
||||
ALL(1, "所有数据"),
|
||||
|
||||
/**
|
||||
* 部门及子部门数据 - 可查看本部门及其下属所有部门的数据
|
||||
*/
|
||||
DEPT_AND_SUB(2, "部门及子部门数据"),
|
||||
|
||||
/**
|
||||
* 本部门数据 - 仅可查看本部门的数据
|
||||
*/
|
||||
DEPT(3, "本部门数据"),
|
||||
|
||||
/**
|
||||
* 本人数据 - 仅可查看自己的数据
|
||||
*/
|
||||
SELF(4, "本人数据"),
|
||||
|
||||
/**
|
||||
* 自定义部门数据 - 可查看指定部门的数据
|
||||
* <p>
|
||||
* 需要配合 sys_role_dept 表使用,存储角色可访问的部门ID列表
|
||||
*/
|
||||
CUSTOM(5, "自定义部门数据");
|
||||
|
||||
private final Integer value;
|
||||
|
||||
private final String label;
|
||||
|
||||
DataScopeEnum(Integer value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否为全部数据权限
|
||||
*
|
||||
* @param value 数据权限值
|
||||
* @return 是否为全部数据权限
|
||||
*/
|
||||
public static boolean isAll(Integer value) {
|
||||
return ALL.getValue().equals(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据值获取枚举
|
||||
*
|
||||
* @param value 数据权限值
|
||||
* @return 枚举对象,未找到则返回 null
|
||||
*/
|
||||
public static DataScopeEnum getByValue(Integer value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
for (DataScopeEnum dataScope : values()) {
|
||||
if (dataScope.getValue().equals(value)) {
|
||||
return dataScope;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
27
src/main/java/com/youlai/boot/common/enums/StatusEnum.java
Normal file
27
src/main/java/com/youlai/boot/common/enums/StatusEnum.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.youlai.boot.common.enums;
|
||||
|
||||
import com.youlai.boot.common.base.IBaseEnum;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 状态枚举
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/10/14
|
||||
*/
|
||||
@Getter
|
||||
public enum StatusEnum implements IBaseEnum<Integer> {
|
||||
|
||||
ENABLE(1, "启用"),
|
||||
DISABLE (0, "禁用");
|
||||
|
||||
private final Integer value;
|
||||
|
||||
|
||||
private final String label;
|
||||
|
||||
StatusEnum(Integer value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
30
src/main/java/com/youlai/boot/common/model/KeyValue.java
Normal file
30
src/main/java/com/youlai/boot/common/model/KeyValue.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.youlai.boot.common.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
/**
|
||||
* 键值对
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2024/5/25
|
||||
*/
|
||||
@Schema(description = "键值对")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class KeyValue {
|
||||
|
||||
public KeyValue(String key, String value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Schema(description = "选项的值")
|
||||
private String key;
|
||||
|
||||
@Schema(description = "选项的标签")
|
||||
private String value;
|
||||
|
||||
}
|
||||
53
src/main/java/com/youlai/boot/common/model/Option.java
Normal file
53
src/main/java/com/youlai/boot/common/model/Option.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.youlai.boot.common.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 下拉选项对象
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/1/22
|
||||
*/
|
||||
@Schema(description ="下拉选项对象")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class Option<T> {
|
||||
|
||||
public Option(T value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public Option(T value, String label, List<Option<T>> children) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
this.children= children;
|
||||
}
|
||||
|
||||
public Option(T value, String label, String tag) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
this.tag= tag;
|
||||
}
|
||||
|
||||
|
||||
@Schema(description="选项的值")
|
||||
private T value;
|
||||
|
||||
@Schema(description="选项的标签")
|
||||
private String label;
|
||||
|
||||
@Schema(description = "标签类型")
|
||||
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
|
||||
private String tag;
|
||||
|
||||
@Schema(description="子选项列表")
|
||||
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
|
||||
private List<Option<T>> children;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user