SELECT boardId as boardId, boardNo as boardNo, categoryCd as categoryCd, parentBoardNo as parentBoardNo, regDate as regDate, bSubject as bsubject, bContent as bcontent, bWriter as bwriter, attachFile as attachFile, attachFileId as attachFileId, bNotice as bnotice, readCount as readCount, remark as remark FROM (SELECT A.*, ROWNUM AS RNUM FROM (SELECT * FROM TB_WWW_BOARD WHERE BOARDID = #{boardId} AND BSUBJECT LIKE '%'||#{searchText}||'%' AND BCONTENT LIKE '%'||#{searchText}||'%' ORDER BY BNOTICE DESC, BOARDNO DESC, REGDATE DESC ) A ) WHERE RNUM > #{pageStart} AND RNUM <= (#{perPageNum}+#{pageStart})
SELECT NVL(COUNT(*), 0) as boardCount FROM TB_WWW_BOARD WHERE BOARDID = #{boardId} AND BSUBJECT LIKE '%'||#{searchText}||'%' AND BCONTENT LIKE '%'||#{searchText}||'%'
SELECT boardId as boardId, boardNo as boardNo, categoryCd as categoryCd, parentBoardNo as parentBoardNo, regDate as regDate, bSubject as bsubject, bContent as bcontent, bWriter as bwriter, attachFile as attachFile, attachFileId as attachFileId, bNotice as bnotice, readCount as readCount, remark as remark FROM TB_WWW_BOARD WHERE BOARDNO = #{boardNo} AND BOARDID = #{boardId}
UPDATE TB_WWW_BOARD SET READCOUNT = READCOUNT+1 WHERE BOARDNO = #{boardNo} AND BOARDID = #{boardId}
INSERT INTO TB_WWW_BOARD (CATEGORYCD, BOARDNO, REGDATE, BSUBJECT, BCONTENT, EMAIL, ATTACHFILE, ATTACHFILEID, BNOTICE, BWRITER, BOARDID, READCOUNT) VALUES ('N', (SELECT NVL(MAX(BOARDNO),0)+1 FROM TB_WWW_BOARD WHERE BOARDID = #{boardId}), TO_DATE(TO_CHAR(SYSDATE,'yyyymmdd hh24mi'), 'YYYYMMDD HH24MI'), #{bSubject}, #{bContent}, #{webUserId}, #{attachFile}, #{ATTACHFILEID}, #{bNotice}, '관리자', #{boardId}, '0')
UPDATE TB_WWW_BOARD SET REGDATE = TO_DATE(TO_CHAR(SYSDATE,'yyyymmdd hh24mi'), 'YYYYMMDD HH24MI'), BSUBJECT = #{bSubject}, BCONTENT = #{bContent}, ATTACHFILE = #{attachFile}, ATTACHFILEID = #{ATTACHFILEID}, BNOTICE = #{bNotice} WHERE BOARDNO = #{boardNo} AND BOARDID = #{boardId}
DELETE TB_WWW_BOARD WHERE CATEGORYCD = 'N' AND BOARDNO = #{boardNo} AND BOARDID = #{boardId}