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

	<resultMap id="approveResult" type="approveVO">
		<result property="seq" column="ESJ_SEQ" />
		<result property="checkDate" column="ESJ_CHECKDATE" />
		<result property="police" column="ESJ_POLICE" />
		<result property="year" column="ESJ_YEAR" />
		<result property="quater" column="ESJ_QUATER" />
		<result property="place1" column="ESJ_PLACE1" />
		<result property="position" column="ESJ_POSITION" />
		<result property="name" column="ESJ_NAME" />
		<result property="userId" column="ESJ_USERID" />
		<result property="proxyId" column="ESJ_PROXY_ID" />
		<result property="message" column="ESJ_MESSAGE" />
	</resultMap>

	<select id="select" parameterType="approveVO" resultMap="approveResult">
	<![CDATA[
		SELECT 
			* 
		FROM 
			H3_EQUIP_APPROVAL_HISTORY
		WHERE
			ESJ_POLICE = #{police}
			AND ESJ_YEAR = #{year}
			AND ESJ_QUATER = #{quater}
	]]>
	</select>
	
	<insert id="insert" parameterType="approveVO">
	<![CDATA[
		INSERT INTO H3_EQUIP_APPROVAL_HISTORY
			( ESJ_POLICE, ESJ_YEAR, ESJ_QUATER, ESJ_CHECKDATE, ESJ_PLACE1, 
  			  ESJ_POSITION, ESJ_NAME, ESJ_USERID, ESJ_PROXY_ID, ESJ_MESSAGE )
		VALUES
  			( #{police}, #{year}, #{quater}, NOW(), #{place1Str},
  			  #{positionStr}, #{name}, #{userId}, #{proxyId}, #{message} )
	]]>
	</insert>
</mapper>
