2021与蓝度共同重构项目,服务端
fix
zhanzhiqin
2022-04-13 15f4681cd32306b7efb04818e2c47cf6caa251de
fix
已修改1个文件
16 ■■■■ 文件已修改
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java
@@ -1,5 +1,6 @@
package com.sandu.ximon.admin.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.sandu.common.execption.BusinessException;
import com.sandu.common.service.impl.BaseServiceImpl;
@@ -8,6 +9,8 @@
import com.sandu.ximon.dao.mapper.PoleBindingMapper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * @author chenjiantian
@@ -30,6 +33,15 @@
        Integer deviceType = param.getDeviceType();
//        if (PoleBindingEnums.LIGHT.getCode().equals(deviceType)) {
//        }
        LambdaQueryWrapper<PoleBinding> eq = Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId);
        List<PoleBinding> list = list(eq);
        if (list.size() != 0){
            for (PoleBinding poleBinding : list) {
                if (poleBinding.getDeviceType().equals(deviceType)) {
                    throw new BusinessException("该灯杆已绑定过相同类型设备");
                }
            }
        }
        PoleBinding one = getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceCode, param.getDeviceCode()));
        if (one == null) {
@@ -86,7 +98,7 @@
        }
    }
    public PoleBinding getPoleIdByMac(String deviceCode){
       return getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceCode, deviceCode));
    public PoleBinding getPoleIdByMac(String deviceCode) {
        return getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceCode, deviceCode));
    }
}