
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.common.schedule.dao.ScheduleDAO">
<!-- 스케줄 업설트 -->
<update id="conflictInsertSchedule" parameterType="Schedule" >
INSERT INTO scheduler
(
schdul_id
, group_id
, sj
, dc
, cron
, cron_chrctr
, schdul_sttus
, cycle_at
, use_at
, creat_id
, creat_dt
)
VALUES
(
#{schdul_id}
, #{group_id}
, #{sj}
, #{dc}
, #{cron}
, #{cron_chrctr}
, #{schdul_sttus}
, #{cycle_at}
, #{use_at}
, #{creatId}
, NOW()
)
ON CONFLICT(schdul_id)
DO UPDATE
SET group_id = #{group_id}
, sj = #{sj}
, dc = #{dc}
, cron = #{cron}
, cron_chrctr = #{cron_chrctr}
, schdul_sttus = #{schdul_sttus}
, cycle_at = #{cycle_at}
, use_at = #{use_at}
, updt_dt = NOW()
, updt_id = #{updtId}
</update>
<!-- 스케줄 리스트 -->
<select id="selectScheduleList" parameterType="SearchVO" resultType="Schedule">
SELECT schdul_id
, group_id
, sj
, dc
, cron
, cron_chrctr
, schdul_sttus
, cycle_at
, use_at
, creat_id as "creatId"
, creat_dt as "creatDt"
, updt_dt as "updtDt"
, updt_id as "updtId"
FROM scheduler
WHERE use_at = true
<!-- 검색영역 -->
<foreach item="item" index="index" collection="searchObjectList">
<choose>
<!-- 날짜 검색 -->
<when test="item.type == 'dates'">
AND #{item.value}::timestamp <![CDATA[<=]]> ${item.key}::timestamp
AND ${item.key2}::timestamp <![CDATA[<]]> #{item.value2}::timestamp + INTERVAL '1' DAY
</when>
<!-- 상태 검색 -->
<when test="item.type == 'string' and item.key == 'schdul_sttus' and item.value != null and item.value !=''">
AND ${item.key} = #{item.value}
</when>
<!-- 일반 검색 -->
<when test="item.type == 'string' and item.key != null and item.key != '' and item.value != null and item.value !=''">
AND ${item.key} LIKE CONCAT('%', #{item.value}, '%')
</when>
</choose>
</foreach>
<!-- 검색영역 끝 -->
ORDER BY creat_dt DESC
LIMIT #{perPage} OFFSET ((#{currentPage} - 1) * #{perPage})
</select>
<!-- 스케줄 리스트 카운트 -->
<select id="selectScheduleListCount" parameterType="SearchVO" resultType="Integer">
SELECT count(*)
FROM scheduler
WHERE use_at = true
<!-- 검색영역 -->
<foreach item="item" index="index" collection="searchObjectList">
<choose>
<!-- 날짜 검색 -->
<when test="item.type == 'dates'">
AND #{item.value}::timestamp <![CDATA[<=]]> ${item.key}::timestamp
AND ${item.key2}::timestamp <![CDATA[<]]> #{item.value2}::timestamp + INTERVAL '1' DAY
</when>
<!-- 상태 검색 -->
<when test="item.type == 'string' and item.key == 'schdul_sttus' and item.value != null and item.value !=''">
AND ${item.key} = #{item.value}
</when>
<!-- 일반 검색 -->
<when test="item.type == 'string' and item.key != null and item.key != '' and item.value != null and item.value !=''">
AND ${item.key} LIKE CONCAT('%', #{item.value}, '%')
</when>
</choose>
</foreach>
<!-- 검색영역 끝 -->
</select>
<!-- 스케줄 단건 조회 -->
<select id="selectSchedule" parameterType="String" resultType="Schedule">
SELECT
schdul_id
, group_id
, sj
, dc
, cron
, cron_chrctr
, schdul_sttus
, cycle_at
, use_at
, creat_id as "creatId"
, creat_dt as "creatDt"
, updt_dt as "updtDt"
, updt_id as "updtId"
FROM scheduler
WHERE schdul_id = #{schdul_id}
AND use_at = true
</select>
<!-- Diagram Id로 Schedule Id 구하기 -->
<select id="selectScheduleIdRead" parameterType="String" resultType="String">
SELECT schdul_id
FROM scheduler
WHERE group_id = #{diagramId}
</select>
<!-- 스케줄 정보 삭제 -->
<update id="deleteSchedule" parameterType="String">
UPDATE scheduler
SET use_at = false
WHERE schdul_id = #{schdulId}
</update>
<!-- 스케줄 상태 변경 -->
<update id="scheduleSttusChange" parameterType="HashMap">
UPDATE scheduler
SET schdul_sttus = #{schdulSttus}
WHERE schdul_id = #{schdulId}
</update>
</mapper>