SELECT a.waybill_detail_id, b.sign_time, b.external_waybill_no, b.sender_city, b.receiver_city, b.goods_weight, b.order_type, b.product_code, u.nick_name, a.waybill_id, a.external_waybill_no, a.fee_item_code, a.fee_item_name, ifnull( a.adjust_amount, a.rate_amount ) rate_amount, a.adjust_amount, a.remark, a.create_time, a.update_time, a.dept_id, a.del_flag, a.create_by, a.update_by FROM biz_waybill_cost_details a LEFT JOIN biz_waybill_order b ON a.waybill_id = b.waybill_id LEFT JOIN sys_user u ON b.user_id = u.user_id LEFT JOIN sys_dept d ON a.dept_id = d.dept_id insert into biz_waybill_cost_details waybill_id, external_waybill_no, fee_item_code, fee_item_name, fee_name, amount, rate_amount, adjust_amount, remark, create_time, update_time, dept_id, user_id, del_flag, create_by, update_by, #{waybillId}, #{externalWaybillNo}, #{feeItemCode}, #{feeItemName}, #{feeName}, #{amount}, #{rateAmount}, #{adjustAmount}, #{remark}, #{createTime}, #{updateTime}, #{deptId}, #{userId}, #{delFlag}, #{createBy}, #{updateBy}, update biz_waybill_cost_details waybill_id = #{waybillId}, external_waybill_no = #{externalWaybillNo}, fee_item_code = #{feeItemCode}, fee_item_name = #{feeItemName}, fee_name = #{feeName}, amount = #{amount}, rate_amount = #{rateAmount}, adjust_amount = #{adjustAmount}, remark = #{remark}, create_time = #{createTime}, update_time = #{updateTime}, dept_id = #{deptId}, user_id = #{userId}, del_flag = #{delFlag}, create_by = #{createBy}, update_by = #{updateBy}, where waybill_detail_id = #{waybillDetailId} delete from biz_waybill_cost_details where waybill_detail_id = #{waybillDetailId} delete from biz_waybill_cost_details where waybill_detail_id in #{waybillDetailId}