|
|
|
@ -4,46 +4,58 @@ import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
public class CmsPrefrenceAreaProductRelationExample {
|
|
|
|
|
// 定义排序子句
|
|
|
|
|
protected String orderByClause;
|
|
|
|
|
|
|
|
|
|
// 是否去重
|
|
|
|
|
protected boolean distinct;
|
|
|
|
|
|
|
|
|
|
// 存储查询条件列表
|
|
|
|
|
protected List<Criteria> oredCriteria;
|
|
|
|
|
|
|
|
|
|
// 构造函数,初始化查询条件列表
|
|
|
|
|
public CmsPrefrenceAreaProductRelationExample() {
|
|
|
|
|
oredCriteria = new ArrayList<>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 设置排序子句
|
|
|
|
|
public void setOrderByClause(String orderByClause) {
|
|
|
|
|
this.orderByClause = orderByClause;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取排序子句
|
|
|
|
|
public String getOrderByClause() {
|
|
|
|
|
return orderByClause;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 设置是否去重
|
|
|
|
|
public void setDistinct(boolean distinct) {
|
|
|
|
|
this.distinct = distinct;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 判断是否去重
|
|
|
|
|
public boolean isDistinct() {
|
|
|
|
|
return distinct;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取查询条件列表
|
|
|
|
|
public List<Criteria> getOredCriteria() {
|
|
|
|
|
return oredCriteria;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 添加一个查询条件到列表中
|
|
|
|
|
public void or(Criteria criteria) {
|
|
|
|
|
oredCriteria.add(criteria);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 创建一个新的查询条件并添加到列表中
|
|
|
|
|
public Criteria or() {
|
|
|
|
|
Criteria criteria = createCriteriaInternal();
|
|
|
|
|
oredCriteria.add(criteria);
|
|
|
|
|
return criteria;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 创建一个新的查询条件,如果当前没有查询条件则添加到列表中
|
|
|
|
|
public Criteria createCriteria() {
|
|
|
|
|
Criteria criteria = createCriteriaInternal();
|
|
|
|
|
if (oredCriteria.size() == 0) {
|
|
|
|
@ -52,37 +64,46 @@ public class CmsPrefrenceAreaProductRelationExample {
|
|
|
|
|
return criteria;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 内部方法,用于创建新的查询条件对象
|
|
|
|
|
protected Criteria createCriteriaInternal() {
|
|
|
|
|
Criteria criteria = new Criteria();
|
|
|
|
|
return criteria;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 清除所有查询条件和排序子句,重置为初始状态
|
|
|
|
|
public void clear() {
|
|
|
|
|
oredCriteria.clear();
|
|
|
|
|
orderByClause = null;
|
|
|
|
|
distinct = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected abstract static class GeneratedCriteria {
|
|
|
|
|
// 定义一个保护类型的列表,用于存储查询条件
|
|
|
|
|
protected List<Criterion> criteria;
|
|
|
|
|
|
|
|
|
|
// 构造函数,初始化criteria列表
|
|
|
|
|
protected GeneratedCriteria() {
|
|
|
|
|
super();
|
|
|
|
|
criteria = new ArrayList<>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 判断是否有有效的查询条件
|
|
|
|
|
public boolean isValid() {
|
|
|
|
|
return criteria.size() > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取所有的查询条件
|
|
|
|
|
public List<Criterion> getAllCriteria() {
|
|
|
|
|
return criteria;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取当前的查询条件列表
|
|
|
|
|
public List<Criterion> getCriteria() {
|
|
|
|
|
return criteria;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 添加一个简单的查询条件
|
|
|
|
|
protected void addCriterion(String condition) {
|
|
|
|
|
if (condition == null) {
|
|
|
|
|
throw new RuntimeException("Value for condition cannot be null");
|
|
|
|
@ -90,6 +111,7 @@ public class CmsPrefrenceAreaProductRelationExample {
|
|
|
|
|
criteria.add(new Criterion(condition));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 添加一个带值的查询条件
|
|
|
|
|
protected void addCriterion(String condition, Object value, String property) {
|
|
|
|
|
if (value == null) {
|
|
|
|
|
throw new RuntimeException("Value for " + property + " cannot be null");
|
|
|
|
@ -97,6 +119,7 @@ public class CmsPrefrenceAreaProductRelationExample {
|
|
|
|
|
criteria.add(new Criterion(condition, value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 添加一个带两个值的查询条件(通常用于范围查询)
|
|
|
|
|
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");
|
|
|
|
@ -104,6 +127,7 @@ public class CmsPrefrenceAreaProductRelationExample {
|
|
|
|
|
criteria.add(new Criterion(condition, value1, value2));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 以下方法用于生成具体的查询条件,例如id是否为空、id等于某个值等
|
|
|
|
|
public Criteria andIdIsNull() {
|
|
|
|
|
addCriterion("id is null");
|
|
|
|
|
return (Criteria) this;
|
|
|
|
@ -164,6 +188,7 @@ public class CmsPrefrenceAreaProductRelationExample {
|
|
|
|
|
return (Criteria) this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 以下方法用于生成prefrence_area_id相关的查询条件
|
|
|
|
|
public Criteria andPrefrenceAreaIdIsNull() {
|
|
|
|
|
addCriterion("prefrence_area_id is null");
|
|
|
|
|
return (Criteria) this;
|
|
|
|
@ -224,6 +249,7 @@ public class CmsPrefrenceAreaProductRelationExample {
|
|
|
|
|
return (Criteria) this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 以下方法用于生成product_id相关的查询条件
|
|
|
|
|
public Criteria andProductIdIsNull() {
|
|
|
|
|
addCriterion("product_id is null");
|
|
|
|
|
return (Criteria) this;
|
|
|
|
@ -259,87 +285,124 @@ public class CmsPrefrenceAreaProductRelationExample {
|
|
|
|
|
return (Criteria) this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加一个条件,要求 product_id 小于或等于指定的值。
|
|
|
|
|
*
|
|
|
|
|
* @param value 要比较的值
|
|
|
|
|
* @return 当前的 Criteria 对象
|
|
|
|
|
*/
|
|
|
|
|
public Criteria andProductIdLessThanOrEqualTo(Long value) {
|
|
|
|
|
addCriterion("product_id <=", value, "productId");
|
|
|
|
|
return (Criteria) this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加一个条件,要求 product_id 在指定的值列表中。
|
|
|
|
|
*
|
|
|
|
|
* @param values 要匹配的值列表
|
|
|
|
|
* @return 当前的 Criteria 对象
|
|
|
|
|
*/
|
|
|
|
|
public Criteria andProductIdIn(List<Long> values) {
|
|
|
|
|
addCriterion("product_id in", values, "productId");
|
|
|
|
|
return (Criteria) this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加一个条件,要求 product_id 不在指定的值列表中。
|
|
|
|
|
*
|
|
|
|
|
* @param values 不匹配的值列表
|
|
|
|
|
* @return 当前的 Criteria 对象
|
|
|
|
|
*/
|
|
|
|
|
public Criteria andProductIdNotIn(List<Long> values) {
|
|
|
|
|
addCriterion("product_id not in", values, "productId");
|
|
|
|
|
return (Criteria) this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加一个条件,要求 product_id 在指定的两个值之间(包含边界)。
|
|
|
|
|
*
|
|
|
|
|
* @param value1 范围的起始值
|
|
|
|
|
* @param value2 范围的结束值
|
|
|
|
|
* @return 当前的 Criteria 对象
|
|
|
|
|
*/
|
|
|
|
|
public Criteria andProductIdBetween(Long value1, Long value2) {
|
|
|
|
|
addCriterion("product_id between", value1, value2, "productId");
|
|
|
|
|
return (Criteria) this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加一个条件,要求 product_id 不在指定的两个值之间(不包含边界)。
|
|
|
|
|
*
|
|
|
|
|
* @param value1 范围的起始值
|
|
|
|
|
* @param value2 范围的结束值
|
|
|
|
|
* @return 当前的 Criteria 对象
|
|
|
|
|
*/
|
|
|
|
|
public Criteria andProductIdNotBetween(Long value1, Long value2) {
|
|
|
|
|
addCriterion("product_id not between", value1, value2, "productId");
|
|
|
|
|
return (Criteria) this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class Criteria extends GeneratedCriteria {
|
|
|
|
|
// 构造函数,初始化Criteria对象
|
|
|
|
|
protected Criteria() {
|
|
|
|
|
super();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class Criterion {
|
|
|
|
|
private String condition;
|
|
|
|
|
|
|
|
|
|
private Object value;
|
|
|
|
|
|
|
|
|
|
private Object secondValue;
|
|
|
|
|
|
|
|
|
|
private boolean noValue;
|
|
|
|
|
|
|
|
|
|
private boolean singleValue;
|
|
|
|
|
|
|
|
|
|
private boolean betweenValue;
|
|
|
|
|
|
|
|
|
|
private boolean listValue;
|
|
|
|
|
|
|
|
|
|
private String typeHandler;
|
|
|
|
|
|
|
|
|
|
private String condition; // 条件表达式
|
|
|
|
|
private Object value; // 条件值
|
|
|
|
|
private Object secondValue; // 第二个条件值(用于between查询)
|
|
|
|
|
private boolean noValue; // 是否没有值
|
|
|
|
|
private boolean singleValue; // 是否为单一值
|
|
|
|
|
private boolean betweenValue; // 是否为区间值
|
|
|
|
|
private boolean listValue; // 是否为列表值
|
|
|
|
|
private String typeHandler; // 类型处理器
|
|
|
|
|
|
|
|
|
|
// 获取条件表达式
|
|
|
|
|
public String getCondition() {
|
|
|
|
|
return condition;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取条件值
|
|
|
|
|
public Object getValue() {
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取第二个条件值
|
|
|
|
|
public Object getSecondValue() {
|
|
|
|
|
return secondValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 判断是否没有值
|
|
|
|
|
public boolean isNoValue() {
|
|
|
|
|
return noValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 判断是否为单一值
|
|
|
|
|
public boolean isSingleValue() {
|
|
|
|
|
return singleValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 判断是否为区间值
|
|
|
|
|
public boolean isBetweenValue() {
|
|
|
|
|
return betweenValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 判断是否为列表值
|
|
|
|
|
public boolean isListValue() {
|
|
|
|
|
return listValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取类型处理器
|
|
|
|
|
public String getTypeHandler() {
|
|
|
|
|
return typeHandler;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 构造函数,仅包含条件表达式
|
|
|
|
|
protected Criterion(String condition) {
|
|
|
|
|
super();
|
|
|
|
|
this.condition = condition;
|
|
|
|
@ -347,33 +410,38 @@ public class CmsPrefrenceAreaProductRelationExample {
|
|
|
|
|
this.noValue = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 构造函数,包含条件表达式和值,以及类型处理器
|
|
|
|
|
protected Criterion(String condition, Object value, String typeHandler) {
|
|
|
|
|
super();
|
|
|
|
|
this.condition = condition;
|
|
|
|
|
this.value = value;
|
|
|
|
|
this.typeHandler = typeHandler;
|
|
|
|
|
if (value instanceof List<?>) {
|
|
|
|
|
this.listValue = true;
|
|
|
|
|
this.listValue = true; // 如果值为列表,则设置listValue为true
|
|
|
|
|
} else {
|
|
|
|
|
this.singleValue = true;
|
|
|
|
|
this.singleValue = true; // 否则设置为单一值
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 构造函数,包含条件表达式和值
|
|
|
|
|
protected Criterion(String condition, Object value) {
|
|
|
|
|
this(condition, value, null);
|
|
|
|
|
this(condition, value, null); // 调用另一个构造函数,并传递null作为类型处理器
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 构造函数,包含条件表达式、两个值和类型处理器
|
|
|
|
|
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
|
|
|
|
super();
|
|
|
|
|
this.condition = condition;
|
|
|
|
|
this.value = value;
|
|
|
|
|
this.secondValue = secondValue;
|
|
|
|
|
this.typeHandler = typeHandler;
|
|
|
|
|
this.betweenValue = true;
|
|
|
|
|
this.betweenValue = true; // 设置为区间值
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 构造函数,包含条件表达式、两个值
|
|
|
|
|
protected Criterion(String condition, Object value, Object secondValue) {
|
|
|
|
|
this(condition, value, secondValue, null);
|
|
|
|
|
this(condition, value, secondValue, null); // 调用另一个构造函数,并传递null作为类型处理器
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|