Commit 0327d1602156510225e695a94147181d9f5db33b

Authored by 648540858
1 parent 59c79c08

优化级联平台删除

src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
... ... @@ -118,14 +118,14 @@ public class GbStreamServiceImpl implements IGbStreamService {
118 118 TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
119 119 try {
120 120 List<DeviceChannel> deviceChannelList = new ArrayList<>();
  121 + platformGbStreamMapper.delByAppAndStreamsByPlatformId(gbStreams, platformId);
121 122 for (GbStream gbStream : gbStreams) {
122   - platformGbStreamMapper.delByAppAndStreamAndPlatform(gbStream.getApp(), gbStream.getStream(), platformId);
123 123 DeviceChannel deviceChannel = new DeviceChannel();
124 124 deviceChannel.setChannelId(gbStream.getGbId());
125 125 deviceChannelList.add(deviceChannel);
126   - eventPublisher.catalogEventPublish(platformId, deviceChannel, CatalogEvent.DEL);
127 126 }
128 127  
  128 + eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
129 129 dataSourceTransactionManager.commit(transactionStatus); //手动提交
130 130 result = true;
131 131 }catch (Exception e) {
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java
... ... @@ -95,6 +95,11 @@ public interface PlatformGbStreamMapper {
95 95 "</script>")
96 96 void delByGbStreams(List<GbStream> gbStreams);
97 97  
98   -
99   -
  98 + @Delete("<script> "+
  99 + "DELETE FROM platform_gb_stream where " +
  100 + "<foreach collection='gbStreams' item='item' separator='or'>" +
  101 + "(app=#{item.app} and stream=#{item.stream}) and platformId=#{platformId}" +
  102 + "</foreach>" +
  103 + "</script>")
  104 + void delByAppAndStreamsByPlatformId(List<GbStream> gbStreams, String platformId);
100 105 }
... ...
web_src/src/components/dialog/getCatalog.vue
... ... @@ -119,12 +119,10 @@ export default {
119 119 if (res.data.code === 0) {
120 120 this.platformName = res.data.data.name;
121 121 this.defaultCatalogId = res.data.data.catalogId;
  122 + this.defaultCatalogIdSign = res.data.data.catalogId;
  123 + this.chooseId = res.data.data.catalogId;
122 124 resolve([
123   - {
124   - name: "未分配",
125   - id: null,
126   - type: -1
127   - },{
  125 + {
128 126 name: this.platformName,
129 127 id: this.platformId,
130 128 type: 0
... ...