Notice
Recent Posts
Recent Comments
Link
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

WON.dev

BoardMapper.xml 본문

SPRING/chapter04_MVC

BoardMapper.xml

GAWON 2023. 7. 18. 09:27
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper 
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >

<mapper namespace="org.joonzis.mapper.BoardMapper">
	
	<select id="getListWithPaging" resultType="org.joonzis.domain.BoardVO">
		<![CDATA[
			select bno,title, content, writer, regdate, updatedate, replycnt from 
			(SELECT /*+index_desc(tbl_board pk_board)*/
			ROWNUM rn, bno,title, content,writer,regdate,updatedate,replycnt from tbl_board
			where rownum <= #{pageNum} * #{amount} )   
			where rn > (#{pageNum} - 1) * #{amount}
		]]>
	</select>
	
	<insert id="insert" parameterType="org.joonzis.domain.BoardVO">
		INSERT INTO tbl_board
		VALUES(
			seq_board.nextval,
			#{title},
			#{content},
			#{writer},
			  sysdate,
			  sysdate,
			  0
		)
	</insert>
	
	<select id="read" parameterType="long" resultType="org.joonzis.domain.BoardVO">
		select * from tbl_board where bno=#{bno}
	</select>
	
	<delete id="delete" parameterType="long">
	 	delete from tbl_board where bno=#{bno}
	</delete>
	
	<update id="update" parameterType="org.joonzis.domain.BoardVO">
		update tbl_board set title=#{title}, content=#{content}, writer=#{writer}, updateDate = sysdate
		where bno=#{bno} 
	</update>
	
	<select id="getTotalCount" resultType="int">
		select count(*) from tbl_board where bno > 0	
	</select>
	
	<update id="updateReplyCnt">
		update tbl_board set replycnt = replycnt + #{amount} where bno=#{bno}
	</update>
	
	<select id="getMaxBno" resultType="long">
		select max(bno) from tbl_board
	</select>
</mapper>

'SPRING > chapter04_MVC' 카테고리의 다른 글

ReplyMapper.xml  (0) 2023.07.18
MemberMapper.xml  (0) 2023.07.18
BoardAttachMapper.xml  (0) 2023.07.18
SampleTxServiceImpl.java  (0) 2023.07.18
SampleTxService.java  (0) 2023.07.18