<?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="doumeemes.dao.ext.WTransferDetailExtMapper"> 
 | 
  
 | 
  <!-- 管理页面查询 --> 
 | 
  <resultMap id="WTransferDetailExtListVO" type="doumeemes.dao.ext.vo.WTransferDetailExtListVO" autoMapping="true"> 
 | 
    <id column="ID" jdbcType="INTEGER" property="id"/> 
 | 
    <association property="tmodel" javaType="doumeemes.dao.business.model.WTransfer"> 
 | 
      <id column="TMODEL_ID" jdbcType="INTEGER" property="id"/> 
 | 
      <result column="TMODEL_DELETED" jdbcType="TINYINT" property="deleted"/> 
 | 
      <result column="TMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/> 
 | 
      <result column="TMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/> 
 | 
      <result column="TMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/> 
 | 
      <result column="TMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/> 
 | 
      <result column="TMODEL_REMARK" jdbcType="VARCHAR" property="remark"/> 
 | 
      <result column="TMODEL_ROOT_DEPART_ID" jdbcType="INTEGER" property="rootDepartId"/> 
 | 
      <result column="TMODEL_CODE" jdbcType="VARCHAR" property="code"/> 
 | 
      <result column="TMODEL_ORIGIN" jdbcType="TINYINT" property="origin"/> 
 | 
      <result column="TMODEL_VALID_DATE" jdbcType="TIMESTAMP" property="validDate"/> 
 | 
      <result column="TMODEL_ORIGIN_TYPE" jdbcType="TINYINT" property="originType"/> 
 | 
      <result column="TMODEL_ORIGIN_CODE" jdbcType="VARCHAR" property="originCode"/> 
 | 
      <result column="TMODEL_ORIGIN_ID" jdbcType="INTEGER" property="originId"/> 
 | 
      <result column="TMODEL_ABSTRACTS" jdbcType="VARCHAR" property="abstracts"/> 
 | 
      <result column="TMODEL_OUT_DEPART_ID" jdbcType="INTEGER" property="outDepartId"/> 
 | 
      <result column="TMODEL_OUT_USER_ID" jdbcType="INTEGER" property="outUserId"/> 
 | 
      <result column="TMODEL_OUT_WAREHOUSE_ID" jdbcType="INTEGER" property="outWarehouseId"/> 
 | 
      <result column="TMODEL_OUT_PLANDATE" jdbcType="TIMESTAMP" property="outPlandate"/> 
 | 
      <result column="TMODEL_OUT_ACTDATE" jdbcType="TIMESTAMP" property="outActdate"/> 
 | 
      <result column="TMODEL_IN_DEPART_ID" jdbcType="INTEGER" property="inDepartId"/> 
 | 
      <result column="TMODEL_IN_USER_ID" jdbcType="INTEGER" property="inUserId"/> 
 | 
      <result column="TMODEL_IN_WAREHOUSE_ID" jdbcType="INTEGER" property="inWarehouseId"/> 
 | 
      <result column="TMODEL_IN_PLANDATE" jdbcType="TIMESTAMP" property="inPlandate"/> 
 | 
      <result column="TMODEL_IN_ACTDATE" jdbcType="TIMESTAMP" property="inActdate"/> 
 | 
      <result column="TMODEL_STATUS" jdbcType="TINYINT" property="status"/> 
 | 
    </association> 
 | 
    <association property="mmodel" javaType="doumeemes.dao.business.model.Material"> 
 | 
      <id column="MMODEL_ID" jdbcType="INTEGER" property="id"/> 
 | 
      <result column="MMODEL_DELETED" jdbcType="TINYINT" property="deleted"/> 
 | 
      <result column="MMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/> 
 | 
      <result column="MMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/> 
 | 
      <result column="MMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/> 
 | 
      <result column="MMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/> 
 | 
      <result column="MMODEL_REMARK" jdbcType="VARCHAR" property="remark"/> 
 | 
      <result column="MMODEL_ROOT_DEPART_ID" jdbcType="INTEGER" property="rootDepartId"/> 
 | 
      <result column="MMODEL_NAME" jdbcType="VARCHAR" property="name"/> 
 | 
      <result column="MMODEL_CODE" jdbcType="VARCHAR" property="code"/> 
 | 
      <result column="MMODEL_ATTR" jdbcType="VARCHAR" property="attr"/> 
 | 
      <result column="MMODEL_UNION_NAME" jdbcType="VARCHAR" property="unionName"/> 
 | 
      <result column="MMODEL_UNIT_ID" jdbcType="INTEGER" property="unitId"/> 
 | 
      <result column="MMODEL_CATE_UNION_ID" jdbcType="INTEGER" property="cateUnionId"/> 
 | 
      <result column="MMODEL_FORMATION" jdbcType="TINYINT" property="formation"/> 
 | 
      <result column="MMODEL_QRCODE_ID" jdbcType="VARCHAR" property="qrcodeId"/> 
 | 
      <result column="MMODEL_STATUS" jdbcType="TINYINT" property="status"/> 
 | 
      <result column="MMODEL_VALID_TIME" jdbcType="TIMESTAMP" property="validTime"/> 
 | 
      <result column="MMODEL_INVALID_TIME" jdbcType="TIMESTAMP" property="invalidTime"/> 
 | 
      <result column="MMODEL_CHECK_WAY" jdbcType="TINYINT" property="checkWay"/> 
 | 
      <result column="MMODEL_QUALITY_REQUIRE" jdbcType="VARCHAR" property="qualityRequire"/> 
 | 
      <result column="MMODEL_CHECK_NOTE" jdbcType="VARCHAR" property="checkNote"/> 
 | 
    </association> 
 | 
    <association property="umodel" javaType="doumeemes.dao.business.model.Unit"> 
 | 
      <id column="UMODEL_ID" jdbcType="INTEGER" property="id"/> 
 | 
      <result column="UMODEL_DELETED" jdbcType="TINYINT" property="deleted"/> 
 | 
      <result column="UMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/> 
 | 
      <result column="UMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/> 
 | 
      <result column="UMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/> 
 | 
      <result column="UMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/> 
 | 
      <result column="UMODEL_REMARK" jdbcType="VARCHAR" property="remark"/> 
 | 
      <result column="UMODEL_ROOT_DEPART_ID" jdbcType="INTEGER" property="rootDepartId"/> 
 | 
      <result column="UMODEL_NAME" jdbcType="VARCHAR" property="name"/> 
 | 
      <result column="UMODEL_TYPE" jdbcType="TINYINT" property="type"/> 
 | 
      <result column="UMODEL_STATUS" jdbcType="TINYINT" property="status"/> 
 | 
    </association> 
 | 
    <association property="odmodel" javaType="doumeemes.dao.business.model.Department"> 
 | 
      <id column="ODMODEL_ID" jdbcType="INTEGER" property="id"/> 
 | 
      <result column="ODMODEL_DELETED" jdbcType="TINYINT" property="deleted"/> 
 | 
      <result column="ODMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/> 
 | 
      <result column="ODMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/> 
 | 
      <result column="ODMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/> 
 | 
      <result column="ODMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/> 
 | 
      <result column="ODMODEL_NAME" jdbcType="VARCHAR" property="name"/> 
 | 
      <result column="ODMODEL_REMARK" jdbcType="VARCHAR" property="remark"/> 
 | 
      <result column="ODMODEL_ROOT_ID" jdbcType="INTEGER" property="rootId"/> 
 | 
      <result column="ODMODEL_PARENT_ID" jdbcType="INTEGER" property="parentId"/> 
 | 
      <result column="ODMODEL_COMPANY_ID" jdbcType="INTEGER" property="companyId"/> 
 | 
      <result column="ODMODEL_TYPE" jdbcType="TINYINT" property="type"/> 
 | 
      <result column="ODMODEL_ERP_ID" jdbcType="VARCHAR" property="erpId"/> 
 | 
      <result column="ODMODEL_STATUS" jdbcType="INTEGER" property="status"/> 
 | 
      <result column="ODMODEL_VALID_TIME" jdbcType="TIMESTAMP" property="validTime"/> 
 | 
      <result column="ODMODEL_INVALID_TIME" jdbcType="TIMESTAMP" property="invalidTime"/> 
 | 
    </association> 
 | 
  </resultMap> 
 | 
  <select id="selectList" parameterType="doumeemes.dao.ext.dto.QueryWTransferDetailExtDTO" resultMap="WTransferDetailExtListVO"> 
 | 
    SELECT 
 | 
      `a`.`ID`, 
 | 
      `a`.`DELETED`, 
 | 
      `a`.`CREATE_USER`, 
 | 
      `a`.`CREATE_TIME`, 
 | 
      `a`.`UPDATE_USER`, 
 | 
      `a`.`UPDATE_TIME`, 
 | 
      `a`.`REMARK`, 
 | 
      `a`.`ROOT_DEPART_ID`, 
 | 
      `a`.`TRANSFER_ID`, 
 | 
      `a`.`MATERIAL_ID`, 
 | 
      `a`.`UNIT_ID`, 
 | 
      `a`.`OUT_DEPART_ID`, 
 | 
      `a`.`OUT_WAREHOUSE_ID`, 
 | 
      `a`.`OUT_LOCATION_ID`, 
 | 
      `a`.`BATCH`, 
 | 
      `a`.`OUT_PLANNUM`, 
 | 
      `a`.`OUT_ACTNUM`, 
 | 
      `a`.`OUT_ACTDATE`, 
 | 
      `a`.`IN_DEPART_ID`, 
 | 
      `a`.`IN_WAREHOUSE_ID`, 
 | 
      `a`.`IN_LCOATION_ID`, 
 | 
      `a`.`IN_ACTNUM`, 
 | 
      `a`.`IN_ACTDATE`, 
 | 
      `tmodel`.`ID` AS TMODEL_ID, 
 | 
      `tmodel`.`DELETED` AS TMODEL_DELETED, 
 | 
      `tmodel`.`CREATE_USER` AS TMODEL_CREATE_USER, 
 | 
      `tmodel`.`CREATE_TIME` AS TMODEL_CREATE_TIME, 
 | 
      `tmodel`.`UPDATE_USER` AS TMODEL_UPDATE_USER, 
 | 
      `tmodel`.`UPDATE_TIME` AS TMODEL_UPDATE_TIME, 
 | 
      `tmodel`.`REMARK` AS TMODEL_REMARK, 
 | 
      `tmodel`.`ROOT_DEPART_ID` AS TMODEL_ROOT_DEPART_ID, 
 | 
      `tmodel`.`CODE` AS TMODEL_CODE, 
 | 
      `tmodel`.`ORIGIN` AS TMODEL_ORIGIN, 
 | 
      `tmodel`.`VALID_DATE` AS TMODEL_VALID_DATE, 
 | 
      `tmodel`.`ORIGIN_TYPE` AS TMODEL_ORIGIN_TYPE, 
 | 
      `tmodel`.`ORIGIN_CODE` AS TMODEL_ORIGIN_CODE, 
 | 
      `tmodel`.`ORIGIN_ID` AS TMODEL_ORIGIN_ID, 
 | 
      `tmodel`.`ABSTRACTS` AS TMODEL_ABSTRACTS, 
 | 
      `tmodel`.`OUT_DEPART_ID` AS TMODEL_OUT_DEPART_ID, 
 | 
      `tmodel`.`OUT_USER_ID` AS TMODEL_OUT_USER_ID, 
 | 
      `tmodel`.`OUT_WAREHOUSE_ID` AS TMODEL_OUT_WAREHOUSE_ID, 
 | 
      `tmodel`.`OUT_PLANDATE` AS TMODEL_OUT_PLANDATE, 
 | 
      `tmodel`.`OUT_ACTDATE` AS TMODEL_OUT_ACTDATE, 
 | 
      `tmodel`.`IN_DEPART_ID` AS TMODEL_IN_DEPART_ID, 
 | 
      `tmodel`.`IN_USER_ID` AS TMODEL_IN_USER_ID, 
 | 
      `tmodel`.`IN_WAREHOUSE_ID` AS TMODEL_IN_WAREHOUSE_ID, 
 | 
      `tmodel`.`IN_PLANDATE` AS TMODEL_IN_PLANDATE, 
 | 
      `tmodel`.`IN_ACTDATE` AS TMODEL_IN_ACTDATE, 
 | 
      `tmodel`.`STATUS` AS TMODEL_STATUS, 
 | 
      `mmodel`.`ID` AS MMODEL_ID, 
 | 
      `mmodel`.`DELETED` AS MMODEL_DELETED, 
 | 
      `mmodel`.`CREATE_USER` AS MMODEL_CREATE_USER, 
 | 
      `mmodel`.`CREATE_TIME` AS MMODEL_CREATE_TIME, 
 | 
      `mmodel`.`UPDATE_USER` AS MMODEL_UPDATE_USER, 
 | 
      `mmodel`.`UPDATE_TIME` AS MMODEL_UPDATE_TIME, 
 | 
      `mmodel`.`REMARK` AS MMODEL_REMARK, 
 | 
      `mmodel`.`ROOT_DEPART_ID` AS MMODEL_ROOT_DEPART_ID, 
 | 
      `mmodel`.`NAME` AS MMODEL_NAME, 
 | 
      `mmodel`.`CODE` AS MMODEL_CODE, 
 | 
      `mmodel`.`ATTR` AS MMODEL_ATTR, 
 | 
      `mmodel`.`UNION_NAME` AS MMODEL_UNION_NAME, 
 | 
      `mmodel`.`UNIT_ID` AS MMODEL_UNIT_ID, 
 | 
      `mmodel`.`CATE_UNION_ID` AS MMODEL_CATE_UNION_ID, 
 | 
      `mmodel`.`FORMATION` AS MMODEL_FORMATION, 
 | 
      `mmodel`.`QRCODE_ID` AS MMODEL_QRCODE_ID, 
 | 
      `mmodel`.`STATUS` AS MMODEL_STATUS, 
 | 
      `mmodel`.`VALID_TIME` AS MMODEL_VALID_TIME, 
 | 
      `mmodel`.`INVALID_TIME` AS MMODEL_INVALID_TIME, 
 | 
      `mmodel`.`CHECK_WAY` AS MMODEL_CHECK_WAY, 
 | 
      `mmodel`.`QUALITY_REQUIRE` AS MMODEL_QUALITY_REQUIRE, 
 | 
      `mmodel`.`CHECK_NOTE` AS MMODEL_CHECK_NOTE, 
 | 
      `umodel`.`ID` AS UMODEL_ID, 
 | 
      `umodel`.`DELETED` AS UMODEL_DELETED, 
 | 
      `umodel`.`CREATE_USER` AS UMODEL_CREATE_USER, 
 | 
      `umodel`.`CREATE_TIME` AS UMODEL_CREATE_TIME, 
 | 
      `umodel`.`UPDATE_USER` AS UMODEL_UPDATE_USER, 
 | 
      `umodel`.`UPDATE_TIME` AS UMODEL_UPDATE_TIME, 
 | 
      `umodel`.`REMARK` AS UMODEL_REMARK, 
 | 
      `umodel`.`ROOT_DEPART_ID` AS UMODEL_ROOT_DEPART_ID, 
 | 
      `umodel`.`NAME` AS UMODEL_NAME, 
 | 
      `umodel`.`TYPE` AS UMODEL_TYPE, 
 | 
      `umodel`.`STATUS` AS UMODEL_STATUS, 
 | 
      `odmodel`.`ID` AS ODMODEL_ID, 
 | 
      `odmodel`.`DELETED` AS ODMODEL_DELETED, 
 | 
      `odmodel`.`CREATE_USER` AS ODMODEL_CREATE_USER, 
 | 
      `odmodel`.`CREATE_TIME` AS ODMODEL_CREATE_TIME, 
 | 
      `odmodel`.`UPDATE_USER` AS ODMODEL_UPDATE_USER, 
 | 
      `odmodel`.`UPDATE_TIME` AS ODMODEL_UPDATE_TIME, 
 | 
      `odmodel`.`NAME` AS ODMODEL_NAME, 
 | 
      `odmodel`.`REMARK` AS ODMODEL_REMARK, 
 | 
      `odmodel`.`ROOT_ID` AS ODMODEL_ROOT_ID, 
 | 
      `odmodel`.`PARENT_ID` AS ODMODEL_PARENT_ID, 
 | 
      `odmodel`.`COMPANY_ID` AS ODMODEL_COMPANY_ID, 
 | 
      `odmodel`.`TYPE` AS ODMODEL_TYPE, 
 | 
      `odmodel`.`ERP_ID` AS ODMODEL_ERP_ID, 
 | 
      `odmodel`.`STATUS` AS ODMODEL_STATUS, 
 | 
      `odmodel`.`VALID_TIME` AS ODMODEL_VALID_TIME, 
 | 
      `odmodel`.`INVALID_TIME` AS ODMODEL_INVALID_TIME 
 | 
    FROM `w_transfer_detail` `a` 
 | 
    LEFT JOIN `w_transfer` `tmodel` ON a.TRANSFER_ID=tmodel.ID 
 | 
    LEFT JOIN `material` `mmodel` ON a.MATERIAL_ID=mmodel.ID 
 | 
    LEFT JOIN `unit` `umodel` ON a.UNIT_ID=umodel.ID 
 | 
    LEFT JOIN `department` `odmodel` ON a.OUT_DEPART_ID=odmodel.ID 
 | 
    <where> 
 | 
      <if test="id != null"> 
 | 
        AND `a`.`ID` = #{id} 
 | 
      </if> 
 | 
      <if test="deleted != null"> 
 | 
        AND `a`.`DELETED` = #{deleted} 
 | 
      </if> 
 | 
      <if test="createUser != null"> 
 | 
        AND `a`.`CREATE_USER` = #{createUser} 
 | 
      </if> 
 | 
      <if test="createTime != null"> 
 | 
        AND `a`.`CREATE_TIME` = #{createTime} 
 | 
      </if> 
 | 
      <if test="updateUser != null"> 
 | 
        AND `a`.`UPDATE_USER` = #{updateUser} 
 | 
      </if> 
 | 
      <if test="updateTime != null"> 
 | 
        AND `a`.`UPDATE_TIME` = #{updateTime} 
 | 
      </if> 
 | 
      <if test="remark != null and remark != ''"> 
 | 
        AND `a`.`REMARK` = #{remark} 
 | 
      </if> 
 | 
      <if test="rootDepartId != null"> 
 | 
        AND `a`.`ROOT_DEPART_ID` = #{rootDepartId} 
 | 
      </if> 
 | 
      <if test="transferId != null"> 
 | 
        AND `a`.`TRANSFER_ID` = #{transferId} 
 | 
      </if> 
 | 
      <if test="materialId != null"> 
 | 
        AND `a`.`MATERIAL_ID` = #{materialId} 
 | 
      </if> 
 | 
      <if test="unitId != null"> 
 | 
        AND `a`.`UNIT_ID` = #{unitId} 
 | 
      </if> 
 | 
      <if test="outDepartId != null"> 
 | 
        AND `a`.`OUT_DEPART_ID` = #{outDepartId} 
 | 
      </if> 
 | 
      <if test="outWarehouseId != null"> 
 | 
        AND `a`.`OUT_WAREHOUSE_ID` = #{outWarehouseId} 
 | 
      </if> 
 | 
      <if test="outLocationId != null"> 
 | 
        AND `a`.`OUT_LOCATION_ID` = #{outLocationId} 
 | 
      </if> 
 | 
      <if test="batch != null and batch != ''"> 
 | 
        AND `a`.`BATCH` = #{batch} 
 | 
      </if> 
 | 
      <if test="outPlannum != null"> 
 | 
        AND `a`.`OUT_PLANNUM` = #{outPlannum} 
 | 
      </if> 
 | 
      <if test="outActnum != null"> 
 | 
        AND `a`.`OUT_ACTNUM` = #{outActnum} 
 | 
      </if> 
 | 
      <if test="outActdate != null"> 
 | 
        AND `a`.`OUT_ACTDATE` = #{outActdate} 
 | 
      </if> 
 | 
      <if test="inDepartId != null"> 
 | 
        AND `a`.`IN_DEPART_ID` = #{inDepartId} 
 | 
      </if> 
 | 
      <if test="inWarehouseId != null"> 
 | 
        AND `a`.`IN_WAREHOUSE_ID` = #{inWarehouseId} 
 | 
      </if> 
 | 
      <if test="inLcoationId != null"> 
 | 
        AND `a`.`IN_LCOATION_ID` = #{inLcoationId} 
 | 
      </if> 
 | 
      <if test="inActnum != null"> 
 | 
        AND `a`.`IN_ACTNUM` = #{inActnum} 
 | 
      </if> 
 | 
      <if test="inActdate != null"> 
 | 
        AND `a`.`IN_ACTDATE` = #{inActdate} 
 | 
      </if> 
 | 
      <if test="tmodelId != null"> 
 | 
        AND `tmodel`.`ID` = #{tmodelId} 
 | 
      </if> 
 | 
      <if test="tmodelDeleted != null"> 
 | 
        AND `tmodel`.`DELETED` = #{tmodelDeleted} 
 | 
      </if> 
 | 
      <if test="tmodelCreateUser != null"> 
 | 
        AND `tmodel`.`CREATE_USER` = #{tmodelCreateUser} 
 | 
      </if> 
 | 
      <if test="tmodelCreateTime != null"> 
 | 
        AND `tmodel`.`CREATE_TIME` = #{tmodelCreateTime} 
 | 
      </if> 
 | 
      <if test="tmodelUpdateUser != null"> 
 | 
        AND `tmodel`.`UPDATE_USER` = #{tmodelUpdateUser} 
 | 
      </if> 
 | 
      <if test="tmodelUpdateTime != null"> 
 | 
        AND `tmodel`.`UPDATE_TIME` = #{tmodelUpdateTime} 
 | 
      </if> 
 | 
      <if test="tmodelRemark != null and tmodelRemark != ''"> 
 | 
        AND `tmodel`.`REMARK` = #{tmodelRemark} 
 | 
      </if> 
 | 
      <if test="tmodelRootDepartId != null"> 
 | 
        AND `tmodel`.`ROOT_DEPART_ID` = #{tmodelRootDepartId} 
 | 
      </if> 
 | 
      <if test="tmodelCode != null and tmodelCode != ''"> 
 | 
        AND `tmodel`.`CODE` = #{tmodelCode} 
 | 
      </if> 
 | 
      <if test="tmodelOrigin != null"> 
 | 
        AND `tmodel`.`ORIGIN` = #{tmodelOrigin} 
 | 
      </if> 
 | 
      <if test="tmodelValidDate != null"> 
 | 
        AND `tmodel`.`VALID_DATE` = #{tmodelValidDate} 
 | 
      </if> 
 | 
      <if test="tmodelOriginType != null"> 
 | 
        AND `tmodel`.`ORIGIN_TYPE` = #{tmodelOriginType} 
 | 
      </if> 
 | 
      <if test="tmodelOriginCode != null and tmodelOriginCode != ''"> 
 | 
        AND `tmodel`.`ORIGIN_CODE` = #{tmodelOriginCode} 
 | 
      </if> 
 | 
      <if test="tmodelOriginId != null"> 
 | 
        AND `tmodel`.`ORIGIN_ID` = #{tmodelOriginId} 
 | 
      </if> 
 | 
      <if test="tmodelAbstracts != null and tmodelAbstracts != ''"> 
 | 
        AND `tmodel`.`ABSTRACTS` = #{tmodelAbstracts} 
 | 
      </if> 
 | 
      <if test="tmodelOutDepartId != null"> 
 | 
        AND `tmodel`.`OUT_DEPART_ID` = #{tmodelOutDepartId} 
 | 
      </if> 
 | 
      <if test="tmodelOutUserId != null"> 
 | 
        AND `tmodel`.`OUT_USER_ID` = #{tmodelOutUserId} 
 | 
      </if> 
 | 
      <if test="tmodelOutWarehouseId != null"> 
 | 
        AND `tmodel`.`OUT_WAREHOUSE_ID` = #{tmodelOutWarehouseId} 
 | 
      </if> 
 | 
      <if test="tmodelOutPlandate != null"> 
 | 
        AND `tmodel`.`OUT_PLANDATE` = #{tmodelOutPlandate} 
 | 
      </if> 
 | 
      <if test="tmodelOutActdate != null"> 
 | 
        AND `tmodel`.`OUT_ACTDATE` = #{tmodelOutActdate} 
 | 
      </if> 
 | 
      <if test="tmodelInDepartId != null"> 
 | 
        AND `tmodel`.`IN_DEPART_ID` = #{tmodelInDepartId} 
 | 
      </if> 
 | 
      <if test="tmodelInUserId != null"> 
 | 
        AND `tmodel`.`IN_USER_ID` = #{tmodelInUserId} 
 | 
      </if> 
 | 
      <if test="tmodelInWarehouseId != null"> 
 | 
        AND `tmodel`.`IN_WAREHOUSE_ID` = #{tmodelInWarehouseId} 
 | 
      </if> 
 | 
      <if test="tmodelInPlandate != null"> 
 | 
        AND `tmodel`.`IN_PLANDATE` = #{tmodelInPlandate} 
 | 
      </if> 
 | 
      <if test="tmodelInActdate != null"> 
 | 
        AND `tmodel`.`IN_ACTDATE` = #{tmodelInActdate} 
 | 
      </if> 
 | 
      <if test="tmodelStatus != null"> 
 | 
        AND `tmodel`.`STATUS` = #{tmodelStatus} 
 | 
      </if> 
 | 
      <if test="mmodelId != null"> 
 | 
        AND `mmodel`.`ID` = #{mmodelId} 
 | 
      </if> 
 | 
      <if test="mmodelDeleted != null"> 
 | 
        AND `mmodel`.`DELETED` = #{mmodelDeleted} 
 | 
      </if> 
 | 
      <if test="mmodelCreateUser != null"> 
 | 
        AND `mmodel`.`CREATE_USER` = #{mmodelCreateUser} 
 | 
      </if> 
 | 
      <if test="mmodelCreateTime != null"> 
 | 
        AND `mmodel`.`CREATE_TIME` = #{mmodelCreateTime} 
 | 
      </if> 
 | 
      <if test="mmodelUpdateUser != null"> 
 | 
        AND `mmodel`.`UPDATE_USER` = #{mmodelUpdateUser} 
 | 
      </if> 
 | 
      <if test="mmodelUpdateTime != null"> 
 | 
        AND `mmodel`.`UPDATE_TIME` = #{mmodelUpdateTime} 
 | 
      </if> 
 | 
      <if test="mmodelRemark != null and mmodelRemark != ''"> 
 | 
        AND `mmodel`.`REMARK` = #{mmodelRemark} 
 | 
      </if> 
 | 
      <if test="mmodelRootDepartId != null"> 
 | 
        AND `mmodel`.`ROOT_DEPART_ID` = #{mmodelRootDepartId} 
 | 
      </if> 
 | 
      <if test="mmodelName != null and mmodelName != ''"> 
 | 
        AND `mmodel`.`NAME` = #{mmodelName} 
 | 
      </if> 
 | 
      <if test="mmodelCode != null and mmodelCode != ''"> 
 | 
        AND `mmodel`.`CODE` = #{mmodelCode} 
 | 
      </if> 
 | 
      <if test="mmodelAttr != null and mmodelAttr != ''"> 
 | 
        AND `mmodel`.`ATTR` = #{mmodelAttr} 
 | 
      </if> 
 | 
      <if test="mmodelUnionName != null and mmodelUnionName != ''"> 
 | 
        AND `mmodel`.`UNION_NAME` = #{mmodelUnionName} 
 | 
      </if> 
 | 
      <if test="mmodelUnitId != null"> 
 | 
        AND `mmodel`.`UNIT_ID` = #{mmodelUnitId} 
 | 
      </if> 
 | 
      <if test="mmodelCateUnionId != null"> 
 | 
        AND `mmodel`.`CATE_UNION_ID` = #{mmodelCateUnionId} 
 | 
      </if> 
 | 
      <if test="mmodelFormation != null"> 
 | 
        AND `mmodel`.`FORMATION` = #{mmodelFormation} 
 | 
      </if> 
 | 
      <if test="mmodelQrcodeId != null and mmodelQrcodeId != ''"> 
 | 
        AND `mmodel`.`QRCODE_ID` = #{mmodelQrcodeId} 
 | 
      </if> 
 | 
      <if test="mmodelStatus != null"> 
 | 
        AND `mmodel`.`STATUS` = #{mmodelStatus} 
 | 
      </if> 
 | 
      <if test="mmodelValidTime != null"> 
 | 
        AND `mmodel`.`VALID_TIME` = #{mmodelValidTime} 
 | 
      </if> 
 | 
      <if test="mmodelInvalidTime != null"> 
 | 
        AND `mmodel`.`INVALID_TIME` = #{mmodelInvalidTime} 
 | 
      </if> 
 | 
      <if test="mmodelCheckWay != null"> 
 | 
        AND `mmodel`.`CHECK_WAY` = #{mmodelCheckWay} 
 | 
      </if> 
 | 
      <if test="mmodelQualityRequire != null and mmodelQualityRequire != ''"> 
 | 
        AND `mmodel`.`QUALITY_REQUIRE` = #{mmodelQualityRequire} 
 | 
      </if> 
 | 
      <if test="mmodelCheckNote != null and mmodelCheckNote != ''"> 
 | 
        AND `mmodel`.`CHECK_NOTE` = #{mmodelCheckNote} 
 | 
      </if> 
 | 
      <if test="umodelId != null"> 
 | 
        AND `umodel`.`ID` = #{umodelId} 
 | 
      </if> 
 | 
      <if test="umodelDeleted != null"> 
 | 
        AND `umodel`.`DELETED` = #{umodelDeleted} 
 | 
      </if> 
 | 
      <if test="umodelCreateUser != null"> 
 | 
        AND `umodel`.`CREATE_USER` = #{umodelCreateUser} 
 | 
      </if> 
 | 
      <if test="umodelCreateTime != null"> 
 | 
        AND `umodel`.`CREATE_TIME` = #{umodelCreateTime} 
 | 
      </if> 
 | 
      <if test="umodelUpdateUser != null"> 
 | 
        AND `umodel`.`UPDATE_USER` = #{umodelUpdateUser} 
 | 
      </if> 
 | 
      <if test="umodelUpdateTime != null"> 
 | 
        AND `umodel`.`UPDATE_TIME` = #{umodelUpdateTime} 
 | 
      </if> 
 | 
      <if test="umodelRemark != null and umodelRemark != ''"> 
 | 
        AND `umodel`.`REMARK` = #{umodelRemark} 
 | 
      </if> 
 | 
      <if test="umodelRootDepartId != null"> 
 | 
        AND `umodel`.`ROOT_DEPART_ID` = #{umodelRootDepartId} 
 | 
      </if> 
 | 
      <if test="umodelName != null and umodelName != ''"> 
 | 
        AND `umodel`.`NAME` = #{umodelName} 
 | 
      </if> 
 | 
      <if test="umodelType != null"> 
 | 
        AND `umodel`.`TYPE` = #{umodelType} 
 | 
      </if> 
 | 
      <if test="umodelStatus != null"> 
 | 
        AND `umodel`.`STATUS` = #{umodelStatus} 
 | 
      </if> 
 | 
      <if test="odmodelId != null"> 
 | 
        AND `odmodel`.`ID` = #{odmodelId} 
 | 
      </if> 
 | 
      <if test="odmodelDeleted != null"> 
 | 
        AND `odmodel`.`DELETED` = #{odmodelDeleted} 
 | 
      </if> 
 | 
      <if test="odmodelCreateUser != null"> 
 | 
        AND `odmodel`.`CREATE_USER` = #{odmodelCreateUser} 
 | 
      </if> 
 | 
      <if test="odmodelCreateTime != null"> 
 | 
        AND `odmodel`.`CREATE_TIME` = #{odmodelCreateTime} 
 | 
      </if> 
 | 
      <if test="odmodelUpdateUser != null"> 
 | 
        AND `odmodel`.`UPDATE_USER` = #{odmodelUpdateUser} 
 | 
      </if> 
 | 
      <if test="odmodelUpdateTime != null"> 
 | 
        AND `odmodel`.`UPDATE_TIME` = #{odmodelUpdateTime} 
 | 
      </if> 
 | 
      <if test="odmodelName != null and odmodelName != ''"> 
 | 
        AND `odmodel`.`NAME` = #{odmodelName} 
 | 
      </if> 
 | 
      <if test="odmodelRemark != null and odmodelRemark != ''"> 
 | 
        AND `odmodel`.`REMARK` = #{odmodelRemark} 
 | 
      </if> 
 | 
      <if test="odmodelRootId != null"> 
 | 
        AND `odmodel`.`ROOT_ID` = #{odmodelRootId} 
 | 
      </if> 
 | 
      <if test="odmodelParentId != null"> 
 | 
        AND `odmodel`.`PARENT_ID` = #{odmodelParentId} 
 | 
      </if> 
 | 
      <if test="odmodelCompanyId != null"> 
 | 
        AND `odmodel`.`COMPANY_ID` = #{odmodelCompanyId} 
 | 
      </if> 
 | 
      <if test="odmodelType != null"> 
 | 
        AND `odmodel`.`TYPE` = #{odmodelType} 
 | 
      </if> 
 | 
      <if test="odmodelErpId != null and odmodelErpId != ''"> 
 | 
        AND `odmodel`.`ERP_ID` = #{odmodelErpId} 
 | 
      </if> 
 | 
      <if test="odmodelStatus != null"> 
 | 
        AND `odmodel`.`STATUS` = #{odmodelStatus} 
 | 
      </if> 
 | 
      <if test="odmodelValidTime != null"> 
 | 
        AND `odmodel`.`VALID_TIME` = #{odmodelValidTime} 
 | 
      </if> 
 | 
      <if test="odmodelInvalidTime != null"> 
 | 
        AND `odmodel`.`INVALID_TIME` = #{odmodelInvalidTime} 
 | 
      </if> 
 | 
    </where> 
 | 
  </select> 
 | 
  
 | 
  
 | 
  <select id="wTransferDetailListById"  resultType="doumeemes.dao.business.model.WTransferDetail"> 
 | 
    SELECT w.* , m.name as materialName ,m.code as materialCode , u.name as unitName ,m.attr as attr 
 | 
    , ( select win.UNION_NAME from warehouse_location win where win.id = w.IN_LCOATION_ID limit 1  ) as inLocationName 
 | 
    , ( select wout.UNION_NAME from warehouse_location wout where wout.id = w.OUT_LOCATION_ID limit 1  ) as outLocationName 
 | 
    ,( SELECT win.`NAME` FROM warehouse win WHERE win.id = w.IN_WAREHOUSE_ID LIMIT 1 ) AS inWarehouseName 
 | 
    ,( SELECT wout.`NAME` FROM warehouse wout WHERE wout.id = w.OUT_WAREHOUSE_ID LIMIT 1 ) AS outWarehouseName 
 | 
    , p.name as procedureName , w.procedure_id as procedureId , w.quality_type as qualityType 
 | 
    FROM w_transfer_detail w 
 | 
    left join material_distribute md on w.MATERIAL_ID = md.id 
 | 
    left join material m on md.MATERIAL_ID = m.id 
 | 
    left join unit u on m.UNIT_ID = u.id 
 | 
    left join procedures p on w.procedure_id = p.id 
 | 
    where 1 = 1 and w.TRANSFER_ID = #{transferId} 
 | 
    order by m.code desc 
 | 
  </select> 
 | 
  
 | 
  <select id="wTransferOutWarehouseListById"  resultType="doumeemes.dao.ext.bean.WTransferWarehouse"> 
 | 
    SELECT wh.id as warehouseId, wh.name as warehouseName , wh.USE_LOCATION as userLocation 
 | 
    FROM w_transfer_detail w 
 | 
           left join warehouse wh on w.OUT_WAREHOUSE_ID = wh.id 
 | 
    where 1 = 1 and w.TRANSFER_ID = #{transferId} 
 | 
     group by wh.id , wh.NAME , wh.USE_LOCATION 
 | 
  </select> 
 | 
  
 | 
  <select id="wTransferInWarehouseListById"  resultType="doumeemes.dao.ext.bean.WTransferWarehouse"> 
 | 
    SELECT wh.id as warehouseId, wh.name as warehouseName , wh.USE_LOCATION as userLocation 
 | 
    FROM w_transfer_detail w 
 | 
           left join warehouse wh on w.IN_WAREHOUSE_ID = wh.id 
 | 
    where 1 = 1 and w.TRANSFER_ID = #{transferId} 
 | 
    group by wh.id , wh.NAME, wh.USE_LOCATION 
 | 
  </select> 
 | 
  
 | 
  
 | 
  <select id="selectListByWorkorder"  resultType="doumeemes.dao.ext.bean.WTransferDetailForWOrderBean"> 
 | 
    select a2.id as proceduresId , 
 | 
           a3.ID as outWarehouseId , 
 | 
           a8.id as materialId, 
 | 
           a8.UNIT_ID as unitId , 
 | 
           case when a8.id is null then sum(a1.PLAN_NUM)  else 
 | 
           ifnull(sum(a1.PLAN_NUM * a7.NUM),0) end  outPlanNum , 
 | 
           a11.ID as inWarehouseId  , 
 | 
           a10.ID as inLocationId , 
 | 
           a1.PRO_USER_ID as inUserId, 
 | 
           a1.MATERIAL_ID as workorderMaterialId, 
 | 
           a1.UNIT_ID as workorderUnitlId , 
 | 
           a1.TYPE as type 
 | 
    from  workorder a1 
 | 
            left join procedures a2 on a1.PROCEDURE_ID  = a2.id 
 | 
            left join warehouse a3 on a2.PICKING_WAREHOUSE_ID = a3.id 
 | 
            left join device a4 on a1.PRO_GROUP_ID = a4.id 
 | 
            left join bom a5 on a1.MATERIAL_ID = a5.MATERIAL_ID 
 | 
            left join bom_version a6 on a5.VERSION = a6.VERSION and a6.MATERIAL_ID = a5.MATERIAL_ID and a1.PROCEDURE_ID = a6.PROCEDURE_ID 
 | 
            left join bom_detail a7 on a6.id = a7.BOM_ID 
 | 
            left join material_distribute a8 on a7.MATERIAL_ID = a8.ID 
 | 
            left join material a9 on a8.MATERIAL_ID = a9.ID 
 | 
            left join warehouse_location a10 on a4.PRODUCE_WAREHOUSE_LOCATION_ID = a10.id 
 | 
            left join warehouse a11 on a10.WAREHOUSE_ID = a11.id 
 | 
    where  1 = 1 and FIND_IN_SET(a1.id, #{ids} ) 
 | 
    group by a2.id ,   a3.ID ,    a8.id , a9.code  , a11.ID,a10.ID , a1.PRO_USER_ID ,a1.MATERIAL_ID  , a1.UNIT_ID , a1.TYPE 
 | 
  </select> 
 | 
  
 | 
  
 | 
  <select id="wTransferConfirmDetail"  resultType="doumeemes.dao.ext.bean.WTransferConfirmDetailBean"> 
 | 
    select m.`NAME` as materialName ,m.`code` as materialCode , u.`NAME` as unitName  , w.BATCH as batch , 
 | 
           ifnull(count(1),0) as sumBox , ifnull(sum(a.NUM),0) as sumNum 
 | 
    , p.name as procedureName , w.procedure_id as procedureId , w.quality_type as qualityType 
 | 
    from w_outbound_record w 
 | 
           left join material_distribute md  on w.MATERIAL_ID = md.id 
 | 
           left join material m on md.MATERIAL_ID = m.ID 
 | 
           left join unit u on m.UNIT_ID = u.id 
 | 
           left join appliances a on w.APPLIANCES_ID = a.id 
 | 
           left join system_dict_data s on a.TYPE = s.id 
 | 
           left join procedures p on w.procedure_id = p.id 
 | 
    where  1 =  1 and w.OUTBOUND_ID in ( select w_o.id from w_outbound w_o where w_o.ORIGIN_TYPE = 3 and w_o.TYPE = 0  and  w_o.ORIGIN_ID =  #{outBoundId} ) 
 | 
    <if test="type != null and type!= '' "> 
 | 
      AND w.QUALITY_TYPE = #{type} 
 | 
    </if> 
 | 
    group by m.`NAME` ,  u.`NAME` , w.BATCH , p.name  , w.procedure_id  , w.quality_type ,m.`code` 
 | 
  </select> 
 | 
  
 | 
  
 | 
  <select id="wTransferConfirmDetailNew"  resultType="doumeemes.dao.ext.bean.WTransferConfirmDetailBean"> 
 | 
    SELECT 
 | 
    m.`NAME` AS materialName, 
 | 
    m.`code` AS materialCode, 
 | 
    u.`NAME` AS unitName, 
 | 
    a.BATCH AS batch, 
 | 
    ifnull( count( 1 ), 0 ) AS sumBox, 
 | 
    ifnull( sum( a.NUM ), 0 ) AS sumNum, 
 | 
    p.NAME AS procedureName, 
 | 
    a.procedure_id AS procedureId, 
 | 
    a.quality_type AS qualityType 
 | 
    FROM 
 | 
    appliances a 
 | 
    INNER JOIN material_distribute md ON a.material_id = md.id 
 | 
    INNER JOIN material m ON md.material_id = m.id 
 | 
    LEFT JOIN unit u ON m.UNIT_ID = u.id 
 | 
    LEFT JOIN procedures p ON a.procedure_id = p.id 
 | 
    WHERE 
 | 
    1 = 1 
 | 
  
 | 
    and not exists ( 
 | 
  
 | 
    select 1 from workorder wo inner join workorder_record wr on wo.id = wr.WORKORDER_ID where wo.status in ( 0 , 1 , 3 ) 
 | 
  
 | 
    and wr.TYPE = 0 and wr.APPLIANCES_ID = a.id 
 | 
  
 | 
    ) 
 | 
    <if test="locationIds != null"> 
 | 
       AND a.LOCATION_ID in 
 | 
      <foreach collection="locationIds" item="id" separator="," open="(" close=")"> 
 | 
        #{id} 
 | 
      </foreach> 
 | 
    </if> 
 | 
    <if test="inIds != null and inIds!= '' "> 
 | 
      and not exists ( select 1 from w_outbound_record w  left join appliances a1 on  w.APPLIANCES_ID = a1.id  where w.APPLIANCES_ID = a.id and FIND_IN_SET(w.OUTBOUND_ID,#{inIds}) 
 | 
      <if test="produceLocationIds != null"> 
 | 
        and a1.LOCATION_ID  in 
 | 
        <foreach collection="produceLocationIds" item="locationId" separator="," open="(" close=")"> 
 | 
          #{locationId} 
 | 
        </foreach> 
 | 
      </if> 
 | 
      ) 
 | 
    </if> 
 | 
    <if test="type != null and type!= '' "> 
 | 
      AND a.QUALITY_TYPE = #{type} 
 | 
    </if> 
 | 
    GROUP BY 
 | 
    m.`NAME`, 
 | 
    m.`code`, 
 | 
    u.`NAME`, 
 | 
    a.BATCH, 
 | 
    p.NAME, 
 | 
    a.procedure_id, 
 | 
    a.quality_type 
 | 
  </select> 
 | 
  
 | 
  
 | 
  
 | 
  <select id="wTransferDetailListByBackOrderId"  resultType="doumeemes.dao.business.model.WTransferDetail"> 
 | 
    SELECT 
 | 
      0 as DELETED, 
 | 
      b.MATERIAL_ID, 
 | 
      m.UNIT_ID, 
 | 
      b.BATCH, 
 | 
      sum( a.NUM ) AS OUT_PLANNUM, 
 | 
      a.PROCEDURE_ID, 
 | 
      a.QUALITY_TYPE 
 | 
    FROM 
 | 
      back_order_detail b 
 | 
        LEFT JOIN appliances a ON b.APPLIANCE_ID = a.id 
 | 
        LEFT JOIN material_distribute md ON b.MATERIAL_ID = md.id 
 | 
        LEFT JOIN material m ON md.MATERIAL_ID = m.id 
 | 
    WHERE 
 | 
         b.BACKORDER_ID = #{backOrderId} 
 | 
    GROUP BY 
 | 
      b.MATERIAL_ID, 
 | 
      m.UNIT_ID, 
 | 
      b.BATCH, 
 | 
      a.PROCEDURE_ID, 
 | 
      a.QUALITY_TYPE 
 | 
  </select> 
 | 
  
 | 
  
 | 
</mapper> 
 |