select id, sub_bill_no, bill_code, fee_code, fee_name, bill_fee, orig_fee, currency, order_num, del_flag, create_by, create_time, update_by, update_time, remark from emis_settle_sub_bill_feeitem
select a.bill_code,
a.lading_bill_code,
a.company_code,
a.departure_port,
a.destination_port,
a.box_quantity,
a.parcel_qty,
a.bill_weight,
a.total_volume,
seaway1.site_name as departure_port_name,
seaway2.site_name as destination_port_name,
b.*
from emis_waybill a
left join emis_settle_sub_bill_feeitem b on a.bill_code = b.bill_code and b.del_flag = '0'
left join emis_site seaway1 on a.departure_port=seaway1.site_code and seaway1.del_flag='0'
left join emis_site seaway2 on a.destination_port=seaway2.site_code and seaway2.del_flag='0'
insert into emis_settle_sub_bill_feeitem
id,sub_bill_no,bill_code,fee_code,fee_name,bill_fee,orig_fee,currency,order_num,del_flag,create_by,create_time,update_by,update_time,remark,#{id},#{subBillNo},#{billCode},#{feeCode},#{feeName},#{billFee},#{origFee},#{currency},#{orderNum},#{delFlag},#{createBy},#{createTime},#{updateBy},#{updateTime},#{remark},
update emis_settle_sub_bill_feeitem
sub_bill_no = #{subBillNo},bill_code = #{billCode},fee_code = #{feeCode},fee_name = #{feeName},bill_fee = #{billFee},orig_fee = #{origFee},currency = #{currency},order_num = #{orderNum},del_flag = #{delFlag},create_by = #{createBy},create_time = #{createTime},update_by = #{updateBy},update_time = #{updateTime},remark = #{remark},
where id = #{id}
update emis_settle_sub_bill_feeitem set del_flag='1' where bill_code = #{billCode} and del_flag='0'
update emis_settle_sub_bill_feeitem set del_flag='1' where id = #{id}
update emis_settle_sub_bill_feeitem set del_flag='1' where id in
#{id}