|
@@ -8,6 +8,7 @@ import com.monitor.model.page.PageRequest; |
|
@@ -8,6 +8,7 @@ import com.monitor.model.page.PageRequest; |
8
|
import com.monitor.model.page.PageResponse;
|
8
|
import com.monitor.model.page.PageResponse;
|
9
|
import com.monitor.model.response.BaseResponse;
|
9
|
import com.monitor.model.response.BaseResponse;
|
10
|
import com.monitor.mysql.mapper.HostGroupMapper;
|
10
|
import com.monitor.mysql.mapper.HostGroupMapper;
|
|
|
11
|
+import com.monitor.mysql.mapper.HostInfoMapper;
|
11
|
import org.slf4j.Logger;
|
12
|
import org.slf4j.Logger;
|
12
|
import org.slf4j.LoggerFactory;
|
13
|
import org.slf4j.LoggerFactory;
|
13
|
import org.springframework.beans.factory.annotation.Autowired;
|
14
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -27,6 +28,9 @@ public class HostGroupServiceImpl implements IHostGroupService { |
|
@@ -27,6 +28,9 @@ public class HostGroupServiceImpl implements IHostGroupService { |
27
|
@Autowired
|
28
|
@Autowired
|
28
|
HostGroupMapper hostGroupMapper;
|
29
|
HostGroupMapper hostGroupMapper;
|
29
|
|
30
|
|
|
|
31
|
+ @Autowired
|
|
|
32
|
+ HostInfoMapper hostInfoMapper;
|
|
|
33
|
+
|
30
|
@Override
|
34
|
@Override
|
31
|
public PageResponse<HostGroup> getHostGroups(PageRequest req) {
|
35
|
public PageResponse<HostGroup> getHostGroups(PageRequest req) {
|
32
|
logger.debug("getHostGroups with param is {}", req);
|
36
|
logger.debug("getHostGroups with param is {}", req);
|
|
@@ -69,8 +73,13 @@ public class HostGroupServiceImpl implements IHostGroupService { |
|
@@ -69,8 +73,13 @@ public class HostGroupServiceImpl implements IHostGroupService { |
69
|
|
73
|
|
70
|
@Override
|
74
|
@Override
|
71
|
public BaseResponse<Integer> delHostGroupById(int id) {
|
75
|
public BaseResponse<Integer> delHostGroupById(int id) {
|
72
|
- int result=hostGroupMapper.deleteByPrimaryKey(id);
|
|
|
73
|
- return new BaseResponse<Integer>(result);
|
76
|
+ List<HostInfo> list = hostInfoMapper.selectHostInfosByGroup(id);
|
|
|
77
|
+ if(list != null && list.size() > 0){
|
|
|
78
|
+ return new BaseResponse<Integer>("有主机绑定此机组,请先删除主机信息");
|
|
|
79
|
+ }else{
|
|
|
80
|
+ int result=hostGroupMapper.deleteByPrimaryKey(id);
|
|
|
81
|
+ return new BaseResponse<Integer>(result);
|
|
|
82
|
+ }
|
74
|
}
|
83
|
}
|
75
|
|
84
|
|
76
|
@Override
|
85
|
@Override
|