2021与蓝度共同重构项目,服务端
zhanzhiqin
2022-04-18 f2dfd5e6fbbb9c4e96e91c86be0bb6f7a44d87c3
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java
@@ -35,9 +35,10 @@
//        }
        LambdaQueryWrapper<PoleBinding> eq = Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId);
        List<PoleBinding> list = list(eq);
        if (list.size() != 0){
        if (list.size() != 0) {
            for (PoleBinding poleBinding : list) {
                if (poleBinding.getDeviceType().equals(deviceType)) {
                //充电桩的绑定是网络请求是带过来的灯杆信息,要允许直接修改
                if (poleBinding.getDeviceType().equals(deviceType) && deviceType != 2) {
                    throw new BusinessException("该灯杆已绑定过相同类型设备");
                }
            }
@@ -52,7 +53,11 @@
            poleBinding.setDeviceCode(param.getDeviceCode());
            return save(poleBinding);
        } else {
            throw new BusinessException("该设备已绑定过");
            one.setPoleId(poleId);
            one.setDeviceType(param.getDeviceType());
            one.setDeviceName(param.getDeviceName());
            one.setDeviceCode(param.getDeviceCode());
            return updateById(one);
        }
    }