
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.openAPI.dao.OpenApiDAO">
<!--
작성자 : 방선주
작성일 : 2024.05.03
내용 : openApi 정보 등록
-->
<insert id="openApiInsert" parameterType="OpenApiInfoVO">
INSERT INTO bi_manager.export(
export_id
, export_ttl
, export_kor_nm
, export_eng_nm
, export_explain
, category_id
, public_potal_is_use
, data_is_use
, keyword
, api_type
, data_format_type
, is_use
, export_creat_id
, export_creat_dt
, hit
, use_cnt
, file_manager_id
) VALUES (
#{export_id}
, #{export_ttl}
, #{export_kor_nm}
, #{export_eng_nm}
, #{export_explain}
, #{category_id}
, #{public_potal_is_use}
, #{data_is_use}
, #{keyword}
, #{api_type}
, #{data_format_type}
, true
, #{export_creat_id}
, now()
, 0
, 0
, #{file_manager_id}
)
</insert>
<!--
작성자 : 방선주
작성일 : 2024.05.03
내용 : openApi 상세 정보 등록
-->
<insert id="openApiDetailInsert" parameterType="ApiExportVO">
INSERT INTO bi_manager.api_export(
api_id
, export_id
, url
, api_detail_kor_nm
, api_detail_eng_nm
, api_detail_explain
, dataset_id
, dataset_post_id
, "index"
) VALUES (
#{api_id}
, #{export_id}
, #{url}
, #{api_detail_kor_nm}
, #{api_detail_eng_nm}
, #{api_detail_explain}
, #{dataset.datasetId}
, #{datasetPost.dataset_post_id}
, #{index}
)
</insert>
<!--
작성자 : 방선주
작성일 : 2024.05.07
내용 : openApi 리스트 조회
-->
<select id="openApiListSelect" parameterType="SearchVO" resultType="OpenApiInfoVO">
SELECT export_id
, export_ttl
, export_kor_nm
, export_eng_nm
, export_explain
, (select code_nm from cmmn_code cc where e.category_id = cc.code_id )as category_id
, public_potal_is_use
, data_is_use
, keyword
, api_type
, data_format_type
, is_use
, export_creat_id
, export_creat_dt
, (select dept_nm
from orgnzt_info oi
right join (select dept_code from orgnzt_member om where om.user_id = e.export_creat_id) dc
on oi.dept_code = dc.dept_code ) as dept_nm
, export_mdfcn_id
, export_mdfcn_dt
, hit, use_cnt
, file_manager_id
FROM bi_manager.export e
WHERE is_use = true
<!-- 검색영역 -->
<foreach item="item" index="index" collection="searchObjectList">
<choose>
<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.type != null and item.type !='' and item.type == 'bool' and item.value != null and item.value !=''">
${item.key} = #{item.value}
</when>
<when test="item.type != null and item.type !='' and item.value != null and item.value !='' and item.type == 'eq'">
AND
${item.key} = #{item.value}
</when>
<when test="item.type != null and item.type !='' and item.value != null and item.value !=''">
AND
${item.key} LIKE CONCAT('%', #{item.value}, '%')
</when>
</choose>
</foreach>
<!-- 검색영역 끝 -->
ORDER BY export_creat_dt DESC
LIMIT #{perPage} OFFSET ((#{currentPage} - 1) * #{perPage})
</select>
<!--
작성자 : 방선주
작성일 : 2024.05.07
내용 : openApi 리스트 count 조회
-->
<select id="openApiListSelectCount" parameterType="SearchVO" resultType="java.lang.Integer">
SELECT count(*)
FROM bi_manager.export
WHERE is_use = true
<!-- 검색영역 -->
<foreach item="item" index="index" collection="searchObjectList">
<choose>
<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.type != null and item.type !='' and item.type == 'bool' and item.value != null and item.value !=''">
${item.key} = #{item.value}
</when>
<when test="item.type != null and item.type !='' and item.value != null and item.value !='' and item.type == 'eq'">
AND
${item.key} = #{item.value}
</when>
<when test="item.type != null and item.type !='' and item.value != null and item.value !=''">
AND
${item.key} LIKE CONCAT('%', #{item.value}, '%')
</when>
</choose>
</foreach>
<!-- 검색영역 끝 -->
LIMIT #{perPage} OFFSET ((#{currentPage} - 1) * #{perPage})
</select>
<!--
작성자 : 방선주
작성일 : 2024.05.07
내용 : openApi one select 조회
-->
<select id="openApiOneSelect" parameterType="java.lang.String" resultType="OpenApiInfoVO">
SELECT export_id
, export_ttl
, export_kor_nm
, export_eng_nm
, export_explain
, category_id
, public_potal_is_use
, data_is_use
, keyword
, api_type
, data_format_type
, is_use
, export_creat_id
, export_creat_dt
, export_mdfcn_id
, export_mdfcn_dt
, hit
, use_cnt
, file_manager_id
FROM bi_manager.export
WHERE export_id = #{export_id}
</select>
<resultMap id="ApiExportMap" type="ApiExportVO">
<result column="api_id" property="api_id"/>
<result column="export_id" property="export_id"/>
<result column="url" property="url"/>
<result column="api_detail_kor_nm" property="api_detail_kor_nm"/>
<result column="api_detail_eng_nm" property="api_detail_eng_nm"/>
<result column="api_detail_explain" property="api_detail_explain"/>
<result column="index" property="index"/>
<association property="dataset" javaType="Dataset">
<result column="dataset_id" property="datasetId"/>
</association>
<association property="datasetPost" javaType="DatasetPost">
<result column="dataset_post_id" property="dataset_post_id"/>
</association>
</resultMap>
<!--
작성자 : 방선주
작성일 : 2024.05.07
내용 : openApi one select 조회
-->
<select id="apiDatasetListSelect" parameterType="java.lang.String" resultMap="ApiExportMap">
SELECT api_id
, export_id
, url
, api_detail_kor_nm
, api_detail_eng_nm
, api_detail_explain
, dataset_id
, dataset_post_id
, "index"
FROM bi_manager.api_export
WHERE export_id = #{export_id}
ORDER BY "index"
</select>
<!--
작성자 : 방선주
작성일 : 2024.05.09
내용 : openApi 상세 정보 삭제
-->
<delete id="apiDetailDelete" parameterType="java.lang.String">
DELETE
FROM bi_manager.api_export
WHERE export_id = #{export_id}
</delete>
<!--
작성자 : 방선주
작성일 : 2024.05.09
내용 : openApi 삭제
-->
<delete id="openApiDelete" parameterType="java.lang.String">
DELETE
FROM bi_manager.export
WHERE export_id = #{export_id}
</delete>
<!--
작성자 : 방선주
작성일 : 2024.05.10
내용 : openApi 조회수 증가
-->
<update id="openApiViewCountUpdate" parameterType="OpenApiInfoVO">
UPDATE bi_manager.export
SET
hit = #{hit}
WHERE export_id=#{export_id};
</update>
<!--
작성자 : 방선주
작성일 : 2024.10.07
내용 : openApi 키 생성
-->
<insert id="openApiKeyCreate" parameterType="OpenApiKeyVO" >
INSERT INTO api_key_info( api_key
, creat_id
, creat_dt
, bgnde
, endde
)VALUES( #{api_key}
, #{creat_id}
, now()
, #{bgnde}::date
, #{endde}::date
)
</insert>
<!--
작성자 : 방선주
작성일 : 2024.10.07
내용 : openApi 키 목록
-->
<select id="openApiKeySelectList" parameterType="SearchVO" resultType="OpenApiKeyVO">
SELECT key_sn
, api_key
, creat_id
, TO_CHAR(creat_dt, 'YYYY-MM-DD HH24:MI:SS') as creat_dt
, CASE WHEN bgnde > CURRENT_DATE THEN 'wait'
WHEN bgnde <= CURRENT_DATE AND endde >= CURRENT_DATE THEN 'use'
WHEN endde < CURRENT_DATE THEN 'expire'
END AS status
, bgnde
, endde
FROM api_key_info
ORDER BY creat_dt DESC
LIMIT #{perPage} OFFSET ((#{currentPage} - 1) * #{perPage})
</select>
<!--
작성자 : 방선주
작성일 : 2024.10.07
내용 : openApi 키 목록
-->
<select id="openApiKeySelectListCnt" parameterType="SearchVO" resultType="java.lang.Integer">
SELECT count(key_sn)
FROM api_key_info
</select>
<!--
작성자 : 방선주
작성일 : 2024.10.07
내용 : openApi 키 삭제
-->
<delete id="openApiKeyDelete" parameterType="java.lang.Integer">
DELETE
FROM api_key_info
WHERE key_sn = #{key_sn}
</delete>
<!--
작성자 : 방선주
작성일 : 2024.10.07
내용 : openApi 서비스키 존재 체크
-->
<select id="openApiKeyCheck" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT count(key_sn)
FROM api_key_info
WHERE api_key = #{serviceKey}
AND bgnde <= CURRENT_DATE AND endde >= CURRENT_DATE
</select>
<!--*********************************************GIS 기능 관리*****************************************************-->
<!--
작성자 : 하관우
작성일 : 2024.11.20
내용 : GIS 리스트 조회
-->
<select id="getGisInfoList" parameterType="SearchVO" resultType="GisInfoVO">
SELECT
gis_id
, gis_title
, dataset_id
, memo
, (select code_nm from cmmn_code cc where g.category_id = cc.code_id )as category_id
, use_at
, (select dept_nm
from orgnzt_info oi
right join (select dept_code from orgnzt_member om where om.user_id = g.gis_creat_id) dc
on oi.dept_code = dc.dept_code ) as dept_nm
, gis_creat_id
, gis_creat_dt
, gis_mdfcn_id
, gis_mdfcn_dt
FROM bi_manager.gis_info g
WHERE true
<!-- 검색영역 -->
<foreach item="item" index="index" collection="searchObjectList">
<choose>
<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.type != null and item.type !='' and item.type == 'int' and item.value != null and item.value !=''">
AND
${item.key} = #{item.value}
</when>
<when test="item.type != null and item.type !='' and item.value != null and item.value !=''">
AND
${item.key} LIKE CONCAT('%', #{item.value}, '%')
</when>
</choose>
</foreach>
<!-- 검색영역 끝 -->
ORDER BY gis_creat_dt DESC
LIMIT #{perPage} OFFSET ((#{currentPage} - 1) * #{perPage})
</select>
<!--
작성자 : 하관우
작성일 : 2024.11.20
내용 : GIS 리스트 count 조회
-->
<select id="getGisInfoListCount" parameterType="SearchVO" resultType="java.lang.Integer">
SELECT count(*)
FROM bi_manager.gis_info
WHERE true
<!-- 검색영역 -->
<foreach item="item" index="index" collection="searchObjectList">
<choose>
<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.type != null and item.type !='' and item.type == 'int' and item.value != null and item.value !=''">
AND
${item.key} = #{item.value}
</when>
<when test="item.type != null and item.type !='' and item.value != null and item.value !=''">
AND
${item.key} LIKE CONCAT('%', #{item.value}, '%')
</when>
</choose>
</foreach>
<!-- 검색영역 끝 -->
LIMIT #{perPage} OFFSET ((#{currentPage} - 1) * #{perPage})
</select>
<!--
작성자 : 하관우
작성일 : 2024.11.20
내용 : GIS 상세조회
-->
<select id="gisInfoOneSelect" parameterType="int" resultType="GisInfoVO">
SELECT gis_id
, gis_title
, dataset_id
, COALESCE(
(SELECT code_nm
FROM cmmn_code cc
WHERE g.category_id = cc.code_id),
NULL
) AS category_id
, memo
, use_at
, COALESCE(
(SELECT dept_nm
FROM orgnzt_info oi
RIGHT JOIN (SELECT dept_code
FROM orgnzt_member om
WHERE om.user_id = g.gis_creat_id) dc
ON oi.dept_code = dc.dept_code),
NULL
) AS dept_nm
, gis_creat_id
, gis_creat_dt
, gis_mdfcn_id
, gis_mdfcn_dt
FROM bi_manager.gis_info g
WHERE gis_id = #{gisId}
</select>
<!--
작성자 : 하관우
작성일 : 2024.11.21
내용 : 데이터셋 체크
-->
<select id="datasetCheck" parameterType="java.lang.String" resultType="int">
SELECT
CASE
WHEN COUNT(d.database_nm) > 0 THEN 1
ELSE 0
END AS count
FROM
bi_manager.db_conect_info d
LEFT JOIN
bi_manager.dataset dc ON dc.db_conect_id = d.db_conect_id
WHERE
dc.dataset_id = #{datasetId}
AND d.database_nm = 'sj_market';
</select>
<!--
작성자 : 하관우
작성일 : 2024.11.21
내용 : gisInfo 정보 등록
-->
<insert id="gisInfoInsert" parameterType="GisInfoVO">
INSERT INTO bi_manager.gis_info(
gis_title
, dataset_id
, category_id
, memo
, use_at
, gis_creat_id
, gis_creat_dt
) VALUES (
#{gis_title}
, #{dataset_id}
, #{category_id}
, #{memo}
, #{use_at}
, #{gis_creat_id}
, now()
)
</insert>
<!--
작성자 : 하관우
작성일 : 2024.11.20
내용 : gisInfo 정보 수정
-->
<update id="gisInfoUpdate" parameterType="GisInfoVO">
UPDATE bi_manager.gis_info
SET
gis_title = #{gis_title}
, dataset_id = #{dataset_id}
, category_id = #{category_id}
, memo = #{memo}
, use_at = #{use_at}
, gis_mdfcn_id = #{gis_mdfcn_id}
, gis_mdfcn_dt = now()
WHERE gis_id=#{gis_id};
</update>
<!--
작성자 : 하관우
작성일 : 2024.11.20
내용 : gisInfo 정보 수정
-->
<delete id="gisInfoOneDel" parameterType="int">
DELETE
FROM bi_manager.gis_info
WHERE gis_id = #{gis_id}
</delete>
</mapper>