131 lines
2.8 KiB
XML
131 lines
2.8 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>
|
|
|
|
<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>
|
|
|
|
<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
|
|
</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>
|