zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
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
package com.changhong.epc.bean.tenant.norm.extend;
 
import com.alibaba.fastjson.annotation.JSONField;
import com.changhong.epc.bean.tenant.norm.AppStanderDef;
import com.changhong.epc.bean.tenant.norm.way.EleType;
import com.iemsoft.framework.cloud.core.tools.ObjectUtil;
import lombok.EqualsAndHashCode;
 
import java.util.List;
import java.util.Objects;
 
@EqualsAndHashCode(callSuper=true)
public class AppStanderExtend extends AppStanderDef {
    
    private static final long serialVersionUID = 1L;
    
    
    private Object asDefValue;
 
    private EleType eleType;
    @JSONField(serialize=false)
    public EleType getEleType() {
        try {
            return EleType.valueOf(this.getType());
        } catch (Exception e) {
            return EleType.QT;
        }
    }
    
    public Object getAsDefValue() {
        if(asDefValue instanceof String){
            if(Objects.toString(asDefValue, "").indexOf('{') == 0){
                return asDefValue;
            }else {
                return Objects.toString(asDefValue, "").split(",");
            }
        }else {
            return this.getString((List<Object>)asDefValue);
        }
    }
 
    public AppStanderExtend() {
    }
    
    public AppStanderExtend(AppStanderExtend def) {
        this.setId(def.getId());
        this.setElIden(def.getElIden());
        this.setMasDefineCode(def.getMasDefineCode());
        this.setType(def.getType());
        this.setDefType(def.getDefType());
        this.setDefName(def.getDefName());
        this.setRowNo(def.getRowNo());
        this.setSqu(def.getSqu());
        this.setShowFlag(def.getShowFlag());
        this.setRelation(def.getRelation());
        this.setInverse(def.getInverse());
        this.setShowCount(def.getShowCount());
        this.setCount(def.getCount());
        this.setSsId(def.getSsId());
        this.setInsP(def.getInsP());
        this.setInsT(def.getInsT());
        this.setUpdP(def.getUpdP());
        this.setUpdT(def.getUpdT());
        this.setDataStart(def.getDataStart());
    }
    
    
    
 
    public void setAsDefValue(Object asDefValue) {
        if(asDefValue instanceof  Integer){
            asDefValue = Objects.toString(asDefValue);
        }
 
        this.asDefValue = asDefValue;
    }
 
    public String getString(List<Object> array){
        if(ObjectUtil.empty(array)){
            return "";
        }else{
            StringBuilder sb = new StringBuilder();
            for(Object str: array){
                sb.append(str).append(',');
            }
            return sb.toString().replaceAll(",$", "");
        }
    }
    
}