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"
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,
productId,
number,
addTime
) VALUES (
#{promotionId},
#{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}
)
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}
WHERE id = #{id}