<?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.style24.admin.biz.dao.TsaEnvsetDao">

	<!-- 환경설정 생성 -->
	<insert id="createEnvset" parameterType="Envset">
		/* TsaEnvset.createEnvset */
		INSERT INTO TB_ENVSET (
		       ENVSET_SQ
		     , SITE_CD
		     , ENVSET_TYPE
		     , ENVSET_NM
		     , STR_SET_VAL1
		     , STR_SET_VAL2
		     , STR_SET_VAL3
		     , STR_SET_VAL4
		     , STR_SET_VAL5
		     , STR_SET_VAL6
		     , STR_SET_VAL7
		     , STR_SET_VAL8
		     , REG_NO
		     , REG_DT
		)
		VALUES (
		       NULL
		     , #{siteCd}
		     , #{envsetType}
		     , #{envsetNm}
		     , #{strSetVal1}
		     , #{strSetVal2}
		     , #{strSetVal3}
		     , #{strSetVal4}
		     , #{strSetVal5}
		     , #{strSetVal6}
		     , #{strSetVal7}
		     , #{strSetVal8}
		     , #{regNo}
		     , NOW()
		)
	</insert>

	<!-- 환경설정 목록 -->
	<select id="getEnvsetList" parameterType="Envset" resultType="Envset">
		/* TsaEnvset.getEnvsetList */
		SELECT SITE_CD
		     , ENVSET_TYPE
		     , ENVSET_NM
		     , STR_SET_VAL1
		     , STR_SET_VAL2
		     , STR_SET_VAL3
		     , STR_SET_VAL4
		     , STR_SET_VAL5
		     , STR_SET_VAL6
		     , STR_SET_VAL7
		     , STR_SET_VAL8
		     , FN_GET_USER_NM(REG_NO)             AS REG_NM
		     , DATE_FORMAT(REG_DT,'%Y%m%d%H%i%S') AS REG_DT
		FROM   TB_ENVSET
		WHERE  SITE_CD = #{siteCd}
		AND    ENVSET_TYPE = #{envsetType}
		ORDER  BY ENVSET_SQ DESC
	</select>

</mapper>