Przeglądaj źródła

普通优惠券添加会员标志

chao 3 lat temu
rodzic
commit
fbb1dc944e

+ 9 - 0
src/main/java/com/caimei/modules/coupon/entity/CmCoupon.java

@@ -25,6 +25,7 @@ public class CmCoupon extends DataEntity<CmCoupon> {
     private Date endDate;        // 使用结束时间(有效期)
     private String status;        // 状态 0未生效 1已生效 2已关闭 3已失效
     private Integer couponType;        // 劵类型 0活动券 1品类券 2用户专享券 3店铺券 4新用户券
+    private Integer vipFlag;        // 超级会员专享优惠券标志:0否,1是
     private Integer userId;     //机构用户id(用户专享券有效)
     private Integer shopId;     //供应商id(店铺券有效)
     private String productType;        // 优惠商品:1全商城商品 2指定商品(活动券有效)
@@ -124,6 +125,14 @@ public class CmCoupon extends DataEntity<CmCoupon> {
         this.productType = productType;
     }
 
+    public Integer getVipFlag() {
+        return vipFlag;
+    }
+
+    public void setVipFlag(Integer vipFlag) {
+        this.vipFlag = vipFlag;
+    }
+
     public String getPcBanner() {
         return pcBanner;
     }

+ 3 - 0
src/main/java/com/caimei/modules/coupon/service/CmCouponService.java

@@ -146,6 +146,9 @@ public class CmCouponService extends CrudService<CmCouponDao, CmCoupon> {
         if (StringUtils.isBlank(cmCoupon.getCouponsMode())) {
             cmCoupon.setCouponsMode("0");
         }
+        if (null == cmCoupon.getVipFlag()){
+            cmCoupon.setVipFlag(0);
+        }
         super.save(cmCoupon);
         List<Integer> associateIds = cmCouponDao.findByCouponId(cmCoupon.getId());
         if (0 == cmCoupon.getCouponType()) {

+ 4 - 0
src/main/java/com/caimei/modules/coupon/service/CmVipCouponService.java

@@ -254,6 +254,7 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
         coupon1.setCouponAmount(svipcouponForm.getCouponAmount1());
         coupon1.setTouchPrice(svipcouponForm.getTouchPrice1());
         coupon1.setStatus("1");
+        coupon1.setVipFlag(1);
         // 0活动券 1品类券 3店铺券
         if ("0".equals(svipcouponForm.getCouponType1())){
             coupon1.setCouponType(0);
@@ -279,6 +280,7 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
         coupon2.setCouponAmount(svipcouponForm.getCouponAmount2());
         coupon2.setTouchPrice(svipcouponForm.getTouchPrice2());
         coupon2.setStatus("1");
+        coupon2.setVipFlag(1);
         // 0活动券 1品类券 3店铺券
         if ("0".equals(svipcouponForm.getCouponType2())){
             coupon2.setCouponType(0);
@@ -304,6 +306,7 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
         coupon3.setCouponAmount(svipcouponForm.getCouponAmount3());
         coupon3.setTouchPrice(svipcouponForm.getTouchPrice3());
         coupon3.setStatus("1");
+        coupon3.setVipFlag(1);
         // 0活动券 1品类券 3店铺券
         if ("0".equals(svipcouponForm.getCouponType3())){
             coupon3.setCouponType(0);
@@ -329,6 +332,7 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
         coupon4.setCouponAmount(svipcouponForm.getCouponAmount4());
         coupon4.setTouchPrice(svipcouponForm.getTouchPrice4());
         coupon4.setStatus("1");
+        coupon4.setVipFlag(1);
         // 0活动券 1品类券 3店铺券
         if ("0".equals(svipcouponForm.getCouponType4())){
             coupon4.setCouponType(0);

+ 5 - 1
src/main/resources/mappings/modules/coupon/CmCouponMapper.xml

@@ -11,6 +11,7 @@
 		a.endDate AS "endDate",
 		a.status AS "status",
 		a.couponType AS "couponType",
+		a.vipFlag AS "vipFlag",
 		a.userId AS "userId",
 		a.shopId AS "shopId",
 		a.productType AS "productType",
@@ -44,7 +45,7 @@
 		LEFT JOIN shop s ON s.shopID = a.shopId
 		<include refid="cmCouponJoins"/>
 		<where>
-			AND a.delFlag = 0
+			AND a.delFlag = 0 AND a.vipFlag != '1'
 			<if test="couponType != null">
 				AND a.couponType = #{couponType}
 			</if>
@@ -136,6 +137,7 @@
 			endDate,
 			status,
 			couponType,
+			vipFlag,
 			userId,
 			shopId,
 			productType,
@@ -153,6 +155,7 @@
 			#{endDate},
 			#{status},
 			#{couponType},
+		    #{vipFlag},
 			#{userId},
 			#{shopId},
 			#{productType},
@@ -174,6 +177,7 @@
 			endDate = #{endDate},
 			status = #{status},
 			couponType = #{couponType},
+			vipFlag = #{vipFlag},
 			userId = #{userId},
 			shopId = #{shopId},
 			productType = #{productType},

+ 2 - 1
src/main/resources/mappings/modules/super/CmCouponVipMapper.xml

@@ -10,6 +10,7 @@
 		a.endDate AS "endDate",
 		a.status AS "status",
 		a.couponType AS "couponType",
+        a.vipFlag AS "vipFlag",
 		a.userId AS "userId",
 		a.shopId AS "shopId",
 		a.productType AS "productType",
@@ -91,7 +92,7 @@
             <if test="couponType!=null and couponType!=''">
                 AND a.couponType = #{couponType}
             </if>
-            <if test="bindCoupons!=null">
+            <if test="bindCoupons!=null and bindCoupons.size()!=0">
                 AND a.id IN
                 <foreach collection="bindCoupons" open="(" separator="," close=")" item="couponId">
                     #{couponId}