|
|
@@ -27,6 +27,7 @@ import java.util.Objects;
|
|
|
@RestController
|
|
|
@RequestMapping("/device")
|
|
|
@RequiredArgsConstructor
|
|
|
+@Validated
|
|
|
public class IotDeviceController {
|
|
|
private final IotDeviceService iotDeviceService;
|
|
|
|
|
|
@@ -38,7 +39,7 @@ public class IotDeviceController {
|
|
|
*/
|
|
|
@PostMapping("/list")
|
|
|
public Result<Object> list(@RequestBody @Validated DevicePage devicePage) {
|
|
|
- return Result.ok(iotDeviceService.pageQuery(devicePage),"查询成功");
|
|
|
+ return Result.ok(iotDeviceService.pageQuery(devicePage), "查询成功");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -49,7 +50,7 @@ public class IotDeviceController {
|
|
|
*/
|
|
|
@PostMapping("/save")
|
|
|
public Result<Object> save(@RequestBody @Validated IotDevicePara iotDevicePara) {
|
|
|
- return Result.ok(iotDeviceService.save(iotDevicePara),"保存成功");
|
|
|
+ return Result.ok(iotDeviceService.save(iotDevicePara), "保存成功");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -60,19 +61,19 @@ public class IotDeviceController {
|
|
|
*/
|
|
|
@GetMapping("/detail")
|
|
|
public Result<Object> detail(@NotNull(message = "id不能为空") @Validated Long id) {
|
|
|
- return Result.ok(iotDeviceService.detail(id),"查询成功");
|
|
|
+ return Result.ok(iotDeviceService.detail(id), "查询成功");
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 设备物模型数据详情
|
|
|
- *
|
|
|
- * @param id 设备id
|
|
|
- * @return
|
|
|
- */
|
|
|
- @GetMapping("/modDetail")
|
|
|
- public Result<Object> modDetail(@NotNull(message = "id不能为空") @Validated Long id) {
|
|
|
- return Result.ok(iotDeviceService.detail(id),"查询成功");
|
|
|
- }
|
|
|
+// /**
|
|
|
+// * 设备物模型数据详情
|
|
|
+// *
|
|
|
+// * @param id 设备id
|
|
|
+// * @return
|
|
|
+// */
|
|
|
+// @GetMapping("/modDetail")
|
|
|
+// public Result<Object> modDetail(@NotNull(message = "id不能为空") @Validated Long id) {
|
|
|
+// return Result.ok(iotDeviceService.detail(id), "查询成功");
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
|
* 导入设备
|
|
|
@@ -110,7 +111,7 @@ public class IotDeviceController {
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("/enable")
|
|
|
- public Result<Object> enable(@RequestBody IotDeviceFlag iotDeviceFlag) {
|
|
|
+ public Result<Object> enable(@RequestBody @Validated IotDeviceFlag iotDeviceFlag) {
|
|
|
return Result.ok(iotDeviceService.enable(iotDeviceFlag), "操作成功");
|
|
|
}
|
|
|
|
|
|
@@ -121,7 +122,7 @@ public class IotDeviceController {
|
|
|
* @return 设备总数、当前在线
|
|
|
*/
|
|
|
@GetMapping("/count")
|
|
|
- public Result<Object> count(Long productId) {
|
|
|
+ public Result<Object> count(@NotNull(message = "产品id不能为空") Long productId) {
|
|
|
return Result.ok(iotDeviceService.count(productId), "查询成功");
|
|
|
}
|
|
|
}
|