From 23855599412c4d61b38d78f0f3abd3430a48b5b1 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期三, 25 六月 2025 11:51:38 +0800
Subject: [PATCH] Merge branch 'mdc_hyjs_master'

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentPunchMapper.xml |   85 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 85 insertions(+), 0 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentPunchMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentPunchMapper.xml
new file mode 100644
index 0000000..8c27d52
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentPunchMapper.xml
@@ -0,0 +1,85 @@
+<?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="org.jeecg.modules.mdc.mapper.MdcEquipmentPunchMapper">
+
+    <select id="list" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentPunch">
+        SELECT
+        p.id,
+        p.equipment_id,
+        p.punch_user,
+        p.check_in_time,
+        p.check_out_time,
+        p.record_date,
+        p.is_absent,
+        p.is_late,
+        p.is_early,
+        p.create_by,
+        p.create_time,
+        p.update_by,
+        p.update_time,
+        p.shift_schedule,
+        u.realname punchUserRealName,
+        u.username punchUserUserName,
+        d1.item_text shiftScheduleName
+        FROM
+        mdc_equipment_punch p
+        INNER JOIN sys_user u ON u.id = p.punch_user
+        INNER JOIN (SELECT i1.item_text, i1.item_value
+        FROM sys_dict_item i1
+        LEFT JOIN sys_dict i2 ON i2.id = i1.dict_id
+        WHERE i2.dict_code = 'shift_schedule') d1
+        ON d1.item_value = CAST (p.shift_schedule AS nvarchar)
+        where 1=1
+        AND p.equipment_id IN
+        <foreach collection="equipmentIds" item="equipmentId" open="(" close=")" separator=",">
+            #{equipmentId}
+        </foreach>
+        <if test="date != null and date != ''">
+            AND p.record_date = #{date}
+        </if>
+        order by p.equipment_id desc, p.shift_schedule asc
+    </select>
+
+    <!--鏌ヨ鎵�鏈夎澶囨暟閲�-->
+    <select id="getTotalDeviceCount" resultType="int">
+        SELECT COUNT(*)
+        FROM mdc_equipment
+    </select>
+
+    <!-- 鏃╃彮 涓婄彮鎵撳崱 -->
+    <select id="countMorningShiftIn" resultType="int">
+        SELECT COUNT(DISTINCT equipment_id)
+        FROM mdc_equipment_punch
+        WHERE record_date = #{date, jdbcType=VARCHAR}
+          AND shift_schedule = '1'
+          AND check_in_time IS NOT NULL
+    </select>
+
+    <!-- 鏅氱彮 涓婄彮鎵撳崱 -->
+    <select id="countEveningShiftIn" resultType="int">
+        SELECT COUNT(DISTINCT equipment_id)
+        FROM mdc_equipment_punch
+        WHERE record_date = #{date, jdbcType=VARCHAR}
+          AND shift_schedule = '2'
+          AND check_in_time IS NOT NULL
+    </select>
+
+    <!-- 鏃╃彮 涓嬬彮鎵撳崱 -->
+    <select id="countMorningShiftOut" resultType="int">
+        SELECT COUNT(DISTINCT equipment_id)
+        FROM mdc_equipment_punch
+        WHERE record_date = #{date, jdbcType=VARCHAR}
+          AND shift_schedule = '1'
+          AND check_out_time IS NOT NULL
+    </select>
+
+    <!-- 鏅氱彮 涓嬬彮鎵撳崱 -->
+    <select id="countEveningShiftOut" resultType="int">
+        SELECT COUNT(DISTINCT equipment_id)
+        FROM mdc_equipment_punch
+        WHERE record_date = #{date, jdbcType=VARCHAR}
+          AND shift_schedule = '2'
+          AND check_out_time IS NOT NULL
+    </select>
+
+</mapper>
\ No newline at end of file

--
Gitblit v1.9.3