<?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.scm.biz.dao.TssNoticeDao">

	<!-- 공지사항 저장 -->
	<insert id="createNotice" parameterType="Notice" keyProperty="noticeSq">
		/* TsaNotice.createNotice */
		INSERT INTO TB_NOTICE (
		       NOTICE_SQ
		     , NOTICE_TYPE
		     , NOTICE_TITLE
		     , NOTICE_STDT
		     , NOTICE_EDDT
		     , NOTICE_CONTENT
		     , URGENT_YN
		     , USE_YN
		     , READ_CNT
		     , REG_NO
		     , REG_DT
		     , UPD_NO
		     , UPD_DT
		)
		VALUES (
		       NULL
		     , #{noticeType}
		     , #{noticeTitle}
		     , STR_TO_DATE(#{noticeStdt},'%Y-%m-%d')
		     , STR_TO_DATE(#{noticeEddt},'%Y-%m-%d')
		     , #{noticeContent}
		     , IFNULL(#{urgentYn},'N')
		     , #{useYn}
		     , IFNULL(#{readCnt},0)
		     , #{regNo}
		     , NOW()
		     , #{updNo}
		     , NOW()
		)
	</insert>

	<!-- 공지사항 수정 -->
	<update id="updateNotice" parameterType="Notice">
		/* TsaNotice.updateNotice */
		UPDATE TB_NOTICE
		SET    NOTICE_TITLE = #{noticeTitle}
		     , NOTICE_CONTENT = #{noticeContent}
		     , NOTICE_STDT = STR_TO_DATE(#{noticeStdt},'%Y-%m-%d')
		     , NOTICE_EDDT = STR_TO_DATE(#{noticeEddt},'%Y-%m-%d')
		     , URGENT_YN = IFNULL(#{urgentYn},'N')
		     , USE_YN = #{useYn}
		     , UPD_NO = #{updNo}
		     , UPD_DT = NOW()
		WHERE  NOTICE_SQ = #{noticeSq}
	</update>

</mapper>