From e53ce59166b38880db2762293cca06011b1f66a3 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期四, 30 十二月 2021 18:25:26 +0800
Subject: [PATCH] Merge pull request #294 from lawrencehj/wvp-28181-2.0
---
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
index 1d0b365..8377ccb 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
@@ -133,7 +133,7 @@
"'${item.streamId}', ${item.longitude}, ${item.latitude},'${item.createTime}', '${item.updateTime}')" +
"</foreach> " +
"</script>")
- void batchAdd(List<DeviceChannel> addChannels);
+ int batchAdd(List<DeviceChannel> addChannels);
@Update({"<script>" +
"<foreach collection='updateChannels' item='item' separator=';'>" +
@@ -167,5 +167,21 @@
"WHERE deviceId=#{item.deviceId} AND channelId=#{item.channelId}"+
"</foreach>" +
"</script>"})
- void batchUpdate(List<DeviceChannel> updateChannels);
+ int batchUpdate(List<DeviceChannel> updateChannels);
+
+ @Select(value = {" <script>" +
+ "SELECT * FROM ( "+
+ " SELECT * , (SELECT count(0) FROM device_channel WHERE parentId=dc.channelId) as subCount FROM device_channel dc " +
+ " WHERE dc.deviceId=#{deviceId} " +
+ " <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
+ " <if test='parentChannelId != null'> AND dc.parentId=#{parentChannelId} </if> " +
+ " <if test='online == true' > AND dc.status=1</if>" +
+ " <if test='online == false' > AND dc.status=0</if>) dcr" +
+ " WHERE 1=1 " +
+ " <if test='hasSubChannel == true' > AND subCount >0</if>" +
+ " <if test='hasSubChannel == false' > AND subCount=0</if>" +
+ " ORDER BY channelId ASC" +
+ " LIMIT #{limit} OFFSET #{start}" +
+ " </script>"})
+ List<DeviceChannel> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, int start, int limit);
}
--
Gitblit v1.8.0