id, title, description, type, code_type,
status, quota, total, price_available, range_type,
range_values, date_type, valid_start_time, valid_end_time, fixed_start_term, fixed_end_term,
preferential_type, percent_off, price_off, discount_price_limit, stat_fetch_num,
create_time
INSERT INTO coupon_template (
title, description, type, code_type,
status, quota, total, price_available, range_type,
range_values, date_type, valid_start_time, valid_end_time, fixed_start_term, fixed_end_term,
preferential_type, percent_off, price_off, discount_price_limit, stat_fetch_num,
create_time
) VALUES (
#{title}, #{description}, #{type}, #{codeType},
#{status}, #{quota}, #{total}, #{priceAvailable}, #{rangeType},
#{rangeValues}, #{dateType}, #{validStartTime}, #{validEndTime}, #{fixedStartTerm}, #{fixedEndTerm}
#{preferentialType}, #{percentOff}, #{priceOff}, #{discountPriceLimit}, #{statFetchNum},
#{createTime}
)
UPDATE coupon_template
title = #{title},
description = #{description},
status = #{status},
quota = #{quota},
total = #{total},
price_available = #{priceAvailable},
range_type = #{rangeType},
range_values = #{rangeValues},
date_type = #{dateType},
valid_start_time = #{validStartTime},
valid_end_time = #{validEndTime},
fixed_start_term = #{fixedStartTerm},
fixed_end_term = #{fixedEndTerm},
preferential_type = #{preferentialType},
percent_off = #{percentOff},
price_off = #{priceOff},
discount_price_limit = #{discountPriceLimit},
WHERE id = #{id}
UPDATE coupon_template
SET stat_fetch_Num = stat_fetch_Num + 1
WHERE id = #{id}
AND total > stat_fetch_Num