kimi
2020-05-27 c007f0ca1785db093d48f4846cda82fe8e955765
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
package com.highdatas.mdm.pojo;
 
import com.highdatas.mdm.util.Constant;
import com.highdatas.mdm.util.DbUtils;
import lombok.Getter;
import lombok.Setter;
 
/**
 * @author kimi
 * @description
 * @date 2019-12-17 12:15
 */
 
 
public class Segment {
    @Getter @Setter
    private String name;
    @Getter @Setter
    private Object value;
    @Getter @Setter
    private String joinStr;
 
    public Segment(String name, Object value) {
        this.name = name;
        this.value = value;
        this.joinStr = Constant.EQUAL;
    }
    public String toRawString() {
        return DbUtils.StrJoin(name,joinStr,String.valueOf(value));
    }
    @Override
    public String toString() {
        if (name == null) {
            return super.toString();
        }
        if (value == null) {
            return Constant.WHERE_DEFAULT;
        }
        if (value instanceof String) {
            return DbUtils.StrJoin(name,joinStr,DbUtils.quotedStr(value));
        } else {
            return DbUtils.StrJoin(name,joinStr,String.valueOf(value));
        }
 
    }
}