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/DeviceConfigMapper.java | 81 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 81 insertions(+), 0 deletions(-)
diff --git a/mes-processes/mes-plcSend/src/main/java/com/mes/device/mapper/DeviceConfigMapper.java b/mes-processes/mes-plcSend/src/main/java/com/mes/device/mapper/DeviceConfigMapper.java
new file mode 100644
index 0000000..dddf712
--- /dev/null
+++ b/mes-processes/mes-plcSend/src/main/java/com/mes/device/mapper/DeviceConfigMapper.java
@@ -0,0 +1,81 @@
+package com.mes.device.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.mes.device.entity.DeviceConfig;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+/**
+ * 璁惧閰嶇疆Mapper鎺ュ彛
+ */
+@Mapper
+public interface DeviceConfigMapper extends BaseMapper<DeviceConfig> {
+
+ /**
+ * 鏍规嵁椤圭洰ID鍜岃澶囩被鍨嬫煡璇㈣澶囬厤缃垪琛�
+ * @param projectId 椤圭洰ID
+ * @param deviceType 璁惧绫诲瀷
+ * @param status 璁惧鐘舵��
+ * @return 璁惧閰嶇疆鍒楄〃
+ */
+ @Select({
+ "<script>",
+ "SELECT * FROM device_config",
+ "WHERE is_deleted = 0",
+ "<when test='projectId != null'>",
+ "AND project_id = #{projectId}",
+ "</when>",
+ "<when test='deviceType != null'>",
+ "AND device_type = #{deviceType}",
+ "</when>",
+ "<when test='status != null'>",
+ "AND status = #{status}",
+ "</when>",
+ "ORDER BY id ASC",
+ "</script>"
+ })
+ java.util.List<DeviceConfig> selectDeviceConfigList(
+ @Param("projectId") Long projectId,
+ @Param("deviceType") String deviceType,
+ @Param("status") String status
+ );
+
+ /**
+ * 缁熻鍦ㄧ嚎璁惧鏁伴噺
+ * @param projectId 椤圭洰ID
+ * @return 鍦ㄧ嚎璁惧鏁伴噺
+ */
+ @Select({
+ "<script>",
+ "SELECT COUNT(*) FROM device_config",
+ "WHERE is_deleted = 0",
+ "AND status = '鍦ㄧ嚎'",
+ "<when test='projectId != null'>",
+ "AND project_id = #{projectId}",
+ "</when>",
+ "</script>"
+ })
+ int countOnlineDevices(@Param("projectId") Long projectId);
+
+ /**
+ * 缁熻璁惧鐘舵�佸垎甯�
+ * @param projectId 椤圭洰ID
+ * @return 璁惧鐘舵�佸垎甯�
+ */
+ @Select({
+ "<script>",
+ "SELECT",
+ " COUNT(CASE WHEN status = '绂荤嚎' THEN 1 END) as offline_count,",
+ " COUNT(CASE WHEN status = '鍦ㄧ嚎' THEN 1 END) as online_count,",
+ " COUNT(CASE WHEN status = '缁存姢涓�' THEN 1 END) as maintenance_count,",
+ " COUNT(CASE WHEN status = '鏁呴殰' THEN 1 END) as fault_count",
+ "FROM device_config",
+ "WHERE is_deleted = 0",
+ "<when test='projectId != null'>",
+ "AND project_id = #{projectId}",
+ "</when>",
+ "</script>"
+ })
+ java.util.Map<String, Object> getDeviceStatusDistribution(@Param("projectId") Long projectId);
+}
\ No newline at end of file
--
Gitblit v1.8.0