
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">
<mapper namespace="com.takensoft.taken_bi_manager.host.dao.HostDAO">
<sql id="searchSQL">
<foreach item="item" index="index" collection="searchObjectList">
<choose>
<when test="item.key == 'currentCode' and item.value != null and item.value != ''">
AND (
dh.dept_code IS NULL
OR dh.dept_code != #{item.value}
)
</when>
<when test="item.type != null and item.type !='' and item.type == 'dates'">
AND #{item.value}::timestamp <![CDATA[<=]]> ${item.key}::timestamp
AND ${item.key}::timestamp <![CDATA[<]]> #{item.value2}::timestamp + INTERVAL '1' DAY
</when>
<when test="item.key != null and item.key !='' and item.value != null and item.value != ''">
AND ${item.key} LIKE CONCAT('%', #{item.value}, '%')
</when>
<when test="item.key == null and item.value != null and item.value !=''">
AND (
hi.host_nm LIKE CONCAT('%', #{item.value}, '%')
OR hi.host_ip LIKE CONCAT('%', #{item.value}, '%')
OR ui.user_nm LIKE CONCAT('%', #{item.value}, '%')
)
</when>
</choose>
</foreach>
</sql>
<!-- 부서 목록 조회 -->
<select id="selectHostList" parameterType="SearchVO" resultType="HostVO">
SELECT hi.host_code,
hi.host_protocol,
hi.host_ip,
hi.host_id,
hi.host_nm,
hi.host_port,
hi.host_pw,
hi.rgtr_id,
hi.reg_dt
FROM host_info AS hi
LEFT JOIN dept_host AS dh
ON hi.host_code = dh.host_code
LEFT JOIN user_info AS ui
ON hi.rgtr_id = ui.user_id
WHERE hi.use_yn = 'Y'
<!-- 검색영역 -->
<include refid="searchSQL" />
<!-- 검색영역 끝 -->
GROUP BY hi.host_code
ORDER BY hi.reg_dt DESC
LIMIT #{perPage} OFFSET ((#{currentPage} - 1) * #{perPage})
</select>
<select id="selectHostListCount" parameterType="SearchVO" resultType="int">
SELECT COUNT(*)
FROM host_info AS hi
LEFT JOIN dept_host AS dh
ON hi.host_code = dh.host_code
LEFT JOIN user_info AS ui
ON hi.rgtr_id = ui.user_id
WHERE hi.use_yn = 'Y'
<!-- 검색영역 -->
<include refid="searchSQL" />
<!-- 검색영역 끝 -->
</select>
<!--
작성자 : 김성훈
작성일 : 2024.02.01
내용 : Host 단건 조회 SQL
-->
<select id="hostSelectOne" parameterType="String" resultType="HostVO">
SELECT
host_code
, host_protocol
, host_ip
, host_id
, host_pw
, host_port
, host_nm
FROM
host_info
WHERE
host_code = #{host_code}
</select>
<insert id="insertHost" parameterType="HostVO">
INSERT INTO host_info
(
host_code,
host_protocol,
host_ip,
host_id,
host_nm,
host_port,
host_pw,
rgtr_id,
reg_dt
) VALUES (
#{host_code},
#{host_protocol},
#{host_ip},
#{host_id},
#{host_nm},
#{host_port},
#{host_pw},
#{rgtr_id},
CURRENT_TIMESTAMP
)
</insert>
<update id="updateHost" parameterType="HostVO">
UPDATE host_info
SET
host_protocol = #{host_protocol}
, host_ip = #{host_ip}
, host_id = #{host_id}
, host_pw = #{host_pw}
, host_nm = #{host_nm}
, host_port = #{host_port}
, mdfr_id = #{mdfr_id}
, mdfcn_dt = CURRENT_TIMESTAMP
WHERE
host_code = #{host_code}
</update>
<delete id="deleteHost" parameterType="HostVO">
UPDATE host_info
SET
use_yn = 'N'
WHERE
host_code = #{host_code}
</delete>
<insert id="insertAcsHost" parameterType="HashMap">
INSERT INTO host_acs_log(
dept_code
,user_id
,acs_dt
,host_code
,author
) VALUES (
CASE
WHEN #{author} = 'ROLE_ADMIN' THEN NULL
ELSE #{dept_code}
END
, #{userId}
, now()
, #{host_code}
, #{author}
)
</insert>
</mapper>