...
|
...
|
@@ -8,6 +8,7 @@ import com.monitor.model.page.PageRequest; |
|
|
import com.monitor.model.page.PageResponse;
|
|
|
import com.monitor.model.response.BaseResponse;
|
|
|
import com.monitor.mysql.mapper.HostGroupMapper;
|
|
|
import com.monitor.mysql.mapper.HostInfoMapper;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
...
|
...
|
@@ -27,6 +28,9 @@ public class HostGroupServiceImpl implements IHostGroupService { |
|
|
@Autowired
|
|
|
HostGroupMapper hostGroupMapper;
|
|
|
|
|
|
@Autowired
|
|
|
HostInfoMapper hostInfoMapper;
|
|
|
|
|
|
@Override
|
|
|
public PageResponse<HostGroup> getHostGroups(PageRequest req) {
|
|
|
logger.debug("getHostGroups with param is {}", req);
|
...
|
...
|
@@ -69,8 +73,13 @@ public class HostGroupServiceImpl implements IHostGroupService { |
|
|
|
|
|
@Override
|
|
|
public BaseResponse<Integer> delHostGroupById(int id) {
|
|
|
int result=hostGroupMapper.deleteByPrimaryKey(id);
|
|
|
return new BaseResponse<Integer>(result);
|
|
|
List<HostInfo> list = hostInfoMapper.selectHostInfosByGroup(id);
|
|
|
if(list != null && list.size() > 0){
|
|
|
return new BaseResponse<Integer>("有主机绑定此机组,请先删除主机信息");
|
|
|
}else{
|
|
|
int result=hostGroupMapper.deleteByPrimaryKey(id);
|
|
|
return new BaseResponse<Integer>(result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
...
|
...
|
|