|  | @@ -2,6 +2,7 @@ package com.xunmei.core.access.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import com.alibaba.nacos.common.utils.CollectionUtils;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.utils.DateUtils;
 | 
	
	
		
			
				|  | @@ -18,7 +19,7 @@ import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import java.util.Arrays;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
	
		
			
				|  | @@ -27,6 +28,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
	
		
			
				|  |  |   * @author xunmei
 | 
	
		
			
				|  |  |   * @date 2023-08-29
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  | +@Transactional
 | 
	
		
			
				|  |  |  @Service
 | 
	
		
			
				|  |  |  public class CoreMonitoringTaskMonitorInfoServiceImpl extends ServiceImpl<CoreMonitoringTaskMonitorInfoMapper, CoreMonitoringTaskMonitorInfo> implements ICoreMonitoringTaskMonitorInfoService {
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
	
		
			
				|  | @@ -74,18 +76,20 @@ public class CoreMonitoringTaskMonitorInfoServiceImpl extends ServiceImpl<CoreMo
 | 
	
		
			
				|  |  |          coreMonitoringTaskMonitorInfo.setCreateTime(DateUtils.getNowDate());
 | 
	
		
			
				|  |  |          coreMonitoringTaskMonitorInfo.setCreateBy(SecurityUtils.getUsername());
 | 
	
		
			
				|  |  |          coreMonitoringTaskMonitorInfo.setId(IdWorker.getId());
 | 
	
		
			
				|  |  | -        coreMonitoringTaskRegistrationMonitorMapper.insert(coreMonitoringTaskMonitorInfo);
 | 
	
		
			
				|  |  | +        int i = 0;
 | 
	
		
			
				|  |  | +        i = coreMonitoringTaskRegistrationMonitorMapper.insert(coreMonitoringTaskMonitorInfo);
 | 
	
		
			
				|  |  |          //新增项目
 | 
	
		
			
				|  |  |          List<CoreMonitoringTaskMonitorInfo> coreMonitoringTaskMonitorInfoList = coreMonitoringTaskRegistrationMonitorDTO.getCoreMonitoringTaskMonitorInfoList();
 | 
	
		
			
				|  |  | -        int i = 0;
 | 
	
		
			
				|  |  | -        for (CoreMonitoringTaskMonitorInfo c : coreMonitoringTaskMonitorInfoList) {
 | 
	
		
			
				|  |  | -            c.setCreateTime(DateUtils.getNowDate());
 | 
	
		
			
				|  |  | -            c.setCreateBy(SecurityUtils.getUsername());
 | 
	
		
			
				|  |  | -            c.setId(IdWorker.getId());
 | 
	
		
			
				|  |  | -            c.setTaskMonitorId(coreMonitoringTaskMonitorInfo.getId());
 | 
	
		
			
				|  |  | -            i = coreMonitoringTaskMonitorInfoMapper.insert(c);
 | 
	
		
			
				|  |  | -            if (i < 1) {
 | 
	
		
			
				|  |  | -                return i;
 | 
	
		
			
				|  |  | +        if (CollectionUtils.isNotEmpty(coreMonitoringTaskMonitorInfoList)) {
 | 
	
		
			
				|  |  | +            for (CoreMonitoringTaskMonitorInfo c : coreMonitoringTaskMonitorInfoList) {
 | 
	
		
			
				|  |  | +                c.setCreateTime(DateUtils.getNowDate());
 | 
	
		
			
				|  |  | +                c.setCreateBy(SecurityUtils.getUsername());
 | 
	
		
			
				|  |  | +                c.setId(IdWorker.getId());
 | 
	
		
			
				|  |  | +                c.setTaskMonitorId(coreMonitoringTaskMonitorInfo.getId());
 | 
	
		
			
				|  |  | +                i = coreMonitoringTaskMonitorInfoMapper.insert(c);
 | 
	
		
			
				|  |  | +                if (i < 1) {
 | 
	
		
			
				|  |  | +                    return i;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return i;
 | 
	
	
		
			
				|  | @@ -106,8 +110,8 @@ public class CoreMonitoringTaskMonitorInfoServiceImpl extends ServiceImpl<CoreMo
 | 
	
		
			
				|  |  |          coreMonitoringTaskRegistrationMonitor.setUpdateTime(DateUtils.getNowDate());
 | 
	
		
			
				|  |  |          coreMonitoringTaskRegistrationMonitor.setUpdateBy(SecurityUtils.getUsername());
 | 
	
		
			
				|  |  |          coreMonitoringTaskRegistrationMonitorMapper.updateById(coreMonitoringTaskRegistrationMonitor);
 | 
	
		
			
				|  |  | -        QueryWrapper<CoreMonitoringTaskMonitorInfo> queryWrapper=new QueryWrapper();
 | 
	
		
			
				|  |  | -        queryWrapper.eq("task_monitor_id",coreMonitoringTaskRegistrationMonitor.getId());
 | 
	
		
			
				|  |  | +        QueryWrapper<CoreMonitoringTaskMonitorInfo> queryWrapper = new QueryWrapper();
 | 
	
		
			
				|  |  | +        queryWrapper.eq("task_monitor_id", coreMonitoringTaskRegistrationMonitor.getId());
 | 
	
		
			
				|  |  |          coreMonitoringTaskMonitorInfoMapper.delete(queryWrapper);
 | 
	
		
			
				|  |  |          int i = 0;
 | 
	
		
			
				|  |  |          for (CoreMonitoringTaskMonitorInfo c : coreMonitoringTaskRegistrationMonitorDTO.getCoreMonitoringTaskMonitorInfoList()) {
 |