From 13c50398212effa9ab6ea5741fe895582bb95c12 Mon Sep 17 00:00:00 2001 From: 199901012 Date: Thu, 25 Mar 2021 23:18:59 +0800 Subject: [PATCH] =?UTF-8?q?'=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HighGoodsPriceReferController.java | 4 +- .../hai/dao/HighGoodsPriceReferMapper.java | 37 ++++++------ .../dao/HighGoodsPriceReferSqlProvider.java | 14 +++++ .../com/hai/entity/HighGoodsPriceRefer.java | 16 +++++ .../entity/HighGoodsPriceReferExample.java | 60 +++++++++++++++++++ .../service/HighGoodsPriceReferService.java | 2 + .../impl/HighGoodsPriceReferServiceImpl.java | 8 +++ 7 files changed, 122 insertions(+), 19 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighGoodsPriceReferController.java b/hai-bweb/src/main/java/com/bweb/controller/HighGoodsPriceReferController.java index a08717d7..d1d66593 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighGoodsPriceReferController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighGoodsPriceReferController.java @@ -122,6 +122,7 @@ public class HighGoodsPriceReferController { // 卡卷原价 * (折扣 ÷ 10) BigDecimal newSalePrice = coupon.getSalesPrice().multiply(new BigDecimal(addGoodsPriceModel.getDiscountNum().toString()).divide(new BigDecimal("10"))); highGoodsPriceRefer.setNewSalePrice(newSalePrice); + highGoodsPriceRefer.setDiscountNum(addGoodsPriceModel.getDiscountNum()); } highGoodsPriceRefer.setCreateTime(new Date()); highGoodsPriceRefer.setStatus(101); // 状态: 0:删除 1:待编辑 2:待生效 3:已生效 4:已失效 101.审批中 102.审批驳回 @@ -131,8 +132,7 @@ public class HighGoodsPriceReferController { } } - - highGoodsPriceReferService.submitApprove(null); + highGoodsPriceReferService.submitApproveList(list); return ResponseMsgUtil.success("操作成功"); } catch (Exception e) { diff --git a/hai-service/src/main/java/com/hai/dao/HighGoodsPriceReferMapper.java b/hai-service/src/main/java/com/hai/dao/HighGoodsPriceReferMapper.java index a4d75a00..31c4fc98 100644 --- a/hai-service/src/main/java/com/hai/dao/HighGoodsPriceReferMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighGoodsPriceReferMapper.java @@ -40,21 +40,21 @@ public interface HighGoodsPriceReferMapper extends HighGoodsPriceReferMapperExt @Insert({ "insert into high_goods_price_refer (object_type, object_id, ", - "price_type, old_sale_price, ", - "new_sale_price, promptly_type, ", - "effective_time, invalid_time, ", - "remark, create_time, ", - "operator_id, operator_name, ", - "`status`, ext_1, ext_2, ", - "ext_3)", + "price_type, discount_num, ", + "old_sale_price, new_sale_price, ", + "promptly_type, effective_time, ", + "invalid_time, remark, ", + "create_time, operator_id, ", + "operator_name, `status`, ", + "ext_1, ext_2, ext_3)", "values (#{objectType,jdbcType=INTEGER}, #{objectId,jdbcType=BIGINT}, ", - "#{priceType,jdbcType=INTEGER}, #{oldSalePrice,jdbcType=DECIMAL}, ", - "#{newSalePrice,jdbcType=DECIMAL}, #{promptlyType,jdbcType=BIT}, ", - "#{effectiveTime,jdbcType=TIMESTAMP}, #{invalidTime,jdbcType=TIMESTAMP}, ", - "#{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ", - "#{operatorId,jdbcType=BIGINT}, #{operatorName,jdbcType=VARCHAR}, ", - "#{status,jdbcType=INTEGER}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ", - "#{ext3,jdbcType=VARCHAR})" + "#{priceType,jdbcType=INTEGER}, #{discountNum,jdbcType=DECIMAL}, ", + "#{oldSalePrice,jdbcType=DECIMAL}, #{newSalePrice,jdbcType=DECIMAL}, ", + "#{promptlyType,jdbcType=BIT}, #{effectiveTime,jdbcType=TIMESTAMP}, ", + "#{invalidTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{operatorId,jdbcType=BIGINT}, ", + "#{operatorName,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", + "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(HighGoodsPriceRefer record); @@ -69,6 +69,7 @@ public interface HighGoodsPriceReferMapper extends HighGoodsPriceReferMapperExt @Result(column="object_type", property="objectType", jdbcType=JdbcType.INTEGER), @Result(column="object_id", property="objectId", jdbcType=JdbcType.BIGINT), @Result(column="price_type", property="priceType", jdbcType=JdbcType.INTEGER), + @Result(column="discount_num", property="discountNum", jdbcType=JdbcType.DECIMAL), @Result(column="old_sale_price", property="oldSalePrice", jdbcType=JdbcType.DECIMAL), @Result(column="new_sale_price", property="newSalePrice", jdbcType=JdbcType.DECIMAL), @Result(column="promptly_type", property="promptlyType", jdbcType=JdbcType.BIT), @@ -87,9 +88,9 @@ public interface HighGoodsPriceReferMapper extends HighGoodsPriceReferMapperExt @Select({ "select", - "id, object_type, object_id, price_type, old_sale_price, new_sale_price, promptly_type, ", - "effective_time, invalid_time, remark, create_time, operator_id, operator_name, ", - "`status`, ext_1, ext_2, ext_3", + "id, object_type, object_id, price_type, discount_num, old_sale_price, new_sale_price, ", + "promptly_type, effective_time, invalid_time, remark, create_time, operator_id, ", + "operator_name, `status`, ext_1, ext_2, ext_3", "from high_goods_price_refer", "where id = #{id,jdbcType=BIGINT}" }) @@ -98,6 +99,7 @@ public interface HighGoodsPriceReferMapper extends HighGoodsPriceReferMapperExt @Result(column="object_type", property="objectType", jdbcType=JdbcType.INTEGER), @Result(column="object_id", property="objectId", jdbcType=JdbcType.BIGINT), @Result(column="price_type", property="priceType", jdbcType=JdbcType.INTEGER), + @Result(column="discount_num", property="discountNum", jdbcType=JdbcType.DECIMAL), @Result(column="old_sale_price", property="oldSalePrice", jdbcType=JdbcType.DECIMAL), @Result(column="new_sale_price", property="newSalePrice", jdbcType=JdbcType.DECIMAL), @Result(column="promptly_type", property="promptlyType", jdbcType=JdbcType.BIT), @@ -128,6 +130,7 @@ public interface HighGoodsPriceReferMapper extends HighGoodsPriceReferMapperExt "set object_type = #{objectType,jdbcType=INTEGER},", "object_id = #{objectId,jdbcType=BIGINT},", "price_type = #{priceType,jdbcType=INTEGER},", + "discount_num = #{discountNum,jdbcType=DECIMAL},", "old_sale_price = #{oldSalePrice,jdbcType=DECIMAL},", "new_sale_price = #{newSalePrice,jdbcType=DECIMAL},", "promptly_type = #{promptlyType,jdbcType=BIT},", diff --git a/hai-service/src/main/java/com/hai/dao/HighGoodsPriceReferSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighGoodsPriceReferSqlProvider.java index f6ca8a95..935d7325 100644 --- a/hai-service/src/main/java/com/hai/dao/HighGoodsPriceReferSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighGoodsPriceReferSqlProvider.java @@ -40,6 +40,10 @@ public class HighGoodsPriceReferSqlProvider { sql.VALUES("price_type", "#{priceType,jdbcType=INTEGER}"); } + if (record.getDiscountNum() != null) { + sql.VALUES("discount_num", "#{discountNum,jdbcType=DECIMAL}"); + } + if (record.getOldSalePrice() != null) { sql.VALUES("old_sale_price", "#{oldSalePrice,jdbcType=DECIMAL}"); } @@ -105,6 +109,7 @@ public class HighGoodsPriceReferSqlProvider { sql.SELECT("object_type"); sql.SELECT("object_id"); sql.SELECT("price_type"); + sql.SELECT("discount_num"); sql.SELECT("old_sale_price"); sql.SELECT("new_sale_price"); sql.SELECT("promptly_type"); @@ -151,6 +156,10 @@ public class HighGoodsPriceReferSqlProvider { sql.SET("price_type = #{record.priceType,jdbcType=INTEGER}"); } + if (record.getDiscountNum() != null) { + sql.SET("discount_num = #{record.discountNum,jdbcType=DECIMAL}"); + } + if (record.getOldSalePrice() != null) { sql.SET("old_sale_price = #{record.oldSalePrice,jdbcType=DECIMAL}"); } @@ -215,6 +224,7 @@ public class HighGoodsPriceReferSqlProvider { sql.SET("object_type = #{record.objectType,jdbcType=INTEGER}"); sql.SET("object_id = #{record.objectId,jdbcType=BIGINT}"); sql.SET("price_type = #{record.priceType,jdbcType=INTEGER}"); + sql.SET("discount_num = #{record.discountNum,jdbcType=DECIMAL}"); sql.SET("old_sale_price = #{record.oldSalePrice,jdbcType=DECIMAL}"); sql.SET("new_sale_price = #{record.newSalePrice,jdbcType=DECIMAL}"); sql.SET("promptly_type = #{record.promptlyType,jdbcType=BIT}"); @@ -250,6 +260,10 @@ public class HighGoodsPriceReferSqlProvider { sql.SET("price_type = #{priceType,jdbcType=INTEGER}"); } + if (record.getDiscountNum() != null) { + sql.SET("discount_num = #{discountNum,jdbcType=DECIMAL}"); + } + if (record.getOldSalePrice() != null) { sql.SET("old_sale_price = #{oldSalePrice,jdbcType=DECIMAL}"); } diff --git a/hai-service/src/main/java/com/hai/entity/HighGoodsPriceRefer.java b/hai-service/src/main/java/com/hai/entity/HighGoodsPriceRefer.java index 8dd1831b..82776635 100644 --- a/hai-service/src/main/java/com/hai/entity/HighGoodsPriceRefer.java +++ b/hai-service/src/main/java/com/hai/entity/HighGoodsPriceRefer.java @@ -34,6 +34,11 @@ public class HighGoodsPriceRefer implements Serializable { */ private Integer priceType; + /** + * 折扣数 + */ + private BigDecimal discountNum; + /** * 旧销售价格 */ @@ -124,6 +129,14 @@ public class HighGoodsPriceRefer implements Serializable { this.priceType = priceType; } + public BigDecimal getDiscountNum() { + return discountNum; + } + + public void setDiscountNum(BigDecimal discountNum) { + this.discountNum = discountNum; + } + public BigDecimal getOldSalePrice() { return oldSalePrice; } @@ -244,6 +257,7 @@ public class HighGoodsPriceRefer implements Serializable { && (this.getObjectType() == null ? other.getObjectType() == null : this.getObjectType().equals(other.getObjectType())) && (this.getObjectId() == null ? other.getObjectId() == null : this.getObjectId().equals(other.getObjectId())) && (this.getPriceType() == null ? other.getPriceType() == null : this.getPriceType().equals(other.getPriceType())) + && (this.getDiscountNum() == null ? other.getDiscountNum() == null : this.getDiscountNum().equals(other.getDiscountNum())) && (this.getOldSalePrice() == null ? other.getOldSalePrice() == null : this.getOldSalePrice().equals(other.getOldSalePrice())) && (this.getNewSalePrice() == null ? other.getNewSalePrice() == null : this.getNewSalePrice().equals(other.getNewSalePrice())) && (this.getPromptlyType() == null ? other.getPromptlyType() == null : this.getPromptlyType().equals(other.getPromptlyType())) @@ -267,6 +281,7 @@ public class HighGoodsPriceRefer implements Serializable { result = prime * result + ((getObjectType() == null) ? 0 : getObjectType().hashCode()); result = prime * result + ((getObjectId() == null) ? 0 : getObjectId().hashCode()); result = prime * result + ((getPriceType() == null) ? 0 : getPriceType().hashCode()); + result = prime * result + ((getDiscountNum() == null) ? 0 : getDiscountNum().hashCode()); result = prime * result + ((getOldSalePrice() == null) ? 0 : getOldSalePrice().hashCode()); result = prime * result + ((getNewSalePrice() == null) ? 0 : getNewSalePrice().hashCode()); result = prime * result + ((getPromptlyType() == null) ? 0 : getPromptlyType().hashCode()); @@ -293,6 +308,7 @@ public class HighGoodsPriceRefer implements Serializable { sb.append(", objectType=").append(objectType); sb.append(", objectId=").append(objectId); sb.append(", priceType=").append(priceType); + sb.append(", discountNum=").append(discountNum); sb.append(", oldSalePrice=").append(oldSalePrice); sb.append(", newSalePrice=").append(newSalePrice); sb.append(", promptlyType=").append(promptlyType); diff --git a/hai-service/src/main/java/com/hai/entity/HighGoodsPriceReferExample.java b/hai-service/src/main/java/com/hai/entity/HighGoodsPriceReferExample.java index ac2779b6..5aa70059 100644 --- a/hai-service/src/main/java/com/hai/entity/HighGoodsPriceReferExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighGoodsPriceReferExample.java @@ -366,6 +366,66 @@ public class HighGoodsPriceReferExample { return (Criteria) this; } + public Criteria andDiscountNumIsNull() { + addCriterion("discount_num is null"); + return (Criteria) this; + } + + public Criteria andDiscountNumIsNotNull() { + addCriterion("discount_num is not null"); + return (Criteria) this; + } + + public Criteria andDiscountNumEqualTo(BigDecimal value) { + addCriterion("discount_num =", value, "discountNum"); + return (Criteria) this; + } + + public Criteria andDiscountNumNotEqualTo(BigDecimal value) { + addCriterion("discount_num <>", value, "discountNum"); + return (Criteria) this; + } + + public Criteria andDiscountNumGreaterThan(BigDecimal value) { + addCriterion("discount_num >", value, "discountNum"); + return (Criteria) this; + } + + public Criteria andDiscountNumGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("discount_num >=", value, "discountNum"); + return (Criteria) this; + } + + public Criteria andDiscountNumLessThan(BigDecimal value) { + addCriterion("discount_num <", value, "discountNum"); + return (Criteria) this; + } + + public Criteria andDiscountNumLessThanOrEqualTo(BigDecimal value) { + addCriterion("discount_num <=", value, "discountNum"); + return (Criteria) this; + } + + public Criteria andDiscountNumIn(List values) { + addCriterion("discount_num in", values, "discountNum"); + return (Criteria) this; + } + + public Criteria andDiscountNumNotIn(List values) { + addCriterion("discount_num not in", values, "discountNum"); + return (Criteria) this; + } + + public Criteria andDiscountNumBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("discount_num between", value1, value2, "discountNum"); + return (Criteria) this; + } + + public Criteria andDiscountNumNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("discount_num not between", value1, value2, "discountNum"); + return (Criteria) this; + } + public Criteria andOldSalePriceIsNull() { addCriterion("old_sale_price is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/service/HighGoodsPriceReferService.java b/hai-service/src/main/java/com/hai/service/HighGoodsPriceReferService.java index ab2312fb..ed7a4bb4 100644 --- a/hai-service/src/main/java/com/hai/service/HighGoodsPriceReferService.java +++ b/hai-service/src/main/java/com/hai/service/HighGoodsPriceReferService.java @@ -37,6 +37,8 @@ public interface HighGoodsPriceReferService { **/ void submitApprove(HighGoodsPriceRefer highGoodsPriceRefer) throws Exception; + void submitApproveList(List highGoodsPriceReferList) throws Exception; + /** * @Author 胡锐 * @Description 根据id查询 diff --git a/hai-service/src/main/java/com/hai/service/impl/HighGoodsPriceReferServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighGoodsPriceReferServiceImpl.java index 6608f443..5f2fc94c 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighGoodsPriceReferServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighGoodsPriceReferServiceImpl.java @@ -63,6 +63,14 @@ public class HighGoodsPriceReferServiceImpl implements HighGoodsPriceReferServic highApproveService.insertApprove(approve); } + @Override + @Transactional(propagation= Propagation.REQUIRES_NEW) + public void submitApproveList(List highGoodsPriceReferList) throws Exception { + for (HighGoodsPriceRefer highGoodsPriceRefer : highGoodsPriceReferList) { + submitApprove(highGoodsPriceRefer); + } + } + @Override public HighGoodsPriceRefer getPriceReferById(Long id) {