
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">
<!--
작성자 : 이원호
작성일 : 2021.11.10
내용 : API 연계정보 관련 SQL
-->
<mapper namespace="com.takensoft.taken_bi_manager.common.connection.api.dao.ConnectionApiDAO">
<!-- JobClass ResultMap -->
<resultMap id="ConnectionApiResult" type="ConnectionApi">
<result property="connectionId" column="connection_id"/>
<result property="title" column="title"/>
<result property="url" column="url"/>
<result property="type" column="type"/>
<result property="depth" column="depth"/>
<result property="rowDataColumnIndex" column="rowdata_column_index"/>
<result property="startRowIndex" column="start_row_index"/>
<result property="startCellIndex" column="start_cell_index"/>
<result property="dataset_post_id" column="data_post_id"/>
<collection property="params" column="connectionId = connection_id" javaType="java.util.ArrayList" ofType="ApiParam" select="selectApiParam" />
</resultMap>
<resultMap id="ApiParamResult" type="ApiParam">
<result property="paramId" column="param_id"/>
<result property="index" column="index"/>
<result property="key" column="key"/>
<result property="value" column="value"/>
<result property="disableDecode" column="disable_decode"/>
<result property="dateForm" column="date_form"/>
<result property="addMonth" column="add_month"/>
</resultMap>
<!-- API연계정보 가져오기 -->
<select id="selectConnectionApi" parameterType="java.lang.String" resultMap="ConnectionApiResult">
SELECT connection_id
, ttl
, url
, type
, depth
, rowdata_column_index
, start_row_index
, start_cell_index
, data_post_id
FROM api_connection_info
WHERE connection_id = #{connectionId}
</select>
<!-- API파라미터 가져오기 -->
<select id="selectApiParam" parameterType="ConnectionApi" resultMap="ApiParamResult">
SELECT
a.connection_id
, a.index
, a.key
, a.value
, a.disable_decode
, a.date_form
, a.add_month
FROM api_parameter_info a
WHERE
connection_id = #{connectionId}
ORDER BY a.index
</select>
<!-- API파라미터 삭제 -->
<delete id="deletefilterItem" parameterType="ConnectionApi">
DELETE FROM
api_parameter_info
WHERE
param_id = #{connectionId}
</delete>
<!-- API연계정보 등록 및 업데이트 -->
<update id="apiConnectionInfoInsert" parameterType="ConnectionApi">
INSERT INTO api_connection_info (
connection_id
, "ttl"
, "url"
, "type"
, "depth"
, "rowdata_column_index"
, "start_row_index"
, "start_cell_index"
, data_post_id
) VALUES (
#{connectionId}
, #{title}
, #{url}
, #{type}
, #{depth}
, #{rowDataColumnIndex}
, #{startRowIndex}
, #{startCellIndex}
, #{dataset_post_id}
) ON CONFLICT(connection_id)
DO UPDATE
SET
"ttl" = #{title}
, "url" = #{url}
, "type" = #{type}
, "depth" = #{depth}
, "rowdata_column_index" = #{rowDataColumnIndex}
, "start_row_index" = #{startRowIndex}
, "start_cell_index" = #{startCellIndex}
, data_post_id = #{dataset_post_id}
</update>
<!-- 연계API 파라미터정보 등록 -->
<insert id="apiParameterInfoInsert" parameterType="ApiParam">
INSERT INTO api_parameter_info (
"connection_id"
, "index"
, "key"
, "value"
, "disable_decode"
, "date_form"
, "add_month"
) VALUES (
#{paramId}
, #{index} ::INTEGER
, #{key}
, #{value}
, #{disableDecode} ::INTEGER
, #{dateForm} ::INTEGER
, #{addMonth} ::INTEGER
)
</insert>
<delete id="deleteApiConnectionInfo" parameterType="java.lang.String">
DELETE FROM
api_connection_info
WHERE
connection_id= #{groupId}
</delete>
<delete id="deleteApiParameterInfo" parameterType="java.lang.String">
DELETE FROM
api_parameter_info
WHERE
connection_id = #{groupId}
</delete>
</mapper>