select mb.buy_id, mb.material_id, mb.buy_time, mb.place, mb.total_num, mb.price, mb.amount, mb.buyer, mb.remark, u.nick_name as buy_nick_name, m.brand, m.name, m.series from cmc_material_buy as mb left join sys_user as u on u.user_id = mb.buyer left join cmc_material as m on m.material_id = mb.material_id insert into cmc_material_buy material_id, buy_time, place, total_num, price, amount, buyer, remark, #{materialId}, #{buyTime}, #{place}, #{totalNum}, #{price}, #{amount}, #{buyer}, #{remark}, update cmc_material_buy material_id = #{materialId}, buy_time = #{buyTime}, place = #{place}, total_num = #{totalNum}, price = #{price}, amount = #{amount}, buyer = #{buyer}, remark = #{remark}, where buy_id = #{buyId} delete from cmc_material_buy where buy_id = #{buyId} delete from cmc_material_buy where buy_id in #{buyId}