自定添加维度类型

This commit is contained in:
zhouhao 2020-02-27 14:00:16 +08:00
parent 2a35078f66
commit 72e313f378
1 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,35 @@
package org.jetlinks.community.auth.service;
import org.hswebframework.ezorm.rdb.mapping.ReactiveRepository;
import org.hswebframework.web.system.authorization.api.entity.DimensionTypeEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Flux;
@Component
public class DimensionInitService implements CommandLineRunner {
private final ReactiveRepository<DimensionTypeEntity, String> dimensionTypeRepository;
public DimensionInitService(ReactiveRepository<DimensionTypeEntity, String> dimensionTypeRepository) {
this.dimensionTypeRepository = dimensionTypeRepository;
}
@Override
public void run(String... args) throws Exception {
DimensionTypeEntity org =new DimensionTypeEntity();
org.setId("org");
org.setName("机构");
org.setDescribe("机构维度");
DimensionTypeEntity role =new DimensionTypeEntity();
role.setId("role");
role.setName("角色");
role.setDescribe("角色维度");
dimensionTypeRepository.save(Flux.just(org,role))
.subscribe();
}
}