SELECT t.*, bv.variety AS varietyName, bs.manage_tags AS manageTags, t.event_type AS eventType, t.transition_date AS transitionDate, CASE t.trans_type WHEN 0 THEN '内部调拨' WHEN 1 THEN '内部销售' WHEN 2 THEN '育肥调拨' ELSE '未知' END AS transTypeText, CASE t.status WHEN 0 THEN '待审批' WHEN 1 THEN '已通过' WHEN 2 THEN '已驳回' ELSE '未知状态' END AS statusText FROM sc_transition_info t LEFT JOIN bas_sheep bs ON t.sheep_id = bs.id LEFT JOIN bas_sheep_variety bv ON bs.variety_id = bv.id insert into sc_transition_info sheep_id, variety_id, trans_to, trans_from, event_type, trans_type, transition_date, technician, status, comment, create_by, create_time, #{sheepId}, #{varietyId}, #{transTo}, #{transFrom}, #{eventType}, #{transType}, #{transitionDate}, #{technician}, #{status}, #{comment}, #{createBy}, #{createTime}, INSERT INTO sc_transition_info ( sheep_id, variety_id, trans_to, trans_from, event_type,trans_type, transition_date, technician, status, comment, create_by, create_time ) VALUES ( #{item.sheepId}, #{item.varietyId}, #{item.transTo}, #{item.transFrom}, #{item.eventType}, #{item.transType},#{item.transitionDate}, #{item.technician}, #{item.status}, #{item.comment}, #{item.createBy}, now() ) update sc_transition_info sheep_id = #{sheepId}, variety_id = #{varietyId}, sheepfold_id = #{sheepfoldId}, trans_to = #{transTo}, trans_from = #{transFrom}, event_type = #{eventType}, trans_type = #{transType}, transition_date = #{transitionDate}, technician = #{technician}, status = #{status}, comment = #{comment}, create_by = #{createBy}, create_time = #{createTime}, where id = #{id} delete from sc_transition_info where id = #{id} delete from sc_transition_info where id in #{id}