select id,
type,
store_category,
store_id,
store_name,
name,
method,
spend_amount,
coupon_amount,
start_sale_time,
end_sale_time,
start_use_time,
end_use_time,
inventory,
stock,
status,
user_claim_limit,
create_time,
create_by,
update_time,
update_by,
descr,
memo,
applicability
from zdy_coupon
insert into zdy_coupon
type,
store_category,
store_id,
store_name,
name,
method,
spend_amount,
coupon_amount,
start_sale_time,
end_sale_time,
start_use_time,
end_use_time,
inventory,
stock,
status,
user_claim_limit,
create_time,
create_by,
update_time,
update_by,
descr,
memo,
applicability,
#{type},
#{storeCategory},
#{storeId},
#{storeName},
#{name},
#{method},
#{spendAmount},
#{couponAmount},
#{startSaleTime},
#{endSaleTime},
#{startUseTime},
#{endUseTime},
#{inventory},
#{stock},
#{status},
#{userClaimLimit},
#{createTime},
#{createBy},
#{updateTime},
#{updateBy},
#{descr},
#{memo},
#{applicability},
update zdy_coupon
type =
#{type},
store_category =
#{storeCategory},
store_id =
#{storeId},
store_name =
#{storeName},
name =
#{name},
method =
#{method},
spend_amount =
#{spendAmount},
coupon_amount =
#{couponAmount},
start_sale_time =
#{startSaleTime},
end_sale_time =
#{endSaleTime},
start_use_time =
#{startUseTime},
end_use_time =
#{endUseTime},
inventory =
#{inventory},
stock =
#{stock},
status =
#{status},
user_claim_limit =
#{userClaimLimit},
create_time =
#{createTime},
create_by =
#{createBy},
update_time =
#{updateTime},
update_by =
#{updateBy},
descr =
#{descr},
memo =
#{memo},
applicability =
#{applicability},
where id = #{id}
UPDATE zdy_coupon
SET STATUS = (CASE
WHEN #{currentDate} > end_use_time THEN '3'
WHEN #{currentDate} >= start_use_time THEN '2'
ELSE STATUS END)
WHERE STATUS IN ('1', '2');
delete
from zdy_coupon
where id = #{id}
delete from zdy_coupon where id in
#{id}