mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-01-31 09:30:05 +08:00
【新增】IOT 设备管理,获得设备数量接口
This commit is contained in:
parent
643e289384
commit
1719b69ef7
@ -1,11 +1,8 @@
|
|||||||
package cn.iocoder.yudao.module.iot.controller.admin.device;
|
package cn.iocoder.yudao.module.iot.controller.admin.device;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
||||||
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.IotDevicePageReqVO;
|
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.IotDevicePageReqVO;
|
||||||
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.IotDeviceRespVO;
|
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.IotDeviceRespVO;
|
||||||
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.IotDeviceSaveReqVO;
|
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.IotDeviceSaveReqVO;
|
||||||
@ -16,16 +13,11 @@ import io.swagger.v3.oas.annotations.Operation;
|
|||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@Tag(name = "管理后台 - IoT 设备")
|
@Tag(name = "管理后台 - IoT 设备")
|
||||||
@ -86,4 +78,12 @@ public class IotDeviceController {
|
|||||||
return success(BeanUtils.toBean(pageResult, IotDeviceRespVO.class));
|
return success(BeanUtils.toBean(pageResult, IotDeviceRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/count")
|
||||||
|
@Operation(summary = "获得设备数量")
|
||||||
|
@Parameter(name = "productId", description = "产品编号", example = "1")
|
||||||
|
@PreAuthorize("@ss.hasPermission('iot:device:query')")
|
||||||
|
public CommonResult<Long> getDeviceCount(@RequestParam("productId") Long productId) {
|
||||||
|
return success(deviceService.getDeviceCount(productId));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -47,4 +47,7 @@ public interface IotDeviceMapper extends BaseMapperX<IotDeviceDO> {
|
|||||||
return selectCount(IotDeviceDO::getGatewayId, id);
|
return selectCount(IotDeviceDO::getGatewayId, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default Long selectCountByProductId(Long productId) {
|
||||||
|
return selectCount(IotDeviceDO::getProductId, productId);
|
||||||
|
}
|
||||||
}
|
}
|
@ -224,4 +224,9 @@ public class DeviceServiceImpl implements IotDeviceService {
|
|||||||
deviceMapper.updateById(updateObj);
|
deviceMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getDeviceCount(Long productId) {
|
||||||
|
return deviceMapper.selectCountByProductId(productId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -57,4 +57,11 @@ public interface IotDeviceService {
|
|||||||
*/
|
*/
|
||||||
void updateDeviceStatus(IotDeviceStatusUpdateReqVO updateReqVO);
|
void updateDeviceStatus(IotDeviceStatusUpdateReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得设备数量
|
||||||
|
*
|
||||||
|
* @param productId 产品编号
|
||||||
|
* @return 设备数量
|
||||||
|
*/
|
||||||
|
Long getDeviceCount(Long productId);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user