WmsSkuDao.xml 1.3 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.sibu.orderHelper.wms.dao.WmsSkuDao">

    <update id="modifyStock" parameterType="com.sibu.orderHelper.wms.model.dto.StockOperateDto">
        <foreach collection="stockOperateItemDtos" open="" close="" separator="" item="item">
            update wms_sku set stock=#{item.stock} where id=#{item.skudId};
        </foreach>
    </update>
    <update id="subtractStock" parameterType="com.sibu.orderHelper.wms.model.dto.StockOperateItemDto">
            update wms_sku set stock=stock-#{stock} where id=#{skudId} and stock-#{stock} >= 0;
    </update>
    <update id="addStock" parameterType="com.sibu.orderHelper.wms.model.dto.StockOperateDto">
        <foreach collection="stockOperateItemDtos" open="" close="" separator="" item="item">
            update wms_sku set stock=stock+#{item.stock} where id=#{item.skudId};
        </foreach>
    </update>
    <select id="findBySkuId" resultType="com.sibu.orderHelper.wms.model.entity.WmsSku">
        select * from wms_sku where id in (
        <foreach collection="" open="" close="" separator="," item="item">
            #{item}
        </foreach>
        )
    </select>
</mapper>