| | |
| | | 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; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | * 添加主机 |
| | | */ |
| | | public boolean addHost(InterphoneHostParam interphoneHostParam) { |
| | | List<InterphoneHost> list = list(Wrappers.lambdaQuery(InterphoneHost.class).eq(InterphoneHost::getHostMac, interphoneHostParam.getHostMac())); |
| | | if(list.size()>0){ |
| | | throw new BusinessException("该设备已存在"); |
| | | } |
| | | InterphoneHost interphoneHost = new InterphoneHost(); |
| | | BeanUtils.copyProperties(interphoneHostParam, interphoneHost); |
| | | boolean save = save(interphoneHost); |
| | |
| | | /** |
| | | * 修改主机 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean updateHost(Integer id, InterphoneHostParam interphoneHostParam) { |
| | | InterphoneHost byId = getById(id); |
| | | if (byId == null) { |
| | |
| | | /** |
| | | * 编辑一键求助主机 日志记录结束 |
| | | */ |
| | | return updateById(interphoneHost); |
| | | boolean b = updateById(interphoneHost); |
| | | List<InterphoneHost> list = list(Wrappers.lambdaQuery(InterphoneHost.class).eq(InterphoneHost::getHostMac, interphoneHostParam.getHostMac())); |
| | | if(list.size()>1){ |
| | | throw new BusinessException("请检查设备mac是否重复"); |
| | | } |
| | | return b; |
| | | } |
| | | |
| | | /** |