Sfoglia il codice sorgente

fix(设备管理): 添加post方式的设备属性列表查询接口 (#302)

bestfeng1020 2 anni fa
parent
commit
ec66ae9ae7

+ 14 - 0
jetlinks-manager/device-manager/src/main/java/org/jetlinks/community/device/service/data/DeviceDataService.java

@@ -157,6 +157,20 @@ public interface DeviceDataService {
                                                         @Nonnull String property,
                                                         @Nonnull QueryParamEntity query);
 
+
+    /**
+     * 分页查询属性
+     *
+     * @param deviceId 设备ID
+     * @param query    查询条件
+     * @return 分页查询结果
+     * @since 1.9
+     */
+    @Nonnull
+    Mono<PagerResult<DeviceProperty>> queryPropertyPage(@Nonnull String deviceId,
+                                                        @Nonnull QueryParamEntity query,
+                                                        @Nonnull String... property);
+
     /**
      * 分页查询设备日志
      *

+ 11 - 1
jetlinks-manager/device-manager/src/main/java/org/jetlinks/community/device/web/DeviceInstanceController.java

@@ -317,7 +317,17 @@ public class DeviceInstanceController implements
     public Mono<PagerResult<DeviceProperty>> queryDeviceProperties(@PathVariable @Parameter(description = "设备ID") String deviceId,
                                                                    @PathVariable @Parameter(description = "属性ID") String property,
                                                                    @Parameter(hidden = true) QueryParamEntity entity) {
-        return deviceDataService.queryPropertyPage(deviceId, property, entity);
+        return deviceDataService.queryPropertyPage(deviceId, entity, property.split(","));
+    }
+
+    //查询属性列表
+    @PostMapping("/{deviceId:.+}/property/{property}/_query")
+    @QueryAction
+    @Operation(summary = "(POST)查询设备指定属性列表")
+    public Mono<PagerResult<DeviceProperty>> queryDeviceProperties(@PathVariable @Parameter(description = "设备ID") String deviceId,
+                                                                   @PathVariable @Parameter(description = "属性ID") String property,
+                                                                   @RequestBody Mono<QueryParamEntity> queryParam) {
+        return queryParam.flatMap(param -> deviceDataService.queryPropertyPage(deviceId, param, property.split(",")));
     }
 
     //查询属性列表