From 3a28b9d4dc0f383ec293390ae522d8022d2336ab Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Tue, 20 Jul 2021 23:35:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OutRechargePriceController.java | 2 + .../com/hai/dao/OutRechargePriceMapper.java | 20 ++- .../hai/dao/OutRechargePriceSqlProvider.java | 28 +++ .../java/com/hai/entity/OutRechargePrice.java | 47 ++++- .../hai/entity/OutRechargePriceExample.java | 161 +++++++++++++++--- 5 files changed, 225 insertions(+), 33 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java b/hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java index e7173373..c70386b0 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java @@ -79,6 +79,7 @@ public class OutRechargePriceController { if (outRechargePrice.getType() == null || outRechargePrice.getPrice() == null || outRechargePrice.getRealPrice() == null + || outRechargePrice.getGoodsId() == null ) { log.error("SecOrganizationController -> insertPrice() error!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); @@ -106,6 +107,7 @@ public class OutRechargePriceController { || outRechargePrice.getId() == null || outRechargePrice.getPrice() == null || outRechargePrice.getRealPrice() == null + || outRechargePrice.getGoodsId() == null ) { log.error("SecOrganizationController -> updatePrice() error!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); diff --git a/hai-service/src/main/java/com/hai/dao/OutRechargePriceMapper.java b/hai-service/src/main/java/com/hai/dao/OutRechargePriceMapper.java index d00ba303..4011f344 100644 --- a/hai-service/src/main/java/com/hai/dao/OutRechargePriceMapper.java +++ b/hai-service/src/main/java/com/hai/dao/OutRechargePriceMapper.java @@ -40,9 +40,11 @@ public interface OutRechargePriceMapper extends OutRechargePriceMapperExt { @Insert({ "insert into out_recharge_price (`type`, price, ", - "real_price, create_time)", + "real_price, create_time, ", + "goods_id, discount)", "values (#{type,jdbcType=INTEGER}, #{price,jdbcType=DECIMAL}, ", - "#{realPrice,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP})" + "#{realPrice,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, ", + "#{goodsId,jdbcType=BIGINT}, #{discount,jdbcType=REAL})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(OutRechargePrice record); @@ -57,13 +59,15 @@ public interface OutRechargePriceMapper extends OutRechargePriceMapperExt { @Result(column="type", property="type", jdbcType=JdbcType.INTEGER), @Result(column="price", property="price", jdbcType=JdbcType.DECIMAL), @Result(column="real_price", property="realPrice", jdbcType=JdbcType.DECIMAL), - @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP) + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="goods_id", property="goodsId", jdbcType=JdbcType.BIGINT), + @Result(column="discount", property="discount", jdbcType=JdbcType.REAL) }) List selectByExample(OutRechargePriceExample example); @Select({ "select", - "id, `type`, price, real_price, create_time", + "id, `type`, price, real_price, create_time, goods_id, discount", "from out_recharge_price", "where id = #{id,jdbcType=BIGINT}" }) @@ -72,7 +76,9 @@ public interface OutRechargePriceMapper extends OutRechargePriceMapperExt { @Result(column="type", property="type", jdbcType=JdbcType.INTEGER), @Result(column="price", property="price", jdbcType=JdbcType.DECIMAL), @Result(column="real_price", property="realPrice", jdbcType=JdbcType.DECIMAL), - @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP) + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="goods_id", property="goodsId", jdbcType=JdbcType.BIGINT), + @Result(column="discount", property="discount", jdbcType=JdbcType.REAL) }) OutRechargePrice selectByPrimaryKey(Long id); @@ -90,7 +96,9 @@ public interface OutRechargePriceMapper extends OutRechargePriceMapperExt { "set `type` = #{type,jdbcType=INTEGER},", "price = #{price,jdbcType=DECIMAL},", "real_price = #{realPrice,jdbcType=DECIMAL},", - "create_time = #{createTime,jdbcType=TIMESTAMP}", + "create_time = #{createTime,jdbcType=TIMESTAMP},", + "goods_id = #{goodsId,jdbcType=BIGINT},", + "discount = #{discount,jdbcType=REAL}", "where id = #{id,jdbcType=BIGINT}" }) int updateByPrimaryKey(OutRechargePrice record); diff --git a/hai-service/src/main/java/com/hai/dao/OutRechargePriceSqlProvider.java b/hai-service/src/main/java/com/hai/dao/OutRechargePriceSqlProvider.java index 54293015..0a8d8774 100644 --- a/hai-service/src/main/java/com/hai/dao/OutRechargePriceSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/OutRechargePriceSqlProvider.java @@ -44,6 +44,14 @@ public class OutRechargePriceSqlProvider { sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); } + if (record.getGoodsId() != null) { + sql.VALUES("goods_id", "#{goodsId,jdbcType=BIGINT}"); + } + + if (record.getDiscount() != null) { + sql.VALUES("discount", "#{discount,jdbcType=REAL}"); + } + return sql.toString(); } @@ -58,6 +66,8 @@ public class OutRechargePriceSqlProvider { sql.SELECT("price"); sql.SELECT("real_price"); sql.SELECT("create_time"); + sql.SELECT("goods_id"); + sql.SELECT("discount"); sql.FROM("out_recharge_price"); applyWhere(sql, example, false); @@ -95,6 +105,14 @@ public class OutRechargePriceSqlProvider { sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); } + if (record.getGoodsId() != null) { + sql.SET("goods_id = #{record.goodsId,jdbcType=BIGINT}"); + } + + if (record.getDiscount() != null) { + sql.SET("discount = #{record.discount,jdbcType=REAL}"); + } + applyWhere(sql, example, true); return sql.toString(); } @@ -108,6 +126,8 @@ public class OutRechargePriceSqlProvider { sql.SET("price = #{record.price,jdbcType=DECIMAL}"); sql.SET("real_price = #{record.realPrice,jdbcType=DECIMAL}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); + sql.SET("goods_id = #{record.goodsId,jdbcType=BIGINT}"); + sql.SET("discount = #{record.discount,jdbcType=REAL}"); OutRechargePriceExample example = (OutRechargePriceExample) parameter.get("example"); applyWhere(sql, example, true); @@ -134,6 +154,14 @@ public class OutRechargePriceSqlProvider { sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); } + if (record.getGoodsId() != null) { + sql.SET("goods_id = #{goodsId,jdbcType=BIGINT}"); + } + + if (record.getDiscount() != null) { + sql.SET("discount = #{discount,jdbcType=REAL}"); + } + sql.WHERE("id = #{id,jdbcType=BIGINT}"); return sql.toString(); diff --git a/hai-service/src/main/java/com/hai/entity/OutRechargePrice.java b/hai-service/src/main/java/com/hai/entity/OutRechargePrice.java index d4d1555a..3c220bd5 100644 --- a/hai-service/src/main/java/com/hai/entity/OutRechargePrice.java +++ b/hai-service/src/main/java/com/hai/entity/OutRechargePrice.java @@ -1,6 +1,7 @@ package com.hai.entity; import java.io.Serializable; +import java.math.BigDecimal; import java.util.Date; /** @@ -26,18 +27,28 @@ public class OutRechargePrice implements Serializable { /** * 金额 */ - private Long price; + private BigDecimal price; /** * 实际金额 */ - private Long realPrice; + private BigDecimal realPrice; /** * 创建时间 */ private Date createTime; + /** + * 商品ID + */ + private Long goodsId; + + /** + * 折扣比例 + */ + private Float discount; + private static final long serialVersionUID = 1L; public Long getId() { @@ -56,19 +67,19 @@ public class OutRechargePrice implements Serializable { this.type = type; } - public Long getPrice() { + public BigDecimal getPrice() { return price; } - public void setPrice(Long price) { + public void setPrice(BigDecimal price) { this.price = price; } - public Long getRealPrice() { + public BigDecimal getRealPrice() { return realPrice; } - public void setRealPrice(Long realPrice) { + public void setRealPrice(BigDecimal realPrice) { this.realPrice = realPrice; } @@ -80,6 +91,22 @@ public class OutRechargePrice implements Serializable { this.createTime = createTime; } + public Long getGoodsId() { + return goodsId; + } + + public void setGoodsId(Long goodsId) { + this.goodsId = goodsId; + } + + public Float getDiscount() { + return discount; + } + + public void setDiscount(Float discount) { + this.discount = discount; + } + @Override public boolean equals(Object that) { if (this == that) { @@ -96,7 +123,9 @@ public class OutRechargePrice implements Serializable { && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType())) && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice())) && (this.getRealPrice() == null ? other.getRealPrice() == null : this.getRealPrice().equals(other.getRealPrice())) - && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())); + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) + && (this.getGoodsId() == null ? other.getGoodsId() == null : this.getGoodsId().equals(other.getGoodsId())) + && (this.getDiscount() == null ? other.getDiscount() == null : this.getDiscount().equals(other.getDiscount())); } @Override @@ -108,6 +137,8 @@ public class OutRechargePrice implements Serializable { result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode()); result = prime * result + ((getRealPrice() == null) ? 0 : getRealPrice().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); + result = prime * result + ((getGoodsId() == null) ? 0 : getGoodsId().hashCode()); + result = prime * result + ((getDiscount() == null) ? 0 : getDiscount().hashCode()); return result; } @@ -122,6 +153,8 @@ public class OutRechargePrice implements Serializable { sb.append(", price=").append(price); sb.append(", realPrice=").append(realPrice); sb.append(", createTime=").append(createTime); + sb.append(", goodsId=").append(goodsId); + sb.append(", discount=").append(discount); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); diff --git a/hai-service/src/main/java/com/hai/entity/OutRechargePriceExample.java b/hai-service/src/main/java/com/hai/entity/OutRechargePriceExample.java index 296230be..c4bb3571 100644 --- a/hai-service/src/main/java/com/hai/entity/OutRechargePriceExample.java +++ b/hai-service/src/main/java/com/hai/entity/OutRechargePriceExample.java @@ -1,5 +1,6 @@ package com.hai.entity; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -255,52 +256,52 @@ public class OutRechargePriceExample { return (Criteria) this; } - public Criteria andPriceEqualTo(Long value) { + public Criteria andPriceEqualTo(BigDecimal value) { addCriterion("price =", value, "price"); return (Criteria) this; } - public Criteria andPriceNotEqualTo(Long value) { + public Criteria andPriceNotEqualTo(BigDecimal value) { addCriterion("price <>", value, "price"); return (Criteria) this; } - public Criteria andPriceGreaterThan(Long value) { + public Criteria andPriceGreaterThan(BigDecimal value) { addCriterion("price >", value, "price"); return (Criteria) this; } - public Criteria andPriceGreaterThanOrEqualTo(Long value) { + public Criteria andPriceGreaterThanOrEqualTo(BigDecimal value) { addCriterion("price >=", value, "price"); return (Criteria) this; } - public Criteria andPriceLessThan(Long value) { + public Criteria andPriceLessThan(BigDecimal value) { addCriterion("price <", value, "price"); return (Criteria) this; } - public Criteria andPriceLessThanOrEqualTo(Long value) { + public Criteria andPriceLessThanOrEqualTo(BigDecimal value) { addCriterion("price <=", value, "price"); return (Criteria) this; } - public Criteria andPriceIn(List values) { + public Criteria andPriceIn(List values) { addCriterion("price in", values, "price"); return (Criteria) this; } - public Criteria andPriceNotIn(List values) { + public Criteria andPriceNotIn(List values) { addCriterion("price not in", values, "price"); return (Criteria) this; } - public Criteria andPriceBetween(Long value1, Long value2) { + public Criteria andPriceBetween(BigDecimal value1, BigDecimal value2) { addCriterion("price between", value1, value2, "price"); return (Criteria) this; } - public Criteria andPriceNotBetween(Long value1, Long value2) { + public Criteria andPriceNotBetween(BigDecimal value1, BigDecimal value2) { addCriterion("price not between", value1, value2, "price"); return (Criteria) this; } @@ -315,52 +316,52 @@ public class OutRechargePriceExample { return (Criteria) this; } - public Criteria andRealPriceEqualTo(Long value) { + public Criteria andRealPriceEqualTo(BigDecimal value) { addCriterion("real_price =", value, "realPrice"); return (Criteria) this; } - public Criteria andRealPriceNotEqualTo(Long value) { + public Criteria andRealPriceNotEqualTo(BigDecimal value) { addCriterion("real_price <>", value, "realPrice"); return (Criteria) this; } - public Criteria andRealPriceGreaterThan(Long value) { + public Criteria andRealPriceGreaterThan(BigDecimal value) { addCriterion("real_price >", value, "realPrice"); return (Criteria) this; } - public Criteria andRealPriceGreaterThanOrEqualTo(Long value) { + public Criteria andRealPriceGreaterThanOrEqualTo(BigDecimal value) { addCriterion("real_price >=", value, "realPrice"); return (Criteria) this; } - public Criteria andRealPriceLessThan(Long value) { + public Criteria andRealPriceLessThan(BigDecimal value) { addCriterion("real_price <", value, "realPrice"); return (Criteria) this; } - public Criteria andRealPriceLessThanOrEqualTo(Long value) { + public Criteria andRealPriceLessThanOrEqualTo(BigDecimal value) { addCriterion("real_price <=", value, "realPrice"); return (Criteria) this; } - public Criteria andRealPriceIn(List values) { + public Criteria andRealPriceIn(List values) { addCriterion("real_price in", values, "realPrice"); return (Criteria) this; } - public Criteria andRealPriceNotIn(List values) { + public Criteria andRealPriceNotIn(List values) { addCriterion("real_price not in", values, "realPrice"); return (Criteria) this; } - public Criteria andRealPriceBetween(Long value1, Long value2) { + public Criteria andRealPriceBetween(BigDecimal value1, BigDecimal value2) { addCriterion("real_price between", value1, value2, "realPrice"); return (Criteria) this; } - public Criteria andRealPriceNotBetween(Long value1, Long value2) { + public Criteria andRealPriceNotBetween(BigDecimal value1, BigDecimal value2) { addCriterion("real_price not between", value1, value2, "realPrice"); return (Criteria) this; } @@ -424,6 +425,126 @@ public class OutRechargePriceExample { addCriterion("create_time not between", value1, value2, "createTime"); return (Criteria) this; } + + public Criteria andGoodsIdIsNull() { + addCriterion("goods_id is null"); + return (Criteria) this; + } + + public Criteria andGoodsIdIsNotNull() { + addCriterion("goods_id is not null"); + return (Criteria) this; + } + + public Criteria andGoodsIdEqualTo(Long value) { + addCriterion("goods_id =", value, "goodsId"); + return (Criteria) this; + } + + public Criteria andGoodsIdNotEqualTo(Long value) { + addCriterion("goods_id <>", value, "goodsId"); + return (Criteria) this; + } + + public Criteria andGoodsIdGreaterThan(Long value) { + addCriterion("goods_id >", value, "goodsId"); + return (Criteria) this; + } + + public Criteria andGoodsIdGreaterThanOrEqualTo(Long value) { + addCriterion("goods_id >=", value, "goodsId"); + return (Criteria) this; + } + + public Criteria andGoodsIdLessThan(Long value) { + addCriterion("goods_id <", value, "goodsId"); + return (Criteria) this; + } + + public Criteria andGoodsIdLessThanOrEqualTo(Long value) { + addCriterion("goods_id <=", value, "goodsId"); + return (Criteria) this; + } + + public Criteria andGoodsIdIn(List values) { + addCriterion("goods_id in", values, "goodsId"); + return (Criteria) this; + } + + public Criteria andGoodsIdNotIn(List values) { + addCriterion("goods_id not in", values, "goodsId"); + return (Criteria) this; + } + + public Criteria andGoodsIdBetween(Long value1, Long value2) { + addCriterion("goods_id between", value1, value2, "goodsId"); + return (Criteria) this; + } + + public Criteria andGoodsIdNotBetween(Long value1, Long value2) { + addCriterion("goods_id not between", value1, value2, "goodsId"); + return (Criteria) this; + } + + public Criteria andDiscountIsNull() { + addCriterion("discount is null"); + return (Criteria) this; + } + + public Criteria andDiscountIsNotNull() { + addCriterion("discount is not null"); + return (Criteria) this; + } + + public Criteria andDiscountEqualTo(Float value) { + addCriterion("discount =", value, "discount"); + return (Criteria) this; + } + + public Criteria andDiscountNotEqualTo(Float value) { + addCriterion("discount <>", value, "discount"); + return (Criteria) this; + } + + public Criteria andDiscountGreaterThan(Float value) { + addCriterion("discount >", value, "discount"); + return (Criteria) this; + } + + public Criteria andDiscountGreaterThanOrEqualTo(Float value) { + addCriterion("discount >=", value, "discount"); + return (Criteria) this; + } + + public Criteria andDiscountLessThan(Float value) { + addCriterion("discount <", value, "discount"); + return (Criteria) this; + } + + public Criteria andDiscountLessThanOrEqualTo(Float value) { + addCriterion("discount <=", value, "discount"); + return (Criteria) this; + } + + public Criteria andDiscountIn(List values) { + addCriterion("discount in", values, "discount"); + return (Criteria) this; + } + + public Criteria andDiscountNotIn(List values) { + addCriterion("discount not in", values, "discount"); + return (Criteria) this; + } + + public Criteria andDiscountBetween(Float value1, Float value2) { + addCriterion("discount between", value1, value2, "discount"); + return (Criteria) this; + } + + public Criteria andDiscountNotBetween(Float value1, Float value2) { + addCriterion("discount not between", value1, value2, "discount"); + return (Criteria) this; + } } /**