|
|
|
@ -4,10 +4,7 @@ import com.xmomen.framework.mybatis.model.BaseMybatisExample;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* TbExchangeCardLogExample 类用于构建查询 TbExchangeCardLog 表的条件。
|
|
|
|
|
* 它继承自 BaseMybatisExample,提供了一系列方法来动态生成 SQL 查询的 WHERE 子句。
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public class TbExchangeCardLogExample extends BaseMybatisExample {
|
|
|
|
|
// 用于指定查询结果的排序规则,例如 "ID ASC"
|
|
|
|
|
protected String orderByClause;
|
|
|
|
@ -16,75 +13,49 @@ public class TbExchangeCardLogExample extends BaseMybatisExample {
|
|
|
|
|
// 存储多个查询条件集合,每个 Criteria 代表一组 AND 条件,多个 Criteria 之间是 OR 关系
|
|
|
|
|
protected List<Criteria> oredCriteria;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 构造函数,初始化 oredCriteria 列表
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public TbExchangeCardLogExample() {
|
|
|
|
|
oredCriteria = new ArrayList<Criteria>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置查询结果的排序规则
|
|
|
|
|
* @param orderByClause 排序规则字符串,例如 "ID ASC"
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public void setOrderByClause(String orderByClause) {
|
|
|
|
|
this.orderByClause = orderByClause;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取查询结果的排序规则
|
|
|
|
|
* @return 排序规则字符串
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public String getOrderByClause() {
|
|
|
|
|
return orderByClause;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置查询结果是否去重
|
|
|
|
|
* @param distinct 是否去重的标志
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public void setDistinct(boolean distinct) {
|
|
|
|
|
this.distinct = distinct;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取查询结果是否去重的标志
|
|
|
|
|
* @return 是否去重的标志
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public boolean isDistinct() {
|
|
|
|
|
return distinct;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取所有的查询条件集合
|
|
|
|
|
* @return 查询条件集合列表
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public List<Criteria> getOredCriteria() {
|
|
|
|
|
return oredCriteria;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加一个新的查询条件集合,并与现有条件集合以 OR 关系连接
|
|
|
|
|
* @param criteria 新的查询条件集合
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public void or(Criteria criteria) {
|
|
|
|
|
oredCriteria.add(criteria);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 创建一个新的查询条件集合,并与现有条件集合以 OR 关系连接
|
|
|
|
|
* @return 新的查询条件集合
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public Criteria or() {
|
|
|
|
|
Criteria criteria = createCriteriaInternal();
|
|
|
|
|
oredCriteria.add(criteria);
|
|
|
|
|
return criteria;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 创建一个新的查询条件集合,如果是第一个条件集合,则直接添加到 oredCriteria 中
|
|
|
|
|
* @return 新的查询条件集合
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public Criteria createCriteria() {
|
|
|
|
|
Criteria criteria = createCriteriaInternal();
|
|
|
|
|
if (oredCriteria.size() == 0) {
|
|
|
|
@ -93,67 +64,46 @@ public class TbExchangeCardLogExample extends BaseMybatisExample {
|
|
|
|
|
return criteria;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 内部方法,用于创建一个新的查询条件集合
|
|
|
|
|
* @return 新的查询条件集合
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
protected Criteria createCriteriaInternal() {
|
|
|
|
|
Criteria criteria = new Criteria();
|
|
|
|
|
return criteria;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 清空所有的查询条件、排序规则和去重标志
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public void clear() {
|
|
|
|
|
oredCriteria.clear();
|
|
|
|
|
orderByClause = null;
|
|
|
|
|
distinct = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GeneratedCriteria 是一个抽象静态类,用于生成具体的查询条件
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
protected abstract static class GeneratedCriteria {
|
|
|
|
|
// 存储具体的查询条件
|
|
|
|
|
protected List<Criterion> criteria;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 构造函数,初始化 criteria 列表
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
protected GeneratedCriteria() {
|
|
|
|
|
super();
|
|
|
|
|
criteria = new ArrayList<Criterion>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断当前查询条件集合是否有效,即是否包含至少一个条件
|
|
|
|
|
* @return 如果有效返回 true,否则返回 false
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public boolean isValid() {
|
|
|
|
|
return criteria.size() > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取所有的查询条件
|
|
|
|
|
* @return 查询条件列表
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public List<Criterion> getAllCriteria() {
|
|
|
|
|
return criteria;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取所有的查询条件
|
|
|
|
|
* @return 查询条件列表
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public List<Criterion> getCriteria() {
|
|
|
|
|
return criteria;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加一个无值的查询条件,例如 "ID is null"
|
|
|
|
|
* @param condition 查询条件字符串
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
protected void addCriterion(String condition) {
|
|
|
|
|
if (condition == null) {
|
|
|
|
|
throw new RuntimeException("Value for condition cannot be null");
|
|
|
|
@ -161,12 +111,7 @@ public class TbExchangeCardLogExample extends BaseMybatisExample {
|
|
|
|
|
criteria.add(new Criterion(condition));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加一个单值的查询条件,例如 "ID = 1"
|
|
|
|
|
* @param condition 查询条件字符串
|
|
|
|
|
* @param value 条件的值
|
|
|
|
|
* @param property 属性名,用于错误提示
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
protected void addCriterion(String condition, Object value, String property) {
|
|
|
|
|
if (value == null) {
|
|
|
|
|
throw new RuntimeException("Value for " + property + " cannot be null");
|
|
|
|
@ -174,13 +119,7 @@ public class TbExchangeCardLogExample extends BaseMybatisExample {
|
|
|
|
|
criteria.add(new Criterion(condition, value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加一个范围查询条件,例如 "ID between 1 and 10"
|
|
|
|
|
* @param condition 查询条件字符串
|
|
|
|
|
* @param value1 范围的起始值
|
|
|
|
|
* @param value2 范围的结束值
|
|
|
|
|
* @param property 属性名,用于错误提示
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
|
|
|
|
if (value1 == null || value2 == null) {
|
|
|
|
|
throw new RuntimeException("Between values for " + property + " cannot be null");
|
|
|
|
@ -190,29 +129,19 @@ public class TbExchangeCardLogExample extends BaseMybatisExample {
|
|
|
|
|
|
|
|
|
|
// 以下是针对各个字段的查询条件生成方法,例如判断字段是否为空、等于某个值、大于某个值等
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加一个条件:ID 字段为空
|
|
|
|
|
* @return 当前查询条件集合
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public Criteria andIdIsNull() {
|
|
|
|
|
addCriterion("ID is null");
|
|
|
|
|
return (Criteria) this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加一个条件:ID 字段不为空
|
|
|
|
|
* @return 当前查询条件集合
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public Criteria andIdIsNotNull() {
|
|
|
|
|
addCriterion("ID is not null");
|
|
|
|
|
return (Criteria) this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加一个条件:ID 字段等于指定值
|
|
|
|
|
* @param value 指定的值
|
|
|
|
|
* @return 当前查询条件集合
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public Criteria andIdEqualTo(Integer value) {
|
|
|
|
|
addCriterion("ID =", value, "id");
|
|
|
|
|
return (Criteria) this;
|
|
|
|
@ -220,10 +149,7 @@ public class TbExchangeCardLogExample extends BaseMybatisExample {
|
|
|
|
|
|
|
|
|
|
// 其他针对 ID 字段的条件生成方法,如不等于、大于、小于等
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加一个条件:OLD_COUPON_ID 字段为空
|
|
|
|
|
* @return 当前查询条件集合
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public Criteria andOldCouponIdIsNull() {
|
|
|
|
|
addCriterion("OLD_COUPON_ID is null");
|
|
|
|
|
return (Criteria) this;
|
|
|
|
@ -235,22 +161,16 @@ public class TbExchangeCardLogExample extends BaseMybatisExample {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Criteria 类继承自 GeneratedCriteria,用于具体的条件生成
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public static class Criteria extends GeneratedCriteria {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 构造函数
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
protected Criteria() {
|
|
|
|
|
super();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Criterion 类表示一个具体的查询条件
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public static class Criterion {
|
|
|
|
|
// 查询条件的字符串表示,例如 "ID = "
|
|
|
|
|
private String condition;
|
|
|
|
@ -269,74 +189,47 @@ public class TbExchangeCardLogExample extends BaseMybatisExample {
|
|
|
|
|
// 类型处理器,用于处理特殊类型的值
|
|
|
|
|
private String typeHandler;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取查询条件的字符串表示
|
|
|
|
|
* @return 查询条件字符串
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public String getCondition() {
|
|
|
|
|
return condition;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取条件的值
|
|
|
|
|
* @return 条件的值
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public Object getValue() {
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取范围查询时的第二个值
|
|
|
|
|
* @return 第二个值
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public Object getSecondValue() {
|
|
|
|
|
return secondValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断是否为无值条件
|
|
|
|
|
* @return 如果是无值条件返回 true,否则返回 false
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public boolean isNoValue() {
|
|
|
|
|
return noValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断是否为单值条件
|
|
|
|
|
* @return 如果是单值条件返回 true,否则返回 false
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public boolean isSingleValue() {
|
|
|
|
|
return singleValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断是否为范围查询条件
|
|
|
|
|
* @return 如果是范围查询条件返回 true,否则返回 false
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public boolean isBetweenValue() {
|
|
|
|
|
return betweenValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断是否为列表值条件
|
|
|
|
|
* @return 如果是列表值条件返回 true,否则返回 false
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public boolean isListValue() {
|
|
|
|
|
return listValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取类型处理器
|
|
|
|
|
* @return 类型处理器字符串
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public String getTypeHandler() {
|
|
|
|
|
return typeHandler;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 构造函数,用于创建无值条件
|
|
|
|
|
* @param condition 查询条件字符串
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
protected Criterion(String condition) {
|
|
|
|
|
super();
|
|
|
|
|
this.condition = condition;
|
|
|
|
@ -344,12 +237,7 @@ public class TbExchangeCardLogExample extends BaseMybatisExample {
|
|
|
|
|
this.noValue = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 构造函数,用于创建单值条件
|
|
|
|
|
* @param condition 查询条件字符串
|
|
|
|
|
* @param value 条件的值
|
|
|
|
|
* @param typeHandler 类型处理器
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
protected Criterion(String condition, Object value, String typeHandler) {
|
|
|
|
|
super();
|
|
|
|
|
this.condition = condition;
|
|
|
|
@ -362,22 +250,12 @@ public class TbExchangeCardLogExample extends BaseMybatisExample {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 构造函数,用于创建单值条件,不指定类型处理器
|
|
|
|
|
* @param condition 查询条件字符串
|
|
|
|
|
* @param value 条件的值
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
protected Criterion(String condition, Object value) {
|
|
|
|
|
this(condition, value, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 构造函数,用于创建范围查询条件
|
|
|
|
|
* @param condition 查询条件字符串
|
|
|
|
|
* @param value 范围的起始值
|
|
|
|
|
* @param secondValue 范围的结束值
|
|
|
|
|
* @param typeHandler 类型处理器
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
|
|
|
|
super();
|
|
|
|
|
this.condition = condition;
|
|
|
|
@ -387,12 +265,7 @@ public class TbExchangeCardLogExample extends BaseMybatisExample {
|
|
|
|
|
this.betweenValue = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 构造函数,用于创建范围查询条件,不指定类型处理器
|
|
|
|
|
* @param condition 查询条件字符串
|
|
|
|
|
* @param value 范围的起始值
|
|
|
|
|
* @param secondValue 范围的结束值
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
protected Criterion(String condition, Object value, Object secondValue) {
|
|
|
|
|
this(condition, value, secondValue, null);
|
|
|
|
|
}
|
|
|
|
|