P15GEN2\59518
2025-10-10 9f6890646993d16260d4201d613c092132856127
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
package biz.report.agg;
 
import java.util.List;
 
import foundation.data.entity.Entity;
 
/**
 * @author kimi
 * @description
 * @date 2024-09-19 15:33
 */
 
 
public class AggDimension {
    private String code;
    private String name;
    private DimensionGroup dimensionGroup;
    private String parentId;
    private String shortName;
    private String dataName;
    private String sqlSegment;
    private String codeField;
    private DimensionAggType aggType;
 
    public static AggDimension createByEntity(Entity entity) {
        if (entity == null) {
            return null;
        }
        AggDimension aggDimension = new AggDimension();
        aggDimension.load(entity);
        return aggDimension;
    }
 
    private void load(Entity entity) {
         this.code = entity.getString("code");
         this.name = entity.getString("name");
         this.dimensionGroup = DimensionGroup.parse(entity.getString("parent_id"));
         this.parentId = entity.getString("parent_id");
         this.shortName = entity.getString("short_name");
         this.dataName = entity.getString("data_name");
         this.sqlSegment = entity.getString("sql_segment");
         this.codeField = entity.getString("code_field");
         
         this.aggType = DimensionAggType.parse(entity.getString("agg_type"));
    }
 
    public String getCode() {
        return code;
    }
 
    public void setCode(String code) {
        this.code = code;
    }
 
    public String getName() {
        return name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public String getParentId() {
        return parentId;
    }
 
    public void setParentId(String parentId) {
        this.parentId = parentId;
    }
 
    public String getShortName() {
        return shortName;
    }
 
    public void setShortName(String shortName) {
        this.shortName = shortName;
    }
 
    public String getDataName() {
        return dataName;
    }
 
    public void setDataName(String dataName) {
        this.dataName = dataName;
    }
 
    public String getSqlSegment() {
        return sqlSegment;
    }
 
    public void setSqlSegment(String sqlSegment) {
        this.sqlSegment = sqlSegment;
    }
 
    public DimensionGroup getDimensionGroup() {
        return dimensionGroup;
    }
 
    public void setDimensionGroup(DimensionGroup dimensionGroup) {
        this.dimensionGroup = dimensionGroup;
    }
 
    public DimensionAggType getAggType() {
        return aggType;
    }
 
    public String getCodeField() {
        return codeField;
    }
 
    public void setCodeField(String codeField) {
        this.codeField = codeField;
    }
 
    public boolean isYear() {
        return AggPeroidType.year.name().equals(codeField);
    }
 
    public boolean isQuarter() {
        return AggPeroidType.quarter.name().equals(codeField);
    }
 
    public boolean isMonth() {
        return AggPeroidType.month.name().equals(codeField);
    }
 
    public List<String> getTerritoryFieldNamePrefixList() {
        return null;
    }
 
    public boolean isPeroid() {
        return isYear() || isQuarter() || isMonth();
    }
}