Stock.xml
1.43 KB
<?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.diligrp.titan.dao.stock.StockDao">
<insert id="insertEntry" parameterType="stock">
<![CDATA[INSERT INTO stock_operate (sn,pid,sku,`count`,status,service,`desc`,ctime) VALUES (#{sn},#{pid},#{sku},#{count},#{status},#{service},#{desc},now())]]>
</insert>
<update id="updateEntry" parameterType="stock">
<![CDATA[UPDATE stock_operate]]>
<set>
<if test="status != null"><![CDATA[status = #{status},]]></if>
<if test="utime != null"><![CDATA[utime = now()]]></if>
</set>
<![CDATA[where sn = #{sn} and sku = #{sku} and status = 1]]>
</update>
<update id="decrPOPStock" parameterType="stock">
<![CDATA[UPDATE product_pop_sku set store = store - #{count},utime=now() where sku = #{sku} and store >= #{count}]]>
</update>
<update id="incrPOPStock" parameterType="stock">
<![CDATA[UPDATE product_pop_sku set store = store + #{count},utime=now() where sku = #{sku} ]]>
</update>
<select id="isExists" parameterType="stock" resultType="int">
<![CDATA[SELECT COUNT(1) AS count from stock_operate]]>
<where>
<if test="sn != null and sn != ''"><![CDATA[AND sn = #{sn}]]></if>
<if test="sku != null and sku != ''"><![CDATA[AND sku = #{sku}]]></if>
<if test="status != null and status != ''"><![CDATA[AND status = #{status}]]></if>
</where>
</select>
</mapper>