<fix> 新增Condition拼接sql方法

This commit is contained in:
lhc
2022-02-21 17:22:34 +08:00
parent 78440ce646
commit c45f8fb7bc

View File

@@ -27,6 +27,8 @@ public class Condition implements Serializable {
public static String IN = "IN";
public static String AND = "AND";
public static String OR = "OR";
public static String NOT_EQUAL = "!=";
public static String NOT = "NOT";
public static String BETWEEN = "BETWEEN";
public static String LT = "<";
public static String GT = ">";
@@ -344,6 +346,26 @@ public class Condition implements Serializable {
return this;
}
public ConditionBuilder not() {
this.conditionSql += " " + NOT + " ";
return this;
}
public ConditionBuilder notEqual(String key, Object value) {
sqlCheck(value);
this.conditionSql += " " + key + " " + NOT_EQUAL + " '" + value.toString() + "' ";
return this;
}
public ConditionBuilder andNotEqual(String key, Object value) {
this.and().notEqual(key, value);
return this;
}
public ConditionBuilder orNotEqual(String key, Object value) {
this.or().notEqual(key, value);
return this;
}
public ConditionBuilder gt(String key, Object value) {
sqlCheck(value);
this.conditionSql += " " + key + " " + GT + " '" + value.toString() + "' ";