|
|
@ -213,6 +213,7 @@ public class DeviceServiceImpl implements IDeviceService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<DeviceDTO> getDevicesByParams(DeviceQueryParam param) { |
|
|
|
// mapper.selectList(new LambdaQueryWrapper<>());//全量查询
|
|
|
|
return mapper.selectList( |
|
|
|
new LambdaQueryWrapper<DeviceEntity>() |
|
|
|
.eq(StringUtils.hasText(param.getDeviceSn()), |
|
|
@ -439,6 +440,7 @@ public class DeviceServiceImpl implements IDeviceService { |
|
|
|
.latitude(entity.getLatitude()) |
|
|
|
.longitude(entity.getLongitude()) |
|
|
|
.height(entity.getHeight()) |
|
|
|
.pushDeptId(entity.getPushDeptId()) |
|
|
|
.thingVersion(entity.getVersion()).build(); |
|
|
|
} catch (CloudSDKException e) { |
|
|
|
log.error(e.getLocalizedMessage() + "Entity: {}", entity); |
|
|
@ -733,6 +735,28 @@ public class DeviceServiceImpl implements IDeviceService { |
|
|
|
.build()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public PaginationData<DeviceDTO> getListShort(String workspaceId, Long page, Long pageSize, Integer domain, String nickname, List<Integer> proIds) { |
|
|
|
Page<DeviceEntity> pagination = mapper.selectPage(new Page<>(page, pageSize), |
|
|
|
new LambdaQueryWrapper<DeviceEntity>() |
|
|
|
.eq(DeviceEntity::getDomain, domain) |
|
|
|
.eq(DeviceEntity::getWorkspaceId, workspaceId) |
|
|
|
.eq(DeviceEntity::getBoundStatus, true) |
|
|
|
.in(ObjectUtil.isAllNotEmpty(proIds),DeviceEntity::getProId, proIds) |
|
|
|
.eq(org.dromara.common.core.utils.StringUtils.isNotEmpty(nickname),DeviceEntity::getNickname,nickname)); |
|
|
|
List<DeviceDTO> devicesList = pagination.getRecords().stream().map(this::deviceEntityConvertToDTO).collect(Collectors.toList()); |
|
|
|
return new PaginationData<DeviceDTO>(devicesList, new Pagination(pagination.getCurrent(), pagination.getSize(), pagination.getTotal())); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public boolean updateDeiceSimple(DeviceEntity device) { |
|
|
|
LambdaUpdateWrapper<DeviceEntity> updateWrapper = new LambdaUpdateWrapper<>(); |
|
|
|
updateWrapper.set(DeviceEntity::getId,device.getId()); |
|
|
|
updateWrapper.set(DeviceEntity::getPushDeptId,device.getPushDeptId()); |
|
|
|
int update = mapper.update(updateWrapper); |
|
|
|
return update > 0; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Convert device data transfer object into database entity object. |
|
|
|
* @param dto |
|
|
|