<?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.core.biz.dao.TscCommonDao">

	<!-- 시퀀스 값 조회 -->
	<select id="getNextSequence" parameterType="String" resultType="Integer">
		/* TsaCommon.getNextSequence */
		SELECT IFNULL((SELECT NEXT_VAL
		               FROM   TB_SEQUENCE
		               WHERE  SEQUENCE_NM = #{sequenceNm}
		              ),0) + 1 AS NEXT_VAL
	</select>

	<!-- 시퀀스 생성 -->
	<insert id="createNextSequence" parameterType="Sequence">
		/* TsaCommon.createNextSequence */
		INSERT INTO TB_SEQUENCE (SEQUENCE_NM, NEXT_VAL) VALUES (#{sequenceNm}, #{nextVal})
		ON DUPLICATE KEY UPDATE NEXT_VAL = #{nextVal}
	</insert>

	<!-- 영업일여부 조회 -->
	<select id="getBizdayYn" parameterType="String" resultType="String">
		/* TsaBusiness.getBizdayYn */
		SELECT BIZDAY_YN
		  FROM TB_BIZDAY
		 WHERE BIZDAY = #{bizday}
	</select>
</mapper>