From f0ec80a9eb4d12aca25f311fecf8f6e5edf8c577 Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期三, 06 十一月 2024 16:47:00 +0800 Subject: [PATCH] 工单加搜索table、一些搜索bug --- ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml | 46 ++++++--- ycl-server/src/main/java/com/ycl/platform/service/impl/YwUnitServiceImpl.java | 2 ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml | 97 +++++++++++-------- ycl-pojo/src/main/java/com/ycl/platform/domain/query/DistributeWorkOrderQuery.java | 22 +++- ycl-pojo/src/main/java/com/ycl/platform/domain/entity/ContractScore.java | 8 ycl-pojo/src/main/java/com/ycl/platform/domain/query/YwPointQuery.java | 3 ycl-pojo/src/main/java/com/ycl/platform/domain/vo/WorkOrderVO.java | 6 ycl-server/src/main/resources/mapper/zgyw/WorkOrderWhiteMapper.xml | 13 +- ycl-server/src/main/java/com/ycl/platform/service/impl/ContractScoreServiceImpl.java | 27 ++++- ycl-server/src/main/resources/mapper/zgyw/YwPointMapper.xml | 3 ycl-pojo/src/main/java/com/ycl/platform/domain/query/WorkOrderWhiteQuery.java | 3 ycl-server/src/main/java/com/ycl/platform/service/impl/ContractResultServiceImpl.java | 13 +- ycl-server/src/main/java/com/ycl/platform/service/impl/WorkOrderServiceImpl.java | 7 + 13 files changed, 161 insertions(+), 89 deletions(-) diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/ContractScore.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/ContractScore.java index 11ae380..baacc38 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/ContractScore.java +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/ContractScore.java @@ -89,19 +89,19 @@ //鏌ヨ鏉′欢 @TableField(exist = false) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd") private Date createStartTime; @TableField(exist = false) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd") private Date createEndTime; @TableField(exist = false) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd") private Date auditingStartTime; @TableField(exist = false) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd") private Date auditingEndTime; } diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/query/DistributeWorkOrderQuery.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/query/DistributeWorkOrderQuery.java index cfefabe..015d175 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/query/DistributeWorkOrderQuery.java +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/query/DistributeWorkOrderQuery.java @@ -1,15 +1,11 @@ package com.ycl.platform.domain.query; -import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonProperty; import com.ycl.platform.base.AbsQuery; -import enumeration.general.FastDistributeTypeEnum; -import enumeration.general.WorkOrderStatusEnum; import io.swagger.annotations.ApiModel; -import jakarta.validation.constraints.Min; -import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.experimental.Accessors; +import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; import java.util.List; @@ -52,5 +48,21 @@ */ private String status; + /** + * 鐘舵�佷笉涓哄緟涓嬪彂(宸ュ崟鍒楄〃澶嶇敤) + */ + private Boolean isNotDistribute; + + /** + * 杩愮淮澶勭悊鏃堕棿 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date start; + + /** + * 杩愮淮澶勭悊鏃堕棿 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date end; } diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/query/WorkOrderWhiteQuery.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/query/WorkOrderWhiteQuery.java index f3bc54f..954dfa6 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/query/WorkOrderWhiteQuery.java +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/query/WorkOrderWhiteQuery.java @@ -15,6 +15,5 @@ @Accessors(chain = true) @ApiModel(value = "宸ュ崟鐧藉悕鍗曟煡璇�", description = "宸ュ崟鐧藉悕鍗曟煡璇�") public class WorkOrderWhiteQuery extends AbsQuery { - private String serialNumber; - private String pointName; + private String keyword; } diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/query/YwPointQuery.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/query/YwPointQuery.java index ab67966..0c05fac 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/query/YwPointQuery.java +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/query/YwPointQuery.java @@ -22,7 +22,8 @@ public class YwPointQuery extends AbsQuery { /** 鍏抽敭璇� */ private String keyword; - + /** 鍗曚綅 */ + private Integer unitId; /** 鍔ㄦ�佸垪鐨勮〃鏄庢潯浠� */ private String tableName = "t_yw_point"; diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/WorkOrderVO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/WorkOrderVO.java index 95fbeb0..1cdc1eb 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/WorkOrderVO.java +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/WorkOrderVO.java @@ -40,7 +40,7 @@ /** 杩愮淮鍗曚綅 */ private Integer unitId; - @Excel(name = "杩愮淮鍗曚綅",sort = 4) + @Excel(name = "杩愮淮鍗曚綅",sort = 5) private String unitName; private String unitContact; private String unitContactPhone; @@ -48,7 +48,9 @@ /** 宸ュ崟鏉ユ簮/璁惧鍚嶇О */ @Excel(name = "璁惧鍚嶇О",sort = 3) private String source; - + /** ip */ + @Excel(name = "IP",sort = 4) + private String ip; /** * 璁惧缂栧彿 */ diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/ContractResultServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/ContractResultServiceImpl.java index aa2682d..8843ace 100644 --- a/ycl-server/src/main/java/com/ycl/platform/service/impl/ContractResultServiceImpl.java +++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/ContractResultServiceImpl.java @@ -51,12 +51,15 @@ */ @Override public List<ContractResultVO> selectCheckResultList(ContractResultVO contractResult) { - Integer unitId = SecurityUtils.getUnitId(); - Long uid = null; - if (Objects.nonNull(unitId)) { - uid = Long.valueOf(unitId); + //閬垮厤鏌ヨ鏉′欢澶辨晥 + if(contractResult.getUnitId()==null) { + Integer unitId = SecurityUtils.getUnitId(); + Long uid = null; + if (Objects.nonNull(unitId)) { + uid = Long.valueOf(unitId); + } + contractResult.setUnitId(uid); } - contractResult.setUnitId(uid); return checkResultMapper.selectCheckResultList(contractResult); } diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/ContractScoreServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/ContractScoreServiceImpl.java index f23b814..010b6fc 100644 --- a/ycl-server/src/main/java/com/ycl/platform/service/impl/ContractScoreServiceImpl.java +++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/ContractScoreServiceImpl.java @@ -9,6 +9,7 @@ import com.ycl.platform.mapper.YwUnitMapper; import com.ycl.platform.service.IContractScoreService; import com.ycl.system.entity.SysUser; +import com.ycl.utils.DateUtils; import com.ycl.utils.SecurityUtils; import enumeration.general.AuditingStatus; import lombok.RequiredArgsConstructor; @@ -42,12 +43,28 @@ */ @Override public List<ContractScore> selectDefaultScoreList(ContractScore contractScore) { - Integer unitId = SecurityUtils.getUnitId(); - Long uid = null; - if (Objects.nonNull(unitId)) { - uid = Long.valueOf(unitId); + //閬垮厤鎼滅储鏉′欢澶辨晥 + if(contractScore.getUnitId()==null) { + //TODO:鏁版嵁鏉冮檺(鏆傛椂涓嶇煡閬撹涓嶈鏁版嵁鏉冮檺) + Integer unitId = SecurityUtils.getUnitId(); + Long uid = null; + if (Objects.nonNull(unitId)) { + uid = Long.valueOf(unitId); + } + contractScore.setUnitId(uid); } - contractScore.setUnitId(uid); + if(contractScore.getCreateStartTime()!=null) { + contractScore.setCreateStartTime(DateUtils.getDayStart(contractScore.getCreateStartTime())); + } + if(contractScore.getCreateEndTime()!=null) { + contractScore.setCreateEndTime(DateUtils.getDayStart(contractScore.getCreateEndTime())); + } + if(contractScore.getAuditingStartTime()!=null) { + contractScore.setAuditingStartTime(DateUtils.getDayStart(contractScore.getAuditingStartTime())); + } + if(contractScore.getAuditingEndTime()!=null) { + contractScore.setAuditingEndTime(DateUtils.getDayStart(contractScore.getAuditingEndTime())); + } return contractScoreMapper.selectDefaultScoreList(contractScore); } diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/WorkOrderServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/WorkOrderServiceImpl.java index fe5aea3..241e65b 100644 --- a/ycl-server/src/main/java/com/ycl/platform/service/impl/WorkOrderServiceImpl.java +++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/WorkOrderServiceImpl.java @@ -217,11 +217,12 @@ return Boolean.TRUE; } List<String> willAddSerialNumber = waitAddList.stream().map(WorkOrder::getSerialNumber).collect(Collectors.toList()); - //鍙敓鎴愯�冩牳璁惧鐨勫伐鍗� + //鍙敓鎴愯�冩牳璁惧銆佷笖鏈夎繍缁村崟浣嶇殑宸ュ崟 List<YwPoint> pointList = new LambdaQueryChainWrapper<>(ywPointService.getBaseMapper()) .select(YwPoint::getUnitId, YwPoint::getSerialNumber, YwPoint::getImportantTag, YwPoint::getImportantTag, YwPoint::getProvinceTag, YwPoint::getImportantCommandImageTag) .in(YwPoint::getSerialNumber, willAddSerialNumber) .eq(YwPoint::getExamineStatus, Boolean.TRUE) + .isNotNull(YwPoint::getUnitId) .list(); Map<String, YwPoint> pointMapping = pointList.stream().collect(Collectors.toMap(YwPoint::getSerialNumber, point -> point)); // 鏌ュ嚭閲嶇偣鐐逛綅銆佹櫘閫氱偣浣嶇殑澶勭悊鏃堕棿 @@ -577,7 +578,9 @@ @Override public Result page(WorkOrderQuery query) { IPage<WorkOrderVO> page = PageUtil.getPage(query, WorkOrderVO.class); - query.setUnitId(SecurityUtils.getUnitId()); + if(query.getUnitId()==null) { + query.setUnitId(SecurityUtils.getUnitId()); + } query.setStart(DateUtils.getDayStart(query.getStart())); query.setEnd(DateUtils.getDayEnd(query.getEnd())); baseMapper.page(page, query); diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/YwUnitServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/YwUnitServiceImpl.java index 61ebd1f..3add210 100644 --- a/ycl-server/src/main/java/com/ycl/platform/service/impl/YwUnitServiceImpl.java +++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/YwUnitServiceImpl.java @@ -216,6 +216,8 @@ @Override public Result workList(DistributeWorkOrderQuery query) { + query.setStart(DateUtils.getDayStart(query.getStart())); + query.setEnd(DateUtils.getDayEnd(query.getEnd())); List<YwUnit> ywUnits = baseMapper.selectList(null); List<YwUnitVO> lists = ywUnits.stream().map(item -> { YwUnitVO vo = new YwUnitVO(); diff --git a/ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml index fe9006f..b6307bf 100644 --- a/ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml +++ b/ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml @@ -20,6 +20,7 @@ <result column="errorType" property="errorType"/> <result column="status" property="status"/> <result column="source" property="source"/> + <result column="ip" property="ip"/> <result column="imgListStr" property="imgListStr"/> <!-- <collection property="errorTypeList" select="getErrorType" column="{workOrderNo=work_order_no,errList=errList}" ofType="string"/>--> </resultMap> @@ -51,6 +52,7 @@ u.unit_contact_phone, p.yw_person_name, tm.name as source, + tm.ip as ip, GROUP_CONCAT(DISTINCT da.dict_label ORDER BY da.dict_label SEPARATOR ',') AS errorType, GROUP_CONCAT(DISTINCT ci.img_url ORDER BY ci.create_time DESC SEPARATOR ',') AS imgListStr FROM @@ -109,6 +111,7 @@ u.unit_contact_phone, p.yw_person_name, tm.name as source, + tm.ip as ip, GROUP_CONCAT(DISTINCT da.dict_label ORDER BY da.dict_label SEPARATOR ',') AS errorType, GROUP_CONCAT(DISTINCT ci.img_url ORDER BY ci.create_time DESC SEPARATOR ',') AS imgListStr FROM @@ -151,51 +154,63 @@ <select id="distributePage" resultType="com.ycl.platform.domain.vo.WorkOrderVO"> SELECT - wo.id,wo.status, wo.work_order_no,wo.create_time, wo.unit_id, wo.yw_people_id, wo.yw_handle_time, wo.yw_result, wo.yw_check_result, wo.overtime, wo.deduct, + wo.id,wo.status, wo.work_order_no,wo.create_time, wo.unit_id, wo.yw_people_id, wo.yw_handle_time, wo.yw_result, + wo.yw_check_result, wo.overtime, wo.deduct, u.unit_name, - p.yw_person_name, - yp.serial_number, - yp.province_tag, - yp.important_tag, - yp.important_command_image_tag, - odr.create_time as distributeTime, - su.nick_name as realName, - tm.name as source, - GROUP_CONCAT(DISTINCT da.dict_label ORDER BY da.dict_label SEPARATOR '銆�') AS errorType + p.yw_person_name, + yp.serial_number, + yp.province_tag, + yp.important_tag, + yp.important_command_image_tag, + odr.create_time as distributeTime, + su.nick_name as realName, + tm.name as source, + GROUP_CONCAT(DISTINCT da.dict_label ORDER BY da.dict_label SEPARATOR '銆�') AS errorType FROM - t_work_order wo - INNER JOIN t_monitor tm ON wo.serial_number = tm.serial_number - INNER JOIN t_yw_point yp ON yp.serial_number = wo.serial_number AND yp.deleted = 0 - INNER JOIN t_work_order_error_type et ON wo.work_order_no = et.work_order_no - INNER JOIN sys_dict_data da ON da.dict_value = et.error_name AND da.dict_type = 'error_type' <if test="query.errorTypeList != null and query.errorTypeList.size() > 0">AND da.dict_value in <foreach - collection="query.errorTypeList" open="(" separator="," close=")" item="errorType">#{errorType}</foreach> </if> - INNER JOIN t_yw_unit u ON wo.unit_id = u.id and u.deleted = 0 - LEFT JOIN t_yw_people p ON wo.yw_people_id = p.id and p.deleted = 0 - LEFT JOIN t_work_order_distribute_record odr ON odr.work_order_no = wo.work_order_no AND odr.deleted = 0 - LEFT JOIN sys_user su ON su.user_id = odr.user_id + t_work_order wo + INNER JOIN t_monitor tm ON wo.serial_number = tm.serial_number + INNER JOIN t_yw_point yp ON yp.serial_number = wo.serial_number AND yp.deleted = 0 + INNER JOIN t_work_order_error_type et ON wo.work_order_no = et.work_order_no + INNER JOIN sys_dict_data da ON da.dict_value = et.error_name AND da.dict_type = 'error_type' + INNER JOIN t_yw_unit u ON wo.unit_id = u.id and u.deleted = 0 + LEFT JOIN t_yw_people p ON wo.yw_people_id = p.id and p.deleted = 0 + LEFT JOIN t_work_order_distribute_record odr ON odr.work_order_no = wo.work_order_no AND odr.deleted = 0 + LEFT JOIN sys_user su ON su.user_id = odr.user_id WHERE - wo.deleted = 0 - <if test="query.unitId != null"> - AND wo.unit_id = #{query.unitId} - </if> - <if test="query.unitId == null"> - AND wo.unit_id is not null - </if> - <if test="query.status != null and query.status != ''"> - AND wo.status = #{query.status} - </if> - <if test="query.keyword != null and query.keyword != ''"> - AND (tm.name like concat('%', #{query.keyword}, '%') or tm.serial_number like concat('%', #{query.keyword}, '%')) - </if> + wo.deleted = 0 + <if test="query.unitId != null"> + AND wo.unit_id = #{query.unitId} + </if> + <if test="query.unitId == null"> + AND wo.unit_id is not null + </if> + <if test="query.status != null and query.status != ''"> + AND wo.status = #{query.status} + </if> + <if test="query.keyword != null and query.keyword != ''"> + AND (tm.name like concat('%', #{query.keyword}, '%') or tm.serial_number like concat('%', #{query.keyword}, + '%')) + </if> + <if test="query.errorTypeList != null and query.errorTypeList.size() > 0"> + AND (EXISTS ( + SELECT 1 + FROM t_work_order_error_type twoet + WHERE twoet.work_order_no = wo.work_order_no + AND twoet.error_name in + <foreach collection="query.errorTypeList" open="(" separator="," close=")" item="errorType">#{errorType} + </foreach> + )) + </if> GROUP BY - wo.id, wo.status, wo.work_order_no,wo.create_time, wo.unit_id, wo.yw_people_id, tm.name, wo.yw_handle_time, wo.yw_result, wo.yw_check_result, wo.overtime, wo.deduct, - u.unit_name, - p.yw_person_name, - yp.province_tag, - yp.important_tag, - yp.important_command_image_tag, - odr.create_time, - su.nick_name + wo.id, wo.status, wo.work_order_no,wo.create_time, wo.unit_id, wo.yw_people_id, tm.name, wo.yw_handle_time, + wo.yw_result, wo.yw_check_result, wo.overtime, wo.deduct, + u.unit_name, + p.yw_person_name, + yp.province_tag, + yp.important_tag, + yp.important_command_image_tag, + odr.create_time, + su.nick_name ORDER BY wo.create_time DESC </select> diff --git a/ycl-server/src/main/resources/mapper/zgyw/WorkOrderWhiteMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/WorkOrderWhiteMapper.xml index 7573a34..810fadd 100644 --- a/ycl-server/src/main/resources/mapper/zgyw/WorkOrderWhiteMapper.xml +++ b/ycl-server/src/main/resources/mapper/zgyw/WorkOrderWhiteMapper.xml @@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.ycl.platform.mapper.WorkOrderWhiteMapper"> - + <resultMap type="WorkOrderWhite" id="WorkOrderWhiteResult"> <result property="id" column="id" /> <result property="serialNumber" column="serial_number" /> @@ -25,11 +25,12 @@ where serial_number = #{serialNumber} </update> - <select id="page" parameterType="Long" resultMap="WorkOrderWhiteResult"> + <select id="page" parameterType="com.ycl.platform.domain.query.WorkOrderWhiteQuery" resultMap="WorkOrderWhiteResult"> <include refid="selectWorkOrderWhiteVo"/> <where> - <if test="query.serialNumber != null and query.serialNumber != ''"> and serial_number = #{query.serialNumber}</if> - <if test="query.pointName != null and query.pointName != ''"> and point_name like concat('%', #{query.pointName}, '%')</if> + <if test="query.keyword != null and query.keyword != ''"> + and (serial_number like concat('%',#{query.keyword},'%') or point_name like concat('%', #{query.keyword}, '%')) + </if> </where> </select> <select id="selectBySerialNumber" resultType="com.ycl.platform.domain.entity.WorkOrderWhite"> @@ -57,7 +58,7 @@ </insert> <delete id="deleteWorkOrderWhiteByIds" parameterType="String"> - delete from t_work_order_white where id in + delete from t_work_order_white where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> @@ -68,4 +69,4 @@ #{id} </foreach> </delete> -</mapper> \ No newline at end of file +</mapper> diff --git a/ycl-server/src/main/resources/mapper/zgyw/YwPointMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/YwPointMapper.xml index 37499af..e4e9379 100644 --- a/ycl-server/src/main/resources/mapper/zgyw/YwPointMapper.xml +++ b/ycl-server/src/main/resources/mapper/zgyw/YwPointMapper.xml @@ -80,6 +80,9 @@ <if test="query.pointName != null and query.pointName != ''"> AND typ.point_name like concat('%', #{query.pointName}, '%') </if> + <if test="query.unitId != null"> + AND typ.unit_id = #{query.unitId} + </if> </where> </select> diff --git a/ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml index 159fc09..b88a779 100644 --- a/ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml +++ b/ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml @@ -35,24 +35,38 @@ <select id="workList" resultType="integer"> SELECT - count(DISTINCT wo.id) + count(DISTINCT wo.id) FROM - t_work_order wo - INNER JOIN t_monitor tm ON wo.serial_number = tm.serial_number - INNER JOIN t_yw_point yp ON yp.serial_number = wo.serial_number AND yp.deleted = 0 - INNER JOIN t_work_order_error_type et ON wo.work_order_no = et.work_order_no - INNER JOIN sys_dict_data da ON da.dict_value = et.error_name AND da.dict_type = 'error_type' - <if test="query.errorTypeList != null and query.errorTypeList.size() > 0">AND da.dict_value in <foreach - collection="query.errorTypeList" open="(" separator="," close=")" item="errorType">#{errorType}</foreach> - </if> + t_work_order wo + INNER JOIN t_monitor tm ON wo.serial_number = tm.serial_number + INNER JOIN t_yw_point yp ON yp.serial_number = wo.serial_number AND yp.deleted = 0 + INNER JOIN t_work_order_error_type et ON wo.work_order_no = et.work_order_no + INNER JOIN sys_dict_data da ON da.dict_value = et.error_name AND da.dict_type = 'error_type' WHERE - wo.unit_id = #{query.unitId} AND wo.deleted = 0 - <if test="query.status != null and query.status != ''"> - AND wo.status = #{query.status} - </if> - <if test="query.keyword != null and query.keyword != ''"> - AND (tm.name like concat('%', #{query.keyword}, '%') or tm.serial_number like concat('%', #{query.keyword}, '%')) - </if> + wo.unit_id = #{query.unitId} AND wo.deleted = 0 + <if test="query.status != null and query.status != ''"> + AND wo.status = #{query.status} + </if> + <if test="query.isNotDistribute != null and query.isNotDistribute"> + AND wo.status != 'WAIT_DISTRIBUTE' + </if> + <if test="query.keyword != null and query.keyword != ''"> + AND (tm.name like concat('%', #{query.keyword}, '%') or tm.serial_number like concat('%', #{query.keyword}, + '%')) + </if> + <if test="query.start != null and query.end != null"> + AND wo.create_time BETWEEN #{query.start} AND #{query.end} + </if> + <if test="query.errorTypeList != null and query.errorTypeList.size() > 0"> + AND (EXISTS ( + SELECT 1 + FROM t_work_order_error_type twoet + WHERE twoet.work_order_no = wo.work_order_no + AND twoet.error_name in + <foreach collection="query.errorTypeList" open="(" separator="," close=")" item="errorType">#{errorType} + </foreach> + )) + </if> </select> <insert id="insertYwUnit" parameterType="YwUnit" useGeneratedKeys="true" keyProperty="id"> -- Gitblit v1.8.0