优化级联平台删除
parent
59c79c08e1
commit
0327d16021
|
@ -118,14 +118,14 @@ public class GbStreamServiceImpl implements IGbStreamService {
|
|||
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
|
||||
try {
|
||||
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
||||
platformGbStreamMapper.delByAppAndStreamsByPlatformId(gbStreams, platformId);
|
||||
for (GbStream gbStream : gbStreams) {
|
||||
platformGbStreamMapper.delByAppAndStreamAndPlatform(gbStream.getApp(), gbStream.getStream(), platformId);
|
||||
DeviceChannel deviceChannel = new DeviceChannel();
|
||||
deviceChannel.setChannelId(gbStream.getGbId());
|
||||
deviceChannelList.add(deviceChannel);
|
||||
eventPublisher.catalogEventPublish(platformId, deviceChannel, CatalogEvent.DEL);
|
||||
}
|
||||
|
||||
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
|
||||
dataSourceTransactionManager.commit(transactionStatus); //手动提交
|
||||
result = true;
|
||||
}catch (Exception e) {
|
||||
|
|
|
@ -95,6 +95,11 @@ public interface PlatformGbStreamMapper {
|
|||
"</script>")
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -119,12 +119,10 @@ export default {
|
|||
if (res.data.code === 0) {
|
||||
this.platformName = res.data.data.name;
|
||||
this.defaultCatalogId = res.data.data.catalogId;
|
||||
this.defaultCatalogIdSign = res.data.data.catalogId;
|
||||
this.chooseId = res.data.data.catalogId;
|
||||
resolve([
|
||||
{
|
||||
name: "未分配",
|
||||
id: null,
|
||||
type: -1
|
||||
},{
|
||||
{
|
||||
name: this.platformName,
|
||||
id: this.platformId,
|
||||
type: 0
|
||||
|
|
Loading…
Reference in New Issue