Explorar el Código

Merge branch 'mazq-0416-dataauth' into 'feature/v2.0.0-data-auth'

feature(数据授权开发): 数据授权开发

See merge request dcuc-tjdsj/app-service!6
黄资权 hace 4 años
padre
commit
b93eb98232

+ 55 - 0
dcuc-app-model/src/main/java/com/dragoninfo/dcuc/app/enumresources/DataAttrTypeEnum.java

@@ -0,0 +1,55 @@
+package com.dragoninfo.dcuc.app.enumresources;
+
+/**
+ * 数据属性类型枚举类
+ * @author mazq
+ * @date 2021/4/13
+ */
+public enum DataAttrTypeEnum {
+    /**
+     * 列资源
+     */
+    DATA_ATTR_COLUMN("列资源","COLUMN"),
+
+    /**
+     * 表资源
+     */
+    DATA_ATTR_TABLE("表资源","TABLE"),
+
+    /**
+     * 公用资源
+     */
+    DATA_ATTR_ALL("公用资源","ALL");
+
+    DataAttrTypeEnum(String label, String value) {
+        this.label = label;
+        this.value = value;
+    }
+
+    /**
+     * 数据属性名称
+     */
+    private String label;
+
+    /**
+     * 数据属性值
+     */
+    private String value;
+
+
+    public String getLabel() {
+        return label;
+    }
+
+    public void setLabel(String label) {
+        this.label = label;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+}

+ 127 - 0
dcuc-app-model/src/main/java/com/dragoninfo/dcuc/app/enumresources/DataResourceEnum.java

@@ -0,0 +1,127 @@
+package com.dragoninfo.dcuc.app.enumresources;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 数据资源类型枚举类
+ * @author mazq
+ * @date 2021/4/13
+ */
+public enum  DataResourceEnum {
+
+    /**
+     * 数据安全级别
+     */
+    DATA_SECURITY_LEVEL("DATA_SECURITY_LEVEL","数据安全级别","DATA_SECURITY_LEVEL", DataAttrTypeEnum.DATA_ATTR_COLUMN),
+    /**
+     * 数据分级
+     */
+    DATA_CLASSIFY("DATA_CLASSIFY","数据分级","DATA_CLASSIFY", DataAttrTypeEnum.DATA_ATTR_TABLE),
+
+    /**
+     * 数据资源分类
+     */
+    DATA_RESOURCE_CLASSIFY("DATA_RESOURCE_CLASSIFY","数据资源分类","DATA_RESOURCE_CLASSIFY",DataAttrTypeEnum.DATA_ATTR_TABLE),
+
+    /**
+     * 字段分类
+     */
+    COLUMN_CLASSIFY("COLUMN_CLASSIFY","字段分类","COLUMN_CLASSIFY",DataAttrTypeEnum.DATA_ATTR_COLUMN);
+
+    DataResourceEnum(String code, String label, String dataType, DataAttrTypeEnum attrType) {
+        this.code = code;
+        this.label = label;
+        this.dataType = dataType;
+        this.attrType = attrType;
+    }
+
+    /**
+     * 数据资源code
+     */
+    private String code;
+
+    /**
+     * 数据资源名称
+     */
+    private String label;
+
+    /**
+     * 数据资源类型
+     * 数据安全级别:DATA_SECURITY_LEVEL
+     * 字段一级分类:LEVEL_1_COLUMN_CLASSIFY
+     * 字段二级分类:LEVEL_2_COLUMN_CLASSIFY
+     * 数据分级:DATA_CLASSIFY
+     */
+    private String dataType;
+
+    /**
+     * 数据属性类型
+     */
+    private DataAttrTypeEnum attrType;
+
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    public void setLabel(String label) {
+        this.label = label;
+    }
+
+    public String getDataType() {
+        return dataType;
+    }
+
+    public void setDataType(String dataType) {
+        this.dataType = dataType;
+    }
+
+    public DataAttrTypeEnum getAttrType() {
+        return attrType;
+    }
+
+    public void setAttrType(DataAttrTypeEnum attrType) {
+        this.attrType = attrType;
+    }
+
+    /**
+     * 获取所有列属性的枚举类,包括公用资源
+     * @return
+     */
+    public static List<DataResourceEnum> getColumnDataResource(){
+        List<DataResourceEnum> list = new ArrayList<>();
+        for (DataResourceEnum value : values()) {
+            if(value.attrType.equals(DataAttrTypeEnum.DATA_ATTR_COLUMN) ||
+               value.attrType.equals(DataAttrTypeEnum.DATA_ATTR_ALL)){
+                 list.add(value);
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 获取所有表属性的枚举类,包括公用资源
+     * @return
+     */
+    public static List<DataResourceEnum> getTableDataResource(){
+        List<DataResourceEnum> list = new ArrayList<>();
+        for (DataResourceEnum value : values()) {
+            if(value.attrType.equals(DataAttrTypeEnum.DATA_ATTR_TABLE) ||
+               value.attrType.equals(DataAttrTypeEnum.DATA_ATTR_ALL)){
+                 list.add(value);
+            }
+        }
+        return list;
+    }
+
+
+}