Sfoglia il codice sorgente

fixed 标签批量更新

18339543638 4 anni fa
parent
commit
5412d83c60

+ 3 - 2
jetlinks-manager/device-manager/src/main/java/org/jetlinks/community/device/web/DeviceInstanceController.java

@@ -426,12 +426,13 @@ public class DeviceInstanceController implements
     @SaveAction
     @Operation(summary = "保存设备标签")
     public Flux<DeviceTagEntity> saveDeviceTag(@PathVariable @Parameter(description = "设备ID") String deviceId,
-                                               @RequestBody DeviceTagEntity tags) {
-        return Flux.just(tags)
+                                               @RequestBody Flux<DeviceTagEntity> tags) {
+        return tags
             .doOnNext(tag -> {
                 tag.setId(DeviceTagEntity.createTagId(deviceId, tag.getKey()));
                 tag.setDeviceId(deviceId);
                 tag.tryValidate();
+                tag.setAutoUpdate(true);
             })
             .flatMap(tagsService::saveOrUpdate)
             .onErrorMap(DuplicateKeyException.class, err -> new BusinessException("标签不可重复添加", err))