<?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="BoardFile">

	<select id="BoardFile.selectBoardFiles" parameterType="boardFileVO" resultType="boardFileVO">
	<![CDATA[
		SELECT
			FILES.BF_SEQ AS SEQ, FILES.BF_ORDER AS BD_ORDERS, FILES.BF_ORG_NAME AS ORGNAME,
			FILES.BF_SAVE_NAME AS SAVENAME, FILES.BF_BD_SEQ AS PARENTSEQ, #{id} ID
		FROM 
			H3_BD_${id}_FILE FILES
		WHERE
			BF_BD_SEQ = #{parentSeq}
		ORDER BY
			BF_ORDER
	]]>
	</select>
	
	<select id="BoardFile.selectBoardFile" parameterType="boardFileVO" resultType="boardFileVO">
	<![CDATA[
		SELECT
			FILES.BF_SEQ AS SEQ, FILES.BF_ORDER AS ORDERS, FILES.BF_ORG_NAME AS ORGNAME,
			FILES.BF_SAVE_NAME AS SAVENAME, FILES.BF_BD_SEQ AS PARENTSEQ, #{id} ID
		FROM 
			H3_BD_${id}_FILE FILES
		WHERE
			BF_SEQ = #{seq}
	]]>
	</select>
	
	<insert id="BoardFile.insertBoardFile" parameterType="boardFileVO" useGeneratedKeys="true" keyColumn="BF_SEQ">
	<![CDATA[
		INSERT INTO 
			H3_BD_${id}_FILE (
				BF_ORDER,
				BF_ORG_NAME,
	  			BF_SAVE_NAME,
	  			BF_BD_SEQ
		) VALUES (
		  	#{orders},
		  	#{orgName},
		  	#{saveName},
		  	#{parentSeq}
		) 
	]]>
	</insert>
	
	
	
	
	<delete id="BoardFile.deleteBoardFile" parameterType="boardFileVO">
	<![CDATA[
		DELETE
		FROM 
			H3_BD_${id}_FILE 
		WHERE
			BF_SEQ = #{seq}
	]]>
	</delete>
	

</mapper>
