delete from t_collection_poem where poem_id=#{poemId} delete from t_collection_dynasty where dynasty_id=#{dynastyId} insert into t_collection_poem (user_id,poem_id,`time`) values (#{userId},#{poemId},#{time}); insert into t_collection_dynasty (user_id,dynasty_id,`time`) values (#{userId},#{dynastyId},#{time}); delete from t_collection_poem where poem_id=#{poemId} and user_id=#{userId} delete from t_collection_dynasty where dynasty_id=#{dynastyId} and user_id=#{userId} update t_poem set collection = #{result} where poem_id = #{poemId}; update t_dynasty set collection = #{result} where dynasty_id = #{dynastyId};