Commit 570fff52 authored by Junling Bu's avatar Junling Bu
Browse files

fix[litemall-db]: LitemallCoupon的goodsValue使用Integer[]类型。

parent 653f6b3c
......@@ -160,6 +160,8 @@
</table>
<table tableName="litemall_coupon">
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
<columnOverride column="goods_value" javaType="java.lang.Integer[]"
typeHandler="org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler"/>
</table>
<table tableName="litemall_coupon_user">
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
......
......@@ -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());
......
......@@ -199,19 +199,50 @@ public class LitemallCouponExample {
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> goodsValueCriteria;
protected List<Criterion> allCriteria;
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
goodsValueCriteria = new ArrayList<Criterion>();
}
public List<Criterion> 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<Criterion> getAllCriteria() {
return criteria;
if (allCriteria == null) {
allCriteria = new ArrayList<Criterion>();
allCriteria.addAll(criteria);
allCriteria.addAll(goodsValueCriteria);
}
return allCriteria;
}
public List<Criterion> 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<String> values) {
addCriterion("goods_value in", values, "goodsValue");
public Criteria andGoodsValueIn(List<Integer[]> values) {
addGoodsValueCriterion("goods_value in", values, "goodsValue");
return (Criteria) this;
}
public Criteria andGoodsValueNotIn(List<String> values) {
addCriterion("goods_value not in", values, "goodsValue");
public Criteria andGoodsValueNotIn(List<Integer[]> 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;
}
......
......@@ -17,7 +17,7 @@
<result column="type" jdbcType="SMALLINT" property="type" />
<result column="status" jdbcType="SMALLINT" property="status" />
<result column="goods_type" jdbcType="SMALLINT" property="goodsType" />
<result column="goods_value" jdbcType="VARCHAR" property="goodsValue" />
<result column="goods_value" jdbcType="VARCHAR" property="goodsValue" typeHandler="org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler" />
<result column="days" jdbcType="SMALLINT" property="days" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
......@@ -53,6 +53,25 @@
</when>
</choose>
</foreach>
<foreach collection="criteria.goodsValueCriteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler} and #{criterion.secondValue,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
......@@ -86,6 +105,25 @@
</when>
</choose>
</foreach>
<foreach collection="criteria.goodsValueCriteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler} and #{criterion.secondValue,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
......@@ -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}
)
</insert>
<insert id="insertSelective" parameterType="org.linlinjava.litemall.db.domain.LitemallCoupon">
<!--
......@@ -334,7 +374,7 @@
#{goodsType,jdbcType=SMALLINT},
</if>
<if test="goodsValue != null">
#{goodsValue,jdbcType=VARCHAR},
#{goodsValue,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler},
</if>
<if test="days != null">
#{days,jdbcType=SMALLINT},
......@@ -407,7 +447,7 @@
goods_type = #{record.goodsType,jdbcType=SMALLINT},
</if>
<if test="record.goodsValue != null">
goods_value = #{record.goodsValue,jdbcType=VARCHAR},
goods_value = #{record.goodsValue,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler},
</if>
<if test="record.days != null">
`days` = #{record.days,jdbcType=SMALLINT},
......@@ -449,7 +489,7 @@
`type` = #{record.type,jdbcType=SMALLINT},
`status` = #{record.status,jdbcType=SMALLINT},
goods_type = #{record.goodsType,jdbcType=SMALLINT},
goods_value = #{record.goodsValue,jdbcType=VARCHAR},
goods_value = #{record.goodsValue,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler},
`days` = #{record.days,jdbcType=SMALLINT},
start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP},
......@@ -498,7 +538,7 @@
goods_type = #{goodsType,jdbcType=SMALLINT},
</if>
<if test="goodsValue != null">
goods_value = #{goodsValue,jdbcType=VARCHAR},
goods_value = #{goodsValue,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler},
</if>
<if test="days != null">
`days` = #{days,jdbcType=SMALLINT},
......@@ -537,7 +577,7 @@
`type` = #{type,jdbcType=SMALLINT},
`status` = #{status,jdbcType=SMALLINT},
goods_type = #{goodsType,jdbcType=SMALLINT},
goods_value = #{goodsValue,jdbcType=VARCHAR},
goods_value = #{goodsValue,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler},
`days` = #{days,jdbcType=SMALLINT},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment