<?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.WorkorderExtMapper">
|
<!-- 管理页面查询 -->
|
<select id="selectCount" parameterType="doumeemes.dao.ext.dto.QueryWorkorderExtDTO" resultType="java.lang.Integer">
|
SELECT count(1)
|
FROM `workorder` `a`
|
LEFT JOIN `procedures` `pmodel` ON a.PROCEDURE_ID=pmodel.ID
|
<where>
|
<if test="id != null">
|
AND `a`.`ID` = #{id}
|
</if>
|
<if test="deleted != null">
|
AND `a`.`DELETED` = #{deleted}
|
</if>
|
<choose>
|
<when test="departIds != null and departIds.size()>0">
|
AND ( `a`.`CREATE_USER` = #{createUser} or
|
exists (select d.id from workorder_user d where d.WORKORDER_ID=a.id and d.DELETED=0 and d.PRO_USER_ID=#{createUser} )
|
or exists (select d.id from company_user d where d.user_id= a.CREATE_USER and d.department_id
|
in <foreach collection="departIds" item="item" separator="," open="(" close=")">#{item}</foreach>)
|
or exists (select d.id from workorder_user wu left join company_user d on wu.PRO_USER_ID=d.USER_ID and d.DELETED=0 where wu.WORKORDER_ID= a.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 exists (select d.id from workorder_user d where d.WORKORDER_ID=a.id and d.DELETED=0 and d.PRO_USER_ID=#{createUser} ))
|
</if>
|
</otherwise>
|
</choose>
|
|
<if test="createTime != null">
|
AND `a`.`CREATE_TIME` = #{createTime}
|
</if>
|
<if test="paused != null">
|
AND `a`.`PAUSED` = #{paused}
|
</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="type != null and type != ''">
|
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="planId != null">
|
AND `a`.`PLAN_ID` = #{planId}
|
</if>
|
<if test="factoryId != null">
|
AND `a`.`FACTORY_ID` = #{factoryId}
|
</if>
|
<if test="procedureId != null">
|
AND `a`.`PROCEDURE_ID` = #{procedureId}
|
</if>
|
<if test="code != null and code != ''">
|
AND `a`.`CODE` = #{code}
|
</if>
|
<if test="originWorkorderId != null">
|
AND `a`.`ORIGIN_WORKORDER_ID` = #{originWorkorderId}
|
</if>
|
<if test="typeId != null">
|
AND `a`.`TYPE_ID` = #{typeId}
|
</if>
|
<if test="originId != null">
|
AND `a`.`ORIGIN_ID` = #{originId}
|
</if>
|
<if test="planDate != null">
|
AND `a`.`PLAN_DATE` = #{planDate}
|
</if>
|
<if test="planNum != null">
|
AND `a`.`PLAN_NUM` = #{planNum}
|
</if>
|
<if test="materialId != null">
|
AND `a`.`MATERIAL_ID` = #{materialId}
|
</if>
|
<if test="unitId != null">
|
AND `a`.`UNIT_ID` = #{unitId}
|
</if>
|
<if test="batch != null and batch != ''">
|
AND `a`.`BATCH` = #{batch}
|
</if>
|
<if test="proUserId != null">
|
and exists (select wu.id from workorder_user wu where wu.deleted=0 and wu.workorder_id=a.id and wu.`PRO_USER_ID` = #{proUserId})
|
</if>
|
<if test="proGroupId != null">
|
AND `a`.`PRO_GROUP_ID` = #{proGroupId}
|
</if>
|
<if test="qualifiedNum != null">
|
AND `a`.`QUALIFIED_NUM` = #{qualifiedNum}
|
</if>
|
<if test="unqualifiedNum != null">
|
AND `a`.`UNQUALIFIED_NUM` = #{unqualifiedNum}
|
</if>
|
<if test="checkUserId != null">
|
AND `a`.`CHECK_USER_ID` = #{checkUserId}
|
</if>
|
<if test="status != null">
|
AND `a`.`STATUS` = #{status}
|
</if>
|
<if test="statusList != null and statusList.size()>0">
|
AND `a`.`STATUS` in <foreach collection="statusList" open="(" close=")" item="item" separator=",">#{item}</foreach>
|
</if>
|
<if test="lastDealDate != null">
|
AND `a`.`LAST_DEAL_DATE` = #{lastDealDate}
|
</if>
|
<if test="lastDealInfo != null and lastDealInfo != ''">
|
AND `a`.`LAST_DEAL_INFO` = #{lastDealInfo}
|
</if>
|
<if test="urgent != null">
|
AND `a`.`URGENT` = #{urgent}
|
</if>
|
<if test="startDate != null">
|
AND `a`.`PLAN_DATE` >= #{startDate}
|
</if>
|
<if test="endDate != null">
|
AND #{endDate} >= `a`.`PLAN_DATE`
|
</if>
|
<if test="mixParam != null and mixParam!=''">
|
AND (a.code like concat('%',#{mixParam},'%') or pmodel.name like concat('%',#{mixParam},'%'))
|
</if>
|
<if test="backorderId != null">
|
AND `a`.`BACKORDER_ID` = #{backorderId}
|
</if>
|
</where>
|
</select>
|
<!-- 管理页面查询 -->
|
<select id="selectCountToday" parameterType="doumeemes.dao.ext.dto.QueryWorkorderExtDTO" resultType="java.lang.Integer">
|
SELECT count(1)
|
FROM `workorder` `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="paused != null">
|
AND `a`.`PAUSED` = #{paused}
|
</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="type != null and type != ''">
|
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="planId != null">
|
AND `a`.`PLAN_ID` = #{planId}
|
</if>
|
<if test="factoryId != null">
|
AND `a`.`FACTORY_ID` = #{factoryId}
|
</if>
|
<if test="procedureId != null">
|
AND `a`.`PROCEDURE_ID` = #{procedureId}
|
</if>
|
<if test="code != null and code != ''">
|
AND `a`.`CODE` = #{code}
|
</if>
|
<if test="originWorkorderId != null">
|
AND `a`.`ORIGIN_WORKORDER_ID` = #{originWorkorderId}
|
</if>
|
<if test="typeId != null">
|
AND `a`.`TYPE_ID` = #{typeId}
|
</if>
|
<if test="originId != null">
|
AND `a`.`ORIGIN_ID` = #{originId}
|
</if>
|
<if test="planDate != null">
|
AND `a`.`PLAN_DATE` = #{planDate}
|
</if>
|
<if test="planNum != null">
|
AND `a`.`PLAN_NUM` = #{planNum}
|
</if>
|
<if test="materialId != null">
|
AND `a`.`MATERIAL_ID` = #{materialId}
|
</if>
|
<if test="unitId != null">
|
AND `a`.`UNIT_ID` = #{unitId}
|
</if>
|
<if test="batch != null and batch != ''">
|
AND `a`.`BATCH` = #{batch}
|
</if>
|
<if test="proUserId != null">
|
AND `a`.`PRO_USER_ID` = #{proUserId}
|
</if>
|
<if test="proGroupId != null">
|
AND `a`.`PRO_GROUP_ID` = #{proGroupId}
|
</if>
|
<if test="qualifiedNum != null">
|
AND `a`.`QUALIFIED_NUM` = #{qualifiedNum}
|
</if>
|
<if test="unqualifiedNum != null">
|
AND `a`.`UNQUALIFIED_NUM` = #{unqualifiedNum}
|
</if>
|
<if test="checkUserId != null">
|
AND `a`.`CHECK_USER_ID` = #{checkUserId}
|
</if>
|
<if test="status != null">
|
AND `a`.`STATUS` = #{status}
|
</if>
|
<if test="lastDealDate != null">
|
AND `a`.`LAST_DEAL_DATE` = #{lastDealDate}
|
</if>
|
<if test="lastDealInfo != null and lastDealInfo != ''">
|
AND `a`.`LAST_DEAL_INFO` = #{lastDealInfo}
|
</if>
|
<if test="urgent != null">
|
AND `a`.`URGENT` = #{urgent}
|
</if>
|
<if test="backorderId != null">
|
AND `a`.`BACKORDER_ID` = #{backorderId}
|
</if>
|
</where>
|
and to_days(`a`.`CREATE_TIME`)=to_days(now())
|
</select>
|
<!-- 管理页面查询 -->
|
<select id="sumOrderNum" parameterType="doumeemes.dao.ext.dto.QueryWorkorderExtDTO" resultType="java.lang.Integer">
|
SELECT sum(`a`.id)
|
FROM `workorder` `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="paused != null">
|
AND `a`.`PAUSED` = #{paused}
|
</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="type != null and type != ''">
|
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="planId != null">
|
AND `a`.`PLAN_ID` = #{planId}
|
</if>
|
<if test="factoryId != null">
|
AND `a`.`FACTORY_ID` = #{factoryId}
|
</if>
|
<if test="procedureId != null">
|
AND `a`.`PROCEDURE_ID` = #{procedureId}
|
</if>
|
<if test="code != null and code != ''">
|
AND `a`.`CODE` = #{code}
|
</if>
|
<if test="originWorkorderId != null">
|
AND `a`.`ORIGIN_WORKORDER_ID` = #{originWorkorderId}
|
</if>
|
<if test="typeId != null">
|
AND `a`.`TYPE_ID` = #{typeId}
|
</if>
|
<if test="originId != null">
|
AND `a`.`ORIGIN_ID` = #{originId}
|
</if>
|
<if test="planDate != null">
|
AND `a`.`PLAN_DATE` = #{planDate}
|
</if>
|
<if test="planNum != null">
|
AND `a`.`PLAN_NUM` = #{planNum}
|
</if>
|
<if test="materialId != null">
|
AND `a`.`MATERIAL_ID` = #{materialId}
|
</if>
|
<if test="unitId != null">
|
AND `a`.`UNIT_ID` = #{unitId}
|
</if>
|
<if test="batch != null and batch != ''">
|
AND `a`.`BATCH` = #{batch}
|
</if>
|
<if test="proUserId != null">
|
AND `a`.`PRO_USER_ID` = #{proUserId}
|
</if>
|
<if test="proGroupId != null">
|
AND `a`.`PRO_GROUP_ID` = #{proGroupId}
|
</if>
|
<if test="qualifiedNum != null">
|
AND `a`.`QUALIFIED_NUM` = #{qualifiedNum}
|
</if>
|
<if test="unqualifiedNum != null">
|
AND `a`.`UNQUALIFIED_NUM` = #{unqualifiedNum}
|
</if>
|
<if test="checkUserId != null">
|
AND `a`.`CHECK_USER_ID` = #{checkUserId}
|
</if>
|
<if test="status != null">
|
AND `a`.`STATUS` = #{status}
|
</if>
|
<if test="lastDealDate != null">
|
AND `a`.`LAST_DEAL_DATE` = #{lastDealDate}
|
</if>
|
<if test="lastDealInfo != null and lastDealInfo != ''">
|
AND `a`.`LAST_DEAL_INFO` = #{lastDealInfo}
|
</if>
|
<if test="urgent != null">
|
AND `a`.`URGENT` = #{urgent}
|
</if>
|
<if test="backorderId != null">
|
AND `a`.`BACKORDER_ID` = #{backorderId}
|
</if>
|
</where>
|
</select>
|
<!-- 管理页面查询 -->
|
<select id="selectList" parameterType="doumeemes.dao.ext.dto.QueryWorkorderExtDTO" resultMap="WorkorderExtListVO">
|
SELECT
|
`a`.*,
|
`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,
|
`pmodel`.`ID` AS PMODEL_ID,
|
`pmodel`.`DELETED` AS PMODEL_DELETED,
|
`pmodel`.`CREATE_USER` AS PMODEL_CREATE_USER,
|
`pmodel`.`CREATE_TIME` AS PMODEL_CREATE_TIME,
|
`pmodel`.`UPDATE_USER` AS PMODEL_UPDATE_USER,
|
`pmodel`.`UPDATE_TIME` AS PMODEL_UPDATE_TIME,
|
`pmodel`.`REMARK` AS PMODEL_REMARK,
|
`pmodel`.`ROOT_DEPART_ID` AS PMODEL_ROOT_DEPART_ID,
|
`pmodel`.`DEPART_ID` AS PMODEL_DEPART_ID,
|
`pmodel`.`ORIGIN` AS PMODEL_ORIGIN,
|
`pmodel`.`PLAN_DATE` AS PMODEL_PLAN_DATE,
|
`pmodel`.`MATERIAL_ID` AS PMODEL_MATERIAL_ID,
|
`pmodel`.`PROCEDURE_ID` AS PMODEL_PROCEDURE_ID,
|
`pmodel`.`FACTORY_ID` AS PMODEL_FACTORY_ID,
|
`pmodel`.`UNIT_ID` AS PMODEL_UNIT_ID,
|
`pmodel`.`NUM` AS PMODEL_NUM,
|
`pmodel`.`BATCH` AS PMODEL_BATCH,
|
`pmodel`.`URGENT` AS PMODEL_URGENT,
|
`pmodel`.`IMPORT_ID` AS PMODEL_IMPORT_ID,
|
`pmodel`.`USER_ID` AS PMODEL_USER_ID,
|
`pmodel`.`STATUS` AS PMODEL_STATUS,
|
`pmodel`.`PUBLISH_DATE` AS PMODEL_PUBLISH_DATE,
|
`fmodel`.`ID` AS FMODEL_ID,
|
`fmodel`.`DELETED` AS FMODEL_DELETED,
|
`fmodel`.`CREATE_USER` AS FMODEL_CREATE_USER,
|
`fmodel`.`CREATE_TIME` AS FMODEL_CREATE_TIME,
|
`fmodel`.`UPDATE_USER` AS FMODEL_UPDATE_USER,
|
`fmodel`.`UPDATE_TIME` AS FMODEL_UPDATE_TIME,
|
`fmodel`.`NAME` AS FMODEL_NAME,
|
`fmodel`.`REMARK` AS FMODEL_REMARK,
|
`fmodel`.`ROOT_ID` AS FMODEL_ROOT_ID,
|
`fmodel`.`PARENT_ID` AS FMODEL_PARENT_ID,
|
`fmodel`.`COMPANY_ID` AS FMODEL_COMPANY_ID,
|
`fmodel`.`TYPE` AS FMODEL_TYPE,
|
`fmodel`.`ERP_ID` AS FMODEL_ERP_ID,
|
`fmodel`.`STATUS` AS FMODEL_STATUS,
|
`fmodel`.`VALID_TIME` AS FMODEL_VALID_TIME,
|
`fmodel`.`INVALID_TIME` AS FMODEL_INVALID_TIME,
|
`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`.`DICT_ID` AS TMODEL_DICT_ID,
|
`tmodel`.`CODE` AS TMODEL_CODE,
|
`tmodel`.`LABEL` AS TMODEL_LABEL,
|
`tmodel`.`SORT` AS TMODEL_SORT,
|
`tmodel`.`DISABLED` AS TMODEL_DISABLED,
|
`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,
|
`pgmodel`.`ID` AS PGMODEL_ID,
|
`pgmodel`.`DELETED` AS PGMODEL_DELETED,
|
`pgmodel`.`CREATE_USER` AS PGMODEL_CREATE_USER,
|
`pgmodel`.`CREATE_TIME` AS PGMODEL_CREATE_TIME,
|
`pgmodel`.`UPDATE_USER` AS PGMODEL_UPDATE_USER,
|
`pgmodel`.`UPDATE_TIME` AS PGMODEL_UPDATE_TIME,
|
`pgmodel`.`REMARK` AS PGMODEL_REMARK,
|
`pgmodel`.`ROOT_DEPART_ID` AS PGMODEL_ROOT_DEPART_ID,
|
`pgmodel`.`DEPART_ID` AS PGMODEL_DEPART_ID,
|
`pgmodel`.`PROCEDURE_ID` AS PGMODEL_PROCEDURE_ID,
|
`pgmodel`.`CODE` AS PGMODEL_CODE,
|
`pgmodel`.`TYPE` AS PGMODEL_TYPE,
|
`pgmodel`.`NAME` AS PGMODEL_NAME,
|
`pgmodel`.`MODEL` AS PGMODEL_MODEL,
|
`pgmodel`.`STATUS` AS PGMODEL_STATUS,
|
`pgmodel`.`SUPPLIER` AS PGMODEL_SUPPLIER,
|
`pgmodel`.`STATION_CODE` AS PGMODEL_STATION_CODE,
|
`pgmodel`.`GROUP_ID` AS PGMODEL_GROUP_ID,
|
`pgmodel`.`SERIAL_NUM` AS PGMODEL_SERIAL_NUM,
|
p.name as procedureName,
|
u.realname as proUserName,
|
uc.realname as createUserName,
|
(select sum(ifnull(num,0)) from workorder_record r where r.deleted=0 and r.type=1 and r.workorder_id=a.id) as proNum
|
<if test="checkTouliao!=null and checkTouliao==1">
|
,(select r.id from workorder_record r where r.deleted=0 and r.type=0 and r.workorder_id=a.id limit 1) as touliaoId
|
</if>
|
,`mmodel`.name as materialName , `mmodel`.code as materialCode , concat('【', `pgmodel`.code , '】' , `pgmodel`.name ) as deviceName,
|
case when `a`.ORIGIN_ID is null then '' else '计划分配' end orderForm , `umodel`.name as unitName
|
FROM `workorder` `a`
|
LEFT JOIN `department` `dmodel` ON a.DEPART_ID=dmodel.ID
|
LEFT JOIN `plans` `pmodel` ON a.PLAN_ID=pmodel.ID
|
LEFT JOIN `department` `fmodel` ON a.FACTORY_ID=fmodel.ID
|
LEFT JOIN `system_dict_data` `tmodel` ON a.TYPE_ID=tmodel.ID
|
LEFT JOIN `material_distribute` `mdmodel` ON a.MATERIAL_ID=mdmodel.ID
|
LEFT JOIN `material` `mmodel` ON mdmodel.MATERIAL_ID=mmodel.ID
|
LEFT JOIN `unit` `umodel` ON a.UNIT_ID=umodel.ID
|
LEFT JOIN `device` `pgmodel` ON a.PRO_GROUP_ID=pgmodel.ID
|
LEFT JOIN `procedures` `p` ON a.`PROCEDURE_ID`=p.ID
|
LEFT JOIN `system_user` `u` ON `a`.`PRO_USER_ID`=u.ID
|
LEFT JOIN `system_user` `uc` ON `a`.`CREATE_USER`=uc.ID
|
<where>
|
<if test="id != null">
|
AND `a`.`ID` = #{id}
|
</if>
|
<if test="deleted != null">
|
AND `a`.`DELETED` = #{deleted}
|
</if>
|
|
<if test="createTime != null">
|
AND `a`.`CREATE_TIME` = #{createTime}
|
</if>
|
<if test="paused != null">
|
AND `a`.`PAUSED` = #{paused}
|
</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="type != null and type != ''">
|
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="planId != null">
|
AND `a`.`PLAN_ID` = #{planId}
|
</if>
|
<if test="factoryId != null">
|
AND `a`.`FACTORY_ID` = #{factoryId}
|
</if>
|
<if test="procedureId != null">
|
AND `a`.`PROCEDURE_ID` = #{procedureId}
|
</if>
|
<if test="code != null and code != ''">
|
AND `a`.`CODE` = #{code}
|
</if>
|
<if test="originWorkorderId != null">
|
AND `a`.`ORIGIN_WORKORDER_ID` = #{originWorkorderId}
|
</if>
|
<if test="typeId != null">
|
AND `a`.`TYPE_ID` = #{typeId}
|
</if>
|
<if test="originId != null">
|
AND `a`.`ORIGIN_ID` = #{originId}
|
</if>
|
<if test="planDate != null">
|
AND `a`.`PLAN_DATE` = #{planDate}
|
</if>
|
<if test="planNum != null">
|
AND `a`.`PLAN_NUM` = #{planNum}
|
</if>
|
<if test="materialId != null">
|
AND `a`.`MATERIAL_ID` = #{materialId}
|
</if>
|
<if test="unitId != null">
|
AND `a`.`UNIT_ID` = #{unitId}
|
</if>
|
<if test="batch != null and batch != ''">
|
AND `a`.`BATCH` = #{batch}
|
</if>
|
<if test="proUserId != null">
|
and exists (select wu.id from workorder_user wu where wu.deleted=0 and wu.workorder_id=a.id and wu.`PRO_USER_ID` = #{proUserId})
|
</if>
|
<if test="proGroupId != null">
|
AND `a`.`PRO_GROUP_ID` = #{proGroupId}
|
</if>
|
<if test="qualifiedNum != null">
|
AND `a`.`QUALIFIED_NUM` = #{qualifiedNum}
|
</if>
|
<if test="unqualifiedNum != null">
|
AND `a`.`UNQUALIFIED_NUM` = #{unqualifiedNum}
|
</if>
|
<if test="checkUserId != null">
|
AND `a`.`CHECK_USER_ID` = #{checkUserId}
|
</if>
|
<if test="status != null">
|
AND `a`.`STATUS` = #{status}
|
</if>
|
<if test="statusList != null and statusList.size()>0">
|
AND `a`.`STATUS` in <foreach collection="statusList" open="(" close=")" item="item" separator=",">#{item}</foreach>
|
</if>
|
<if test="lastDealDate != null">
|
AND `a`.`LAST_DEAL_DATE` = #{lastDealDate}
|
</if>
|
<if test="lastDealInfo != null and lastDealInfo != ''">
|
AND `a`.`LAST_DEAL_INFO` = #{lastDealInfo}
|
</if>
|
<if test="urgent != null">
|
AND `a`.`URGENT` = #{urgent}
|
</if>
|
<if test="backorderId != null">
|
AND `a`.`BACKORDER_ID` = #{backorderId}
|
</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="pmodelId != null">
|
AND `pmodel`.`ID` = #{pmodelId}
|
</if>
|
<if test="pmodelDeleted != null">
|
AND `pmodel`.`DELETED` = #{pmodelDeleted}
|
</if>
|
<if test="pmodelCreateUser != null">
|
AND `pmodel`.`CREATE_USER` = #{pmodelCreateUser}
|
</if>
|
<if test="pmodelCreateTime != null">
|
AND `pmodel`.`CREATE_TIME` = #{pmodelCreateTime}
|
</if>
|
<if test="pmodelUpdateUser != null">
|
AND `pmodel`.`UPDATE_USER` = #{pmodelUpdateUser}
|
</if>
|
<if test="pmodelUpdateTime != null">
|
AND `pmodel`.`UPDATE_TIME` = #{pmodelUpdateTime}
|
</if>
|
<if test="pmodelRemark != null and pmodelRemark != ''">
|
AND `pmodel`.`REMARK` = #{pmodelRemark}
|
</if>
|
<if test="pmodelRootDepartId != null">
|
AND `pmodel`.`ROOT_DEPART_ID` = #{pmodelRootDepartId}
|
</if>
|
<if test="pmodelDepartId != null">
|
AND `pmodel`.`DEPART_ID` = #{pmodelDepartId}
|
</if>
|
<if test="pmodelOrigin != null">
|
AND `pmodel`.`ORIGIN` = #{pmodelOrigin}
|
</if>
|
<if test="pmodelPlanDate != null">
|
AND `pmodel`.`PLAN_DATE` = #{pmodelPlanDate}
|
</if>
|
<if test="pmodelMaterialId != null">
|
AND `pmodel`.`MATERIAL_ID` = #{pmodelMaterialId}
|
</if>
|
<if test="pmodelProcedureId != null">
|
AND `pmodel`.`PROCEDURE_ID` = #{pmodelProcedureId}
|
</if>
|
<if test="pmodelFactoryId != null">
|
AND `pmodel`.`FACTORY_ID` = #{pmodelFactoryId}
|
</if>
|
<if test="pmodelUnitId != null">
|
AND `pmodel`.`UNIT_ID` = #{pmodelUnitId}
|
</if>
|
<if test="pmodelNum != null">
|
AND `pmodel`.`NUM` = #{pmodelNum}
|
</if>
|
<if test="pmodelBatch != null and pmodelBatch != ''">
|
AND `pmodel`.`BATCH` = #{pmodelBatch}
|
</if>
|
<if test="pmodelUrgent != null">
|
AND `pmodel`.`URGENT` = #{pmodelUrgent}
|
</if>
|
<if test="pmodelImportId != null">
|
AND `pmodel`.`IMPORT_ID` = #{pmodelImportId}
|
</if>
|
<if test="pmodelUserId != null">
|
AND `pmodel`.`USER_ID` = #{pmodelUserId}
|
</if>
|
<if test="pmodelStatus != null">
|
AND `pmodel`.`STATUS` = #{pmodelStatus}
|
</if>
|
<if test="pmodelPublishDate != null">
|
AND `pmodel`.`PUBLISH_DATE` = #{pmodelPublishDate}
|
</if>
|
<if test="fmodelId != null">
|
AND `fmodel`.`ID` = #{fmodelId}
|
</if>
|
<if test="fmodelDeleted != null">
|
AND `fmodel`.`DELETED` = #{fmodelDeleted}
|
</if>
|
<if test="fmodelCreateUser != null">
|
AND `fmodel`.`CREATE_USER` = #{fmodelCreateUser}
|
</if>
|
<if test="fmodelCreateTime != null">
|
AND `fmodel`.`CREATE_TIME` = #{fmodelCreateTime}
|
</if>
|
<if test="fmodelUpdateUser != null">
|
AND `fmodel`.`UPDATE_USER` = #{fmodelUpdateUser}
|
</if>
|
<if test="fmodelUpdateTime != null">
|
AND `fmodel`.`UPDATE_TIME` = #{fmodelUpdateTime}
|
</if>
|
<if test="fmodelName != null and fmodelName != ''">
|
AND `fmodel`.`NAME` = #{fmodelName}
|
</if>
|
<if test="fmodelRemark != null and fmodelRemark != ''">
|
AND `fmodel`.`REMARK` = #{fmodelRemark}
|
</if>
|
<if test="fmodelRootId != null">
|
AND `fmodel`.`ROOT_ID` = #{fmodelRootId}
|
</if>
|
<if test="fmodelParentId != null">
|
AND `fmodel`.`PARENT_ID` = #{fmodelParentId}
|
</if>
|
<if test="fmodelCompanyId != null">
|
AND `fmodel`.`COMPANY_ID` = #{fmodelCompanyId}
|
</if>
|
<if test="fmodelType != null">
|
AND `fmodel`.`TYPE` = #{fmodelType}
|
</if>
|
<if test="fmodelErpId != null and fmodelErpId != ''">
|
AND `fmodel`.`ERP_ID` = #{fmodelErpId}
|
</if>
|
<if test="fmodelStatus != null">
|
AND `fmodel`.`STATUS` = #{fmodelStatus}
|
</if>
|
<if test="fmodelValidTime != null">
|
AND `fmodel`.`VALID_TIME` = #{fmodelValidTime}
|
</if>
|
<if test="fmodelInvalidTime != null">
|
AND `fmodel`.`INVALID_TIME` = #{fmodelInvalidTime}
|
</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="tmodelDictId != null">
|
AND `tmodel`.`DICT_ID` = #{tmodelDictId}
|
</if>
|
<if test="tmodelCode != null and tmodelCode != ''">
|
AND `tmodel`.`CODE` = #{tmodelCode}
|
</if>
|
<if test="tmodelLabel != null and tmodelLabel != ''">
|
AND `tmodel`.`LABEL` = #{tmodelLabel}
|
</if>
|
<if test="tmodelSort != null">
|
AND `tmodel`.`SORT` = #{tmodelSort}
|
</if>
|
<if test="tmodelDisabled != null">
|
AND `tmodel`.`DISABLED` = #{tmodelDisabled}
|
</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` like concat('%', #{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="pgmodelId != null">
|
AND `pgmodel`.`ID` = #{pgmodelId}
|
</if>
|
<if test="pgmodelDeleted != null">
|
AND `pgmodel`.`DELETED` = #{pgmodelDeleted}
|
</if>
|
<if test="pgmodelCreateUser != null">
|
AND `pgmodel`.`CREATE_USER` = #{pgmodelCreateUser}
|
</if>
|
<if test="pgmodelCreateTime != null">
|
AND `pgmodel`.`CREATE_TIME` = #{pgmodelCreateTime}
|
</if>
|
<if test="pgmodelUpdateUser != null">
|
AND `pgmodel`.`UPDATE_USER` = #{pgmodelUpdateUser}
|
</if>
|
<if test="pgmodelUpdateTime != null">
|
AND `pgmodel`.`UPDATE_TIME` = #{pgmodelUpdateTime}
|
</if>
|
<if test="pgmodelRemark != null and pgmodelRemark != ''">
|
AND `pgmodel`.`REMARK` = #{pgmodelRemark}
|
</if>
|
<if test="pgmodelRootDepartId != null">
|
AND `pgmodel`.`ROOT_DEPART_ID` = #{pgmodelRootDepartId}
|
</if>
|
<if test="pgmodelDepartId != null">
|
AND `pgmodel`.`DEPART_ID` = #{pgmodelDepartId}
|
</if>
|
<if test="pgmodelProcedureId != null">
|
AND `pgmodel`.`PROCEDURE_ID` = #{pgmodelProcedureId}
|
</if>
|
<if test="pgmodelCode != null">
|
AND `pgmodel`.`CODE` = #{pgmodelCode}
|
</if>
|
<if test="pgmodelType != null">
|
AND `pgmodel`.`TYPE` = #{pgmodelType}
|
</if>
|
<if test="pgmodelName != null and pgmodelName != ''">
|
AND `pgmodel`.`NAME` = #{pgmodelName}
|
</if>
|
<if test="pgmodelModel != null and pgmodelModel != ''">
|
AND `pgmodel`.`MODEL` = #{pgmodelModel}
|
</if>
|
<if test="pgmodelStatus != null">
|
AND `pgmodel`.`STATUS` = #{pgmodelStatus}
|
</if>
|
<if test="pgmodelSupplier != null and pgmodelSupplier != ''">
|
AND `pgmodel`.`SUPPLIER` = #{pgmodelSupplier}
|
</if>
|
<if test="pgmodelStationCode != null and pgmodelStationCode != ''">
|
AND `pgmodel`.`STATION_CODE` = #{pgmodelStationCode}
|
</if>
|
<if test="pgmodelGroupId != null">
|
AND `pgmodel`.`GROUP_ID` = #{pgmodelGroupId}
|
</if>
|
<if test="pgmodelSerialNum != null and pgmodelSerialNum != ''">
|
AND `pgmodel`.`SERIAL_NUM` = #{pgmodelSerialNum}
|
</if>
|
<choose>
|
<when test="departIds != null and departIds.size()>0">
|
AND ( `a`.`CREATE_USER` = #{createUser} or
|
exists (select d.id from workorder_user d where d.WORKORDER_ID=a.id and d.DELETED=0 and d.PRO_USER_ID=#{createUser} )
|
or exists (select d.id from company_user d where d.user_id= a.CREATE_USER and d.department_id
|
in <foreach collection="departIds" item="item" separator="," open="(" close=")">#{item}</foreach>)
|
or exists (select d.id from workorder_user wu left join company_user d on wu.PRO_USER_ID=d.USER_ID and d.DELETED=0 where wu.WORKORDER_ID= a.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 exists (select d.id from workorder_user d where d.WORKORDER_ID=a.id and d.DELETED=0 and d.PRO_USER_ID=#{createUser} ))
|
</if>
|
</otherwise>
|
</choose>
|
<if test="startDate != null and startDate!=''">
|
AND `a`.`PLAN_DATE` >= #{startDate}
|
</if>
|
<if test="endDate != null and endDate!=''">
|
AND #{endDate} >= `a`.`PLAN_DATE`
|
</if>
|
<if test="mixParam != null and mixParam!=''">
|
AND (a.code like concat('%',#{mixParam},'%') or p.name like concat('%',#{mixParam},'%'))
|
</if>
|
</where>
|
order by a.PLAN_DATE desc,a.CREATE_TIME desc,p.SORTNUM asc
|
</select>
|
<resultMap id="WorkorderExtListVO" type="doumeemes.dao.ext.vo.WorkorderExtListVO" 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>
|
<association property="pmodel" javaType="doumeemes.dao.business.model.Plans">
|
<id column="PMODEL_ID" jdbcType="INTEGER" property="id"/>
|
<result column="PMODEL_DELETED" jdbcType="TINYINT" property="deleted"/>
|
<result column="PMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/>
|
<result column="PMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
|
<result column="PMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/>
|
<result column="PMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
|
<result column="PMODEL_REMARK" jdbcType="VARCHAR" property="remark"/>
|
<result column="PMODEL_ROOT_DEPART_ID" jdbcType="INTEGER" property="rootDepartId"/>
|
<result column="PMODEL_DEPART_ID" jdbcType="INTEGER" property="departId"/>
|
<result column="PMODEL_ORIGIN" jdbcType="TINYINT" property="origin"/>
|
<result column="PMODEL_PLAN_DATE" jdbcType="TIMESTAMP" property="planDate"/>
|
<result column="PMODEL_MATERIAL_ID" jdbcType="INTEGER" property="materialId"/>
|
<result column="PMODEL_PROCEDURE_ID" jdbcType="INTEGER" property="procedureId"/>
|
<result column="PMODEL_FACTORY_ID" jdbcType="INTEGER" property="factoryId"/>
|
<result column="PMODEL_UNIT_ID" jdbcType="INTEGER" property="unitId"/>
|
<result column="PMODEL_NUM" jdbcType="INTEGER" property="num"/>
|
<result column="PMODEL_BATCH" jdbcType="VARCHAR" property="batch"/>
|
<result column="PMODEL_URGENT" jdbcType="TINYINT" property="urgent"/>
|
<result column="PMODEL_IMPORT_ID" jdbcType="INTEGER" property="importId"/>
|
<result column="PMODEL_USER_ID" jdbcType="INTEGER" property="userId"/>
|
<result column="PMODEL_STATUS" jdbcType="TINYINT" property="status"/>
|
<result column="PMODEL_PUBLISH_DATE" jdbcType="TIMESTAMP" property="publishDate"/>
|
</association>
|
<association property="fmodel" javaType="doumeemes.dao.business.model.Department">
|
<id column="FMODEL_ID" jdbcType="INTEGER" property="id"/>
|
<result column="FMODEL_DELETED" jdbcType="TINYINT" property="deleted"/>
|
<result column="FMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/>
|
<result column="FMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
|
<result column="FMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/>
|
<result column="FMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
|
<result column="FMODEL_NAME" jdbcType="VARCHAR" property="name"/>
|
<result column="FMODEL_REMARK" jdbcType="VARCHAR" property="remark"/>
|
<result column="FMODEL_ROOT_ID" jdbcType="INTEGER" property="rootId"/>
|
<result column="FMODEL_PARENT_ID" jdbcType="INTEGER" property="parentId"/>
|
<result column="FMODEL_COMPANY_ID" jdbcType="INTEGER" property="companyId"/>
|
<result column="FMODEL_TYPE" jdbcType="TINYINT" property="type"/>
|
<result column="FMODEL_ERP_ID" jdbcType="VARCHAR" property="erpId"/>
|
<result column="FMODEL_STATUS" jdbcType="INTEGER" property="status"/>
|
<result column="FMODEL_VALID_TIME" jdbcType="TIMESTAMP" property="validTime"/>
|
<result column="FMODEL_INVALID_TIME" jdbcType="TIMESTAMP" property="invalidTime"/>
|
</association>
|
<association property="tmodel" javaType="doumeemes.dao.system.model.SystemDictData">
|
<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_DICT_ID" jdbcType="INTEGER" property="dictId"/>
|
<result column="TMODEL_CODE" jdbcType="LONGVARCHAR" property="code"/>
|
<result column="TMODEL_LABEL" jdbcType="VARCHAR" property="label"/>
|
<result column="TMODEL_SORT" jdbcType="INTEGER" property="sort"/>
|
<result column="TMODEL_DISABLED" jdbcType="INTEGER" property="disabled"/>
|
</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_ATTRIBUTE_DATA" jdbcType="INTEGER" property="attributeData"/>
|
<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="pgmodel" javaType="doumeemes.dao.business.model.Device">
|
<id column="PGMODEL_ID" jdbcType="INTEGER" property="id"/>
|
<result column="PGMODEL_DELETED" jdbcType="TINYINT" property="deleted"/>
|
<result column="PGMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/>
|
<result column="PGMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
|
<result column="PGMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/>
|
<result column="PGMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
|
<result column="PGMODEL_REMARK" jdbcType="VARCHAR" property="remark"/>
|
<result column="PGMODEL_ROOT_DEPART_ID" jdbcType="INTEGER" property="rootDepartId"/>
|
<result column="PGMODEL_DEPART_ID" jdbcType="INTEGER" property="departId"/>
|
<result column="PGMODEL_PROCEDURE_ID" jdbcType="INTEGER" property="procedureId"/>
|
<result column="PGMODEL_CODE" jdbcType="INTEGER" property="code"/>
|
<result column="PGMODEL_TYPE" jdbcType="TINYINT" property="type"/>
|
<result column="PGMODEL_NAME" jdbcType="VARCHAR" property="name"/>
|
<result column="PGMODEL_MODEL" jdbcType="VARCHAR" property="model"/>
|
<result column="PGMODEL_STATUS" jdbcType="TINYINT" property="status"/>
|
<result column="PGMODEL_SUPPLIER" jdbcType="VARCHAR" property="supplier"/>
|
<result column="PGMODEL_STATION_CODE" jdbcType="VARCHAR" property="stationCode"/>
|
<result column="PGMODEL_GROUP_ID" jdbcType="INTEGER" property="groupId"/>
|
<result column="PGMODEL_SERIAL_NUM" jdbcType="VARCHAR" property="serialNum"/>
|
</association>
|
</resultMap>
|
<select id="selectOne" parameterType="doumeemes.dao.business.model.Workorder" resultType="doumeemes.dao.business.model.Workorder">
|
SELECT
|
`a`.*,c.needcheck,c.`ISCALCULATE` as iscalculate,ifnull(p.num,0) as totalPlanNum,
|
`pgmodel`.`PRODUCE_WAREHOUSE_LOCATION_ID` AS produceWarehouseLocationId,
|
`pgmodel`.`FINISH_WAREHOUSE_LOCATION_ID` AS finishWarehouseLocationId,
|
w. `WAREHOUSE_ID` as produceWarehouseId,
|
f. `WAREHOUSE_ID` as finishWarehouseId
|
<if test="queryFlag !=null and queryFlag ==1">
|
,(select sum(b.num) from workorder_record b where b.deleted=0 and b.type=0 and b.workorder_id=a.id) as hasMaterialNum
|
,(select sum(b.num) from workorder_record b where b.deleted=0 and b.type=1 and b.workorder_id=a.id) as hasProduceNum
|
,(select sum(b.`UNQUALIFIED_NUM`) from workorder_check b where b.deleted=0 and b.workorder_id=a.id) as hasUnqulifiedNum
|
</if>
|
FROM `workorder` `a`
|
LEFT JOIN `device` `pgmodel` ON a.PRO_GROUP_ID=pgmodel.ID
|
LEFT JOIN `procedures` c ON `a`.`PROCEDURE_ID`=c.ID
|
LEFT JOIN `plans` p ON `a`.`PLAN_ID`=p.ID
|
LEFT JOIN `warehouse_location` w ON `pgmodel`.`PRODUCE_WAREHOUSE_LOCATION_ID`=w.ID
|
LEFT JOIN `warehouse_location` f ON `pgmodel`.`FINISH_WAREHOUSE_LOCATION_ID`=f.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="paused != null">
|
AND `a`.`PAUSED` = #{paused}
|
</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="type != null and type != ''">
|
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="planId != null">
|
AND `a`.`PLAN_ID` = #{planId}
|
</if>
|
<if test="factoryId != null">
|
AND `a`.`FACTORY_ID` = #{factoryId}
|
</if>
|
<if test="procedureId != null">
|
AND `a`.`PROCEDURE_ID` = #{procedureId}
|
</if>
|
<if test="code != null and code != ''">
|
AND `a`.`CODE` = #{code}
|
</if>
|
<if test="originWorkorderId != null">
|
AND `a`.`ORIGIN_WORKORDER_ID` = #{originWorkorderId}
|
</if>
|
<if test="typeId != null">
|
AND `a`.`TYPE_ID` = #{typeId}
|
</if>
|
<if test="originId != null">
|
AND `a`.`ORIGIN_ID` = #{originId}
|
</if>
|
<if test="planDate != null">
|
AND `a`.`PLAN_DATE` = #{planDate}
|
</if>
|
<if test="planNum != null">
|
AND `a`.`PLAN_NUM` = #{planNum}
|
</if>
|
<if test="materialId != null">
|
AND `a`.`MATERIAL_ID` = #{materialId}
|
</if>
|
<if test="unitId != null">
|
AND `a`.`UNIT_ID` = #{unitId}
|
</if>
|
<if test="batch != null and batch != ''">
|
AND `a`.`BATCH` = #{batch}
|
</if>
|
<if test="proUserId != null">
|
AND `a`.`PRO_USER_ID` = #{proUserId}
|
</if>
|
<if test="proGroupId != null">
|
AND `a`.`PRO_GROUP_ID` = #{proGroupId}
|
</if>
|
<if test="qualifiedNum != null">
|
AND `a`.`QUALIFIED_NUM` = #{qualifiedNum}
|
</if>
|
<if test="unqualifiedNum != null">
|
AND `a`.`UNQUALIFIED_NUM` = #{unqualifiedNum}
|
</if>
|
<if test="checkUserId != null">
|
AND `a`.`CHECK_USER_ID` = #{checkUserId}
|
</if>
|
<if test="status != null">
|
AND `a`.`STATUS` = #{status}
|
</if>
|
<if test="lastDealDate != null">
|
AND `a`.`LAST_DEAL_DATE` = #{lastDealDate}
|
</if>
|
<if test="lastDealInfo != null and lastDealInfo != ''">
|
AND `a`.`LAST_DEAL_INFO` = #{lastDealInfo}
|
</if>
|
<if test="urgent != null">
|
AND `a`.`URGENT` = #{urgent}
|
</if>
|
<if test="backorderId != null">
|
AND `a`.`BACKORDER_ID` = #{backorderId}
|
</if>
|
</where>
|
</select>
|
<select id="selectByModel" parameterType="doumeemes.dao.ext.dto.QueryWorkorderExtDTO" resultMap="WorkorderExtListVO">
|
SELECT
|
`a`.*,
|
p.name as procedureName,
|
p.needcheck as procedureNeedcheck,
|
u.realname as proUserName,
|
cu.realname as userName,
|
`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,
|
`pmodel`.`ID` AS PMODEL_ID,
|
`pmodel`.`DELETED` AS PMODEL_DELETED,
|
`pmodel`.`CREATE_USER` AS PMODEL_CREATE_USER,
|
`pmodel`.`CREATE_TIME` AS PMODEL_CREATE_TIME,
|
`pmodel`.`UPDATE_USER` AS PMODEL_UPDATE_USER,
|
`pmodel`.`UPDATE_TIME` AS PMODEL_UPDATE_TIME,
|
`pmodel`.`REMARK` AS PMODEL_REMARK,
|
`pmodel`.`ROOT_DEPART_ID` AS PMODEL_ROOT_DEPART_ID,
|
`pmodel`.`DEPART_ID` AS PMODEL_DEPART_ID,
|
`pmodel`.`ORIGIN` AS PMODEL_ORIGIN,
|
`pmodel`.`PLAN_DATE` AS PMODEL_PLAN_DATE,
|
`pmodel`.`MATERIAL_ID` AS PMODEL_MATERIAL_ID,
|
`pmodel`.`PROCEDURE_ID` AS PMODEL_PROCEDURE_ID,
|
`pmodel`.`FACTORY_ID` AS PMODEL_FACTORY_ID,
|
`pmodel`.`UNIT_ID` AS PMODEL_UNIT_ID,
|
`pmodel`.`NUM` AS PMODEL_NUM,
|
`pmodel`.`BATCH` AS PMODEL_BATCH,
|
`pmodel`.`URGENT` AS PMODEL_URGENT,
|
`pmodel`.`IMPORT_ID` AS PMODEL_IMPORT_ID,
|
`pmodel`.`USER_ID` AS PMODEL_USER_ID,
|
`pmodel`.`STATUS` AS PMODEL_STATUS,
|
`pmodel`.`PUBLISH_DATE` AS PMODEL_PUBLISH_DATE,
|
`fmodel`.`ID` AS FMODEL_ID,
|
`fmodel`.`DELETED` AS FMODEL_DELETED,
|
`fmodel`.`CREATE_USER` AS FMODEL_CREATE_USER,
|
`fmodel`.`CREATE_TIME` AS FMODEL_CREATE_TIME,
|
`fmodel`.`UPDATE_USER` AS FMODEL_UPDATE_USER,
|
`fmodel`.`UPDATE_TIME` AS FMODEL_UPDATE_TIME,
|
`fmodel`.`NAME` AS FMODEL_NAME,
|
`fmodel`.`REMARK` AS FMODEL_REMARK,
|
`fmodel`.`ROOT_ID` AS FMODEL_ROOT_ID,
|
`fmodel`.`PARENT_ID` AS FMODEL_PARENT_ID,
|
`fmodel`.`COMPANY_ID` AS FMODEL_COMPANY_ID,
|
`fmodel`.`TYPE` AS FMODEL_TYPE,
|
`fmodel`.`ERP_ID` AS FMODEL_ERP_ID,
|
`fmodel`.`STATUS` AS FMODEL_STATUS,
|
`fmodel`.`VALID_TIME` AS FMODEL_VALID_TIME,
|
`fmodel`.`INVALID_TIME` AS FMODEL_INVALID_TIME,
|
`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`.`DICT_ID` AS TMODEL_DICT_ID,
|
`tmodel`.`CODE` AS TMODEL_CODE,
|
`tmodel`.`LABEL` AS TMODEL_LABEL,
|
`tmodel`.`SORT` AS TMODEL_SORT,
|
`tmodel`.`DISABLED` AS TMODEL_DISABLED,
|
`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`.`ATTRIBUTE_DATA` AS UMODEL_ATTRIBUTE_DATA,
|
`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,
|
`pgmodel`.`ID` AS PGMODEL_ID,
|
`pgmodel`.`DELETED` AS PGMODEL_DELETED,
|
`pgmodel`.`CREATE_USER` AS PGMODEL_CREATE_USER,
|
`pgmodel`.`CREATE_TIME` AS PGMODEL_CREATE_TIME,
|
`pgmodel`.`UPDATE_USER` AS PGMODEL_UPDATE_USER,
|
`pgmodel`.`UPDATE_TIME` AS PGMODEL_UPDATE_TIME,
|
`pgmodel`.`REMARK` AS PGMODEL_REMARK,
|
`pgmodel`.`ROOT_DEPART_ID` AS PGMODEL_ROOT_DEPART_ID,
|
`pgmodel`.`DEPART_ID` AS PGMODEL_DEPART_ID,
|
`pgmodel`.`PROCEDURE_ID` AS PGMODEL_PROCEDURE_ID,
|
`pgmodel`.`CODE` AS PGMODEL_CODE,
|
`pgmodel`.`TYPE` AS PGMODEL_TYPE,
|
`pgmodel`.`NAME` AS PGMODEL_NAME,
|
`pgmodel`.`MODEL` AS PGMODEL_MODEL,
|
`pgmodel`.`STATUS` AS PGMODEL_STATUS,
|
`pgmodel`.`SUPPLIER` AS PGMODEL_SUPPLIER,
|
`pgmodel`.`STATION_CODE` AS PGMODEL_STATION_CODE,
|
`pgmodel`.`GROUP_ID` AS PGMODEL_GROUP_ID,
|
`pgmodel`.`SERIAL_NUM` AS PGMODEL_SERIAL_NUM,
|
`pgmodel`.`PRODUCE_WAREHOUSE_LOCATION_ID` AS PGMODEL_PRODUCE_WAREHOUSE_LOCATION_ID,
|
p.`ISCALCULATE` as iscalculate,
|
(select sum(ifnull(num,0)) from workorder_record r where r.deleted=0 and r.type=1 and r.workorder_id=a.id) as proNum
|
FROM `workorder` `a`
|
LEFT JOIN `department` `dmodel` ON a.DEPART_ID=dmodel.ID
|
LEFT JOIN `plans` `pmodel` ON a.PLAN_ID=pmodel.ID
|
LEFT JOIN `department` `fmodel` ON a.FACTORY_ID=fmodel.ID
|
LEFT JOIN `system_dict_data` `tmodel` ON a.TYPE_ID=tmodel.ID
|
LEFT JOIN `material_distribute` `mdmodel` ON a.MATERIAL_ID=mdmodel.ID
|
LEFT JOIN `material` `mmodel` ON mdmodel.MATERIAL_ID=mmodel.ID
|
LEFT JOIN `unit` `umodel` ON a.UNIT_ID=umodel.ID
|
LEFT JOIN `device` `pgmodel` ON a.PRO_GROUP_ID=pgmodel.ID
|
LEFT JOIN `procedures` `p` ON a.`PROCEDURE_ID`=p.ID
|
LEFT JOIN `system_user` `u` ON `a`.`PRO_USER_ID`=u.ID
|
LEFT JOIN `system_user` `cu` ON `a`.`CREATE_USER`=cu.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="paused != null">
|
AND `a`.`PAUSED` = #{paused}
|
</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="type != null and type != ''">
|
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="planId != null">
|
AND `a`.`PLAN_ID` = #{planId}
|
</if>
|
<if test="factoryId != null">
|
AND `a`.`FACTORY_ID` = #{factoryId}
|
</if>
|
<if test="procedureId != null">
|
AND `a`.`PROCEDURE_ID` = #{procedureId}
|
</if>
|
<if test="code != null and code != ''">
|
AND `a`.`CODE` = #{code}
|
</if>
|
<if test="originWorkorderId != null">
|
AND `a`.`ORIGIN_WORKORDER_ID` = #{originWorkorderId}
|
</if>
|
<if test="typeId != null">
|
AND `a`.`TYPE_ID` = #{typeId}
|
</if>
|
<if test="originId != null">
|
AND `a`.`ORIGIN_ID` = #{originId}
|
</if>
|
<if test="planDate != null">
|
AND `a`.`PLAN_DATE` = #{planDate}
|
</if>
|
<if test="planNum != null">
|
AND `a`.`PLAN_NUM` = #{planNum}
|
</if>
|
<if test="materialId != null">
|
AND `a`.`MATERIAL_ID` = #{materialId}
|
</if>
|
<if test="unitId != null">
|
AND `a`.`UNIT_ID` = #{unitId}
|
</if>
|
<if test="batch != null and batch != ''">
|
AND `a`.`BATCH` = #{batch}
|
</if>
|
<if test="proUserId != null">
|
AND `a`.`PRO_USER_ID` = #{proUserId}
|
</if>
|
<if test="proGroupId != null">
|
AND `a`.`PRO_GROUP_ID` = #{proGroupId}
|
</if>
|
<if test="qualifiedNum != null">
|
AND `a`.`QUALIFIED_NUM` = #{qualifiedNum}
|
</if>
|
<if test="unqualifiedNum != null">
|
AND `a`.`UNQUALIFIED_NUM` = #{unqualifiedNum}
|
</if>
|
<if test="checkUserId != null">
|
AND `a`.`CHECK_USER_ID` = #{checkUserId}
|
</if>
|
<if test="status != null">
|
AND `a`.`STATUS` = #{status}
|
</if>
|
<if test="lastDealDate != null">
|
AND `a`.`LAST_DEAL_DATE` = #{lastDealDate}
|
</if>
|
<if test="lastDealInfo != null and lastDealInfo != ''">
|
AND `a`.`LAST_DEAL_INFO` = #{lastDealInfo}
|
</if>
|
<if test="urgent != null">
|
AND `a`.`URGENT` = #{urgent}
|
</if>
|
<if test="backorderId != null">
|
AND `a`.`BACKORDER_ID` = #{backorderId}
|
</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="pmodelId != null">
|
AND `pmodel`.`ID` = #{pmodelId}
|
</if>
|
<if test="pmodelDeleted != null">
|
AND `pmodel`.`DELETED` = #{pmodelDeleted}
|
</if>
|
<if test="pmodelCreateUser != null">
|
AND `pmodel`.`CREATE_USER` = #{pmodelCreateUser}
|
</if>
|
<if test="pmodelCreateTime != null">
|
AND `pmodel`.`CREATE_TIME` = #{pmodelCreateTime}
|
</if>
|
<if test="pmodelUpdateUser != null">
|
AND `pmodel`.`UPDATE_USER` = #{pmodelUpdateUser}
|
</if>
|
<if test="pmodelUpdateTime != null">
|
AND `pmodel`.`UPDATE_TIME` = #{pmodelUpdateTime}
|
</if>
|
<if test="pmodelRemark != null and pmodelRemark != ''">
|
AND `pmodel`.`REMARK` = #{pmodelRemark}
|
</if>
|
<if test="pmodelRootDepartId != null">
|
AND `pmodel`.`ROOT_DEPART_ID` = #{pmodelRootDepartId}
|
</if>
|
<if test="pmodelDepartId != null">
|
AND `pmodel`.`DEPART_ID` = #{pmodelDepartId}
|
</if>
|
<if test="pmodelOrigin != null">
|
AND `pmodel`.`ORIGIN` = #{pmodelOrigin}
|
</if>
|
<if test="pmodelPlanDate != null">
|
AND `pmodel`.`PLAN_DATE` = #{pmodelPlanDate}
|
</if>
|
<if test="pmodelMaterialId != null">
|
AND `pmodel`.`MATERIAL_ID` = #{pmodelMaterialId}
|
</if>
|
<if test="pmodelProcedureId != null">
|
AND `pmodel`.`PROCEDURE_ID` = #{pmodelProcedureId}
|
</if>
|
<if test="pmodelFactoryId != null">
|
AND `pmodel`.`FACTORY_ID` = #{pmodelFactoryId}
|
</if>
|
<if test="pmodelUnitId != null">
|
AND `pmodel`.`UNIT_ID` = #{pmodelUnitId}
|
</if>
|
<if test="pmodelNum != null">
|
AND `pmodel`.`NUM` = #{pmodelNum}
|
</if>
|
<if test="pmodelBatch != null and pmodelBatch != ''">
|
AND `pmodel`.`BATCH` = #{pmodelBatch}
|
</if>
|
<if test="pmodelUrgent != null">
|
AND `pmodel`.`URGENT` = #{pmodelUrgent}
|
</if>
|
<if test="pmodelImportId != null">
|
AND `pmodel`.`IMPORT_ID` = #{pmodelImportId}
|
</if>
|
<if test="pmodelUserId != null">
|
AND `pmodel`.`USER_ID` = #{pmodelUserId}
|
</if>
|
<if test="pmodelStatus != null">
|
AND `pmodel`.`STATUS` = #{pmodelStatus}
|
</if>
|
<if test="pmodelPublishDate != null">
|
AND `pmodel`.`PUBLISH_DATE` = #{pmodelPublishDate}
|
</if>
|
<if test="fmodelId != null">
|
AND `fmodel`.`ID` = #{fmodelId}
|
</if>
|
<if test="fmodelDeleted != null">
|
AND `fmodel`.`DELETED` = #{fmodelDeleted}
|
</if>
|
<if test="fmodelCreateUser != null">
|
AND `fmodel`.`CREATE_USER` = #{fmodelCreateUser}
|
</if>
|
<if test="fmodelCreateTime != null">
|
AND `fmodel`.`CREATE_TIME` = #{fmodelCreateTime}
|
</if>
|
<if test="fmodelUpdateUser != null">
|
AND `fmodel`.`UPDATE_USER` = #{fmodelUpdateUser}
|
</if>
|
<if test="fmodelUpdateTime != null">
|
AND `fmodel`.`UPDATE_TIME` = #{fmodelUpdateTime}
|
</if>
|
<if test="fmodelName != null and fmodelName != ''">
|
AND `fmodel`.`NAME` = #{fmodelName}
|
</if>
|
<if test="fmodelRemark != null and fmodelRemark != ''">
|
AND `fmodel`.`REMARK` = #{fmodelRemark}
|
</if>
|
<if test="fmodelRootId != null">
|
AND `fmodel`.`ROOT_ID` = #{fmodelRootId}
|
</if>
|
<if test="fmodelParentId != null">
|
AND `fmodel`.`PARENT_ID` = #{fmodelParentId}
|
</if>
|
<if test="fmodelCompanyId != null">
|
AND `fmodel`.`COMPANY_ID` = #{fmodelCompanyId}
|
</if>
|
<if test="fmodelType != null">
|
AND `fmodel`.`TYPE` = #{fmodel
|
|
</if>
|
<if test="fmodelErpId != null and fmodelErpId != ''">
|
AND `fmodel`.`ERP_ID` = #{fmodelErpId}
|
</if>
|
<if test="fmodelStatus != null">
|
AND `fmodel`.`STATUS` = #{fmodelStatus}
|
</if>
|
<if test="fmodelValidTime != null">
|
AND `fmodel`.`VALID_TIME` = #{fmodelValidTime}
|
</if>
|
<if test="fmodelInvalidTime != null">
|
AND `fmodel`.`INVALID_TIME` = #{fmodelInvalidTime}
|
</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="tmodelDictId != null">
|
AND `tmodel`.`DICT_ID` = #{tmodelDictId}
|
</if>
|
<if test="tmodelCode != null and tmodelCode != ''">
|
AND `tmodel`.`CODE` = #{tmodelCode}
|
</if>
|
<if test="tmodelLabel != null and tmodelLabel != ''">
|
AND `tmodel`.`LABEL` = #{tmodelLabel}
|
</if>
|
<if test="tmodelSort != null">
|
AND `tmodel`.`SORT` = #{tmodelSort}
|
</if>
|
<if test="tmodelDisabled != null">
|
AND `tmodel`.`DISABLED` = #{tmodelDisabled}
|
</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="pgmodelId != null">
|
AND `pgmodel`.`ID` = #{pgmodelId}
|
</if>
|
<if test="pgmodelDeleted != null">
|
AND `pgmodel`.`DELETED` = #{pgmodelDeleted}
|
</if>
|
<if test="pgmodelCreateUser != null">
|
AND `pgmodel`.`CREATE_USER` = #{pgmodelCreateUser}
|
</if>
|
<if test="pgmodelCreateTime != null">
|
AND `pgmodel`.`CREATE_TIME` = #{pgmodelCreateTime}
|
</if>
|
<if test="pgmodelUpdateUser != null">
|
AND `pgmodel`.`UPDATE_USER` = #{pgmodelUpdateUser}
|
</if>
|
<if test="pgmodelUpdateTime != null">
|
AND `pgmodel`.`UPDATE_TIME` = #{pgmodelUpdateTime}
|
</if>
|
<if test="pgmodelRemark != null and pgmodelRemark != ''">
|
AND `pgmodel`.`REMARK` = #{pgmodelRemark}
|
</if>
|
<if test="pgmodelRootDepartId != null">
|
AND `pgmodel`.`ROOT_DEPART_ID` = #{pgmodelRootDepartId}
|
</if>
|
<if test="pgmodelDepartId != null">
|
AND `pgmodel`.`DEPART_ID` = #{pgmodelDepartId}
|
</if>
|
<if test="pgmodelProcedureId != null">
|
AND `pgmodel`.`PROCEDURE_ID` = #{pgmodelProcedureId}
|
</if>
|
<if test="pgmodelCode != null">
|
AND `pgmodel`.`CODE` = #{pgmodelCode}
|
</if>
|
<if test="pgmodelType != null">
|
AND `pgmodel`.`TYPE` = #{pgmodelType}
|
</if>
|
<if test="pgmodelName != null and pgmodelName != ''">
|
AND `pgmodel`.`NAME` = #{pgmodelName}
|
</if>
|
<if test="pgmodelModel != null and pgmodelModel != ''">
|
AND `pgmodel`.`MODEL` = #{pgmodelModel}
|
</if>
|
<if test="pgmodelStatus != null">
|
AND `pgmodel`.`STATUS` = #{pgmodelStatus}
|
</if>
|
<if test="pgmodelSupplier != null and pgmodelSupplier != ''">
|
AND `pgmodel`.`SUPPLIER` = #{pgmodelSupplier}
|
</if>
|
<if test="pgmodelStationCode != null and pgmodelStationCode != ''">
|
AND `pgmodel`.`STATION_CODE` = #{pgmodelStationCode}
|
</if>
|
<if test="pgmodelGroupId != null">
|
AND `pgmodel`.`GROUP_ID` = #{pgmodelGroupId}
|
</if>
|
<if test="pgmodelSerialNum != null and pgmodelSerialNum != ''">
|
AND `pgmodel`.`SERIAL_NUM` = #{pgmodelSerialNum}
|
</if>
|
<choose>
|
<when test="departIds != null and departIds.size()>0">
|
AND ( `a`.`CREATE_USER` = #{createUser} or
|
exists (select d.id from workorder_user d where d.WORKORDER_ID=a.id and d.DELETED=0 and d.PRO_USER_ID=#{createUser} )
|
or exists (select d.id from company_user d where d.user_id= a.CREATE_USER and d.department_id
|
in <foreach collection="departIds" item="item" separator="," open="(" close=")">#{item}</foreach>)
|
or exists (select d.id from workorder_user wu left join company_user d on wu.PRO_USER_ID=d.USER_ID and d.DELETED=0 where wu.WORKORDER_ID= a.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 exists (select d.id from workorder_user d where d.WORKORDER_ID=a.id and d.DELETED=0 and d.PRO_USER_ID=#{createUser} ))
|
</if>
|
</otherwise>
|
</choose>
|
</where>
|
limit 1
|
</select>
|
|
<update id="updateByPlan" parameterType="doumeemes.dao.business.model.Workorder">
|
update `workorder`
|
<set>
|
<if test="deleted != null">
|
`DELETED` = #{deleted},
|
</if>
|
<if test="createUser != null">
|
`CREATE_USER` = #{createUser},
|
</if>
|
<if test="createTime != null">
|
`CREATE_TIME` = #{createTime},
|
</if>
|
<if test="updateUser != null">
|
`UPDATE_USER` = #{updateUser},
|
</if>
|
<if test="updateTime != null">
|
`UPDATE_TIME` = #{updateTime},
|
</if>
|
<if test="remark != null">
|
`REMARK` = #{remark},
|
</if>
|
<if test="rootDepartId != null">
|
`ROOT_DEPART_ID` = #{rootDepartId},
|
</if>
|
<if test="departId != null">
|
`DEPART_ID` = #{departId},
|
</if>
|
<if test="planId != null">
|
`PLAN_ID` = #{planId},
|
</if>
|
<if test="factoryId != null">
|
`FACTORY_ID` = #{factoryId},
|
</if>
|
<if test="procedureId != null">
|
`PROCEDURE_ID` = #{procedureId},
|
</if>
|
<if test="code != null">
|
`CODE` = #{code},
|
</if>
|
<if test="originWorkorderId != null">
|
`ORIGIN_WORKORDER_ID` = #{originWorkorderId},
|
</if>
|
<if test="typeId != null">
|
`TYPE_ID` = #{typeId},
|
</if>
|
<if test="originId != null">
|
`ORIGIN_ID` = #{originId},
|
</if>
|
<if test="planDate != null">
|
`PLAN_DATE` = #{planDate},
|
</if>
|
<if test="planNum != null">
|
`PLAN_NUM` = #{planNum},
|
</if>
|
<if test="materialId != null">
|
`MATERIAL_ID` = #{materialId},
|
</if>
|
<if test="unitId != null">
|
`UNIT_ID` = #{unitId},
|
</if>
|
<if test="batch != null">
|
`BATCH` = #{batch},
|
</if>
|
<if test="proUserId != null">
|
`PRO_USER_ID` = #{proUserId},
|
</if>
|
<if test="proGroupId != null">
|
`PRO_GROUP_ID` = #{proGroupId},
|
</if>
|
<if test="qualifiedNum != null">
|
`QUALIFIED_NUM` = #{qualifiedNum},
|
</if>
|
<if test="unqualifiedNum != null">
|
`UNQUALIFIED_NUM` = #{unqualifiedNum},
|
</if>
|
<if test="checkUserId != null">
|
`CHECK_USER_ID` = #{checkUserId},
|
</if>
|
<if test="status != null">
|
`STATUS` = #{status},
|
</if>
|
<if test="lastDealDate != null">
|
`LAST_DEAL_DATE` = #{lastDealDate},
|
</if>
|
<if test="lastDealInfo != null">
|
`LAST_DEAL_INFO` = #{lastDealInfo},
|
</if>
|
<if test="urgent != null">
|
`URGENT` = #{urgent},
|
</if>
|
<if test="paused != null">
|
`PAUSED` = #{paused},
|
</if>
|
<if test="backorderId != null">
|
`BACKORDER_ID` = #{backorderId}
|
</if>
|
</set>
|
where id in
|
<foreach collection="ids" separator="," item="item" open="(" close=")">
|
#{item}
|
</foreach>
|
</update>
|
|
|
|
<select id="workOrderForWTransferConfirm" resultType="doumeemes.dao.ext.bean.WTransferConfirmWorkOrderBean">
|
select w.id,w.`CODE` as workOrderNo , w.PLAN_DATE as planDate , m.`NAME` as materialName ,
|
u.`NAME` as unitName , w.BATCH as batch , w.PLAN_NUM as planNum , cu.`NAME` as worker ,
|
d.`NAME` as groupName ,
|
case when w.type = 0 then '合格品加工' when w.type = 1 then '返工加工' else '客户返修' end typeDetail ,
|
p.name as procedureName
|
from workorder 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 company_user cu on w.PRO_USER_ID = cu.USER_ID and cu.DELETED = 0 and cu.ROOT_DEPART_ID = w.ROOT_DEPART_ID
|
left join department d on cu.DEPARTMENT_ID = d.id
|
left join procedures p on w.PROCEDURE_ID = p.id
|
where 1 = 1 and
|
FIND_IN_SET(w.id ,#{ids})
|
</select>
|
|
|
</mapper>
|