优化级联平台删除

pull/343/head
648540858 2022-02-17 15:33:25 +08:00
parent 59c79c08e1
commit 0327d16021
3 changed files with 12 additions and 9 deletions

View File

@ -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) {

View File

@ -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);
} }

View File

@ -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