提交代码

dev-discount
胡锐 3 years ago
parent 332d2ee711
commit 3cdd0a7bce
  1. 6
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  2. 45
      hai-service/src/main/java/com/hai/dao/HighDiscountMapper.java
  3. 14
      hai-service/src/main/java/com/hai/dao/HighDiscountSqlProvider.java
  4. 20
      hai-service/src/main/java/com/hai/entity/HighDiscount.java
  5. 60
      hai-service/src/main/java/com/hai/entity/HighDiscountExample.java
  6. 48
      hai-service/src/main/java/com/hai/enum_type/DiscountUseScope.java

@ -15,6 +15,7 @@ import com.hai.common.utils.IDGenerator;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.TuanYouConfig;
import com.hai.entity.*;
import com.hai.enum_type.DiscountUseScope;
import com.hai.model.HighMerchantStoreModel;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
@ -252,6 +253,11 @@ public class HighOrderController {
if (highDiscountUserRel != null) {
highOrder.setMemDiscountName(highDiscountUserRel.getHighDiscount().getDiscountName());
//
if (highDiscountUserRel.getHighDiscount().getUseScope().equals(DiscountUseScope.type1.getType())) {
}
// 卡卷类型 1:满减 2:抵扣 3:折扣
if (highDiscountUserRel.getHighDiscount().getDiscountType() == 1) {
// 如果订单总额 小于 满减价格

@ -40,23 +40,25 @@ public interface HighDiscountMapper extends HighDiscountMapperExt {
@Insert({
"insert into high_discount (company_id, discount_key, ",
"using_range, discount_name, ",
"discount_img, discount_carousel_img, ",
"discount_type, discount_condition, ",
"discount_price, effective_day, ",
"sales_end_time, create_time, ",
"update_time, operator_id, ",
"operator_name, `status`, ",
"ext_1, ext_2, ext_3)",
"using_range, use_scope, ",
"discount_name, discount_img, ",
"discount_carousel_img, discount_type, ",
"discount_condition, discount_price, ",
"effective_day, sales_end_time, ",
"create_time, update_time, ",
"operator_id, operator_name, ",
"`status`, ext_1, ext_2, ",
"ext_3)",
"values (#{companyId,jdbcType=BIGINT}, #{discountKey,jdbcType=VARCHAR}, ",
"#{usingRange,jdbcType=INTEGER}, #{discountName,jdbcType=VARCHAR}, ",
"#{discountImg,jdbcType=VARCHAR}, #{discountCarouselImg,jdbcType=VARCHAR}, ",
"#{discountType,jdbcType=INTEGER}, #{discountCondition,jdbcType=DECIMAL}, ",
"#{discountPrice,jdbcType=DECIMAL}, #{effectiveDay,jdbcType=INTEGER}, ",
"#{salesEndTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{operatorId,jdbcType=BIGINT}, ",
"#{operatorName,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
"#{usingRange,jdbcType=INTEGER}, #{useScope,jdbcType=INTEGER}, ",
"#{discountName,jdbcType=VARCHAR}, #{discountImg,jdbcType=VARCHAR}, ",
"#{discountCarouselImg,jdbcType=VARCHAR}, #{discountType,jdbcType=INTEGER}, ",
"#{discountCondition,jdbcType=DECIMAL}, #{discountPrice,jdbcType=DECIMAL}, ",
"#{effectiveDay,jdbcType=INTEGER}, #{salesEndTime,jdbcType=TIMESTAMP}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,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(HighDiscount record);
@ -71,6 +73,7 @@ public interface HighDiscountMapper extends HighDiscountMapperExt {
@Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT),
@Result(column="discount_key", property="discountKey", jdbcType=JdbcType.VARCHAR),
@Result(column="using_range", property="usingRange", jdbcType=JdbcType.INTEGER),
@Result(column="use_scope", property="useScope", jdbcType=JdbcType.INTEGER),
@Result(column="discount_name", property="discountName", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_img", property="discountImg", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_carousel_img", property="discountCarouselImg", jdbcType=JdbcType.VARCHAR),
@ -92,10 +95,10 @@ public interface HighDiscountMapper extends HighDiscountMapperExt {
@Select({
"select",
"id, company_id, discount_key, using_range, discount_name, discount_img, discount_carousel_img, ",
"discount_type, discount_condition, discount_price, effective_day, sales_end_time, ",
"create_time, update_time, operator_id, operator_name, `status`, ext_1, ext_2, ",
"ext_3",
"id, company_id, discount_key, using_range, use_scope, discount_name, discount_img, ",
"discount_carousel_img, discount_type, discount_condition, discount_price, effective_day, ",
"sales_end_time, create_time, update_time, operator_id, operator_name, `status`, ",
"ext_1, ext_2, ext_3",
"from high_discount",
"where id = #{id,jdbcType=BIGINT}"
})
@ -104,6 +107,7 @@ public interface HighDiscountMapper extends HighDiscountMapperExt {
@Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT),
@Result(column="discount_key", property="discountKey", jdbcType=JdbcType.VARCHAR),
@Result(column="using_range", property="usingRange", jdbcType=JdbcType.INTEGER),
@Result(column="use_scope", property="useScope", jdbcType=JdbcType.INTEGER),
@Result(column="discount_name", property="discountName", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_img", property="discountImg", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_carousel_img", property="discountCarouselImg", jdbcType=JdbcType.VARCHAR),
@ -137,6 +141,7 @@ public interface HighDiscountMapper extends HighDiscountMapperExt {
"set company_id = #{companyId,jdbcType=BIGINT},",
"discount_key = #{discountKey,jdbcType=VARCHAR},",
"using_range = #{usingRange,jdbcType=INTEGER},",
"use_scope = #{useScope,jdbcType=INTEGER},",
"discount_name = #{discountName,jdbcType=VARCHAR},",
"discount_img = #{discountImg,jdbcType=VARCHAR},",
"discount_carousel_img = #{discountCarouselImg,jdbcType=VARCHAR},",

@ -40,6 +40,10 @@ public class HighDiscountSqlProvider {
sql.VALUES("using_range", "#{usingRange,jdbcType=INTEGER}");
}
if (record.getUseScope() != null) {
sql.VALUES("use_scope", "#{useScope,jdbcType=INTEGER}");
}
if (record.getDiscountName() != null) {
sql.VALUES("discount_name", "#{discountName,jdbcType=VARCHAR}");
}
@ -117,6 +121,7 @@ public class HighDiscountSqlProvider {
sql.SELECT("company_id");
sql.SELECT("discount_key");
sql.SELECT("using_range");
sql.SELECT("use_scope");
sql.SELECT("discount_name");
sql.SELECT("discount_img");
sql.SELECT("discount_carousel_img");
@ -166,6 +171,10 @@ public class HighDiscountSqlProvider {
sql.SET("using_range = #{record.usingRange,jdbcType=INTEGER}");
}
if (record.getUseScope() != null) {
sql.SET("use_scope = #{record.useScope,jdbcType=INTEGER}");
}
if (record.getDiscountName() != null) {
sql.SET("discount_name = #{record.discountName,jdbcType=VARCHAR}");
}
@ -242,6 +251,7 @@ public class HighDiscountSqlProvider {
sql.SET("company_id = #{record.companyId,jdbcType=BIGINT}");
sql.SET("discount_key = #{record.discountKey,jdbcType=VARCHAR}");
sql.SET("using_range = #{record.usingRange,jdbcType=INTEGER}");
sql.SET("use_scope = #{record.useScope,jdbcType=INTEGER}");
sql.SET("discount_name = #{record.discountName,jdbcType=VARCHAR}");
sql.SET("discount_img = #{record.discountImg,jdbcType=VARCHAR}");
sql.SET("discount_carousel_img = #{record.discountCarouselImg,jdbcType=VARCHAR}");
@ -280,6 +290,10 @@ public class HighDiscountSqlProvider {
sql.SET("using_range = #{usingRange,jdbcType=INTEGER}");
}
if (record.getUseScope() != null) {
sql.SET("use_scope = #{useScope,jdbcType=INTEGER}");
}
if (record.getDiscountName() != null) {
sql.SET("discount_name = #{discountName,jdbcType=VARCHAR}");
}

@ -1,7 +1,5 @@
package com.hai.entity;
import com.hai.model.HighDiscountModel;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@ -15,7 +13,7 @@ import java.util.Date;
* 代码由工具生成
*
**/
public class HighDiscount extends HighDiscountModel implements Serializable {
public class HighDiscount implements Serializable {
/**
* 主键
*/
@ -36,6 +34,11 @@ public class HighDiscount extends HighDiscountModel implements Serializable {
*/
private Integer usingRange;
/**
* 使用范围 1. 全场 2.卡券 3.话费
*/
private Integer useScope;
/**
* 优惠券名称
*/
@ -141,6 +144,14 @@ public class HighDiscount extends HighDiscountModel implements Serializable {
this.usingRange = usingRange;
}
public Integer getUseScope() {
return useScope;
}
public void setUseScope(Integer useScope) {
this.useScope = useScope;
}
public String getDiscountName() {
return discountName;
}
@ -285,6 +296,7 @@ public class HighDiscount extends HighDiscountModel implements Serializable {
&& (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId()))
&& (this.getDiscountKey() == null ? other.getDiscountKey() == null : this.getDiscountKey().equals(other.getDiscountKey()))
&& (this.getUsingRange() == null ? other.getUsingRange() == null : this.getUsingRange().equals(other.getUsingRange()))
&& (this.getUseScope() == null ? other.getUseScope() == null : this.getUseScope().equals(other.getUseScope()))
&& (this.getDiscountName() == null ? other.getDiscountName() == null : this.getDiscountName().equals(other.getDiscountName()))
&& (this.getDiscountImg() == null ? other.getDiscountImg() == null : this.getDiscountImg().equals(other.getDiscountImg()))
&& (this.getDiscountCarouselImg() == null ? other.getDiscountCarouselImg() == null : this.getDiscountCarouselImg().equals(other.getDiscountCarouselImg()))
@ -311,6 +323,7 @@ public class HighDiscount extends HighDiscountModel implements Serializable {
result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode());
result = prime * result + ((getDiscountKey() == null) ? 0 : getDiscountKey().hashCode());
result = prime * result + ((getUsingRange() == null) ? 0 : getUsingRange().hashCode());
result = prime * result + ((getUseScope() == null) ? 0 : getUseScope().hashCode());
result = prime * result + ((getDiscountName() == null) ? 0 : getDiscountName().hashCode());
result = prime * result + ((getDiscountImg() == null) ? 0 : getDiscountImg().hashCode());
result = prime * result + ((getDiscountCarouselImg() == null) ? 0 : getDiscountCarouselImg().hashCode());
@ -340,6 +353,7 @@ public class HighDiscount extends HighDiscountModel implements Serializable {
sb.append(", companyId=").append(companyId);
sb.append(", discountKey=").append(discountKey);
sb.append(", usingRange=").append(usingRange);
sb.append(", useScope=").append(useScope);
sb.append(", discountName=").append(discountName);
sb.append(", discountImg=").append(discountImg);
sb.append(", discountCarouselImg=").append(discountCarouselImg);

@ -376,6 +376,66 @@ public class HighDiscountExample {
return (Criteria) this;
}
public Criteria andUseScopeIsNull() {
addCriterion("use_scope is null");
return (Criteria) this;
}
public Criteria andUseScopeIsNotNull() {
addCriterion("use_scope is not null");
return (Criteria) this;
}
public Criteria andUseScopeEqualTo(Integer value) {
addCriterion("use_scope =", value, "useScope");
return (Criteria) this;
}
public Criteria andUseScopeNotEqualTo(Integer value) {
addCriterion("use_scope <>", value, "useScope");
return (Criteria) this;
}
public Criteria andUseScopeGreaterThan(Integer value) {
addCriterion("use_scope >", value, "useScope");
return (Criteria) this;
}
public Criteria andUseScopeGreaterThanOrEqualTo(Integer value) {
addCriterion("use_scope >=", value, "useScope");
return (Criteria) this;
}
public Criteria andUseScopeLessThan(Integer value) {
addCriterion("use_scope <", value, "useScope");
return (Criteria) this;
}
public Criteria andUseScopeLessThanOrEqualTo(Integer value) {
addCriterion("use_scope <=", value, "useScope");
return (Criteria) this;
}
public Criteria andUseScopeIn(List<Integer> values) {
addCriterion("use_scope in", values, "useScope");
return (Criteria) this;
}
public Criteria andUseScopeNotIn(List<Integer> values) {
addCriterion("use_scope not in", values, "useScope");
return (Criteria) this;
}
public Criteria andUseScopeBetween(Integer value1, Integer value2) {
addCriterion("use_scope between", value1, value2, "useScope");
return (Criteria) this;
}
public Criteria andUseScopeNotBetween(Integer value1, Integer value2) {
addCriterion("use_scope not between", value1, value2, "useScope");
return (Criteria) this;
}
public Criteria andDiscountNameIsNull() {
addCriterion("discount_name is null");
return (Criteria) this;

@ -0,0 +1,48 @@
package com.hai.enum_type;
import java.util.Objects;
/**
* 优惠券使用范围
* @author hurui
*/
public enum DiscountUseScope {
type1(1 , "全场"),
type2(2 , "卡券"),
type3(3 , "话费"),
;
private Integer type;
private String name;
DiscountUseScope(int type , String name) {
this.type = type;
this.name = name;
}
public static String getNameByType(Integer type) {
for (DiscountUseScope ele : values()) {
if (Objects.equals(type,ele.getType())) {
return ele.getName();
}
}
return null;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Loading…
Cancel
Save