select sc.id, sc.sheep_id, bs.manage_tags as manageTags, -- 关联羊只表的耳号 sc.sheepfold, sf.sheepfold_name as sheepfoldName, sc.variety_id, bv.variety as varietyName, sc.comment, sc.technician, sc.create_by, sc.create_time from sc_castrate sc left join bas_sheep bs on sc.sheep_id = bs.id -- 关联羊只表获取耳号 left join da_sheepfold sf on sc.sheepfold = sf.id left join bas_sheep_variety bv on sc.variety_id = bv.id insert into sc_castrate sheep_id, sheepfold, variety_id, comment, technician, create_by, create_time, #{sheepId}, #{sheepfold}, #{varietyId}, #{comment}, #{technician}, #{createBy}, #{createTime}, update sc_castrate sheep_id = #{sheepId}, sheepfold = #{sheepfold}, variety_id = #{varietyId}, comment = #{comment}, technician = #{technician}, create_by = #{createBy}, create_time = #{createTime}, where id = #{id} delete from sc_castrate where id = #{id} delete from sc_castrate where id in #{id}