2021与蓝度共同重构项目,服务端
liuhaonan
2022-07-07 13df4af0cb954740fd23c4bc0553f731161d15fc
ximon-admin/src/main/java/com/sandu/ximon/admin/service/InterphoneHostSubService.java
@@ -23,17 +23,17 @@
        if (hostId == null || subId == null) {
            throw new BusinessException("主设备id或子设备id不能为空");
        }
        InterphoneHostSubPole pole = new InterphoneHostSubPole();
        InterphoneHost host = SpringContextHolder.getBean(InterphoneHostService.class).getById(hostId);
        InterphoneHost sub = SpringContextHolder.getBean(InterphoneHostService.class).getById(subId);
        if (host == null || sub == null) {
            throw new BusinessException("主设备或子设备不存在");
        }
        InterphoneHostSubPole one = getOne(Wrappers.lambdaQuery(InterphoneHostSubPole.class).eq(InterphoneHostSubPole::getSubId, subId));
        if (one != null) {
            throw new BusinessException("子设备已绑定");
        }
        InterphoneHostSubPole pole = new InterphoneHostSubPole();
        InterphoneHost host = SpringContextHolder.getBean(InterphoneHostService.class).getById(hostId);
        InterphoneHost sub = SpringContextHolder.getBean(InterphoneHostService.class).getById(subId);
        if (host == null && sub == null) {
            throw new BusinessException("主设备或子设备不存在");
        }
        pole.setHostId(hostId);
        pole.setSubId(subId);
        return save(pole);