| | |
| | | public Boolean updateWorkType(String sn, Long workType) { |
| | | // 方式1:使用LambdaUpdateWrapper(推荐,类型安全,避免字段名硬编码) |
| | | LambdaUpdateWrapper<DeviceEntity> lambdaUpdateWrapper = new LambdaUpdateWrapper<>(); |
| | | // 设置更新条件:deviceSn = 100 |
| | | // 设置更新条件:deviceSn = sn |
| | | lambdaUpdateWrapper.eq(DeviceEntity::getDeviceSn, sn) |
| | | // 只更新status字段为"online" |
| | | // 只更新workType字段 |
| | | .set(DeviceEntity::getWorkType, workType); |
| | | // 执行更新(第一个参数传null,因为更新字段已通过wrapper的set指定) |
| | | int update = mapper.update(null, lambdaUpdateWrapper); |
| | |
| | | */ |
| | | @Override |
| | | public PaginationData<DeviceDTO> getBoundDevicesWithDomain(Long page, |
| | | Long pageSize, Integer domain) { |
| | | Long pageSize, Integer domain, Long deptId) { |
| | | |
| | | Page<DeviceEntity> pagination = mapper.selectPage(new Page<>(page, pageSize), |
| | | new LambdaQueryWrapper<DeviceEntity>() |
| | | .eq(DeviceEntity::getDomain, domain) |
| | | .eq(deptId != null, DeviceEntity::getDeptId, deptId) |
| | | .isNotNull(DeviceEntity::getDeptId)); |
| | | // .eq(DeviceEntity::getBoundStatus, true)); |
| | | List<DeviceDTO> devicesList = pagination.getRecords().stream().map(this::deviceEntityConvertToDTO) |