| | |
| | | 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 addSub(InterphoneSubParam interphoneSubParam) { |
| | | List<InterphoneSub> list = list(Wrappers.lambdaQuery(InterphoneSub.class).eq(InterphoneSub::getSubMac, interphoneSubParam.getSubMac())); |
| | | if (list.size() > 0) { |
| | | throw new BusinessException("该设备已存在"); |
| | | } |
| | | InterphoneSub interphoneSub = new InterphoneSub(); |
| | | BeanUtils.copyProperties(interphoneSubParam, interphoneSub); |
| | | boolean save = save(interphoneSub); |
| | |
| | | /** |
| | | * 修改子设备 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean updateSub(Integer id, InterphoneSubParam interphoneSubParam) { |
| | | InterphoneSub byId = getById(id); |
| | | if (byId == null) { |
| | |
| | | "}"; |
| | | |
| | | StoreOperationRecordsUtils.storeOperationData(listCode, null, "编辑一键求助子设备", content); |
| | | boolean b = updateById(interphoneSub); |
| | | /** |
| | | * 编辑一键求助子设备 日志记录结束 |
| | | */ |
| | | |
| | | return updateById(interphoneSub); |
| | | List<InterphoneSub> list = list(Wrappers.lambdaQuery(InterphoneSub.class).eq(InterphoneSub::getSubMac, interphoneSubParam.getSubMac())); |
| | | if (list.size() > 1) { |
| | | throw new BusinessException("请检查设备mac是否重复"); |
| | | } |
| | | return b; |
| | | } |
| | | |
| | | /** |
| | |
| | | } else { |
| | | list = interphoneSubMapper.getInterphoneSubList(keyword, SecurityUtils.getUserId()); |
| | | } |
| | | list.forEach(interphoneSubBo -> { |
| | | InterphoneHostSubPole one = SpringContextHolder.getBean(InterphoneHostSubService.class).getOne(Wrappers.lambdaQuery(InterphoneHostSubPole.class) |
| | | .eq(InterphoneHostSubPole::getSubId, interphoneSubBo.getSubId())); |
| | | if (one != null) { |
| | | interphoneSubBo.setHostId(one.getHostId()); |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | } |