Files
Blog_Project/VamPa/target/classes/com/vam/mapper/AdminMapper.xml

150 lines
4.1 KiB
XML

<?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="com.vam.mapper.AdminMapper">
<!-- 상품 등록 -->
<insert id="bookEnroll">
<selectKey resultType="int" keyProperty="bookId" order="AFTER">
SELECT ISEQ$$_74040.currval from dual
</selectKey>
insert into vam_book(bookName, authorId, publeYear, publisher, cateCode, bookPrice, bookStock, bookDiscount, bookIntro, bookContents)
values(#{bookName},#{authorId}, #{publeYear},#{publisher},#{cateCode},#{bookPrice},#{bookStock},#{bookDiscount},#{bookIntro},#{bookContents})
</insert>
<!-- 카테고리 리스트 -->
<select id="cateList" resultType="com.vam.model.CateVO">
select * from vam_bcate order by catecode
</select>
<!-- 상품 리스트 -->
<select id="goodsGetList" resultType="com.vam.model.BookVO">
<![CDATA[
select * from(
select /*+INDEX_DESC(vam_book SYS_C007551)*/ rownum as rn, bookId, bookName,
(select authorName from vam_author where vam_book.authorId = vam_author.authorId) authorName,
(select cateName from vam_bcate where vam_book.cateCode = vam_bcate.cateCode) cateName,bookStock,regDate
from vam_book
where
]]>
<if test="keyword != null">
bookName like '%' || #{keyword} || '%' and
</if>
<![CDATA[
rownum <= #{pageNum} * #{amount}
)
where rn > (#{pageNum} -1) * #{amount}
]]>
</select>
<!-- 상품 총 개수 -->
<select id="goodsGetTotal" resultType="int">
select count(*) from vam_book
<if test="keyword != null">
where bookName like '%' || #{keyword} || '%'
</if>
</select>
<!-- 상품 조회 페이지 -->
<select id="goodsGetDetail" resultType="com.vam.model.BookVO">
select bookId, bookName, (select authorName from vam_author where authorId =vam_book.authorId) authorName,
authorId, publeYear, publisher, cateCode, bookPrice, bookStock, bookDiscount, bookIntro, bookContents, regDate, updateDate
from vam_book where bookId = #{bookId}
</select>
<!-- 상품 정보 수정 -->
<update id="goodsModify">
update vam_book set bookName = #{bookName}, authorId = #{authorId}, publeYear = #{publeYear}, publisher = #{publisher}, cateCode = ${cateCode},
bookPrice = #{bookPrice}, bookStock = #{bookStock}, bookDiscount = #{bookDiscount}, bookIntro = #{bookIntro}, bookContents = #{bookContents}, updateDate = sysdate
where bookId = ${bookId}
</update>
<!-- 상품 정보 삭제 -->
<delete id="goodsDelete">
delete from vam_book where bookId = #{bookId}
</delete>
<!-- 이미지 등록 -->
<insert id="imageEnroll">
insert into vam_image(bookId, fileName, uploadPath, uuid) values (#{bookId}, #{fileName}, #{uploadPath}, #{uuid})
</insert>
<!-- 지정 상품 이미지 전체 삭제 -->
<delete id="deleteImageAll">
delete FROM vam_image where bookId = #{bookId}
</delete>
<!-- 어제자 날자 이미지 리스트 -->
<select id="checkFileList" resultType="com.vam.model.AttachImageVO">
select * from vam_image where uploadpath = to_char(sysdate -1, 'yyyy\mm\dd')
</select>
<!-- 지정 상품 이미지 정보 얻기 -->
<select id="getAttachInfo" resultType="com.vam.model.AttachImageVO">
select * from vam_image where bookId = #{bookId}
</select>
<!-- 주문 리스트 -->
<select id="getOrderList" resultType="com.vam.model.OrderDTO">
<![CDATA[
select *
from(
select rownum rn, orderId, memberId, orderstate, orderdate
from vam_order
where rownum <= #{pageNum} * #{amount}
]]>
<if test="keyword != null">
and memberId like '%'||#{keyword}||'%'
</if>
<![CDATA[
order by orderdate desc
)
where rn > (#{pageNum} -1) * #{amount}
]]>
</select>
<!-- 상품 총 개수 -->
<select id="getOrderTotal" resultType="int">
select count(*) from vam_order
<if test="keyword != null">
where memberId like '%'||#{keyword}||'%'
</if>
</select>
</mapper>