INSERT INTO board(bbs_id, bbs_ttl, bbs_cls, bbs_cnt, bbs_tm, file_mng_id, scls_id) VALUES (#{bbsId}, #{bbsTtl}, #{bbsCls}, #{bbsCnt}, now(), #{fileMngId}, #{sclsId}); UPDATE board SET bbs_ttl = #{bbsTtl}, bbs_cls = #{bbsCls}, bbs_cnt = #{bbsCnt}, file_mng_id = #{fileMngId} WHERE bbs_id = #{bbsId} DELETE FROM board WHERE bbs_id = #{bbsId} INSERT INTO user_board (std_id, bbs_id, check_yn) SELECT u.std_id, b.bbs_id, 'F' FROM user_class u JOIN board b ON u.scls_id = b.scls_id ON CONFLICT (std_id, bbs_id) DO NOTHING; DELETE FROM user_board WHERE bbs_id = #{bbsId} UPDATE user_board set check_yn = 'T' WHERE bbs_id = #{bbsId} AND std_id = #{stdId} AND check_yn = 'F' UPDATE user_board set check_yn = 'T' WHERE std_id = #{stdId} AND check_yn = 'F'