select
a.id,
a.waybill_id,
a.bill_code,
a.sales_support,
a.money_user_id,
mu.company as money_company,
a.cabinet_number,
a.del_flag,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.create_site,
a.update_site,
a.remark
from emis_waybill_other a
left join emis_money_user mu on a.money_user_id = mu.id and mu.del_flag = '0'
insert into emis_waybill_other
waybill_id,
bill_code,
sales_support,
money_user_id,
cabinet_number,
del_flag,
create_by,
create_time,
update_by,
update_time,
create_site,
update_site,
remark,
#{waybillId},
#{billCode},
#{salesSupport},
#{moneyUserId},
#{cabinetNumber},
#{delFlag},
#{createBy},
#{createTime},
#{updateBy},
#{updateTime},
#{createSite},
#{updateSite},
#{remark},
update emis_waybill_other
waybill_id = #{waybillId},
bill_code = #{billCode},
sales_support = #{salesSupport},
money_user_id = #{moneyUserId},
cabinet_number = #{cabinetNumber},
del_flag = #{delFlag},
update_by = #{updateBy},
update_time = #{updateTime},
create_site = #{createSite},
update_site = #{updateSite},
remark = #{remark},
where id = #{id}
update emis_waybill_other set del_flag = '1' where id = #{id}
update emis_waybill_other set del_flag = '1' where waybill_id = #{waybillId}
update emis_waybill_other set del_flag = '1' where bill_code = #{billCode}