JSP/BBS
bbs.xml
GAWON
2023. 6. 9. 17:49
<?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.mybatis.bbs"> <!-- 경로 표기법이 클래스명 표기법처럼 사용된다! -->
<!--
각 태그 속성
1. id : id를 통해서 sql문을 선택(임의로 결정 가능)
2. parameterType : 매개변수의 타입
3. resultType : 리턴 데이터의 타입 (풀 패키지로 작성)
* insert, update, delete의 경우 무조건 int 형식이기 때문에 작성할 필요가 없다
-->
<select id="total_record" resultType="int">
select count(*) from bbs_t
</select>
<select id="list_bbs" resultType="org.joonzis.ex.BVO" parameterType="map">
select * from
(select rownum r_num, A.* from
(select * from bbs_t order by b_idx desc)A)
where r_num BETWEEN #{begin} and #{end}
</select>
<insert id="insert_bbs" parameterType="org.joonzis.ex.BVO">
INSERT INTO BBS_T VALUES(
bbs_seq.nextval,
#{writer},
#{title},
#{content},
#{pw},
0,
#{ip},
#{filename},
sysdate
)
</insert>
<select id="select_bbs" resultType="org.joonzis.ex.BVO" parameterType="int">
SELECT * FROM BBS_T WHERE B_IDX = #{b_idx }
</select>
<delete id="remove_bbs" parameterType="int">
DELETE * FROM BBS_T WHERE b_idx=#{b_idx}
</delete>
<update id="update_bbs" parameterType="org.joonzis.ex.BVO">
update bbs_t set title=#{title}, content=#{content},IP=#{ip},filename=#{filename} where b_idx=#{b_idx}
</update>
<update id="UpdateHit" parameterType="org.joonzis.ex.BVO">
update bbs_t set hit=#{hit} where b_idx=#{b_idx}
</update>
</mapper>