AND question_id = #{params.questionId} AND author_id = #{params.authorId} AND note_id IN (SELECT note_id FROM collection_note WHERE collection_id = #{params.collectionId}) AND created_at >= DATE_SUB(CURRENT_DATE, INTERVAL #{params.recentDays} DAY) INSERT INTO note (question_id, author_id, content) VALUES (#{questionId}, #{authorId}, #{content}) UPDATE note SET content = #{content} WHERE note_id = #{noteId} UPDATE note SET like_count = like_count + 1 WHERE note_id = #{noteId} UPDATE note SET like_count = like_count - 1 WHERE note_id = #{noteId} UPDATE note SET collect_count = collect_count + 1 WHERE note_id = #{noteId} UPDATE note SET collect_count = collect_count - 1 WHERE note_id = #{noteId} DELETE FROM note WHERE note_id = #{noteId} UPDATE note SET comment_count = comment_count + 1, updated_at = CURRENT_TIMESTAMP WHERE note_id = #{noteId} UPDATE note SET comment_count = CASE WHEN comment_count > 0 THEN comment_count - 1 ELSE 0 END, updated_at = CURRENT_TIMESTAMP WHERE note_id = #{noteId}