dcs 2 달 전
부모
커밋
ce9be06ccb

+ 13 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/workark/model/ProductCoupon.java

@@ -12,6 +12,11 @@ public class ProductCoupon {
 
     private Long id;
 
+    /**
+     * 模板id
+     */
+    private long productCouponModelId;
+
     /**
      * 类型(1、打折,2、现金)
      */
@@ -109,6 +114,14 @@ public class ProductCoupon {
         this.id = id;
     }
 
+    public long getProductCouponModelId() {
+        return productCouponModelId;
+    }
+
+    public void setProductCouponModelId(long productCouponModelId) {
+        this.productCouponModelId = productCouponModelId;
+    }
+
     public Integer getType() {
         return type;
     }

+ 13 - 2
virgo.api/src/main/resources/mapper/ProductCouponMapper.xml

@@ -6,6 +6,7 @@
 
     <resultMap type="com.bosshand.virgo.api.workark.model.ProductCoupon" id="result">
         <id column="id" property="id"/>
+        <result column="productCouponModelId" property="productCouponModelId"/>
         <result column="type" property="type"/>
         <result column="otherType" property="otherType"/>
         <result column="discount" property="discount"/>
@@ -38,6 +39,9 @@
             <if test="userId != 0">
                 and userId = #{userId}
             </if>
+            <if test="productCouponModelId != 0">
+                and productCouponModelId = #{productCouponModelId}
+            </if>
             <if test="type != null">
                 and type = #{type}
             </if>
@@ -62,6 +66,9 @@
             <if test="userId != 0">
                 and userId = #{userId}
             </if>
+            <if test="productCouponModelId != 0">
+                and productCouponModelId = #{productCouponModelId}
+            </if>
             <if test="type != null">
                 and type = #{type}
             </if>
@@ -86,6 +93,9 @@
             <if test="p.userId != 0">
                 and userId = #{p.userId}
             </if>
+            <if test="p.productCouponModelId != 0">
+                and productCouponModelId = #{p.productCouponModelId}
+            </if>
             <if test="p.type != null">
                 and type = #{p.type}
             </if>
@@ -103,13 +113,14 @@
     </select>
 
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
-        INSERT INTO workark_product_coupon (type, otherType, discount, organizationId, userId, createTime, lifespan, productLevelId, couponAmount, title, threshold, mostConstraint, description)
-        VALUES (#{type}, #{otherType}, #{discount}, #{organizationId}, #{userId}, now(), #{lifespan}, #{productLevelId}, #{couponAmount}, #{title}, #{threshold}, #{mostConstraint}, #{description})
+        INSERT INTO workark_product_coupon (productCouponModelId, type, otherType, discount, organizationId, userId, createTime, lifespan, productLevelId, couponAmount, title, threshold, mostConstraint, description)
+        VALUES (#{productCouponModelId}, #{type}, #{otherType}, #{discount}, #{organizationId}, #{userId}, now(), #{lifespan}, #{productLevelId}, #{couponAmount}, #{title}, #{threshold}, #{mostConstraint}, #{description})
     </insert>
 
     <update id="update" parameterType="com.bosshand.virgo.api.workark.model.ProductCoupon">
         UPDATE workark_product_coupon
         <trim prefix="set" suffixOverrides=",">
+            <if test="productCouponModelId!=0">productCouponModelId=#{productCouponModelId},</if>
             <if test="type!=null">type=#{type},</if>
             <if test="otherType!=null">otherType=#{otherType},</if>
             <if test="discount!=null">discount=#{discount},</if>