cp.id AS "id", cp.name AS "name", cp.description AS "description", cp.type AS "type", cp.mode AS "mode", cp.touchPrice AS "touchPrice", cp.reducedPrice AS "reducedPrice", cp.beginTime AS "beginTime", cp.endTime AS "endTime", cp.addTime AS "addTime", cp.updateTime AS "updateTime", cp.status AS "status", cp.delFlag AS "delFlag1", cp.seen AS "seen", cp.discount AS "discount" DELETE FROM cm_promotions_product WHERE promotionsId = #{id} DELETE FROM cm_promotions_gift WHERE promotionsId = #{id} INSERT INTO cm_promotions_product(promotionsId, productId, addTime) VALUES (#{promotionId}, #{productId}, now()) INSERT INTO cm_promotions_gift(promotionsId, skuId, productId, number, addTime) VALUES (#{promotionId}, #{giftId}, (select productId from cm_sku where skuId = #{giftId}), #{number}, now()) INSERT INTO cm_promotions_product(promotionsId, supplierId, productId, addTime) VALUES (#{promotionId}, #{shopId}, 0, now()) INSERT INTO cm_promotions(name, description, type, mode, touchPrice, reducedPrice, beginTime, endTime, addTime, updateTime, status, delFlag, discount, seen) VALUES (#{name}, #{description}, #{type}, #{mode}, #{touchPrice}, #{reducedPrice}, #{beginTime}, #{endTime}, #{addTime}, #{updateTime}, #{status}, #{delFlag1}, #{discount}, #{seen}) insert into cm_promotion_sku(promotionId, skuId, productId, touchPrice) values (#{promotionId}, #{skuId}, (select productId from cm_sku where skuId = #{skuId}), #{touchPrice}) UPDATE cm_promotions SET name = #{name}, description = #{description}, type = #{type}, mode = #{mode}, touchPrice = #{touchPrice}, reducedPrice = #{reducedPrice}, beginTime = #{beginTime}, endTime = #{endTime}, updateTime = #{updateTime}, status = #{status}, delFlag = #{delFlag1}, discount = #{discount}, seen = #{seen} WHERE id = #{id} delete from cm_promotions_gift where promotionsId = #{id} and skuId = #{skuId} delete from cm_promotion_sku where promotionId = #{promotionId}