648540858
2022-01-13 f99c9cac6afc899c244aa66897cb3bf35a2da7d6
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);
}