INSERT INTO sys_notice_read (notice_id, user_id, read_time) SELECT #{noticeId}, #{userId}, SYSDATE FROM DUAL WHERE NOT EXISTS ( SELECT 1 FROM sys_notice_read WHERE notice_id = #{noticeId} AND user_id = #{userId} ); insert ignore into sys_notice_read (notice_id, user_id, read_time) values (#{noticeId}, #{userId}, sysdate()) delete from sys_notice_read where notice_id in #{noticeId}