refactor: 初始化数据时不触发crud事件

This commit is contained in:
zhouhao 2023-12-21 10:13:10 +08:00
parent 27ff0510a6
commit a20814b68d
1 changed files with 2 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package org.jetlinks.community.device.service;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.hswebframework.web.api.crud.entity.TreeSupportEntity;
import org.hswebframework.web.crud.events.EntityEventHelper;
import org.hswebframework.web.crud.service.GenericReactiveTreeSupportCrudService;
import org.hswebframework.web.id.IDGenerator;
import org.jetlinks.community.device.entity.DeviceCategoryEntity;
@ -39,6 +40,7 @@ public class DeviceCategoryService extends GenericReactiveTreeSupportCrudService
.createQuery()
.fetchOne()
.switchIfEmpty(initDefaultData().then(Mono.empty()))
.as(EntityEventHelper::setDoNotFireEvent)
.subscribe(ignore->{},
err -> log.error("init device category error", err));
}