File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
<?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">
<!--
작성자 : takensoft
작성일 : 2024.04.03
내 용 : 회원정보 관련
-->
<mapper namespace="com.takensoft.cms.mber.dao.MberDAO">
<!-- 회원 정보 resultMap(권한 포함) -->
<resultMap id="mberMap" type="MberVO">
<result property="mbrId" column="mbr_id" />
<result property="lgnId" column="lgn_id" />
<result property="mbrNm" column="mbr_nm" />
<result property="ncnm" column="ncnm" />
<result property="pswd" column="pswd" />
<result property="mblTelno" column="mbl_telno" />
<result property="telno" column="telno" />
<result property="eml" column="eml" />
<result property="zip" column="zip" />
<result property="addr" column="addr" />
<result property="daddr" column="daddr" />
<result property="mbrStts" column="mbr_stts" />
<result property="useYn" column="use_yn" />
<result property="cntrlDt" column="cntrl_dt" />
<result property="cntrlRsn" column="cntrl_rsn" />
<result property="smsRcptnAgreYn" column="sms_rcptn_agre_yn" />
<result property="emlRcptnAgreYn" column="eml_rcptn_agre_yn" />
<result property="prvcRcptnAgreYn" column="prvc_rcptn_agre_yn" />
<result property="mbrType" column="mbr_type" />
<result property="pswdChgDt" column="pswd_chg_dt" />
<result property="frstRegIp" column="frst_reg_ip" />
<result property="sysPvsnYn" column="sys_pvsn_yn" />
<result property="rgtr" column="rgtr" />
<result property="regDt" column="reg_dt" />
<result property="mdfr" column="mdfr" />
<result property="mdfcnDt" column="mdfcn_dt" />
<collection property="authorList" column="{mbrId = mbr_id}" javaType="java.util.ArrayList" ofType="MberAuthorVO" select="findByMberAuthor" />
</resultMap>
<!-- 회원, 권한 매핑 -->
<resultMap id="authMap" type="MberAuthorVO">
<result property="mbrId" column="mbr_id" />
<result property="authrtCd" column="authrt_cd" />
<result property="rgtr" column="rgtr" />
<result property="regDt" column="reg_dt" />
</resultMap>
<!--
작성자 : takensoft
작성일 : 2024.04.03
내 용 : 로그인 아이디 중복 확인
-->
<select id="findByCheckLoginId" parameterType="String" resultType="boolean">
SELECT COUNT(lgn_id)
FROM mbr_info
WHERE lgn_id = #{lgnId}
</select>
<!--
작성자 : takensoft
작성일 : 2024.04.03
내 용 : 회원가입
-->
<insert id="save" parameterType="JoinDTO">
INSERT INTO mbr_info (
mbr_id
, lgn_id
, mbr_nm
, ncnm
, pswd
, mbl_telno
, telno
, eml
, zip
, addr
, daddr
, mbr_stts
, use_yn
, cntrl_dt
, cntrl_rsn
, sms_rcptn_agre_yn
, eml_rcptn_agre_yn
, prvc_rcptn_agre_yn
, mbr_type
, pswd_chg_dt
, frst_reg_ip
, sys_pvsn_yn
, rgtr
, reg_dt
) VALUES (
#{mbrId}
, #{lgnId}
, #{mbrNm}
, #{ncnm}
, #{pswd}
, #{mblTelno}
, #{telno}
, #{eml}
, #{zip}
, #{addr}
, #{daddr}
, #{mbrStts}
, 'Y'
, #{cntrlDt}::timestamp
, #{cntrlRsn}
, #{smsRcptnAgreYn}
, #{emlRcptnAgreYn}
, #{prvcRcptnAgreYn}
, 'S'
, NOW()
, #{frstRegIp}
, 'Y'
, #{rgtr}
, NOW()
)
</insert>
<!--
작성자 : takensoft
작성일 : 2024.04.03
내 용 : 회원 권한 등록
-->
<insert id="authorSave" parameterType="MberAuthorVO">
INSERT INTO mbr_authrt_info (
mbr_id
, authrt_cd
, rgtr
, reg_dt
) VALUES (
#{mbrId}
, #{authrtCd}
, #{rgtr}
, NOW()
)
</insert>
<sql id="selectMber">
SELECT mi.mbr_id
, mi.lgn_id
, mi.mbr_nm
, mi.ncnm
, mi.pswd
, mi.mbl_telno
, mi.telno
, mi.eml
, mi.zip
, mi.addr
, mi.daddr
, mi.mbr_stts
, mi.use_yn
, TO_CHAR(mi.cntrl_dt, 'YYYY-MM-DD') AS cntrl_dt
, mi.cntrl_rsn
, mi.sms_rcptn_agre_yn
, mi.eml_rcptn_agre_yn
, mi.prvc_rcptn_agre_yn
, mi.mbr_type
, TO_CHAR(mi.pswd_chg_dt, 'YYYY-MM-DD HH24:MI') AS pswd_chg_dt
, mi.frst_reg_ip
, mi.sys_pvsn_yn
, mi.rgtr
, TO_CHAR(mi.reg_dt, 'YYYY-MM-DD HH24:MI') AS reg_dt
, mi.mdfr
, TO_CHAR(mi.mdfcn_dt, 'YYYY-MM-DD HH24:MI') AS mdfcn_dt
FROM mbr_info mi
</sql>
<!--
작성자 : takensoft
작성일 : 2024.04.03
내 용 : 회원정보 조회 [security 용]
-->
<select id="findByMberSecurity" parameterType="String" resultMap="mberMap">
<include refid="selectMber" />
WHERE mi.lgn_id = #{lgnId}
AND mi.use_yn = 'Y'
</select>
<!--
작성자 : takensoft
작성일 : 2024.04.15
내 용 : 회원정보 조회
-->
<select id="findByMber" parameterType="String" resultMap="mberMap">
<include refid="selectMber" />
WHERE mi.mbr_id = #{mbrId}
AND mi.use_yn = 'Y'
</select>
<!--
작성자 : takensoft
작성일 : 2024.04.03
내 용 : 회원 권한 정보 조회
-->
<select id="findByMberAuthor" parameterType="MberVO" resultMap="authMap">
SELECT mai.mbr_id
, mai.authrt_cd
, mai.rgtr
, TO_CHAR(mai.reg_dt, 'YYYY-MM-DD HH24:MI') AS reg_dt
FROM mbr_authrt_info mai
WHERE mai.mbr_id = #{mbrId}
</select>
<!--
작성자 : takensoft
작성일 : 2024.04.15
내 용 : 비밀번호 변경
-->
<update id="updatePassword" parameterType="PasswordDTO">
UPDATE mbr_info
SET pswd = #{newPswd}
WHERE mbr_id = #{mbrId}
</update>
<!-- 목록 조회 -->
<sql id="findAll">
SELECT mi.mbr_id
, mi.lgn_id
, mi.mbr_nm
, mi.ncnm
, mi.pswd
, mi.mbl_telno
, mi.telno
, mi.eml
, mi.zip
, mi.addr
, mi.daddr
, mi.mbr_stts
, mi.use_yn
, TO_CHAR(mi.cntrl_dt, 'YYYY-MM-DD HH24:MI') AS cntrl_dt
, mi.cntrl_rsn
, mi.sms_rcptn_agre_yn
, mi.eml_rcptn_agre_yn
, mi.prvc_rcptn_agre_yn
, mi.mbr_type
, TO_CHAR(mi.pswd_chg_dt, 'YYYY-MM-DD HH24:MI') AS pswd_chg_dt
, mi.frst_reg_ip
, mi.sys_pvsn_yn
, mi.rgtr
, TO_CHAR(mi.reg_dt, 'YYYY-MM-DD HH24:MI') AS reg_dt
, mi.mdfr
, TO_CHAR(mi.mdfcn_dt, 'YYYY-MM-DD HH24:MI') AS mdfcn_dt
, mai.authrt_cd
FROM mbr_info AS mi
LEFT JOIN mbr_authrt_info AS mai
ON mi.mbr_id = mai.mbr_id
</sql>
<!-- 검색 조건 -->
<sql id="selectRequirement">
<if test="searchText != null and searchText != ''">
<choose>
<when test="searchType != null and searchType != ''">
<if test="searchType == 'lgn_id'">
AND mi.lgn_id LIKE CONCAT('%', #{searchText}, '%')
</if>
<if test="searchType == 'mbr_nm'">
AND mi.mbr_nm LIKE CONCAT('%', #{searchText}, '%')
</if>
</when>
<otherwise>
AND (
mi.lgn_id LIKE CONCAT('%', #{searchText}, '%')
OR
mi.mbr_nm LIKE CONCAT('%', #{searchText}, '%')
)
</otherwise>
</choose>
</if>
</sql>
<!--
작성자 : 박정하
작성일 : 2024.04.23
내 용 : 회원정보 목록 조회 (관리자)
-->
<select id="findAllMng" resultMap="mberMap">
<include refid="findAll"></include>
WHERE mi.use_yn = 'Y'
AND mai.authrt_cd = 'ROLE_ADMIN'
<include refid="selectRequirement" />
ORDER BY mi.reg_dt DESC
OFFSET #{limitStart} LIMIT #{recordSize}
</select>
<!--
작성자 : 박정하
작성일 : 2024.04.23
내 용 : 회원정보 목록 조회 (사용자)
-->
<select id="findAllMbr" resultMap="mberMap">
<include refid="findAll"></include>
WHERE mi.use_yn = 'Y'
AND mai.authrt_cd != 'ROLE_ADMIN'
<include refid="selectRequirement" />
ORDER BY mi.reg_dt DESC
OFFSET #{limitStart} LIMIT #{recordSize}
</select>
<!--
작성자 : 박정하
작성일 : 2024.04.23
내 용 : 회원정보 목록 조회 (관리자) 개수
-->
<select id="findAllMngCnt" resultType="int">
SELECT count(mi.mbr_id)
FROM mbr_info AS mi
LEFT JOIN mbr_authrt_info AS mai
ON mi.mbr_id = mai.mbr_id
WHERE mi.use_yn = 'Y'
AND mai.authrt_cd = 'ROLE_ADMIN'
<include refid="selectRequirement" />
</select>
<!--
작성자 : 박정하
작성일 : 2024.04.23
내 용 : 회원정보 목록 조회 (사용자) 개수
-->
<select id="findAllMbrCnt" resultType="int">
SELECT count(mi.mbr_id)
FROM mbr_info AS mi
LEFT JOIN mbr_authrt_info AS mai
ON mi.mbr_id = mai.mbr_id
WHERE mi.use_yn = 'Y'
AND mai.authrt_cd = 'ROLE_USER'
<include refid="selectRequirement" />
</select>
<!--
작성자 : 박정하
작성일 : 2024.04.24
내 용 : 회원정보 수정
-->
<update id="updateUser" parameterType="HashMap">
UPDATE mbr_info
SET mbr_nm = #{mbrNm}
, ncnm = #{ncnm}
, mbl_telno = #{mblTelno}
, telno = #{telno}
, eml = #{eml}
, zip = #{zip}
, addr = #{addr}
, daddr = #{daddr}
, mbr_stts = #{mbrStts}
, use_yn = #{useYn}
, cntrl_dt = #{cntrlDt}::timestamp
, cntrl_rsn = #{cntrlRsn}
, sms_rcptn_agre_yn = #{smsRcptnAgreYn}
, eml_rcptn_agre_yn = #{emlRcptnAgreYn}
, prvc_rcptn_agre_yn = #{prvcRcptnAgreYn}
, mbr_type = #{mbrType}
, sys_pvsn_yn = #{sysPvsnYn}
, mdfr = #{mdfr}
, mdfcn_dt = NOW()
WHERE mbr_id = #{mbrId}
</update>
<!--
작성자 : 박정하
작성일 : 2024.04.26
내 용 : 회원 권한 삭제
-->
<delete id="deleteByMbrId" parameterType="HashMap">
DELETE
FROM mbr_authrt_info
WHERE mbr_id = #{mbrId}
</delete>
</mapper>