From 28f6317f7189d5c4a7e64f57dd6c7fc2011f8632 Mon Sep 17 00:00:00 2001
From: Fancy <Fancy.fx@outlook.com>
Date: 星期二, 07 一月 2025 15:41:46 +0800
Subject: [PATCH] attend user
---
pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml
index b31a6a2..ade031c 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml
@@ -366,6 +366,28 @@
LEFT JOIN ba_user us ON FIND_IN_SET(us.id,w.assistants) GROUP BY w.id
) sawl ON ps.id = sawl.station_id
</select>
+ <select id="queryAttendUser" resultType="cn.hutool.json.JSONObject">
+ WITH total AS (
+ SELECT DISTINCT user_id,dt AS login_time FROM sta_assembly_work_last
+ union
+ SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(a.assistants, ',', b.help_topic_id + 1 ), ',', - 1 ) AS user_id ,login_time
+ FROM
+ (SELECT assistants ,dt AS login_time FROM sta_assembly_work_last) a
+ JOIN mysql.help_topic AS b ON b.help_topic_id <![CDATA[ < ]]> ( LENGTH( a.assistants ) - LENGTH( REPLACE ( a.assistants, ',', '' ) ) + 1 )
+ union
+ SELECT DISTINCT user_id ,end_time AS login_time FROM sta_assembly_work_history WHERE end_time BETWEEN #{startTime,jdbcType=TIMESTAMP} AND #{endTime,jdbcType=TIMESTAMP}
+ union
+ SELECT DISTINCT SUBSTRING_INDEX(SUBSTRING_INDEX(c.assistants, ',', d.help_topic_id + 1 ), ',', - 1 ) AS user_id ,login_time
+ FROM
+ (SELECT assistants,end_time AS login_time FROM sta_assembly_work_history WHERE end_time BETWEEN #{startTime,jdbcType=TIMESTAMP} AND #{endTime,jdbcType=TIMESTAMP}) c
+ JOIN mysql.help_topic AS d ON d.help_topic_id <![CDATA[ < ]]> ( LENGTH( c.assistants ) - LENGTH( REPLACE ( c.assistants, ',', '' ) ) + 1 ))
+ SELECT MAX(CASE record.title WHEN 'require_attend' THEN record.count_user ELSE 0 END) require_attend,
+ MAX(CASE record.title WHEN 'actual_attend' THEN record.count_user ELSE 0 END) actual_attend
+ FROM
+ (SELECT COUNT(DISTINCT user_id) AS count_user,'require_attend' AS title FROM total WHERE user_id !=''
+ UNION
+ SELECT COUNT(DISTINCT user_id) AS count_user,'actual_attend' AS title FROM total WHERE user_id !='' AND login_time <![CDATA[ < ]]> #{todayDt,jdbcType=TIMESTAMP}) record
+ </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete
--
Gitblit v1.8.0