Merge remote-tracking branch 'base-version/test' into dev
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
package com.zt.plat.module.system.enums.permission;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 数据规则条件枚举
|
||||
*
|
||||
* 用于菜单数据规则的条件类型
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DataRuleConditionEnum {
|
||||
|
||||
EQ("=", "等于"),
|
||||
NE("!=", "不等于"),
|
||||
GT(">", "大于"),
|
||||
GE(">=", "大于等于"),
|
||||
LT("<", "小于"),
|
||||
LE("<=", "小于等于"),
|
||||
IN("IN", "包含"),
|
||||
NOT_IN("NOT_IN", "不包含"),
|
||||
LIKE("LIKE", "模糊匹配"),
|
||||
LEFT_LIKE("LEFT_LIKE", "左模糊"),
|
||||
RIGHT_LIKE("RIGHT_LIKE", "右模糊"),
|
||||
NOT_LIKE("NOT_LIKE", "不匹配"),
|
||||
IS_NULL("IS_NULL", "为空"),
|
||||
IS_NOT_NULL("IS_NOT_NULL", "不为空"),
|
||||
SQL_RULE("SQL_RULE", "自定义SQL");
|
||||
|
||||
/**
|
||||
* 条件符号
|
||||
*/
|
||||
private final String condition;
|
||||
|
||||
/**
|
||||
* 条件描述
|
||||
*/
|
||||
private final String description;
|
||||
|
||||
/**
|
||||
* 根据条件符号查找枚举
|
||||
*
|
||||
* @param condition 条件符号
|
||||
* @return 枚举值
|
||||
*/
|
||||
public static DataRuleConditionEnum findByCondition(String condition) {
|
||||
if (condition == null) {
|
||||
return null;
|
||||
}
|
||||
for (DataRuleConditionEnum value : values()) {
|
||||
if (value.condition.equals(condition)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.zt.plat.module.system.enums.permission;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 数据规则变量枚举
|
||||
*
|
||||
* 用于菜单数据规则的变量替换
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DataRuleVariableEnum {
|
||||
|
||||
USER_ID("#{userId}", "当前用户ID"),
|
||||
USERNAME("#{username}", "当前用户名"),
|
||||
DEPT_ID("#{deptId}", "当前用户部门ID"),
|
||||
DEPT_IDS("#{deptIds}", "当前用户所有部门ID"),
|
||||
ORG_CODE("#{orgCode}", "当前用户组织编码"),
|
||||
TENANT_ID("#{tenantId}", "当前租户ID"),
|
||||
CURRENT_DATE("#{currentDate}", "当前日期"),
|
||||
CURRENT_TIME("#{currentTime}", "当前时间");
|
||||
|
||||
/**
|
||||
* 变量名
|
||||
*/
|
||||
private final String variable;
|
||||
|
||||
/**
|
||||
* 变量描述
|
||||
*/
|
||||
private final String description;
|
||||
|
||||
/**
|
||||
* 根据变量名查找枚举
|
||||
*
|
||||
* @param variable 变量名
|
||||
* @return 枚举值
|
||||
*/
|
||||
public static DataRuleVariableEnum findByVariable(String variable) {
|
||||
if (variable == null) {
|
||||
return null;
|
||||
}
|
||||
for (DataRuleVariableEnum value : values()) {
|
||||
if (value.variable.equals(variable)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user