
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
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">
<!--
작 성 자 : 박정하
작 성 일 : 2024.05.22
내 용 : 개인정보 조회 이력 관련
-->
<mapper namespace="com.takensoft.cms.prvcInqHstry.dao.PrvcInqHstryDAO">
<!-- 개인정보 조회 이력 resultMap -->
<resultMap id="prvcInqHstryMap" type="PrvcInqHstryVO">
<result property="inqHstryId" column="inq_hstry_id" />
<result property="inqTrprId" column="inq_trpr_id" />
<result property="inqRsn" column="inq_rsn" />
<result property="inqIp" column="inq_ip" />
<result property="rdr" column="rdr" />
<result property="inqDt" column="inq_dt" />
<result property="mbrNm" column="mbr_nm" />
<result property="lgnId" column="lgn_id" />
</resultMap>
<!--
작 성 자 : 박정하
작 성 일 : 2024.05.22
내 용 : 개인정보조회 이력 등록
-->
<insert id="insertPrvcInqHstry" parameterType="PrvcInqHstryVO">
INSERT INTO prvc_inq_hstry (
inq_trpr_id
, inq_rsn
, inq_ip
, rdr
, inq_dt
) VALUES (
#{inqTrprId}
, #{inqRsn}
, #{inqIp}
, #{rdr}
, now()
)
</insert>
<!-- SELECT SQL -->
<sql id="selectItem">
SELECT pih.inq_hstry_id
, pih.inq_trpr_id
, pih.inq_rsn
, pih.inq_ip
, pih.rdr
, TO_CHAR(pih.inq_dt, 'YYYY-MM-DD HH24:MI') AS inq_dt
, mi.mbr_nm
, (SELECT lgn_id FROM mbr_info WHERE pih.inq_trpr_id = mbr_id) AS lgn_id
FROM prvc_inq_hstry AS pih
LEFT JOIN mbr_info AS mi
ON pih.rdr = mi.mbr_id
</sql>
<sql id="selectRequirement">
<if test="startDt != null and startDt != ''">
AND pih.inq_dt >= #{startDt}::timestamp
</if>
<if test="endDt != null and endDt != ''">
AND #{endDt}::timestamp >= pih.inq_dt
</if>
<if test="searchText != null and searchText != ''">
<choose>
<when test="searchType != null and searchType != ''">
<if test="searchType == 'inqRdr'">
AND mi.mbr_nm LIKE '%' || #{searchText} || '%'
</if>
<if test="searchType == 'inqTrprId'">
AND pih.inq_trpr_id IN (select mbr_id
from mbr_info
where lgn_id LIKE '%' || #{searchText} || '%')
</if>
</when>
<otherwise>
AND (
mi.mbr_nm LIKE '%' || #{searchText} || '%'
OR
pih.inq_trpr_id IN (select mbr_id
from mbr_info
where lgn_id LIKE '%' || #{searchText} || '%')
)
</otherwise>
</choose>
</if>
</sql>
<!-- // SELECT SQL -->
<!--
작 성 자 : 박정하
작 성 일 : 2024.05.27
내 용 : 개인정보조회 이력 개수
-->
<select id="selectPrvcInqHstryListCnt" parameterType="Pagination" resultType="Integer">
SELECT COUNT(pih.inq_hstry_id)
FROM prvc_inq_hstry AS pih
LEFT JOIN mbr_info AS mi
ON pih.rdr = mi.mbr_id
WHERE true
<include refid="selectRequirement" />
</select>
<!--
작 성 자 : 박정하
작 성 일 : 2024.05.27
내 용 : 개인정보조회 이력 조회
-->
<select id="selectPrvcInqHstryList" parameterType="Pagination" resultMap="prvcInqHstryMap">
<include refid="selectItem" />
WHERE true
<include refid="selectRequirement" />
ORDER BY pih.inq_dt DESC
LIMIT #{recordSize} OFFSET #{limitStart}
</select>
<!--
작 성 자 : 박정하
작 성 일 : 2024.05.27
내 용 : 개인정보조회 이력 상세 조회
-->
<select id="selectPrvcInqHstryDetail" parameterType="Integer" resultMap="prvcInqHstryMap">
<include refid="selectItem" />
WHERE pih.inq_hstry_id = #{inqHstryId}
</select>
</mapper>