Browse Source

优化级联平台删除

ui-optimization
648540858 3 years ago
parent
commit
0327d16021
  1. 4
      src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
  2. 9
      src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java
  3. 8
      web_src/src/components/dialog/getCatalog.vue

4
src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java

@ -118,14 +118,14 @@ public class GbStreamServiceImpl implements IGbStreamService {
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
try { try {
List<DeviceChannel> deviceChannelList = new ArrayList<>(); List<DeviceChannel> deviceChannelList = new ArrayList<>();
platformGbStreamMapper.delByAppAndStreamsByPlatformId(gbStreams, platformId);
for (GbStream gbStream : gbStreams) { for (GbStream gbStream : gbStreams) {
platformGbStreamMapper.delByAppAndStreamAndPlatform(gbStream.getApp(), gbStream.getStream(), platformId);
DeviceChannel deviceChannel = new DeviceChannel(); DeviceChannel deviceChannel = new DeviceChannel();
deviceChannel.setChannelId(gbStream.getGbId()); deviceChannel.setChannelId(gbStream.getGbId());
deviceChannelList.add(deviceChannel); deviceChannelList.add(deviceChannel);
eventPublisher.catalogEventPublish(platformId, deviceChannel, CatalogEvent.DEL);
} }
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
dataSourceTransactionManager.commit(transactionStatus); //手动提交 dataSourceTransactionManager.commit(transactionStatus); //手动提交
result = true; result = true;
}catch (Exception e) { }catch (Exception e) {

9
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java

@ -95,6 +95,11 @@ public interface PlatformGbStreamMapper {
"</script>") "</script>")
void delByGbStreams(List<GbStream> gbStreams); void delByGbStreams(List<GbStream> gbStreams);
@Delete("<script> "+
"DELETE FROM platform_gb_stream where " +
"<foreach collection='gbStreams' item='item' separator='or'>" +
"(app=#{item.app} and stream=#{item.stream}) and platformId=#{platformId}" +
"</foreach>" +
"</script>")
void delByAppAndStreamsByPlatformId(List<GbStream> gbStreams, String platformId);
} }

8
web_src/src/components/dialog/getCatalog.vue

@ -119,12 +119,10 @@ export default {
if (res.data.code === 0) { if (res.data.code === 0) {
this.platformName = res.data.data.name; this.platformName = res.data.data.name;
this.defaultCatalogId = res.data.data.catalogId; this.defaultCatalogId = res.data.data.catalogId;
this.defaultCatalogIdSign = res.data.data.catalogId;
this.chooseId = res.data.data.catalogId;
resolve([ resolve([
{ {
name: "未分配",
id: null,
type: -1
},{
name: this.platformName, name: this.platformName,
id: this.platformId, id: this.platformId,
type: 0 type: 0

Loading…
Cancel
Save