a.id AS "id",
a.order_code AS "orderCode",
a.member_code AS "memberCode",
a.member_name AS "memberName",
/*a.charging_item_name AS "chargingItemName",*/
case when a.charging_item_name like '%犬只参赛费%' then '犬只参赛费' else
a.charging_item_name end AS "chargingItemName",
a.project_name AS "projectName",
a.charging_item_id AS "chargingItemId",
a.num AS "num",
a.price AS "price",
a.total_price AS "totalPrice",
a.add_time AS "addTime",
a.project_id AS "projectId",
a.voucher_code AS "voucherCode",
a.proccess_state AS "proccessState",
a.proccess_time AS "proccessTime",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.remarks AS "remarks",
a.del_flag AS "delFlag",
a.business_code AS "businessCode",
a.business_ids AS "businessIds",
a.business_table AS "businessTable",
a.business_refund AS "businessRefund",
a.business_refund_state AS "businessRefundState",
a.business_id as "businessId",
a.business_name AS "businessName",
a.business_order_code AS "businessOrderCode",
a.business_refund_reason AS "businessRefundReason"
LEFT JOIN payment_order o
ON a.order_code = o.order_code
INSERT INTO payment_order_detail(
id,
order_code,
member_code,
member_name,
charging_item_id,
charging_item_name,
num,
price,
total_price,
add_time,
project_id,
project_name,
voucher_code,
proccess_state,
proccess_time,
create_by,
create_date,
update_by,
update_date,
show_business_model_flag,
remarks,
del_flag,
business_code,
business_ids,
business_table,
business_id,
business_name,
business_refund,
business_order_code
) VALUES (
#{id},
#{orderCode},
#{memberCode},
#{memberName},
#{chargingItemId},
#{chargingItemName},
#{num},
#{price},
#{totalPrice},
#{addTime},
#{projectId},
#{projectName},
#{voucherCode},
#{proccessState},
#{proccessTime},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{showBusinessModelFlag},
#{remarks},
#{delFlag},
#{businessCode},
#{businessIds},
#{businessTable},
#{businessId},
#{businessName},
#{businessRefund},
#{businessOrderCode}
)
INSERT INTO payment_order_detail (
id,
order_code,
member_code,
member_name,
charging_item_id,
charging_item_name,
num,
price,
total_price,
add_time,
project_id,
project_name,
voucher_code,
proccess_state,
proccess_time,
create_by,
create_date,
update_by,
update_date,
remarks,
del_flag,
business_code,
business_ids,
business_table,
business_id,
business_name,
business_refund,
business_order_code
) VALUES
(
#{item.id},
#{item.orderCode},
#{item.memberCode},
#{item.memberName},
#{item.chargingItemId},
#{item.chargingItemName},
#{item.num},
#{item.price},
#{item.totalPrice},
#{item.addTime},
#{item.projectId},
#{item.projectName},
#{item.voucherCode},
#{item.proccessState},
#{item.proccessTime},
#{item.createBy.id},
#{item.createDate},
#{item.updateBy.id},
#{item.updateDate},
#{item.remarks},
#{item.delFlag},
#{item.businessCode},
#{item.businessIds},
#{item.businessTable},
#{item.businessId},
#{item.businessName},
#{item.businessRefund},
#{item.businessOrderCode}
)
UPDATE payment_order_detail SET
order_code = #{orderCode},
member_code = #{memberCode},
member_name = #{memberName},
charging_item_name = #{chargingItemName},
project_name = #{projectName},
charging_item_id = #{chargingItemId},
num = #{num},
price = #{price},
total_price = #{totalPrice},
add_time = #{addTime},
project_id = #{projectId},
voucher_code = #{voucherCode},
proccess_state = #{proccessState},
proccess_time = #{proccessTime},
update_by = #{updateBy.id},
update_date = #{updateDate},
remarks = #{remarks},
business_order_code = #{businessOrderCode},
business_ids = #{businessIds},
business_table = #{businessTable},
business_refund_state = #{businessRefundState},
business_refund_time = #{businessRefundTime},
business_refund_reason = #{businessRefundReason}
WHERE id = #{id}
UPDATE payment_order_detail SET
proccess_state = #{proccessState},
proccess_time = #{proccessTime}
WHERE id=#{id}
UPDATE payment_order_detail SET
business_ids = #{businessIds},
business_table = #{businessTable}
WHERE id=#{id}
UPDATE payment_order_detail SET
remarks = concat(IFNULL(remarks,''),#{remarks}),
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
UPDATE
payment_order_detail
SET
business_refund_state = '2'
WHERE id=#{id}
AND business_refund_state = '1'
UPDATE
payment_order_detail
SET
business_refund_state =#{businessRefundState},
update_by =#{updateBy.id},
update_date =#{updateDate}
WHERE
business_refund_state = '1'
AND business_order_code =#{businessOrderCode}
update
payment_order_detail
set
business_refund = "0"
where business_ids = #{businessIds}