ContainerMapper.xml 4.01 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.config.container.mapper.ContainerMapper">
  <resultMap id="BaseResultMap" type="com.huaheng.config.container.domain.Container">
    <!--@mbg.generated-->
    <!--@Table container-->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="code" jdbcType="VARCHAR" property="code" />
    <result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" />
    <result column="companyCode" jdbcType="VARCHAR" property="companyCode" />
    <result column="locationCode" jdbcType="VARCHAR" property="locationCode" />
    <result column="containerType" jdbcType="VARCHAR" property="containerType" />
    <result column="status" jdbcType="VARCHAR" property="status" />
    <result column="created" jdbcType="TIMESTAMP" property="created" />
    <result column="createdBy" jdbcType="VARCHAR" property="createdBy" />
    <result column="lastUpdated" jdbcType="TIMESTAMP" property="lastUpdated" />
    <result column="lastUpdatedBy" jdbcType="VARCHAR" property="lastUpdatedBy" />
    <result column="enable" jdbcType="BIT" property="enable" />
    <result column="printNum" jdbcType="INTEGER" property="printNum" />
    <result column="version" jdbcType="INTEGER" property="version" />
    <result column="userDef1" jdbcType="VARCHAR" property="userDef1" />
    <result column="userDef2" jdbcType="VARCHAR" property="userDef2" />
    <result column="userDef3" jdbcType="VARCHAR" property="userDef3" />
    <result column="userDef4" jdbcType="VARCHAR" property="userDef4" />
    <result column="userDef5" jdbcType="VARCHAR" property="userDef5" />
    <result column="userDef6" jdbcType="VARCHAR" property="userDef6" />
    <result column="userDef7" jdbcType="VARCHAR" property="userDef7" />
    <result column="userDef8" jdbcType="VARCHAR" property="userDef8" />
    <result column="processStamp" jdbcType="VARCHAR" property="processStamp" />
    <result column="goodsShelfNo" jdbcType="VARCHAR" property="goodsShelfNo" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, `name`, code, warehouseCode, companyCode, locationCode, containerType, `status`, 
    created, createdBy, lastUpdated, lastUpdatedBy, `enable`, printNum, version, userDef1, 
    userDef2, userDef3, userDef4, userDef5, userDef6, userDef7, userDef8, processStamp, 
    goodsShelfNo
  </sql>

  <select id="getEmptyContainerInLocation" resultType="com.huaheng.config.location.domain.Location">
    SELECT *
    FROM location t
    <where>
      t.locationType = 'L'
      AND t.warehouseCode = #{warehouseCode}
      AND t.status='empty'
      AND t.containerCode !=''
      AND t.containerCode is not NULL
      AND t.containerCode NOT in (SELECT h.containerCode from task_header h WHERE status &lt; 100 AND warehouseCode=#{warehouseCode})
      AND t.`code` NOT in (SELECT b.locationCode FROM inventory_detail b WHERE b.warehouseCode = #{warehouseCode} )
      <if test="containerCode != null and containerCode !=''">
        and t.containerCode = #{containerCode}
      </if>
      <if test="locationCode != null and locationCode !=''">
        and t.`code` = #{locationCode}
      </if>
    </where>
  </select>


  <select id="selectListShelf" resultType="com.huaheng.config.container.domain.Container">
    SELECT
        g.goodsShelfNo
    FROM
        ( SELECT DISTINCT ( goodsShelfNo ) goodsShelfNo, COUNT( * ) cunt FROM container WHERE `status` = 'empty' AND type = 'A' GROUP BY goodsShelfNo ) g
                INNER JOIN ( SELECT DISTINCT ( goodsShelfNo ) goodsShelfNo, COUNT( * ) cunt FROM container WHERE type = 'A' GROUP BY goodsShelfNo ) s ON g.goodsShelfNo = s.goodsShelfNo
                AND g.cunt = s.cunt
  </select>

  <select id="emptyContainer" resultMap="BaseResultMap">
    select * from container where `status` = "empty" and (locationCode IS NOT NULL OR locationCode = "") ORDER BY id DESC limit 1
  </select>
</mapper>