From 570fff521b73bcdd0d4ec16906f7fc55e385946d Mon Sep 17 00:00:00 2001 From: Junling Bu Date: Thu, 13 Dec 2018 13:00:30 +0800 Subject: [PATCH] =?UTF-8?q?fix[litemall-db]:=20LitemallCoupon=E7=9A=84good?= =?UTF-8?q?sValue=E4=BD=BF=E7=94=A8Integer[]=E7=B1=BB=E5=9E=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatis-generator/generatorConfig.xml | 2 + .../litemall/db/domain/LitemallCoupon.java | 10 +-- .../db/domain/LitemallCouponExample.java | 86 +++++++++++++------ .../litemall/db/dao/LitemallCouponMapper.xml | 64 +++++++++++--- 4 files changed, 119 insertions(+), 43 deletions(-) diff --git a/litemall-db/mybatis-generator/generatorConfig.xml b/litemall-db/mybatis-generator/generatorConfig.xml index bfa13bea..b7c24314 100644 --- a/litemall-db/mybatis-generator/generatorConfig.xml +++ b/litemall-db/mybatis-generator/generatorConfig.xml @@ -160,6 +160,8 @@ +
diff --git a/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallCoupon.java b/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallCoupon.java index 8836c5d7..85f0d78b 100644 --- a/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallCoupon.java +++ b/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallCoupon.java @@ -130,7 +130,7 @@ public class LitemallCoupon { * * @mbg.generated */ - private String goodsValue; + private Integer[] goodsValue; /** * @@ -458,7 +458,7 @@ public class LitemallCoupon { * * @mbg.generated */ - public String getGoodsValue() { + public Integer[] getGoodsValue() { return goodsValue; } @@ -470,7 +470,7 @@ public class LitemallCoupon { * * @mbg.generated */ - public void setGoodsValue(String goodsValue) { + public void setGoodsValue(Integer[] goodsValue) { this.goodsValue = goodsValue; } @@ -681,7 +681,7 @@ public class LitemallCoupon { && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getGoodsType() == null ? other.getGoodsType() == null : this.getGoodsType().equals(other.getGoodsType())) - && (this.getGoodsValue() == null ? other.getGoodsValue() == null : this.getGoodsValue().equals(other.getGoodsValue())) + && (Arrays.equals(this.getGoodsValue(), other.getGoodsValue())) && (this.getDays() == null ? other.getDays() == null : this.getDays().equals(other.getDays())) && (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime())) && (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime())) @@ -711,7 +711,7 @@ public class LitemallCoupon { result = prime * result + ((getType() == null) ? 0 : getType().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getGoodsType() == null) ? 0 : getGoodsType().hashCode()); - result = prime * result + ((getGoodsValue() == null) ? 0 : getGoodsValue().hashCode()); + result = prime * result + (Arrays.hashCode(getGoodsValue())); result = prime * result + ((getDays() == null) ? 0 : getDays().hashCode()); result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode()); result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode()); diff --git a/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallCouponExample.java b/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallCouponExample.java index ed8a48e9..78ade52d 100644 --- a/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallCouponExample.java +++ b/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallCouponExample.java @@ -199,19 +199,50 @@ public class LitemallCouponExample { * @mbg.generated */ protected abstract static class GeneratedCriteria { + protected List goodsValueCriteria; + + protected List allCriteria; + protected List criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList(); + goodsValueCriteria = new ArrayList(); + } + + public List getGoodsValueCriteria() { + return goodsValueCriteria; + } + + protected void addGoodsValueCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + goodsValueCriteria.add(new Criterion(condition, value, "org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler")); + allCriteria = null; + } + + protected void addGoodsValueCriterion(String condition, Integer[] value1, Integer[] value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + goodsValueCriteria.add(new Criterion(condition, value1, value2, "org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler")); + allCriteria = null; } public boolean isValid() { - return criteria.size() > 0; + return criteria.size() > 0 + || goodsValueCriteria.size() > 0; } public List getAllCriteria() { - return criteria; + if (allCriteria == null) { + allCriteria = new ArrayList(); + allCriteria.addAll(criteria); + allCriteria.addAll(goodsValueCriteria); + } + return allCriteria; } public List getCriteria() { @@ -223,6 +254,7 @@ public class LitemallCouponExample { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); + allCriteria = null; } protected void addCriterion(String condition, Object value, String property) { @@ -230,6 +262,7 @@ public class LitemallCouponExample { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); + allCriteria = null; } protected void addCriterion(String condition, Object value1, Object value2, String property) { @@ -237,6 +270,7 @@ public class LitemallCouponExample { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); + allCriteria = null; } public Criteria andIdIsNull() { @@ -1731,8 +1765,8 @@ public class LitemallCouponExample { return (Criteria) this; } - public Criteria andGoodsValueEqualTo(String value) { - addCriterion("goods_value =", value, "goodsValue"); + public Criteria andGoodsValueEqualTo(Integer[] value) { + addGoodsValueCriterion("goods_value =", value, "goodsValue"); return (Criteria) this; } @@ -1748,8 +1782,8 @@ public class LitemallCouponExample { return (Criteria) this; } - public Criteria andGoodsValueNotEqualTo(String value) { - addCriterion("goods_value <>", value, "goodsValue"); + public Criteria andGoodsValueNotEqualTo(Integer[] value) { + addGoodsValueCriterion("goods_value <>", value, "goodsValue"); return (Criteria) this; } @@ -1765,8 +1799,8 @@ public class LitemallCouponExample { return (Criteria) this; } - public Criteria andGoodsValueGreaterThan(String value) { - addCriterion("goods_value >", value, "goodsValue"); + public Criteria andGoodsValueGreaterThan(Integer[] value) { + addGoodsValueCriterion("goods_value >", value, "goodsValue"); return (Criteria) this; } @@ -1782,8 +1816,8 @@ public class LitemallCouponExample { return (Criteria) this; } - public Criteria andGoodsValueGreaterThanOrEqualTo(String value) { - addCriterion("goods_value >=", value, "goodsValue"); + public Criteria andGoodsValueGreaterThanOrEqualTo(Integer[] value) { + addGoodsValueCriterion("goods_value >=", value, "goodsValue"); return (Criteria) this; } @@ -1799,8 +1833,8 @@ public class LitemallCouponExample { return (Criteria) this; } - public Criteria andGoodsValueLessThan(String value) { - addCriterion("goods_value <", value, "goodsValue"); + public Criteria andGoodsValueLessThan(Integer[] value) { + addGoodsValueCriterion("goods_value <", value, "goodsValue"); return (Criteria) this; } @@ -1816,8 +1850,8 @@ public class LitemallCouponExample { return (Criteria) this; } - public Criteria andGoodsValueLessThanOrEqualTo(String value) { - addCriterion("goods_value <=", value, "goodsValue"); + public Criteria andGoodsValueLessThanOrEqualTo(Integer[] value) { + addGoodsValueCriterion("goods_value <=", value, "goodsValue"); return (Criteria) this; } @@ -1833,33 +1867,33 @@ public class LitemallCouponExample { return (Criteria) this; } - public Criteria andGoodsValueLike(String value) { - addCriterion("goods_value like", value, "goodsValue"); + public Criteria andGoodsValueLike(Integer[] value) { + addGoodsValueCriterion("goods_value like", value, "goodsValue"); return (Criteria) this; } - public Criteria andGoodsValueNotLike(String value) { - addCriterion("goods_value not like", value, "goodsValue"); + public Criteria andGoodsValueNotLike(Integer[] value) { + addGoodsValueCriterion("goods_value not like", value, "goodsValue"); return (Criteria) this; } - public Criteria andGoodsValueIn(List values) { - addCriterion("goods_value in", values, "goodsValue"); + public Criteria andGoodsValueIn(List values) { + addGoodsValueCriterion("goods_value in", values, "goodsValue"); return (Criteria) this; } - public Criteria andGoodsValueNotIn(List values) { - addCriterion("goods_value not in", values, "goodsValue"); + public Criteria andGoodsValueNotIn(List values) { + addGoodsValueCriterion("goods_value not in", values, "goodsValue"); return (Criteria) this; } - public Criteria andGoodsValueBetween(String value1, String value2) { - addCriterion("goods_value between", value1, value2, "goodsValue"); + public Criteria andGoodsValueBetween(Integer[] value1, Integer[] value2) { + addGoodsValueCriterion("goods_value between", value1, value2, "goodsValue"); return (Criteria) this; } - public Criteria andGoodsValueNotBetween(String value1, String value2) { - addCriterion("goods_value not between", value1, value2, "goodsValue"); + public Criteria andGoodsValueNotBetween(Integer[] value1, Integer[] value2) { + addGoodsValueCriterion("goods_value not between", value1, value2, "goodsValue"); return (Criteria) this; } diff --git a/litemall-db/src/main/resources/org/linlinjava/litemall/db/dao/LitemallCouponMapper.xml b/litemall-db/src/main/resources/org/linlinjava/litemall/db/dao/LitemallCouponMapper.xml index 6e251b3c..ace6e052 100644 --- a/litemall-db/src/main/resources/org/linlinjava/litemall/db/dao/LitemallCouponMapper.xml +++ b/litemall-db/src/main/resources/org/linlinjava/litemall/db/dao/LitemallCouponMapper.xml @@ -17,7 +17,7 @@ - + @@ -53,6 +53,25 @@ + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler} + + + and ${criterion.condition} #{criterion.value,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler} and #{criterion.secondValue,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler} + + + and ${criterion.condition} + + #{listItem,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler} + + + + @@ -86,6 +105,25 @@ + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler} + + + and ${criterion.condition} #{criterion.value,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler} and #{criterion.secondValue,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler} + + + and ${criterion.condition} + + #{listItem,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler} + + + + @@ -230,15 +268,17 @@ insert into litemall_coupon (`name`, `desc`, tag, total, discount, `min`, `limit`, `type`, `status`, - goods_type, goods_value, `days`, - start_time, end_time, add_time, - update_time, deleted) + goods_type, goods_value, + `days`, start_time, end_time, + add_time, update_time, deleted + ) values (#{name,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR}, #{tag,jdbcType=VARCHAR}, #{total,jdbcType=INTEGER}, #{discount,jdbcType=DECIMAL}, #{min,jdbcType=DECIMAL}, #{limit,jdbcType=SMALLINT}, #{type,jdbcType=SMALLINT}, #{status,jdbcType=SMALLINT}, - #{goodsType,jdbcType=SMALLINT}, #{goodsValue,jdbcType=VARCHAR}, #{days,jdbcType=SMALLINT}, - #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{addTime,jdbcType=TIMESTAMP}, - #{updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT}) + #{goodsType,jdbcType=SMALLINT}, #{goodsValue,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler}, + #{days,jdbcType=SMALLINT}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, + #{addTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT} + )