From e76f0739e647fe8a7e0e2618914e2faff554b1b7 Mon Sep 17 00:00:00 2001
From: huang <1532065656@qq.com>
Date: 星期一, 17 十一月 2025 17:33:23 +0800
Subject: [PATCH] 解决冲突
---
mes-processes/mes-plcSend/src/main/java/com/mes/device/mapper/DeviceGroupConfigMapper.java | 99 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 99 insertions(+), 0 deletions(-)
diff --git a/mes-processes/mes-plcSend/src/main/java/com/mes/device/mapper/DeviceGroupConfigMapper.java b/mes-processes/mes-plcSend/src/main/java/com/mes/device/mapper/DeviceGroupConfigMapper.java
new file mode 100644
index 0000000..3dd72c9
--- /dev/null
+++ b/mes-processes/mes-plcSend/src/main/java/com/mes/device/mapper/DeviceGroupConfigMapper.java
@@ -0,0 +1,99 @@
+package com.mes.device.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.mes.device.entity.DeviceGroupConfig;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+/**
+ * 璁惧缁勯厤缃甅apper鎺ュ彛
+ */
+@Mapper
+public interface DeviceGroupConfigMapper extends BaseMapper<DeviceGroupConfig> {
+
+ /**
+ * 鏍规嵁椤圭洰ID鍜岃澶囩粍绫诲瀷鏌ヨ璁惧缁勯厤缃垪琛�
+ * @param projectId 椤圭洰ID
+ * @param groupType 璁惧缁勭被鍨�
+ * @param status 璁惧缁勭姸鎬�
+ * @return 璁惧缁勯厤缃垪琛�
+ */
+ @Select({
+ "<script>",
+ "SELECT * FROM device_group_config",
+ "WHERE is_deleted = 0",
+ "<when test='projectId != null'>",
+ "AND project_id = #{projectId}",
+ "</when>",
+ "<when test='groupType != null'>",
+ "AND group_type = #{groupType}",
+ "</when>",
+ "<when test='status != null'>",
+ "AND status = #{status}",
+ "</when>",
+ "ORDER BY id ASC",
+ "</script>"
+ })
+ java.util.List<DeviceGroupConfig> selectDeviceGroupConfigList(
+ @Param("projectId") Long projectId,
+ @Param("groupType") Integer groupType,
+ @Param("status") Integer status
+ );
+
+ /**
+ * 缁熻鍚敤璁惧缁勬暟閲�
+ * @param projectId 椤圭洰ID
+ * @return 鍚敤璁惧缁勬暟閲�
+ */
+ @Select({
+ "<script>",
+ "SELECT COUNT(*) FROM device_group_config",
+ "WHERE is_deleted = 0",
+ "AND status = 1",
+ "<when test='projectId != null'>",
+ "AND project_id = #{projectId}",
+ "</when>",
+ "</script>"
+ })
+ int countEnabledDeviceGroups(@Param("projectId") Long projectId);
+
+ /**
+ * 缁熻璁惧缁勭姸鎬佸垎甯�
+ * @param projectId 椤圭洰ID
+ * @return 璁惧缁勭姸鎬佸垎甯�
+ */
+ @Select({
+ "<script>",
+ "SELECT",
+ " COUNT(CASE WHEN status = 0 THEN 1 END) as disabled_count,",
+ " COUNT(CASE WHEN status = 1 THEN 1 END) as enabled_count,",
+ " COUNT(CASE WHEN status = 2 THEN 1 END) as maintenance_count",
+ "FROM device_group_config",
+ "WHERE is_deleted = 0",
+ "<when test='projectId != null'>",
+ "AND project_id = #{projectId}",
+ "</when>",
+ "</script>"
+ })
+ java.util.Map<String, Object> getDeviceGroupStatusDistribution(@Param("projectId") Long projectId);
+
+ /**
+ * 鏌ヨ璁惧缁勪笅鐨勮澶囨暟閲忕粺璁�
+ * @param groupId 璁惧缁処D
+ * @return 璁惧鏁伴噺缁熻
+ */
+ @Select({
+ "SELECT",
+ " COUNT(*) as total_devices,",
+ " COUNT(CASE WHEN dgr.status = 1 THEN 1 END) as normal_devices,",
+ " COUNT(CASE WHEN dgr.status = 2 THEN 1 END) as fault_devices,",
+ " COUNT(CASE WHEN dgr.status = 3 THEN 1 END) as maintenance_devices",
+ "FROM device_group_relation dgr",
+ "INNER JOIN device_config dc ON dgr.device_id = dc.id",
+ "WHERE dgr.is_deleted = 0",
+ "AND dc.is_deleted = 0",
+ "AND dgr.group_id = #{groupId}"
+ })
+ java.util.Map<String, Object> getDeviceGroupDeviceStatistics(@Param("groupId") Long groupId);
+}
\ No newline at end of file
--
Gitblit v1.8.0