select id, code, task_id, back_person, phone, direct_audit_by, direct_audit_time, direct_audit_remark, create_by, create_time, update_by, update_time, remark, company_id, back_time, status, direct_id from back_apply_info
insert into back_apply_info
code,
task_id,
back_person,
phone,
direct_audit_by,
direct_audit_time,
direct_audit_remark,
create_by,
create_time,
update_by,
update_time,
remark,
company_id,
back_time,
status,
direct_id,
#{code},
#{taskId},
#{backPerson},
#{phone},
#{directAuditBy},
#{directAuditTime},
#{directAuditRemark},
#{createBy},
#{createTime},
#{updateBy},
#{updateTime},
#{remark},
#{companyId},
#{backTime},
#{status},
#{directId},
insert into back_apply_details
code,
parent_id,
type_id,
pre_num,
audit_num,
use_num,
status,
create_by,
create_time,
ap_detection,
remark,
company_id,
#{code},
#{parentId},
#{typeId},
#{preNum},
#{auditNum},
#{num},
#{status},
#{createBy},
#{createTime},
#{apDetection},
#{remark},
#{companyId},
insert into back_check_details
parent_id,
type_id,
back_num,
ma_id,
status,
back_status,
is_finished,
create_by,
create_time,
remark,
ap_detection,
company_id,
#{parentId},
#{typeId},
#{preNum},
#{maId},
#{status},
#{backStatus},
#{isFinished},
#{createBy},
#{createTime},
#{remark},
#{apDetection},
#{companyId},
insert into repair_apply_details
(
task_id,
ma_id,
type_id,
repair_num,
status,
create_by,
remark,
company_id,
back_id,
create_time
)
values (
#{taskId},
#{maId},
#{typeId},
#{backNum},
#{status},
#{createBy},
#{remark},
#{companyId},
#{id},
NOW()
)
update back_apply_info
code = #{code},
task_id = #{taskId},
back_person = #{backPerson},
phone = #{phone},
direct_audit_by = #{directAuditBy},
direct_audit_time = #{directAuditTime},
direct_audit_remark = #{directAuditRemark},
update_by = #{updateBy},
update_time = #{updateTime},
remark = #{remark},
company_id = #{companyId},
back_time = #{backTime},
`status` = #{status},
direct_id = #{directId},
print_status = #{printStatus},
where id = #{id}
update tm_task set task_status = #{taskStatus} where task_id = #{taskId}
update back_apply_info set status = #{taskStatus} where id = #{id}
update back_apply_details set status = #{taskStatus} where parent_id = #{id}
update back_check_details set is_finished = '1', update_time = now() where parent_id = #{id} and type_id = #{typeId} and (is_finished is null or is_finished != 1)
update slt_agreement_info
set end_time = now(),
update_time = now(),
back_id = #{record.id},
status = '1'
where id = #{info.id}
update slt_agreement_info
set num = #{backNum},
end_time = now(),
update_time = now(),
back_id = #{record.id},
status = '1'
where id = #{info.id}
update back_apply_details set use_num = use_num - COALESCE(#{preNum} ,0) where parent_id = #{parentId} and type_id = #{typeId}
update back_apply_details set pre_num = pre_num + COALESCE(#{preNum} ,0) where id = #{id}
update back_check_details set back_num = back_num + COALESCE(#{preNum} ,0) where parent_id = #{parentId} and type_id = #{typeId}
and ma_id = #{maId}
update back_check_details
set
update_by = #{updateBy},
update_time = #{updateTime},
ap_detection = #{apDetection}
where parent_id = #{parentId} and ma_id = #{maId}
insert into slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,is_slt,company_id,lease_type,create_time)
values (#{info.agreementId},#{info.typeId},#{info.maId},#{many},#{info.startTime},#{info.status},#{info.leaseId},#{info.leasePrice},#{info.buyPrice},'0',#{info.companyId},#{info.leaseType},now());
delete from back_apply_info where id = #{id}
delete from back_apply_details where parent_id = #{id}
delete from back_check_details where parent_id = #{id}
delete from back_apply_details where id = #{id}
delete from back_check_details where parent_id = #{parentId} and type_id = #{typeId}
and ma_id = #{maId}