| | |
| | | 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.domain.InterphoneSub; |
| | | import com.sandu.ximon.dao.enums.PoleBindingEnums; |
| | | import com.sandu.ximon.dao.mapper.InterphoneHostMapper; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | */ |
| | | public boolean addHost(InterphoneHostParam interphoneHostParam) { |
| | | List<InterphoneHost> list = list(Wrappers.lambdaQuery(InterphoneHost.class).eq(InterphoneHost::getHostMac, interphoneHostParam.getHostMac())); |
| | | if(list.size()>0){ |
| | | if (list.size() > 0) { |
| | | throw new BusinessException("该设备已存在"); |
| | | } |
| | | InterphoneHost interphoneHost = new InterphoneHost(); |
| | |
| | | return false; |
| | | } |
| | | |
| | | if(SecurityUtils.getClientId()!=null){ |
| | | boolean belong = SpringContextHolder.getBean(PoleBindingService.class).isBelong(byId.getHostMac(), PoleBindingEnums.FOR_HELP); |
| | | if (!belong) { |
| | | throw new BusinessException("该设备不属于您,不能修改设备信息"); |
| | | } |
| | | } |
| | | if (SecurityUtils.getClientId() != null) { |
| | | boolean belong = SpringContextHolder.getBean(PoleBindingService.class).isBelong(byId.getHostMac(), PoleBindingEnums.FOR_HELP); |
| | | if (!belong) { |
| | | throw new BusinessException("该设备不属于您,不能修改设备信息"); |
| | | } |
| | | } |
| | | InterphoneHost interphoneHost = new InterphoneHost(); |
| | | interphoneHost.setHostId(id); |
| | | BeanUtils.copyProperties(interphoneHostParam, interphoneHost); |
| | |
| | | */ |
| | | boolean b = updateById(interphoneHost); |
| | | List<InterphoneHost> list = list(Wrappers.lambdaQuery(InterphoneHost.class).eq(InterphoneHost::getHostMac, interphoneHostParam.getHostMac())); |
| | | if(list.size()>1){ |
| | | if (list.size() > 1) { |
| | | throw new BusinessException("请检查设备mac是否重复"); |
| | | } |
| | | return b; |