Commit 58b9dab89fef80076e79e43c8eafe811a644415c
1 parent
22441ad5
优化 分屏设备与电子地图中树结构展示信息
优化 国标设备中通道内查看的逻辑,保证与分屏与电子地图中树结构的数据一致
Showing
2 changed files
with
21 additions
and
8 deletions
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
| ... | ... | @@ -398,10 +398,10 @@ public class DeviceServiceImpl implements IDeviceService { |
| 398 | 398 | return null; |
| 399 | 399 | } |
| 400 | 400 | // 使用行政区划展示树 |
| 401 | - if (parentId.length() > 10) { | |
| 402 | - // TODO 可能是行政区划与业务分组混杂的情形 | |
| 403 | - return null; | |
| 404 | - } | |
| 401 | +// if (parentId.length() > 10) { | |
| 402 | +// // TODO 可能是行政区划与业务分组混杂的情形 | |
| 403 | +// return null; | |
| 404 | +// } | |
| 405 | 405 | |
| 406 | 406 | if (parentId.length() == 10 ) { |
| 407 | 407 | if (onlyCatalog) { |
| ... | ... | @@ -416,7 +416,18 @@ public class DeviceServiceImpl implements IDeviceService { |
| 416 | 416 | List<DeviceChannel> channelsForCivilCode = deviceChannelMapper.getChannelsWithCivilCodeAndLength(deviceId, parentId, parentId.length() + 2); |
| 417 | 417 | if (!onlyCatalog) { |
| 418 | 418 | List<DeviceChannel> channels = deviceChannelMapper.getChannelsByCivilCode(deviceId, parentId); |
| 419 | - channelsForCivilCode.addAll(channels); | |
| 419 | + | |
| 420 | + for(DeviceChannel channel : channels) { | |
| 421 | + boolean flag = false; | |
| 422 | + for(DeviceChannel deviceChannel : channelsForCivilCode) { | |
| 423 | + if(channel.getChannelId().equals(deviceChannel.getChannelId())) { | |
| 424 | + flag = true; | |
| 425 | + } | |
| 426 | + } | |
| 427 | + if(!flag) { | |
| 428 | + channelsForCivilCode.add(channel); | |
| 429 | + } | |
| 430 | + } | |
| 420 | 431 | } |
| 421 | 432 | List<BaseTree<DeviceChannel>> trees = transportChannelsToTree(channelsForCivilCode, parentId); |
| 422 | 433 | return trees; | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
| ... | ... | @@ -71,7 +71,7 @@ public interface DeviceChannelMapper { |
| 71 | 71 | "WHERE " + |
| 72 | 72 | "dc.deviceId = #{deviceId} " + |
| 73 | 73 | " <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " + |
| 74 | - " <if test='parentChannelId != null'> AND dc.parentId=#{parentChannelId} </if> " + | |
| 74 | + " <if test='parentChannelId != null'> AND (dc.parentId=#{parentChannelId} OR dc.civilCode = #{parentChannelId}) </if> " + | |
| 75 | 75 | " <if test='online == true' > AND dc.status=1</if>" + |
| 76 | 76 | " <if test='online == false' > AND dc.status=0</if>" + |
| 77 | 77 | " <if test='hasSubChannel == true' > AND dc.subCount > 0 </if>" + |
| ... | ... | @@ -309,8 +309,10 @@ public interface DeviceChannelMapper { |
| 309 | 309 | "select * " + |
| 310 | 310 | "from device_channel " + |
| 311 | 311 | "where deviceId=#{deviceId}" + |
| 312 | - " <if test='parentId != null' > and left(channelId, ${parentId.length()}) = #{parentId}</if>" + | |
| 313 | - " <if test='length != null' > and length(channelId)=${length}</if>" + | |
| 312 | + " <if test='parentId != null and length != null' > and parentId = #{parentId} or left(channelId, ${parentId.length()}) = #{parentId} and length(channelId)=${length} </if>" + | |
| 313 | + " <if test='parentId == null and length != null' > and parentId = #{parentId} or length(channelId)=${length} </if>" + | |
| 314 | + " <if test='parentId == null and length == null' > and parentId = #{parentId} </if>" + | |
| 315 | + " <if test='parentId != null and length == null' > and parentId = #{parentId} or left(channelId, ${parentId.length()}) = #{parentId} </if>" + | |
| 314 | 316 | " </script>"}) |
| 315 | 317 | List<DeviceChannel> getChannelsWithCivilCodeAndLength(String deviceId, String parentId, Integer length); |
| 316 | 318 | ... | ... |