cuikaidong
2025-06-12 44e283b774bb1168d0c17dfe5070a1ca8e2274cd
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
package org.jeecg.common.util.jsonschema.validate;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.common.util.jsonschema.CommonProperty;
 
import com.alibaba.fastjson.JSONObject;
 
public class StringProperty extends CommonProperty {
    
    private static final long serialVersionUID = -3200493311633999539L;
    
    private Integer maxLength;
    
    private Integer minLength;
    
    /**
     * 根据ECMA 262正则表达式方言,该字符串应该是有效的正则表达式。
     */
    private String pattern;
    
    /**
     * 错误提示信息
     */
    private String errorInfo;
    
    public Integer getMaxLength() {
        return maxLength;
    }
 
 
    public void setMaxLength(Integer maxLength) {
        this.maxLength = maxLength;
    }
 
    public Integer getMinLength() {
        return minLength;
    }
 
    public void setMinLength(Integer minLength) {
        this.minLength = minLength;
    }
 
    public String getPattern() {
        return pattern;
    }
 
    public void setPattern(String pattern) {
        this.pattern = pattern;
    }
    
    public String getErrorInfo() {
        return errorInfo;
    }
 
 
    public void setErrorInfo(String errorInfo) {
        this.errorInfo = errorInfo;
    }
 
 
    public StringProperty() {}
    
    /**
     *  一般字符串类型走这个构造器
     * @param key 字段名
     * @param title 字段备注
     * @param view 展示控件
     * @param maxLength 数据库字段最大长度
     */
    public StringProperty(String key,String title,String view,Integer maxLength) {
        this.maxLength = maxLength;
        this.key = key;
        this.view = view;
        this.title = title;
        this.type = "string";
    }
    
    /**
         *  列表类型的走这个构造器  
     * @param key 字段名
     * @param title 字段备注 
     * @param view 展示控件 list-checkbox-radio
     * @param maxLength 数据库字段最大长度
     * @param include 数据字典
     */
    public StringProperty(String key,String title,String view,Integer maxLength,List<DictModel> include) {
        this.maxLength = maxLength;
        this.key = key;
        this.view = view;
        this.title = title;
        this.type = "string";
        this.include = include;
    }
    @Override
    public Map<String, Object> getPropertyJson() {
        Map<String,Object> map = new HashMap<>();
        map.put("key",getKey());
        JSONObject prop = getCommonJson();
        if(maxLength!=null) {
            prop.put("maxLength",maxLength);
        }
        if(minLength!=null) {
            prop.put("minLength",minLength);
        }
        if(pattern!=null) {
            prop.put("pattern",pattern);
        }
        if(errorInfo!=null) {
            prop.put("errorInfo",errorInfo);
        }
        map.put("prop",prop);
        return map;
    }
 
}