SiteManagement.ja

리무 rimu ·2023년 11월 28일
0

Co.

목록 보기
39/43

<?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.jnv.bnr.site.service.SiteManageDAO">

    <select id="selectSiteManageList" parameterType="map" resultType="SiteVO">
        /* site-manage-mapper.selectSiteManageList */
        SELECT S.SITE_ID
             , S.SITE_NM
             , S.SITE_URL
             , S.SITE_DESC
             , S.SITE_CLS_CD
             , S.USE_YN
             , S.RGSTR_ID
             , S.RGST_DT
             , S.UPDTR_ID
             , S.UPDT_DT
          FROM PTS_SITE_LIST S
        <where>
            <if test='searchKeyword != null and searchKeyword != ""'>
                <choose>
                    <when test='searchType == "SITENAME"'>
                    AND S.SITE_NM LIKE '%'|| #{searchKeyword} || '%'
                    </when>
                    <when test='searchType == "SITEURL"'>
                    AND S.SITE_URL LIKE '%'|| #{searchKeyword} || '%'
                    </when>
                    <when test='searchType == "WRITERNAME"'>
                    AND S.RGSTR_ID = #{searchKeyword}
                    </when>
                    <otherwise>
                    AND (S.SITE_NM LIKE '%'|| #{searchKeyword} || '%'
                        OR S.SITE_URL LIKE '%'|| #{searchKeyword} || '%'
                        OR S.RGSTR_ID = #{searchKeyword})
                    </otherwise>
                </choose>
            </if>
        </where>
         ORDER BY S.RGST_DT DESC
    </select>

    <insert id="insertSiteManageItem" parameterType= "SiteVO">
        /* site-manage-mapper.insertSiteManageItem */
        INSERT INTO PTS_SITE_LIST
                  ( SITE_ID
                  , SITE_NM
                  , SITE_URL
                  , SITE_DESC
                  , SITE_CLS_CD
                  , USE_YN
                  , RGSTR_ID
                  , RGST_DT
                  , UPDTR_ID
                  , UPDT_DT)
            VALUES(
                   #{siteId}
                  ,#{siteNm}
                  ,#{siteUrl}
                  ,#{siteDesc}
                  ,#{siteClsCd}
                  ,#{useYn}
                  ,#{sessionUserId}
                  ,NOW()
                  ,#{sessionUserId}
                  ,NOW()
                   )
    </insert>

    <update id="updateSiteManageItem" parameterType= "SiteVO">
        /* site-manage-mapper.updateSiteManageItem */
        UPDATE PTS_SITE_LIST
           SET SITE_NM = #{siteNm}
             , SITE_URL = #{siteUrl}
             , SITE_DESC = #{siteDesc}
             , SITE_CLS_CD = #{siteClsCd}
             , USE_YN = #{useYn}
             , RGSTR_ID = #{sessionUserId}
             , RGST_DT = NOW()
             , UPDTR_ID = #{sessionUserId}
             , UPDT_DT = NOW()
         WHERE SITE_ID = #{siteId}
    </update>

    <delete id="deleteSiteManageItem" parameterType="SiteVO">
        /* site-manage-mapper.deleteSiteManageItem */
        DELETE FROM PTS_SITE_LIST
         WHERE SITE_ID = #{siteId}
    </delete>

</mapper>
profile
JAVA / SQL / Spring 을 공부하고 있습니다 🐥

0개의 댓글