ard-sample/src/main/java/com/ard/sample/manage/service/impl/DeviceServiceImpl.java
@@ -636,6 +636,7 @@
                .nickname(entity.getNickname())
                .firmwareVersion(entity.getFirmwareVersion())
                .deptId(entity.getDeptId())
                .workType(entity.getWorkType())
                .workspaceName(entity.getDeptId() != null
                        ? Optional.ofNullable(sysDeptService.selectDeptById(entity.getDeptId()))
                        .map(SysDept::getDeptName)
@@ -671,6 +672,19 @@
    public Boolean updateDevice(DeviceDTO deviceDTO) {
        int update = mapper.update(this.deviceDTO2Entity(deviceDTO),
                new LambdaUpdateWrapper<DeviceEntity>().eq(DeviceEntity::getDeviceSn, deviceDTO.getDeviceSn()));
        return update > 0;
    }
    @Override
    public Boolean updateWorkType(String sn, Long workType) {
        // 方式1:使用LambdaUpdateWrapper(推荐,类型安全,避免字段名硬编码)
        LambdaUpdateWrapper<DeviceEntity> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
        // 设置更新条件:deviceSn = sn
        lambdaUpdateWrapper.eq(DeviceEntity::getDeviceSn, sn)
                // 只更新workType字段
                .set(DeviceEntity::getWorkType, workType);
        // 执行更新(第一个参数传null,因为更新字段已通过wrapper的set指定)
        int update = mapper.update(null, lambdaUpdateWrapper);
        return update > 0;
    }
@@ -804,12 +818,14 @@
     */
    @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(DeviceEntity::getBoundStatus, true));
                        .eq(deptId != null, DeviceEntity::getDeptId, deptId)
                        .isNotNull(DeviceEntity::getDeptId));
//                        .eq(DeviceEntity::getBoundStatus, true));
        List<DeviceDTO> devicesList = pagination.getRecords().stream().map(this::deviceEntityConvertToDTO)
                .peek(device -> {
                    device.setStatus(RedisOpsUtils.checkExist(RedisConst.DEVICE_ONLINE_PREFIX + device.getDeviceSn()));
@@ -835,6 +851,7 @@
        DeviceDTO device = DeviceDTO.builder()
                .deviceSn(deviceSn)
                .boundStatus(false)
                .deptId(null)
                .build();
        this.updateDevice(device);
    }
@@ -1009,6 +1026,7 @@
                .childSn(dto.getChildDeviceSn())
                .domain(dto.getDomain())
                .firmwareVersion(dto.getFirmwareVersion())
                .workType(dto.getWorkType())
                .compatibleStatus(dto.getFirmwareStatus() == null ? null :
                        DeviceFirmwareStatusEnum.CONSISTENT_UPGRADE != DeviceFirmwareStatusEnum.find(dto.getFirmwareStatus()))
                .build();