select
a.id,
a.installment_history_id,
a.bank_card_lend_id,
a.current_amount,
a.repayment_date,
a.principal,
a.interest,
a.posting_state,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.del_flag,
a.remark,
a.type,
a.periods,
CONCAT(bcl."name",
'(',
right(bcl.code,
4),
')') as bank_card_lend_name
from
installment_history_detail a
left join bank_card_lend bcl on
bcl.id = a.bank_card_lend_id
left join installment_history ih on ih.id=a.installment_history_id
insert into installment_history_detail
id,installment_history_id,bank_card_lend_id,current_amount,repayment_date,principal,interest,posting_state,create_by,create_time,update_by,update_time,del_flag,remark,type,periods,#{id},#{installmentHistoryId},#{bankCardLendId},#{currentAmount},#{repaymentDate},#{principal},#{interest},#{postingState},#{createBy},#{createTime},#{updateBy},#{updateTime},#{delFlag},#{remark},#{type},#{periods},
update installment_history_detail
installment_history_id = #{installmentHistoryId},bank_card_lend_id = #{bankCardLendId},current_amount = #{currentAmount},repayment_date = #{repaymentDate},principal = #{principal},interest = #{interest},posting_state = #{postingState},create_by = #{createBy},create_time = #{createTime},update_by = #{updateBy},update_time = #{updateTime},del_flag = #{delFlag},remark = #{remark},type = #{type},periods = #{periods},
where id = #{id}
delete from installment_history_detail where id = #{id}
delete from installment_history_detail where id in
#{id}
update installment_history_detail set del_flag='1' where id = #{id}
update installment_history_detail set del_flag='1' where id in
#{id}