From 3bf7e93280dfb00e6a1a9cee5a841ba5c5aeb863 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期二, 15 十月 2024 10:48:37 +0800
Subject: [PATCH] 考核积分刷新功能
---
ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml | 46 ++++++++++++++++++----------------------------
1 files changed, 18 insertions(+), 28 deletions(-)
diff --git a/ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml
index 8c06409..159fc09 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml
@@ -33,36 +33,26 @@
where id = #{id}
</select>
- <select id="workList" resultType="com.ycl.platform.domain.vo.YwUnitVO">
+ <select id="workList" resultType="integer">
SELECT
- u.id AS id, u.unit_name, count(DISTINCT wot.id) AS work_order_count
+ count(DISTINCT wo.id)
FROM
- t_yw_unit u
- LEFT JOIN
- (
- SELECT
- wo.id,
- wo.unit_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>
- WHERE
- 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>
- ) as wot ON wot.unit_id = u.id
- WHERE u.deleted = 0
- group by u.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'
+ <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>
+ 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>
</select>
<insert id="insertYwUnit" parameterType="YwUnit" useGeneratedKeys="true" keyProperty="id">
--
Gitblit v1.8.0