
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">
<!--
작성자 : takensoft
작성일 : 2024.04.09
내 용 : 로그인 이력 관련
-->
<mapper namespace="com.takensoft.cms.mber.dao.LgnHstryDAO">
<!-- 로그인 이력 resultMap -->
<resultMap id="lgnHstryMap" type="LgnHstryVO">
<result property="lgnId" column="lgn_id" />
<result property="lgnType" column="lgn_type" />
<result property="cntnDt" column="cntn_dt" />
<result property="cntnIp" column="cntn_ip" />
<result property="cntnOperSys" column="cntn_oper_sys" />
<result property="deviceNm" column="device_nm" />
<result property="brwsrNm" column="brwsr_nm" />
</resultMap>
<!--
작성자 : takensoft
작성일 : 2024.04.11
내 용 : 로그인 이력 등록
-->
<insert id="save" parameterType="LgnHstryVO">
INSERT INTO lgn_hstry (
lgn_id
, lgn_type
, cntn_dt
, cntn_ip
, cntn_oper_sys
, device_nm
, brwsr_nm
) VALUES (
#{lgnId}
, #{lgnType}
, NOW()
, #{cntnIp}
, #{cntnOperSys}
, #{deviceNm}
, #{brwsrNm}
)
</insert>
<!-- SELECT SQL -->
<sql id="selectItem">
SELECT lh.lgn_id
, lh.lgn_type
, TO_CHAR(lh.cntn_dt, 'YYYY-MM-DD HH24:MI') AS cntn_dt
, lh.cntn_ip
, lh.cntn_oper_sys
, lh.device_nm
, lh.brwsr_nm
FROM lgn_hstry AS lh
</sql>
<sql id="selectRequirement">
<if test="startDt != null and startDt != ''">
AND lh.cntn_dt >= #{startDt}::timestamp
</if>
<if test="endDt != null and endDt != ''">
AND #{endDt}::timestamp >= lh.cntn_dt
</if>
<if test="searchText != null and searchText != ''">
<choose>
<when test="searchType != null and searchType != ''">
<if test="searchType == 'lgnType'">
lh.lgn_type = (SELECT CASE cm.cd_nm
WHEN '관리자' THEN '0'
WHEN '사용자' THEN '1'
ELSE ''
END
FROM cd_mng AS cm
WHERE cm.use_yn = 'Y'
AND cm.up_cd = 'lgnHstryType'
AND cm.cd_nm LIKE '%' || #{searchText} || '%')
</if>
<if test="searchType == 'lgnId'">
AND lh.lgn_id LIKE '%' || #{searchText} || '%'
</if>
</when>
<otherwise>
AND (
lh.lgn_type = (SELECT CASE cm.cd_nm
WHEN '관리자' THEN '0'
WHEN '사용자' THEN '1'
ELSE ''
END
FROM cd_mng AS cm
WHERE cm.use_yn = 'Y'
AND cm.up_cd = 'lgnHstryType'
AND cm.cd_nm LIKE '%' || #{searchText} || '%')
OR
lh.lgn_id LIKE '%' || #{searchText} || '%'
)
</otherwise>
</choose>
</if>
</sql>
<!-- // SELECT SQL -->
<!--
작 성 자 : 박정하
작 성 일 : 2024.05.24
내 용 : 로그인 이력 개수
-->
<select id="selectLgnHstryListCnt" parameterType="Pagination" resultType="Integer">
SELECT COUNT(lgn_hstry_id)
FROM lgn_hstry AS lh
WHERE true
<include refid="selectRequirement" />
</select>
<!--
작 성 자 : 박정하
작 성 일 : 2024.05.24
내 용 : 로그인 이력 조회
-->
<select id="selectLgnHstryList" parameterType="Pagination" resultMap="lgnHstryMap">
<include refid="selectItem" />
WHERE true
<include refid="selectRequirement" />
ORDER BY cntn_dt DESC
LIMIT #{recordSize} OFFSET #{limitStart}
</select>
</mapper>