<?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.op.wms.mapper.PurcodeMapper">

	<resultMap type="com.op.wms.domain.Purcode" id="PurcodeMap">
		<result property="rowId" column="ROW_ID" />
		<result property="orderType" column="ORDER_TYPE" />
		<result property="curDate" column="CUR_DATE" />
		<result property="value" column="VALUE" />
	</resultMap>

	<select id="queryCurValue" resultType="java.lang.Integer">
		SELECT VALUE FROM purcode WHERE ORDER_TYPE = #{orderType} AND CUR_DATE = #{curDate}
	</select>
	<!--新增所有列-->
	<insert id="insert">
		insert into purcode(ORDER_TYPE, CUR_DATE, VALUE)
		values (#{orderType}, #{curDate}, #{value})
	</insert>
	<update id="updateCurValue">
		UPDATE purcode SET VALUE = #{value} + 1 WHERE ORDER_TYPE = #{orderType} AND CUR_DATE = #{curDate} AND VALUE = #{value}
	</update>
</mapper>
