<?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.WOutboundExtMapper">
|
|
<!-- 管理页面查询 -->
|
<resultMap id="WOutboundExtListVO" type="doumeemes.dao.ext.vo.WOutboundExtListVO" autoMapping="true">
|
<id column="ID" jdbcType="INTEGER" property="id"/>
|
<association property="dmodel" javaType="doumeemes.dao.business.model.Department">
|
<id column="DMODEL_ID" jdbcType="INTEGER" property="id"/>
|
<result column="DMODEL_DELETED" jdbcType="TINYINT" property="deleted"/>
|
<result column="DMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/>
|
<result column="DMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
|
<result column="DMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/>
|
<result column="DMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
|
<result column="DMODEL_NAME" jdbcType="VARCHAR" property="name"/>
|
<result column="DMODEL_REMARK" jdbcType="VARCHAR" property="remark"/>
|
<result column="DMODEL_ROOT_ID" jdbcType="INTEGER" property="rootId"/>
|
<result column="DMODEL_PARENT_ID" jdbcType="INTEGER" property="parentId"/>
|
<result column="DMODEL_COMPANY_ID" jdbcType="INTEGER" property="companyId"/>
|
<result column="DMODEL_TYPE" jdbcType="TINYINT" property="type"/>
|
<result column="DMODEL_ERP_ID" jdbcType="VARCHAR" property="erpId"/>
|
<result column="DMODEL_STATUS" jdbcType="INTEGER" property="status"/>
|
<result column="DMODEL_VALID_TIME" jdbcType="TIMESTAMP" property="validTime"/>
|
<result column="DMODEL_INVALID_TIME" jdbcType="TIMESTAMP" property="invalidTime"/>
|
</association>
|
</resultMap>
|
<select id="selectCountToday" parameterType="doumeemes.dao.ext.dto.QueryWOutboundExtDTO" resultType="java.lang.Integer">
|
SELECT count(1)
|
FROM `w_outbound` `a`
|
|
<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="departId != null">
|
AND `a`.`DEPART_ID` = #{departId}
|
</if>
|
<if test="code != null and code != ''">
|
AND `a`.`CODE` = #{code}
|
</if>
|
<if test="origin != null">
|
AND `a`.`ORIGIN` = #{origin}
|
</if>
|
<if test="validDate != null">
|
AND `a`.`VALID_DATE` = #{validDate}
|
</if>
|
<if test="type != null">
|
AND `a`.`TYPE` = #{type}
|
</if>
|
<if test="originType != null">
|
AND `a`.`ORIGIN_TYPE` = #{originType}
|
</if>
|
<if test="originCode != null and originCode != ''">
|
AND `a`.`ORIGIN_CODE` = #{originCode}
|
</if>
|
<if test="originId != null">
|
AND `a`.`ORIGIN_ID` = #{originId}
|
</if>
|
<if test="abstracts != null and abstracts != ''">
|
AND `a`.`ABSTRACTS` = #{abstracts}
|
</if>
|
<if test="userId != null">
|
AND `a`.`USER_ID` = #{userId}
|
</if>
|
<if test="warehouseId != null">
|
AND `a`.`WAREHOUSE_ID` = #{warehouseId}
|
</if>
|
<if test="dealDate != null">
|
AND `a`.`DEAL_DATE` = #{dealDate}
|
</if>
|
<if test="status != null">
|
AND `a`.`STATUS` = #{status}
|
</if>
|
<if test="planDate != null">
|
AND `a`.`PLAN_DATE` = #{planDate}
|
</if>
|
<if test="procedureId != null">
|
AND `a`.`PROCEDURE_ID` = #{procedureId}
|
</if>
|
<if test="cancelUserId != null">
|
AND `a`.`CANCEL_USER_ID` = #{cancelUserId}
|
</if>
|
<if test="cancelDate != null">
|
AND `a`.`CANCEL_DATE` = #{cancelDate}
|
</if>
|
<if test="cancelInfo != null and cancelInfo != ''">
|
AND `a`.`CANCEL_INFO` = #{cancelInfo}
|
</if>
|
and to_days(`a`.`CREATE_TIME`)=to_days(now())
|
</where>
|
</select>
|
<select id="selectList" parameterType="doumeemes.dao.ext.dto.QueryWOutboundExtDTO" resultMap="WOutboundExtListVO">
|
SELECT
|
`a`.`ID`,
|
`a`.`DELETED`,
|
`a`.`CREATE_USER`,
|
`a`.`CREATE_TIME`,
|
`a`.`UPDATE_USER`,
|
`a`.`UPDATE_TIME`,
|
`a`.`REMARK`,
|
`a`.`ROOT_DEPART_ID`,
|
`a`.`DEPART_ID`,
|
`a`.`CODE`,
|
`a`.`ORIGIN`,
|
`a`.`VALID_DATE`,
|
`a`.`TYPE`,
|
`a`.`ORIGIN_TYPE`,
|
`a`.`ORIGIN_CODE`,
|
`a`.`ORIGIN_ID`,
|
`a`.`ABSTRACTS`,
|
`a`.`USER_ID`,
|
`a`.`WAREHOUSE_ID`,
|
`a`.`DEAL_DATE`,
|
`a`.`STATUS`,
|
`a`.`PLAN_DATE`,
|
`a`.`PROCEDURE_ID`,
|
`a`.`CANCEL_USER_ID`,
|
`a`.`CANCEL_DATE`,
|
`a`.`CANCEL_INFO`,
|
`a`.`BILL_TYPE`,
|
`dmodel`.`ID` AS DMODEL_ID,
|
`dmodel`.`DELETED` AS DMODEL_DELETED,
|
`dmodel`.`CREATE_USER` AS DMODEL_CREATE_USER,
|
`dmodel`.`CREATE_TIME` AS DMODEL_CREATE_TIME,
|
`dmodel`.`UPDATE_USER` AS DMODEL_UPDATE_USER,
|
`dmodel`.`UPDATE_TIME` AS DMODEL_UPDATE_TIME,
|
`dmodel`.`NAME` AS DMODEL_NAME,
|
`dmodel`.`REMARK` AS DMODEL_REMARK,
|
`dmodel`.`ROOT_ID` AS DMODEL_ROOT_ID,
|
`dmodel`.`PARENT_ID` AS DMODEL_PARENT_ID,
|
`dmodel`.`COMPANY_ID` AS DMODEL_COMPANY_ID,
|
`dmodel`.`TYPE` AS DMODEL_TYPE,
|
`dmodel`.`ERP_ID` AS DMODEL_ERP_ID,
|
`dmodel`.`STATUS` AS DMODEL_STATUS,
|
`dmodel`.`VALID_TIME` AS DMODEL_VALID_TIME,
|
`dmodel`.`INVALID_TIME` AS DMODEL_INVALID_TIME
|
FROM `w_outbound` `a`
|
LEFT JOIN `department` `dmodel` ON a.DEPART_ID=dmodel.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="departId != null">
|
AND `a`.`DEPART_ID` = #{departId}
|
</if>
|
<if test="code != null and code != ''">
|
AND `a`.`CODE` = #{code}
|
</if>
|
<if test="origin != null">
|
AND `a`.`ORIGIN` = #{origin}
|
</if>
|
<if test="validDate != null">
|
AND `a`.`VALID_DATE` = #{validDate}
|
</if>
|
<if test="type != null">
|
AND `a`.`TYPE` = #{type}
|
</if>
|
<if test="originType != null">
|
AND `a`.`ORIGIN_TYPE` = #{originType}
|
</if>
|
<if test="originCode != null and originCode != ''">
|
AND `a`.`ORIGIN_CODE` = #{originCode}
|
</if>
|
<if test="originId != null">
|
AND `a`.`ORIGIN_ID` = #{originId}
|
</if>
|
<if test="abstracts != null and abstracts != ''">
|
AND `a`.`ABSTRACTS` = #{abstracts}
|
</if>
|
<if test="userId != null">
|
AND `a`.`USER_ID` = #{userId}
|
</if>
|
<if test="warehouseId != null">
|
AND `a`.`WAREHOUSE_ID` = #{warehouseId}
|
</if>
|
<if test="dealDate != null">
|
AND `a`.`DEAL_DATE` = #{dealDate}
|
</if>
|
<if test="status != null">
|
AND `a`.`STATUS` = #{status}
|
</if>
|
<if test="planDate != null">
|
AND `a`.`PLAN_DATE` = #{planDate}
|
</if>
|
<if test="procedureId != null">
|
AND `a`.`PROCEDURE_ID` = #{procedureId}
|
</if>
|
<if test="cancelUserId != null">
|
AND `a`.`CANCEL_USER_ID` = #{cancelUserId}
|
</if>
|
<if test="cancelDate != null">
|
AND `a`.`CANCEL_DATE` = #{cancelDate}
|
</if>
|
<if test="cancelInfo != null and cancelInfo != ''">
|
AND `a`.`CANCEL_INFO` = #{cancelInfo}
|
</if>
|
<if test="dmodelId != null">
|
AND `dmodel`.`ID` = #{dmodelId}
|
</if>
|
<if test="dmodelDeleted != null">
|
AND `dmodel`.`DELETED` = #{dmodelDeleted}
|
</if>
|
<if test="dmodelCreateUser != null">
|
AND `dmodel`.`CREATE_USER` = #{dmodelCreateUser}
|
</if>
|
<if test="dmodelCreateTime != null">
|
AND `dmodel`.`CREATE_TIME` = #{dmodelCreateTime}
|
</if>
|
<if test="dmodelUpdateUser != null">
|
AND `dmodel`.`UPDATE_USER` = #{dmodelUpdateUser}
|
</if>
|
<if test="dmodelUpdateTime != null">
|
AND `dmodel`.`UPDATE_TIME` = #{dmodelUpdateTime}
|
</if>
|
<if test="dmodelName != null and dmodelName != ''">
|
AND `dmodel`.`NAME` = #{dmodelName}
|
</if>
|
<if test="dmodelRemark != null and dmodelRemark != ''">
|
AND `dmodel`.`REMARK` = #{dmodelRemark}
|
</if>
|
<if test="dmodelRootId != null">
|
AND `dmodel`.`ROOT_ID` = #{dmodelRootId}
|
</if>
|
<if test="dmodelParentId != null">
|
AND `dmodel`.`PARENT_ID` = #{dmodelParentId}
|
</if>
|
<if test="dmodelCompanyId != null">
|
AND `dmodel`.`COMPANY_ID` = #{dmodelCompanyId}
|
</if>
|
<if test="dmodelType != null">
|
AND `dmodel`.`TYPE` = #{dmodelType}
|
</if>
|
<if test="dmodelErpId != null and dmodelErpId != ''">
|
AND `dmodel`.`ERP_ID` = #{dmodelErpId}
|
</if>
|
<if test="dmodelStatus != null">
|
AND `dmodel`.`STATUS` = #{dmodelStatus}
|
</if>
|
<if test="dmodelValidTime != null">
|
AND `dmodel`.`VALID_TIME` = #{dmodelValidTime}
|
</if>
|
<if test="dmodelInvalidTime != null">
|
AND `dmodel`.`INVALID_TIME` = #{dmodelInvalidTime}
|
</if>
|
|
|
<if test="rootDepartId != null">
|
AND `a`.`ROOT_DEPART_ID` = #{rootDepartId}
|
</if>
|
|
<if test="departId != null">
|
AND `a`.`DEPART_ID` = #{departId}
|
</if>
|
|
<if test="proUserId != null">
|
AND `a`.`USER_ID` = #{proUserId}
|
</if>
|
|
<if test="departIds != null and departIds.size()>0">
|
AND exists (select d.id from company_user d where d.user_id= a.USER_ID and d.department_id
|
in <foreach collection="departIds" item="item" separator="," open="(" close=")">#{item}</foreach>)
|
</if>
|
</where>
|
order by a.CREATE_TIME desc
|
</select>
|
|
|
<select id="selectAdminList" parameterType="doumeemes.dao.ext.beanDto.QueryWOutBoundDto" resultMap="WOutboundExtListVO">
|
SELECT
|
a.* , b.NAME as warehouseName , b.code as warehouseCode,
|
c.REALNAME as userName , e.NAME as userDepartName , '-' as procedureName
|
FROM w_outbound a
|
left join warehouse b on a.WAREHOUSE_ID = b.id
|
left join `system_user` c on a.user_id = c.id
|
left join company_user cu on c.id = cu.USER_ID and cu.ROOT_DEPART_ID = a.ROOT_DEPART_ID and cu.DELETED = 0
|
LEFT JOIN department e ON cu.DEPARTMENT_ID = e.id
|
AND e.DELETED = 0
|
<where>
|
<if test="code != null and code != ''">
|
AND a.CODE like CONCAT('%',#{code},'%')
|
</if>
|
<if test="originCode != null and originCode != ''">
|
AND a.ORIGIN_CODE like CONCAT('%',#{originCode},'%')
|
</if>
|
<if test="planDateStart != null and planDateStart != '' ">
|
AND a.PLAN_DATE >= #{planDateStart}
|
</if>
|
<if test="planDateEnd != null and planDateEnd != '' ">
|
AND #{planDateEnd} >= a.PLAN_DATE
|
</if>
|
<if test="warehouseId != null">
|
AND a.WAREHOUSE_ID = #{warehouseId}
|
</if>
|
<if test="originType != null">
|
AND a.ORIGIN_TYPE = #{originType}
|
</if>
|
<if test="status != null">
|
AND a.STATUS = #{status}
|
</if>
|
<if test="type != null">
|
AND a.TYPE = #{type}
|
</if>
|
|
<if test="rootDepartId != null">
|
AND `a`.`ROOT_DEPART_ID` = #{rootDepartId}
|
</if>
|
|
<if test="departId != null">
|
AND `a`.`DEPART_ID` = #{departId}
|
</if>
|
|
<if test="billType != null">
|
AND `a`.`BILL_TYPE` = #{billType}
|
</if>
|
|
<if test="codeOrHouse != null and codeOrHouse != ''">
|
AND ( a.CODE like CONCAT('%',#{codeOrHouse},'%') or a.WAREHOUSE_ID in ( select w.id from warehouse w where w.NAME like CONCAT('%',#{codeOrHouse},'%') ) )
|
</if>
|
<!-- <if test="proUserId != null">-->
|
<!-- AND `a`.`USER_ID` = #{proUserId}-->
|
<!-- </if>-->
|
|
<choose>
|
<when test="departIds != null and departIds.size()>0">
|
AND (
|
a.CREATE_USER=#{createUser} or a.USER_ID =#{createUser}
|
or exists (select d.id from company_user d where (d.user_id= a.CREATE_USER or d.user_id=a.USER_ID ) and d.department_id
|
in <foreach collection="departIds" item="item" separator="," open="(" close=")">#{item}</foreach>)
|
)
|
</when>
|
<otherwise>
|
<if test="createUser!=null">
|
and( a.CREATE_USER=#{createUser} or a.USER_ID =#{createUser})
|
</if>
|
</otherwise>
|
</choose>
|
|
</where>
|
order by a.CREATE_TIME desc
|
</select>
|
|
|
<select id="selectCount" parameterType="doumeemes.dao.ext.beanDto.QueryWOutBoundDto" resultType="java.lang.Integer">
|
SELECT
|
count(1)
|
FROM w_outbound a
|
left join warehouse b on a.WAREHOUSE_ID = b.id
|
left join `system_user` c on a.user_id = c.id
|
left join system_department_user d on c.id = d.user_id and d.DELETED = 0
|
left join department e on d.DEPARTMENT_ID = e.id and e.DELETED = 0
|
<where>
|
<if test="code != null and code != ''">
|
AND a.CODE like CONCAT('%',#{code},'%')
|
</if>
|
<if test="originCode != null and originCode != ''">
|
AND a.ORIGIN_CODE like CONCAT('%',#{originCode},'%')
|
|
</if>
|
|
<if test="codeOrHouse != null and codeOrHouse != ''">
|
AND ( a.CODE like CONCAT('%',#{codeOrHouse},'%') or a.WAREHOUSE_ID in ( select w.id from warehouse w where w.NAME like CONCAT('%',#{codeOrHouse},'%') ) )
|
</if>
|
<if test="planDateStart != null and planDateStart != '' ">
|
AND a.PLAN_DATE >= #{planDateStart}
|
</if>
|
<if test="planDateEnd != null and planDateEnd != '' ">
|
AND #{planDateEnd} >= a.PLAN_DATE
|
</if>
|
<if test="warehouseId != null">
|
AND a.WAREHOUSE_ID = #{warehouseId}
|
</if>
|
<if test="originType != null">
|
AND a.ORIGIN_TYPE = #{originType}
|
</if>
|
<if test="status != null">
|
AND a.STATUS = #{status}
|
</if>
|
<if test="type != null">
|
AND a.TYPE = #{type}
|
</if>
|
|
<if test="rootDepartId != null">
|
AND `a`.`ROOT_DEPART_ID` = #{rootDepartId}
|
</if>
|
|
<if test="departId != null">
|
AND `a`.`DEPART_ID` = #{departId}
|
</if>
|
|
<if test="billType != null">
|
AND `a`.`BILL_TYPE` = #{billType}
|
</if>
|
<!-- <if test="proUserId != null">-->
|
<!-- AND `a`.`USER_ID` = #{proUserId}-->
|
<!-- </if>-->
|
|
<!-- <if test="departIds != null and departIds.size()>0">-->
|
<!-- AND exists (select d.id from company_user d where d.user_id= a.USER_ID and d.department_id-->
|
<!-- in <foreach collection="departIds" item="item" separator="," open="(" close=")">#{item}</foreach>)-->
|
<!-- </if>-->
|
|
|
<choose>
|
<when test="departIds != null and departIds.size()>0">
|
AND (
|
a.CREATE_USER=#{createUser} or a.USER_ID =#{createUser}
|
or exists (select d.id from company_user d where (d.user_id= a.CREATE_USER or d.user_id=a.USER_ID ) and d.department_id
|
in <foreach collection="departIds" item="item" separator="," open="(" close=")">#{item}</foreach>)
|
)
|
</when>
|
<otherwise>
|
<if test="createUser!=null">
|
and( a.CREATE_USER=#{createUser} or a.USER_ID =#{createUser})
|
</if>
|
</otherwise>
|
</choose>
|
</where>
|
order by a.CREATE_TIME desc
|
</select>
|
|
|
|
<select id="wOutboundById" resultType="doumeemes.dao.business.model.WOutbound">
|
SELECT a.* ,b.name as warehouseName ,b.code as warehouseCode,b.SYSTEM_DIC_DATA_ID as warehouseQualityType, c.realName as userName ,
|
e.NAME as userDepartName , f.realName as createName , g.mobile as updateMobile , g.realName as updateName , p.name as procedureName
|
from w_outbound a
|
left join warehouse b on b.id = a.WAREHOUSE_ID
|
left join `system_user` c on a.user_id = c.id
|
left join system_department_user d on c.id = d.user_id and d.DELETED = 0
|
left join company_user cu on c.id = cu.USER_ID and cu.ROOT_DEPART_ID = a.ROOT_DEPART_ID and cu.DELETED = 0
|
left join department e on cu.DEPARTMENT_ID = e.id
|
left join `system_user` f on a.CREATE_USER = f.id
|
left join `system_user` g on a.UPDATE_USER = g.id
|
left join procedures p on a.procedure_Id = p.id
|
where 1 = 1 and a.id = #{id}
|
limit 1
|
</select>
|
|
|
<!-- 完工入库使用 根据入库货位筛选 13 件小时内,设备对应货位的转库单入库后产生的入库单记录 -->
|
<select id="finishedInBill" resultType="doumeemes.dao.ext.bean.FinishedInBillBean">
|
SELECT w.id, w.`CODE` as code , c.`NAME` as userName , d.`NAME` as departmentName , w.DEAL_DATE as dealDate ,w.CREATE_TIME
|
FROM w_outbound w
|
left join company_user c on w.USER_ID = c.USER_ID and c.ROOT_DEPART_ID = w.ROOT_DEPART_ID
|
left join department d on c.DEPARTMENT_ID = d.id
|
where w.TYPE = 1
|
and c.deleted = 0
|
and w.DELETED = 0 and w.`STATUS` = 1 and w.ORIGIN_TYPE = 3
|
<if test="inLocationIds != null and inLocationIds != '' ">
|
and exists (
|
select 1 from w_outbound_detail wd
|
where wd.OUTBOUND_ID = w.id
|
and wd.CREATE_TIME >= date_sub(now(), interval 13 hour)
|
and FIND_IN_SET( wd.LOCATION_ID ,#{inLocationIds} )
|
)
|
</if>
|
<if test="inIds != null and inIds != '' ">
|
and FIND_IN_SET( w.id ,#{inIds} )
|
</if>
|
|
order by w.CREATE_TIME desc
|
|
|
</select>
|
|
|
|
|
<select id="workOrderOutList" resultType="doumeemes.dao.ext.vo.WorkOrderOutboundExtListVO" parameterType="doumeemes.dao.ext.beanDto.QueryWSOutBoundDto" >
|
select SUBSTR(w.VALID_DATE,1,10) as workDate , m.`CODE` as materialCode ,m.`NAME` as materialName , wd.BATCH as batch , p.`NAME` as produceName ,w.CREATE_TIME ,
|
wd.QUALITY_TYPE as qualityType , round(sum( wd.DONE_NUM ),2) as inNum , wh.`NAME` as warehouseName , w.`CODE` as billNo ,wd.MATERIAL_ID, u.`NAME` as unit,
|
w.ORIGIN_TYPE,w.ORIGIN_CODE, cu.name as createUserName , w.type , w.BILL_TYPE as billType
|
from w_outbound w inner join w_outbound_detail wd on w.id = wd.OUTBOUND_ID
|
inner join material_distribute md on wd.MATERIAL_ID = md.ID
|
left join material m on md.MATERIAL_ID = m.ID
|
left join procedures p on wd.PROCEDURE_ID = p.ID
|
left join warehouse wh on w.WAREHOUSE_ID = wh.ID
|
LEFT JOIN unit U ON M.UNIT_ID = U.ID
|
left join `system_user` c on w.CREATE_USER = c.id
|
left join company_user cu on c.id = cu.USER_ID and cu.DELETED = 0 and cu.ROOT_DEPART_ID = w.ROOT_DEPART_ID
|
<where>
|
<if test="billType != null">
|
AND w.bill_type = #{billType}
|
</if>
|
<if test="code != null and code != ''">
|
AND w.CODE like CONCAT('%',#{code},'%')
|
</if>
|
<if test="type != null">
|
AND w.type = #{type}
|
</if>
|
<if test="originType != null">
|
AND w.ORIGIN_TYPE = #{originType}
|
</if>
|
<if test="originCode != null and originCode != ''">
|
AND w.ORIGIN_CODE like CONCAT('%',#{originCode},'%')
|
</if>
|
|
<if test="materialCode != null and materialCode != ''">
|
AND m.code like CONCAT('%',#{materialCode},'%')
|
</if>
|
|
<if test="produceName != null and produceName != ''">
|
AND p.name like CONCAT('%',#{produceName},'%')
|
</if>
|
|
<if test="batch != null and batch != ''">
|
AND wd.batch like CONCAT('%',#{batch},'%')
|
</if>
|
|
<if test="warehouseId != null ">
|
AND w.WAREHOUSE_ID = #{warehouseId}
|
</if>
|
<if test="qualityType != null ">
|
AND wd.QUALITY_TYPE = #{qualityType}
|
</if>
|
<if test="beginDate != null and beginDate != '' ">
|
AND `w`.`VALID_DATE` >= CONCAT(#{beginDate},' 00:00:00')
|
</if>
|
|
<if test="rootDepartId != null">
|
AND `w`.`ROOT_DEPART_ID` = #{rootDepartId}
|
</if>
|
|
<if test="departId != null">
|
AND `w`.`DEPART_ID` = #{departId}
|
</if>
|
|
<if test="endDate != null and endDate != '' ">
|
AND CONCAT(#{endDate},' 23:59:59') >= `w`.`VALID_DATE`
|
</if>
|
</where>
|
group by SUBSTR(w.VALID_DATE,1,10) , m.`CODE` ,m.`NAME` , wd.BATCH , p.`NAME` , wd.QUALITY_TYPE , wh.`NAME` , w.`CODE` ,u.`NAME` ,w.CREATE_TIME , w.ORIGIN_TYPE,w.ORIGIN_CODE, w.type , w.BILL_TYPE
|
order by w.VALID_DATE desc, w.CREATE_TIME desc
|
</select>
|
|
|
|
</mapper>
|