From fea22e82e7e49691f6e0c20a29b228d0ab3173e9 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期三, 29 十月 2025 17:08:38 +0800
Subject: [PATCH] 修改问题
---
ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml | 63 ++++++++++++++++++++++++++++++-
1 files changed, 60 insertions(+), 3 deletions(-)
diff --git a/ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml
index 6af2bf0..23545c9 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml
@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycl.platform.mapper.YwUnitMapper">
- <resultMap type="YwUnit" id="YwUnitResult">
+ <resultMap type="YwUnitVo" id="YwUnitResult">
<result property="id" column="id" />
<result property="unitCode" column="unit_code" />
<result property="unitName" column="unit_name" />
@@ -13,8 +13,6 @@
<result property="unitAdminAccount" column="unit_admin_account" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- <result property="deleted" column="deleted" />
</resultMap>
<sql id="selectYwUnitVo">
@@ -33,6 +31,43 @@
<select id="selectYwUnitById" parameterType="Long" resultMap="YwUnitResult">
<include refid="selectYwUnitVo"/>
where id = #{id}
+ </select>
+
+ <select id="workList" resultType="integer">
+ SELECT
+ 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'
+ 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.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="(" close=")" separator="," item="errorType">
+ #{errorType}
+ </foreach>
+ ))
+ </if>
</select>
<insert id="insertYwUnit" parameterType="YwUnit" useGeneratedKeys="true" keyProperty="id">
@@ -87,4 +122,26 @@
#{id}
</foreach>
</delete>
+
+ <select id="getByUserId" resultMap="YwUnitResult">
+ SELECT
+ tyw.*
+ FROM
+ t_yw_unit tyw
+ INNER JOIN t_unit_people tup ON tup.unit_id = tyw.id and tyw.deleted = 0
+ INNER JOIN t_yw_people typ ON tup.yw_people_id = typ.id AND typ.user_id = #{userId} AND typ.deleted = 0
+ </select>
+
+ <select id="ywUnitCount" resultType="java.util.Map">
+ SELECT
+ u.unit_name AS name,
+ COUNT(tcs.id) AS num,
+ 100 - SUM(score) AS score
+ FROM
+ t_contract_score tcs
+ LEFT JOIN t_yw_unit u ON tcs.unit_id = u.id
+ WHERE tcs.deleted = 0
+ GROUP BY tcs.unit_id
+ ORDER BY score DESC
+ </select>
</mapper>
--
Gitblit v1.8.0