
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">
<mapper namespace="com.takensoft.portal.entDscsnAply.dao.EntDscsnAplyDAO">
<!-- 기업상담신청 resultMap -->
<resultMap id="entDscsnAplyMap" type="EntDscsnAplyVO">
<result property="entDscsnAplyId" column="ent_dscsn_aply_id" />
<result property="entNm" column="ent_nm" />
<result property="aplcntNm" column="aplcnt_nm" />
<result property="telno" column="telno" />
<result property="eml" column="eml" />
<result property="aplyCn" column="aply_cn" />
<result property="fileMngId" column="file_mng_id" />
<result property="actnPic" column="actn_pic" />
<result property="actnDt" column="actn_dt" />
<result property="rmrk" column="rmrk" />
<result property="prcsStts" column="prcs_stts" />
<result property="useYn" column="use_yn" />
<result property="aplcntIp" column="aplcnt_ip" />
<result property="regDt" column="reg_dt" />
<result property="mbrNm" column="mbr_nm" />
</resultMap>
<!--
작 성 자 : 박정하
작 성 일 : 2024.04.02
내 용 : 기업상담신청 등록
-->
<insert id="entDscsnAplyInsert" parameterType="HashMap">
INSERT INTO ent_dscsn_aply (
ent_dscsn_aply_id
, ent_nm
, aplcnt_nm
, telno
, eml
, aply_cn
, file_mng_id
, actn_pic
, actn_dt
, rmrk
, prcs_stts
, use_yn
, aplcnt_ip
, reg_dt
) VALUES (
#{entDscsnAplyId}
, #{entNm}
, #{aplcntNm}
, #{telno}
, #{eml}
, #{aplyCn}
, #{fileMngId}
, #{actnPic}
, #{actnDt}::timestamp
, #{rmrk}
, null
, 'Y'
, #{aplcntIp}
, now()
)
</insert>
<!-- SELECT SQL -->
<sql id="selectItem">
SELECT eda.ent_dscsn_aply_id
, eda.ent_nm
, eda.aplcnt_nm
, eda.telno
, eda.eml
, eda.aply_cn
, eda.file_mng_id
, eda.actn_pic
, to_char(eda.actn_dt, 'YYYY-MM-DD HH24:MI') AS actn_dt
, eda.rmrk
, eda.prcs_stts
, eda.use_yn
, eda.aplcnt_ip
, to_char(eda.reg_dt, 'YYYY-MM-DD HH24:MI') AS reg_dt
, mi.mbr_nm
FROM ent_dscsn_aply AS eda
LEFT JOIN mbr_info AS mi
ON eda.actn_pic = mi.mbr_id
AND mi.use_yn = 'Y'
WHERE eda.use_yn = 'Y'
</sql>
<sql id="selectRequirement">
<if test="searchText != null and searchText != ''">
AND ent_nm LIKE '%' || #{searchText} || '%'
</if>
<if test="cateValue != null and cateValue != ''">
<choose>
<when test='cateValue == "S"'>
AND prcs_stts IS NULL
</when>
<otherwise>
AND prcs_stts = #{cateValue}
</otherwise>
</choose>
</if>
</sql>
<!--
작 성 자 : 박정하
작 성 일 : 2024.04.02
내 용 : 기업상담신청 목록 조회
-->
<select id="entDscsnAplyList" parameterType="Pagination" resultMap="entDscsnAplyMap">
SELECT ent_dscsn_aply_id
, ent_nm
, aplcnt_nm
, telno
, eml
, aply_cn
, file_mng_id
, actn_pic
, actn_dt
, rmrk
, prcs_stts
, use_yn
, aplcnt_ip
, reg_dt
, mbr_nm
FROM (
<include refid="selectItem" />
<if test='isAdmin != "Y"'>
AND actn_pic = #{mbrId}
</if>
) AS datas
WHERE TRUE
<include refid="selectRequirement" />
ORDER BY reg_dt DESC
OFFSET #{limitStart} LIMIT #{recordSize}
</select>
<!--
작 성 자 : 박정하
작 성 일 : 2024.04.02
내 용 : 기업상담신청 목록 총 개수 조회
-->
<select id="entDscsnAplyListCount" parameterType="Pagination" resultType="int">
SELECT COUNT(ent_dscsn_aply_id)
FROM (
<include refid="selectItem" />
<if test='isAdmin != "Y"'>
AND actn_pic = #{mbrId}
</if>
) AS datas
WHERE TRUE
<include refid="selectRequirement" />
</select>
<!--
작 성 자 : 박정하
작 성 일 : 2024.04.02
내 용 : 기업상담신청 상세 조회
-->
<select id="entDscsnAplyDetail" parameterType="String" resultMap="entDscsnAplyMap">
<include refid="selectItem" />
AND ent_dscsn_aply_id = #{entDscsnAplyId}
</select>
<!--
작성자 : 박정하
작성일자 : 2024-04-02
내용 : 기업상담신청 수정
-->
<update id="entDscsnAplyUpdate" parameterType="HashMap">
UPDATE ent_dscsn_aply
SET actn_pic = #{actnPic},
actn_dt = now(),
rmrk = #{rmrk},
prcs_stts = #{prcsStts}
WHERE ent_dscsn_aply_id = #{entDscsnAplyId}
</update>
<!--
작 성 자 : 박정하
작 성 일 : 2024.04.04
내 용 : 기업상담신청 1시간 이내 동일 아이피 등록 개수
-->
<select id="entDscsnAplyCountByOneHourWriteSameIp" parameterType="string" resultType="HashMap">
SELECT COALESCE(count(0), 0) AS writecount,
'1 HOUR'::interval - (now() - MIN(reg_dt)) AS lastdatetime
FROM ent_dscsn_aply
WHERE aplcnt_ip = #{aplcntIp}
AND reg_dt > now() - '1 HOUR'::interval
</select>
</mapper>