id, order_no, process_state, `status`, `type`, create_time, remarks, voucher_url, total_amount, settlement_amount, change_amount, applicant, dep_name, project_state, zxs_cost, zxs_remarks, payment_time, payment_amount, invoice_time, invoice_amount, invoice_type, cw_cost, refundable_amount, cw_remarks, estimate_cost, estimate_refundable, refund_Invoice, used_order, refund_status, refund_url, back_status, attachment_url, contract_picture_url, first_amount, examine_name delete from new_order_change where id = #{id,jdbcType=INTEGER} insert into new_order_change (order_no, process_state, `status`, `type`, create_time, remarks, voucher_url, total_amount, settlement_amount, change_amount, applicant, dep_name, project_state, zxs_cost, zxs_remarks, payment_time, payment_amount, invoice_time, invoice_amount, invoice_type, cw_cost, refundable_amount, cw_remarks, estimate_cost, estimate_refundable, refund_Invoice, used_order, refund_status, refund_url, back_status, attachment_url, contract_picture_url, first_amount, examine_name) values (#{orderNo,jdbcType=VARCHAR}, #{processState,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, #{voucherUrl,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL}, #{settlementAmount,jdbcType=DECIMAL}, #{changeAmount,jdbcType=DECIMAL}, #{applicant,jdbcType=VARCHAR}, #{depName,jdbcType=VARCHAR}, #{projectState,jdbcType=VARCHAR}, #{zxsCost,jdbcType=DECIMAL}, #{zxsRemarks,jdbcType=VARCHAR}, #{paymentTime,jdbcType=TIMESTAMP}, #{paymentAmount,jdbcType=DECIMAL}, #{invoiceTime,jdbcType=TIMESTAMP}, #{invoiceAmount,jdbcType=DECIMAL}, #{invoiceType,jdbcType=VARCHAR}, #{cwCost,jdbcType=DECIMAL}, #{refundableAmount,jdbcType=DECIMAL}, #{cwRemarks,jdbcType=VARCHAR}, #{estimateCost,jdbcType=DECIMAL}, #{estimateRefundable,jdbcType=DECIMAL}, #{refundInvoice,jdbcType=DECIMAL}, #{usedOrder,jdbcType=VARCHAR}, #{refundStatus,jdbcType=INTEGER}, #{refundUrl,jdbcType=VARCHAR}, #{backStatus,jdbcType=INTEGER}, #{attachmentUrl,jdbcType=VARCHAR}, #{contractPictureUrl,jdbcType=VARCHAR}, #{firstAmount,jdbcType=DECIMAL}, #{examineName,jdbcType=VARCHAR}) insert into new_order_change order_no, process_state, `status`, `type`, create_time, remarks, voucher_url, total_amount, settlement_amount, change_amount, applicant, dep_name, project_state, zxs_cost, zxs_remarks, payment_time, payment_amount, invoice_time, invoice_amount, invoice_type, cw_cost, refundable_amount, cw_remarks, estimate_cost, estimate_refundable, refund_Invoice, used_order, refund_status, refund_url, back_status, attachment_url, contract_picture_url, first_amount, examine_name, #{orderNo,jdbcType=VARCHAR}, #{processState,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, #{voucherUrl,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL}, #{settlementAmount,jdbcType=DECIMAL}, #{changeAmount,jdbcType=DECIMAL}, #{applicant,jdbcType=VARCHAR}, #{depName,jdbcType=VARCHAR}, #{projectState,jdbcType=VARCHAR}, #{zxsCost,jdbcType=DECIMAL}, #{zxsRemarks,jdbcType=VARCHAR}, #{paymentTime,jdbcType=TIMESTAMP}, #{paymentAmount,jdbcType=DECIMAL}, #{invoiceTime,jdbcType=TIMESTAMP}, #{invoiceAmount,jdbcType=DECIMAL}, #{invoiceType,jdbcType=VARCHAR}, #{cwCost,jdbcType=DECIMAL}, #{refundableAmount,jdbcType=DECIMAL}, #{cwRemarks,jdbcType=VARCHAR}, #{estimateCost,jdbcType=DECIMAL}, #{estimateRefundable,jdbcType=DECIMAL}, #{refundInvoice,jdbcType=DECIMAL}, #{usedOrder,jdbcType=VARCHAR}, #{refundStatus,jdbcType=INTEGER}, #{refundUrl,jdbcType=VARCHAR}, #{backStatus,jdbcType=INTEGER}, #{attachmentUrl,jdbcType=VARCHAR}, #{contractPictureUrl,jdbcType=VARCHAR}, #{firstAmount,jdbcType=DECIMAL}, #{examineName,jdbcType=VARCHAR}, update new_order_change order_no = #{orderNo,jdbcType=VARCHAR}, process_state = #{processState,jdbcType=INTEGER}, `status` = #{status,jdbcType=INTEGER}, `type` = #{type,jdbcType=INTEGER}, create_time = #{createTime,jdbcType=TIMESTAMP}, remarks = #{remarks,jdbcType=VARCHAR}, voucher_url = #{voucherUrl,jdbcType=VARCHAR}, total_amount = #{totalAmount,jdbcType=DECIMAL}, settlement_amount = #{settlementAmount,jdbcType=DECIMAL}, change_amount = #{changeAmount,jdbcType=DECIMAL}, applicant = #{applicant,jdbcType=VARCHAR}, dep_name = #{depName,jdbcType=VARCHAR}, project_state = #{projectState,jdbcType=VARCHAR}, zxs_cost = #{zxsCost,jdbcType=DECIMAL}, zxs_remarks = #{zxsRemarks,jdbcType=VARCHAR}, payment_time = #{paymentTime,jdbcType=TIMESTAMP}, payment_amount = #{paymentAmount,jdbcType=DECIMAL}, invoice_time = #{invoiceTime,jdbcType=TIMESTAMP}, invoice_amount = #{invoiceAmount,jdbcType=DECIMAL}, invoice_type = #{invoiceType,jdbcType=VARCHAR}, cw_cost = #{cwCost,jdbcType=DECIMAL}, refundable_amount = #{refundableAmount,jdbcType=DECIMAL}, cw_remarks = #{cwRemarks,jdbcType=VARCHAR}, estimate_cost = #{estimateCost,jdbcType=DECIMAL}, estimate_refundable = #{estimateRefundable,jdbcType=DECIMAL}, refund_Invoice = #{refundInvoice,jdbcType=DECIMAL}, used_order = #{usedOrder,jdbcType=VARCHAR}, refund_status = #{refundStatus,jdbcType=INTEGER}, refund_url = #{refundUrl,jdbcType=VARCHAR}, back_status = #{backStatus,jdbcType=INTEGER}, attachment_url = #{attachmentUrl,jdbcType=VARCHAR}, contract_picture_url = #{contractPictureUrl,jdbcType=VARCHAR}, first_amount = #{firstAmount,jdbcType=DECIMAL}, examine_name = #{examineName,jdbcType=VARCHAR}, where id = #{id,jdbcType=INTEGER} update new_order_change set order_no = #{orderNo,jdbcType=VARCHAR}, process_state = #{processState,jdbcType=INTEGER}, `status` = #{status,jdbcType=INTEGER}, `type` = #{type,jdbcType=INTEGER}, create_time = #{createTime,jdbcType=TIMESTAMP}, remarks = #{remarks,jdbcType=VARCHAR}, voucher_url = #{voucherUrl,jdbcType=VARCHAR}, total_amount = #{totalAmount,jdbcType=DECIMAL}, settlement_amount = #{settlementAmount,jdbcType=DECIMAL}, change_amount = #{changeAmount,jdbcType=DECIMAL}, applicant = #{applicant,jdbcType=VARCHAR}, dep_name = #{depName,jdbcType=VARCHAR}, project_state = #{projectState,jdbcType=VARCHAR}, zxs_cost = #{zxsCost,jdbcType=DECIMAL}, zxs_remarks = #{zxsRemarks,jdbcType=VARCHAR}, payment_time = #{paymentTime,jdbcType=TIMESTAMP}, payment_amount = #{paymentAmount,jdbcType=DECIMAL}, invoice_time = #{invoiceTime,jdbcType=TIMESTAMP}, invoice_amount = #{invoiceAmount,jdbcType=DECIMAL}, invoice_type = #{invoiceType,jdbcType=VARCHAR}, cw_cost = #{cwCost,jdbcType=DECIMAL}, refundable_amount = #{refundableAmount,jdbcType=DECIMAL}, cw_remarks = #{cwRemarks,jdbcType=VARCHAR}, estimate_cost = #{estimateCost,jdbcType=DECIMAL}, estimate_refundable = #{estimateRefundable,jdbcType=DECIMAL}, refund_Invoice = #{refundInvoice,jdbcType=DECIMAL}, used_order = #{usedOrder,jdbcType=VARCHAR}, refund_status = #{refundStatus,jdbcType=INTEGER}, refund_url = #{refundUrl,jdbcType=VARCHAR}, back_status = #{backStatus,jdbcType=INTEGER}, attachment_url = #{attachmentUrl,jdbcType=VARCHAR}, contract_picture_url = #{contractPictureUrl,jdbcType=VARCHAR}, first_amount = #{firstAmount,jdbcType=DECIMAL}, examine_name = #{examineName,jdbcType=VARCHAR} where id = #{id,jdbcType=INTEGER} update new_order_change set `refund_Invoice`=ifnull(`refund_Invoice`,0)+ #{amount} where order_no= #{orderNo} update new_order_change set `refund_Invoice`=ifnull(`refund_Invoice`,0)- #{amount} where order_no= #{orderNo} update new_order_change a ,t_order_new b,admin c set a.examine_name=c.name where a.process_state = #{type} and a.order_no =b.order_no and b.order_dep = #{depId} and c.id= #{aid} ,t_order_new b set a.examine_name=#{names} where a.process_state = #{type} and a.order_no =b.order_no and b.order_dep = #{depId} update new_order_change n left join (select c.id from t_order_new a left join t_order_task b on a.order_no =b.order_no left join new_order_change c on a.order_no =c.order_no where (b.consultant_id in (#{aid},#{taskReceiverId}) or b.manager_id in (#{aid},#{taskReceiverId})) and c.process_state in (#{type}) group by c.id)x on n.id =x.id left join (select a.order_no ,group_concat(DISTINCT b.name)name from order_examine a left join admin b on a.aid=b.id where 1=1 and a.type=0 and a.type=1 group by a.order_no ) a on n.order_no =a.order_no set n.examine_name =a.name where n.process_state =#{type}