2021与蓝度共同重构项目,服务端
liuhaonan
2022-05-10 326334dbf5de8eeb09cdf8dd7a4511ab821e12ff
ximon-admin/src/main/java/com/sandu/ximon/admin/service/InterphoneHostService.java
@@ -1,10 +1,12 @@
package com.sandu.ximon.admin.service;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.sandu.common.service.impl.BaseServiceImpl;
import com.sandu.ximon.admin.param.InterphoneHostParam;
import com.sandu.ximon.admin.security.SecurityUtils;
import com.sandu.ximon.dao.bo.InterphoneHostBo;
import com.sandu.ximon.dao.domain.InterphoneHost;
import com.sandu.ximon.dao.domain.InterphoneHostSubPole;
import com.sandu.ximon.dao.mapper.InterphoneHostMapper;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
@@ -17,6 +19,8 @@
public class InterphoneHostService extends BaseServiceImpl<InterphoneHostMapper, InterphoneHost> {
    private final InterphoneHostMapper interphoneHostMapper;
    private final InterphoneHostSubService interphoneHostSubService;
    /**
@@ -50,6 +54,11 @@
     */
    public boolean deleteHost(Integer id) {
        InterphoneHost byId = getById(id);
        InterphoneHostSubPole one = interphoneHostSubService.getOne(Wrappers.lambdaQuery(InterphoneHostSubPole.class).eq(InterphoneHostSubPole::getHostId, id));
        if(one!=null){
            throw new RuntimeException("该主机存在绑定关系,不能删除");
        }
        if (byId == null) {
            return false;
        }
@@ -82,6 +91,4 @@
        }
        return list;
    }
}