LocationMapper.xml 5.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.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>
    <select id="getAllLocation" resultType="com.huaheng.pc.general.location.domain.Location">
        select  max(row) as row,max(line) as line,max(layer) as layer,max(grid) as grid from location l where l.warehouseCode= #{warehouseCode} AND l.type=#{type}
    </select>

	<select id="selectSSPLocation" resultType="com.huaheng.pc.general.location.domain.Location">
    SELECT * FROM `location`  WHERE zoneCode = 'QG' AND `status` = 'empty'  ORDER BY `row` LIMIT 1
    </select>

    <select id="getAllLocationCode" resultType="java.lang.String">
        SELECT  code
        FROM location
        <where>
            <if test="id != null">
                AND id = #{id}
            </if>
            <if test="code != null">
                AND code = #{code}
            </if>
            <if test="warehouseId != null">
                AND warehouseId = #{warehouseId}
            </if>
            <if test="warehouseCode != null">
                AND warehouseCode = #{warehouseCode}
            </if>
            <if test="row != null">
                AND row = #{row}
            </if>
            <if test="line != null">
                AND line = #{line}
            </if>
            <if test="layer != null">
                AND layer = #{layer}
            </if>
            <if test="grid != null">
                AND grid = #{grid}
            </if>
            <if test="rowIndex != null">
                AND rowIndex = #{rowIndex}
            </if>
            <if test="roadway != null">
                AND roadway = #{roadway}
            </if>
            <if test="type != null">
                AND type = #{type}
            </if>
            <if test="containerId != null">
                AND containerId = #{containerId}
            </if>
            <if test="containerCode != null">
                AND containerCode = #{containerCode}
            </if>
            <if test="zoneId != null">
                AND zoneId = #{zoneId}
            </if>
            <if test="zoneCode != null">
                AND zoneCode = #{zoneCode}
            </if>
            <if test="status != null">
                AND status = #{status}
            </if>
            <if test="lastCycleCountDate != null">
                AND lastCycleCountDate = #{lastCycleCountDate}
            </if>
            <if test="created != null">
                AND created = #{created}
            </if>
            <if test="createdBy != null">
                AND createdBy = #{createdBy}
            </if>
            <if test="lastUpdated != null">
                AND lastUpdated = #{lastUpdated}
            </if>
            <if test="lastUpdatedBy != null">
                AND lastUpdatedBy = #{lastUpdatedBy}
            </if>
            <if test="enable != null">
                AND enable = #{enable}
            </if>
            <if test="deleted != null">
                AND deleted = #{deleted}
            </if>
            <if test="userDef1 != null">
                AND userDef1 = #{userDef1}
            </if>
            <if test="userDef2 != null">
                AND userDef2 = #{userDef2}
            </if>
            <if test="userDef3 != null">
                AND userDef3 = #{userDef3}
            </if>
            <if test="userDef4 != null">
                AND userDef4 = #{userDef4}
            </if>
            <if test="userDef5 != null">
                AND userDef5 = #{userDef5}
            </if>
        </where>
    </select>
</mapper>