LocationMapper.xml 2.03 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.huaheng.pc.general.location.mapper.LocationMapper">


    <select id="getEmptyContainerInLocation" resultType="com.huaheng.pc.general.location.domain.Location">
        SELECT * FROM location t
        <where>
            t.warehouseId = #{warehouseId} AND t.status='empty' AND t.containerCode !='' AND t.containerCode is not NULL
            AND t.`code` NOT in (SELECT b.locationCode FROM inventory b WHERE b.warehouseId = #{warehouseId} )
            <if test="containerCode != null and containerCode !=''">
                <bind name="temp1" value="'%' + containerCode + '%'" />
                and t.containerCode like #{temp1}
            </if>
            <if test="locationCode != null and locationCode !=''">
                <bind name="temp2" value="'%' + locationCode + '%'" />
                and t.`code` like #{temp2}
            </if>
        </where>
    </select>

	<update id="updateStatus">
        UPDATE location set `status`=#{status} WHERE warehouseCode=#{warehouseCode} AND `code`=#{code}
    </update>

    <update id="updateContainerCodeAndStatus">
        UPDATE location set `status`=#{status},containerCode=#{containerCode} WHERE warehouseCode=#{warehouseCode} AND `code`=#{locationCode}
    </update>

    <update id="updateContainerCode">
        UPDATE location set containerCode=#{containerCode} WHERE warehouseCode=#{warehouseCode} AND `code`=#{locationCode}
    </update>

    <select id="getEmptyLocation" resultType="com.huaheng.pc.general.location.domain.Location">
        select * from location l
        <where>
            l.containerCode = "" AND l.warehouseId = #{warehouseId} AND l.deleted = #{deleted} AND l.status = #{status}
            <if test="locationCode != null and locationCode !=''">
                <bind name="temp2" value="'%' + locationCode + '%'" />
                and l.`code` like #{temp2}
            </if>
        </where>
    </select>
</mapper>