150 lines
3.4 KiB
XML
150 lines
3.4 KiB
XML
<?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="io.company.localhost.mapper.commoncodMapper">
|
|
<select id="selectWordCategory" resultType="Map">
|
|
select
|
|
CMNCODVAL
|
|
,CMNCODNAM
|
|
from
|
|
commoncod
|
|
where
|
|
CMNCODLV1 = 600
|
|
and
|
|
CMNCODODR != 0
|
|
</select>
|
|
<insert id="insertCategory" parameterType="map">
|
|
INSERT INTO commoncod
|
|
(CMNCODLV1, CMNCODLV2, CMNCODODR, CMNCODVAL, CMNCODNAM, CMNCODYON, CMNCODRDT, CMNCODUDT)
|
|
SELECT
|
|
600
|
|
,IFNULL(MAX(CMNCODLV2), 100) + 1 AS NEXT_CMNCODLV2
|
|
,IFNULL(MAX(CMNCODODR), 0) + 1 AS NEXT_CMNCODODR
|
|
,CONCAT(600, LPAD(IFNULL(MAX(CMNCODLV2), 100) + 1, 3, '0')) AS CMNCODVAL
|
|
,#{CMNCODNAM}
|
|
,'1'
|
|
,NOW()
|
|
,NOW()
|
|
FROM
|
|
commoncod
|
|
WHERE
|
|
CMNCODLV1 = 600;
|
|
</insert>
|
|
|
|
<!-- 색상 조회 YON는 user, YNP는 프로젝트-->
|
|
<select id="selectColorList" resultType="Map">
|
|
SELECT
|
|
CMNCODVAL
|
|
,CMNCODNAM
|
|
FROM
|
|
commoncod
|
|
WHERE
|
|
CMNCODLV1 = 100
|
|
AND
|
|
CMNCODODR != 0
|
|
<if test="type == 'YON'">
|
|
AND CMNCODYON = 0
|
|
</if>
|
|
<if test="type == 'YNP'">
|
|
AND CMNCODYNP = 0
|
|
</if>
|
|
</select>
|
|
|
|
<!-- mbti 조회 -->
|
|
<select id="selectMbtiList" resultType="Map">
|
|
SELECT
|
|
CMNCODVAL
|
|
,CMNCODNAM
|
|
FROM
|
|
commoncod
|
|
WHERE
|
|
CMNCODLV1 = 200
|
|
AND
|
|
CMNCODODR != 0
|
|
</select>
|
|
|
|
<!-- 비밀번호 힌트 조회 -->
|
|
<select id="selectPwhintList" resultType="Map">
|
|
SELECT
|
|
CMNCODVAL
|
|
,CMNCODNAM
|
|
FROM
|
|
commoncod
|
|
WHERE
|
|
CMNCODLV1 = 800
|
|
AND
|
|
CMNCODODR != 0
|
|
</select>
|
|
|
|
<!-- 선택한 색상 사용 중으로 업데이트 -->
|
|
<update id="updateColorYon" parameterType="Map">
|
|
UPDATE commoncod
|
|
SET
|
|
<if test="type == 'YON'">
|
|
CMNCODYON = 1
|
|
</if>
|
|
<if test="type == 'YNP'">
|
|
CMNCODYNP = 1
|
|
</if>
|
|
WHERE CMNCODVAL = #{color};
|
|
</update>
|
|
|
|
<!-- 수정 시 기존 컬러 사용안함으로 업데이트 -->
|
|
<update id="updateColorChange" parameterType="Map">
|
|
UPDATE commoncod
|
|
SET
|
|
<if test="type == 'YON'">
|
|
CMNCODYON = 0
|
|
</if>
|
|
<if test="type == 'YNP'">
|
|
CMNCODYNP = 0
|
|
</if>
|
|
WHERE CMNCODVAL = #{color}
|
|
</update>
|
|
|
|
<select id="selectCategories" resultType="Map">
|
|
SELECT CMNCODVAL, CMNCODNAM FROM commoncod
|
|
WHERE CMNCODVAL BETWEEN 300101 AND 300103
|
|
</select>
|
|
|
|
<!-- 연도 -->
|
|
<select id="selectYearCategories" resultType="Map">
|
|
SELECT
|
|
CMNCODVAL,
|
|
CMNCODNAM
|
|
FROM
|
|
commoncod
|
|
WHERE
|
|
CMNCODLV1 = 900
|
|
AND
|
|
CMNCODODR != 0
|
|
AND
|
|
(CMNCODNAM = 'All' OR CMNCODNAM IN (
|
|
SELECT DISTINCT
|
|
CAST(YEAR(STR_TO_DATE(PROJCTSTR, '%Y-%m-%d')) AS CHAR) AS project_year
|
|
FROM
|
|
netprojct
|
|
WHERE
|
|
PROJCTSTR IS NOT NULL
|
|
))
|
|
ORDER BY
|
|
CASE WHEN CMNCODODR = 1 THEN 0 ELSE 1 END ASC,
|
|
CMNCODODR DESC
|
|
</select>
|
|
|
|
<select id="selectcheckCategoryExists" parameterType="Map" resultType="Long">
|
|
select
|
|
count(*) checkCategory
|
|
from
|
|
commoncod
|
|
where
|
|
CMNCODNAM = #{CMNCODNAM}
|
|
</select>
|
|
|
|
<!-- 공통 코드 목록 조회 -->
|
|
<select id="selectVacationType" resultType="io.company.localhost.common.dto.MapDto">
|
|
SELECT CMNCODVAL AS code, CMNCODNAM AS name
|
|
FROM commoncod
|
|
WHERE CMNCODVAL IN ('700101', '700102', '700103')
|
|
</select>
|
|
</mapper>
|