
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.entInfo.dao.EntInfoDAO">
<!-- 기업정보 resultMap -->
<resultMap id="entInfoMap" type="EntInfoVO">
<result property="entId" column="ent_id" />
<result property="entNm" column="ent_nm" />
<result property="brno" column="brno" />
<result property="rprsvNm" column="rprsv_nm" />
<result property="lctnAdmdsp" column="lctn_admdsp" />
<result property="lctnSsg" column="lctn_ssg" />
<result property="bplcSiar" column="bplc_siar" />
<result property="bplcSiarUnit" column="bplc_siar_unit" />
<result property="fctryArea" column="fctry_area" />
<result property="fctryAreaUnit" column="fctry_area_unit" />
<result property="ksicUpCd" column="ksic_up_cd" />
<result property="ksicCd" column="ksic_cd" />
<result property="ksicNm" column="ksic_nm" />
<result property="mainPrdct" column="main_prdct" />
<result property="entCrdt" column="ent_crdt" />
<result property="fndnDt" column="fndn_dt" />
<result property="wrkrCnt" column="wrkr_cnt" />
<result property="rmrk" column="rmrk" />
<result property="useYn" column="use_yn" />
<result property="rgtr" column="rgtr" />
<result property="regDt" column="reg_dt" />
<result property="mdfr" column="mdfr" />
<result property="mdfcnDt" column="mdfcn_dt" />
<result property="mvnInten" column="mvn_inten" />
<result property="mouInten" column="mou_inten" />
<result property="fileMngId" column="file_mng_id" />
<collection property="bplcList" column="{entId = ent_id}" javaType="java.util.ArrayList" ofType="BplcVO" select="selectBplcList" />
</resultMap>
<!-- 기업주요사업장 resultMap -->
<resultMap id="bplcMap" type="BplcVO">
<result property="bplcId" column="bplc_id" />
<result property="entId" column="ent_id" />
<result property="wrkrCnt" column="wrkr_cnt" />
<result property="bplcAddr" column="bplc_addr" />
<result property="useYn" column="use_yn" />
<result property="rgtr" column="rgtr" />
<result property="regDt" column="reg_dt" />
<result property="mdfr" column="mdfr" />
<result property="mdfcnDt" column="mdfcn_dt" />
<result property="bplcSiarUnit" column="bplc_siar_unit" />
<result property="fctryAreaUnit" column="fctry_area_unit" />
</resultMap>
<!--
작 성 자 : 박정하
작 성 일 : 2024.03.20
내 용 : 기업정보 등록
-->
<insert id="entInfoInsert" parameterType="EntInfoVO">
INSERT INTO ent_info (
ent_id
, ent_nm
, brno
, rprsv_nm
, lctn_admdsp
, lctn_ssg
, bplc_siar
, bplc_siar_unit
, fctry_area
, fctry_area_unit
, ksic_up_cd
, ksic_cd
, ksic_nm
, main_prdct
, ent_crdt
, fndn_dt
, wrkr_cnt
, rmrk
, file_mng_id
, use_yn
, rgtr
, reg_dt
) VALUES (
#{entId}
, #{entNm}
, #{brno}
, #{rprsvNm}
, #{lctnAdmdsp}
, #{lctnSsg}
, #{bplcSiar}
, #{bplcSiarUnit}
, #{fctryArea}
, #{fctryAreaUnit}
, #{ksicUpCd}
, #{ksicCd}
, #{ksicNm}
, #{mainPrdct}
, #{entCrdt}
, #{fndnDt}::timestamp
, #{wrkrCnt}
, #{rmrk}
, #{fileMngId}
, 'Y'
, #{rgtr}
, now()
)
</insert>
<!--
작 성 자 : 박정하
작 성 일 : 2024.03.21
내 용 : 사업자등록번호 중복 검사
-->
<select id="selectCntByCheckBrno" resultType="int">
SELECT count(brno)
FROM ent_info
WHERE use_yn = 'Y'
AND brno = #{brno}
</select>
<!-- SELECT SQL -->
<sql id="selectItem">
SELECT ei.ent_id
, ei.ent_nm
, ei.brno
, ei.rprsv_nm
, ei.lctn_admdsp
, ei.lctn_ssg
, ei.bplc_siar
, ei.bplc_siar_unit
, ei.fctry_area
, ei.fctry_area_unit
, ei.ksic_up_cd
, ei.ksic_cd
, ei.ksic_nm
, ei.main_prdct
, ei.ent_crdt
, to_char(ei.fndn_dt, 'YYYY-MM-DD') AS fndn_dt
, ei.wrkr_cnt
, ei.rmrk
, ei.file_mng_id
, ei.use_yn
, ei.rgtr
, to_char(ei.reg_dt, 'YYYY-MM-DD HH24:MI') AS reg_dt
, ei.mdfr
, to_char(ei.mdfcn_dt, 'YYYY-MM-DD HH24:MI') AS mdfcn_dt
, (SELECT mvn_inten <include refid="searchIvstDscsn" />) AS mvn_inten
, (SELECT mou_inten <include refid="searchIvstDscsn" />) AS mou_inten
FROM ent_info AS ei
</sql>
<sql id="selectRequirement">
<if test="searchText != null and searchText != ''">
<choose>
<when test="searchType != null and searchType != ''">
<if test="searchType == 'ent_nm'">
AND ent_nm LIKE '%' || #{searchText} || '%'
</if>
<if test="searchType == 'rprsv_nm'">
AND rprsv_nm LIKE '%' || #{searchText} || '%'
</if>
<if test="searchType == 'brno'">
AND brno LIKE '%' || #{searchText} || '%'
</if>
</when>
<otherwise>
AND ( ent_nm LIKE '%' || #{searchText} || '%'
OR rprsv_nm LIKE '%' || #{searchText} || '%'
OR brno LIKE '%' || #{searchText} || '%')
</otherwise>
</choose>
</if>
</sql>
<sql id="searchCate">
<if test="mvnInten != null and mvnInten != ''">
AND mvn_inten = #{mvnInten}
</if>
<if test="mouInten != null and mouInten != ''">
AND mou_inten = #{mouInten}
</if>
</sql>
<sql id="searchIvstDscsn">
FROM ivst_dscsn AS id
WHERE id.use_yn = 'Y'
AND id.ent_id = ei.ent_id
ORDER BY id.reg_dt DESC
LIMIT 1
</sql>
<sql id="selectListInner">
SELECT ei.ent_id
, ei.ent_nm
, ei.brno
, ei.rprsv_nm
, ei.lctn_admdsp
, ei.lctn_ssg
, ei.bplc_siar
, ei.bplc_siar_unit
, ei.fctry_area
, ei.fctry_area_unit
, ei.ksic_up_cd
, ei.ksic_cd
, ei.ksic_nm
, ei.main_prdct
, ei.ent_crdt
, ei.fndn_dt
, ei.wrkr_cnt
, ei.rmrk
, ei.file_mng_id
, ei.use_yn
, ei.rgtr
, ei.reg_dt
, ei.mdfr
, ei.mdfcn_dt
, (SELECT mvn_inten <include refid="searchIvstDscsn" />) AS mvn_inten
, (SELECT mou_inten <include refid="searchIvstDscsn" />) AS mou_inten
FROM ent_info AS ei
WHERE ei.use_yn = 'Y'
</sql>
<!--
작 성 자 : 박정하
작 성 일 : 2024.03.21
내 용 : 기업정보 목록 조회
-->
<select id="entInfoSelectList" parameterType="HashMap" resultMap="entInfoMap">
SELECT ent_id
, ent_nm
, brno
, rprsv_nm
, lctn_admdsp
, lctn_ssg
, bplc_siar
, bplc_siar_unit
, fctry_area
, fctry_area_unit
, ksic_up_cd
, ksic_cd
, ksic_nm
, main_prdct
, ent_crdt
, to_char(fndn_dt, 'YYYY-MM-DD') AS fndn_dt
, wrkr_cnt
, rmrk
, file_mng_id
, use_yn
, to_char(reg_dt, 'YYYY-MM-DD HH24:MI') AS reg_dt
, mdfr
, to_char(mdfcn_dt, 'YYYY-MM-DD HH24:MI') AS mdfcn_dt
, mvn_inten
, mou_inten
FROM (
<include refid="selectListInner" />
<include refid="selectRequirement" />
) AS datas
WHERE TRUE
<include refid="searchCate" />
ORDER BY ent_id DESC
OFFSET #{limitStart} LIMIT #{recordSize}
</select>
<!--
작 성 자 : 박정하
작 성 일 : 2024.03.21
내 용 : 기업정보 목록 총 개수 조회
-->
<select id="entInfoSelectListCount" parameterType="HashMap" resultType="int">
SELECT count(ent_id)
FROM (
SELECT ent_id
, (SELECT mvn_inten <include refid="searchIvstDscsn" />)
, (SELECT mou_inten <include refid="searchIvstDscsn" />)
FROM ent_info AS ei
WHERE ei.use_yn = 'Y'
<include refid="selectRequirement" />
) AS datas
WHERE TRUE
<include refid="searchCate" />
</select>
<!--
작 성 자 : 박정하
작 성 일 : 2024.03.21
내 용 : 기업정보 상세 조회
-->
<select id="selectEntInfoDetail" parameterType="String" resultMap="entInfoMap">
<include refid="selectItem" />
WHERE ei.use_yn = 'Y'
AND ei.ent_id = #{entId}
</select>
<!--
작 성 자 : 박정하
작 성 일 : 2024-06-10
내 용 : 기업주요사업장 목록 조회
-->
<select id="selectBplcList" parameterType="BplcVO" resultMap="bplcMap">
SELECT bplc_id
, ent_id
, wrkr_cnt
, bplc_addr
, use_yn
, rgtr
, to_char(reg_dt, 'YYYY-MM-DD HH24:MI') AS reg_dt
, mdfr
, to_char(mdfcn_dt, 'YYYY-MM-DD HH24:MI') AS mdfcn_dt
, bplc_nm
, main_prdt
, bplc_siar
, fctry_area
, bplc_siar_unit
, fctry_area_unit
FROM ent_main_bplc
WHERE use_yn = #{useYn}
AND ent_id = #{entId}
ORDER BY bplc_id
</select>
<!--
작 성 자 : 박정하
작 성 일 : 2024.03.22
내 용 : 기업정보 수정
-->
<update id="entInfoUpdate" parameterType="EntInfoVO">
UPDATE ent_info
SET ent_nm = #{entNm}
, brno = #{brno}
, rprsv_nm = #{rprsvNm}
, lctn_admdsp = #{lctnAdmdsp}
, lctn_ssg = #{lctnSsg}
, bplc_siar = #{bplcSiar}
, bplc_siar_unit = #{bplcSiarUnit}
, fctry_area = #{fctryArea}
, fctry_area_unit = #{fctryAreaUnit}
, ksic_up_cd = #{ksicUpCd}
, ksic_cd = #{ksicCd}
, ksic_nm = #{ksicNm}
, main_prdct = #{mainPrdct}
, ent_crdt = #{entCrdt}
, fndn_dt = #{fndnDt}::timestamp
, wrkr_cnt = #{wrkrCnt}
, rmrk = #{rmrk}
, file_mng_id = #{fileMngId}
, mdfr = #{mdfr}
, mdfcn_dt = now()
WHERE ent_id = #{entId}
</update>
<!--
작 성 자 : 박정하
작 성 일 : 2024.03.22
내 용 : 기업정보 삭제
-->
<update id="entInfoDelete" parameterType="EntInfoVO">
UPDATE ent_info
SET use_yn = 'N',
mdfr = #{mdfr},
mdfcn_dt = now()
WHERE ent_id = #{entId}
</update>
<!--
작 성 자 : 박정하
작 성 일 : 2024.05.13
내 용 : 팝업 목록 조회
-->
<select id="selectCompanyInfoListByNew" resultMap="entInfoMap">
<include refid="selectItem" />
WHERE ei.use_yn = 'Y'
ORDER BY ei.reg_dt DESC
LIMIT 5
</select>
<!--
작 성 자 : 박정하
작 성 일 : 2024.06.26
내 용 : 기업정보 목록 조회 (엑셀 다운로드 용)
-->
<select id="entInfoSelectListAll" parameterType="HashMap" resultType="HashMap">
SELECT ent_nm
, brno
, rprsv_nm
, (SELECT cd_nm FROM cd_mng WHERE cd = lctn_admdsp) || ' ' || lctn_ssg AS lctn
, bplc_siar || (SELECT cd_nm FROM cd_mng WHERE cd = bplc_siar_unit) AS bplc_siar
, fctry_area || (SELECT cd_nm FROM cd_mng WHERE cd = fctry_area_unit) AS fctry_area
, '(' || ksic_up_cd || ksic_cd || ') ' || ksic_nm AS ksic
, main_prdct
, ent_crdt
, to_char(fndn_dt, 'YYYY-MM-DD') AS fndn_dt
, wrkr_cnt || '' AS wrkr_cnt
, mvn_inten
, mou_inten
, rmrk
FROM (<include refid="selectListInner" />) AS datas
WHERE TRUE
<if test="mvnInten != null and mvnInten != ''">
AND mvn_inten = #{mvnInten}
</if>
<if test="mouInten != null and mouInten != ''">
AND mou_inten = #{mouInten}
</if>
<if test="ksicUpCd != null and ksicUpCd != ''">
AND ksic_up_cd = #{ksicUpCd}
</if>
ORDER BY ent_nm
</select>
<!--
작 성 자 : 박정하
작 성 일 : 2024.06.26
내 용 : 상위업종코드 목록 조회 (엑셀 다운로드 용)
-->
<select id="ksicUpCdList" parameterType="String" resultType="String">
SELECT ksic_up_cd
FROM ent_info
WHERE use_yn = 'Y'
GROUP BY ksic_up_cd
ORDER BY ksic_up_cd
</select>
</mapper>