diff --git a/README.md b/README.md
index d95dc960f..4c7110285 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,11 @@
# hsweb4 基于spring-boot2,全响应式的后台管理框架
[](https://codecov.io/gh/hs-web/hsweb-framework/branch/master)
-[](https://travis-ci.org/hs-web/hsweb-framework)
+[](https://travis-ci.
+com/hs-web/hsweb-framework)
[](https://www.apache.org/licenses/LICENSE-2.0.html)
# 功能,特性
-- [x] 基于[r2dbc](https://github.com/r2dbc) ,[easy-orm](https://github.com/hs-web/hsweb-easy-orm/tree/4.0.x)的通用响应式CRUD
+- [x] 基于[r2dbc](https://github.com/r2dbc) ,[easy-orm](https://github.com/hs-web/hsweb-easy-orm/tree/4.0.x) 的通用响应式CRUD
- [x] H2,Mysql,SqlServer,PostgreSQL
- [x] 响应式r2dbc事务控制
- [x] 响应式权限控制,以及权限信息获取
diff --git a/hsweb-authorization/hsweb-authorization-api/pom.xml b/hsweb-authorization/hsweb-authorization-api/pom.xml
index ce219986a..81acffd8e 100644
--- a/hsweb-authorization/hsweb-authorization-api/pom.xml
+++ b/hsweb-authorization/hsweb-authorization-api/pom.xml
@@ -5,7 +5,7 @@
hsweb-authorization
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
4.0.0
diff --git a/hsweb-authorization/hsweb-authorization-basic/pom.xml b/hsweb-authorization/hsweb-authorization-basic/pom.xml
index 58a2c8b2d..b7618225a 100644
--- a/hsweb-authorization/hsweb-authorization-basic/pom.xml
+++ b/hsweb-authorization/hsweb-authorization-basic/pom.xml
@@ -5,7 +5,7 @@
hsweb-authorization
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
4.0.0
diff --git a/hsweb-authorization/hsweb-authorization-oauth2/pom.xml b/hsweb-authorization/hsweb-authorization-oauth2/pom.xml
index 13ab3780c..fedc0eba4 100644
--- a/hsweb-authorization/hsweb-authorization-oauth2/pom.xml
+++ b/hsweb-authorization/hsweb-authorization-oauth2/pom.xml
@@ -5,7 +5,7 @@
hsweb-authorization
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
4.0.0
diff --git a/hsweb-authorization/pom.xml b/hsweb-authorization/pom.xml
index 28163f83b..b5f2236d6 100644
--- a/hsweb-authorization/pom.xml
+++ b/hsweb-authorization/pom.xml
@@ -5,7 +5,7 @@
hsweb-framework
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
4.0.0
diff --git a/hsweb-commons/hsweb-commons-api/pom.xml b/hsweb-commons/hsweb-commons-api/pom.xml
index 219aaad23..03a295967 100644
--- a/hsweb-commons/hsweb-commons-api/pom.xml
+++ b/hsweb-commons/hsweb-commons-api/pom.xml
@@ -5,7 +5,7 @@
hsweb-commons
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
4.0.0
diff --git a/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/TreeSupportEntity.java b/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/TreeSupportEntity.java
index 39fd008b3..3f35ddb6c 100644
--- a/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/TreeSupportEntity.java
+++ b/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/TreeSupportEntity.java
@@ -20,6 +20,7 @@ package org.hswebframework.web.api.crud.entity;
import org.hswebframework.utils.RandomUtil;
+import org.hswebframework.web.exception.ValidationException;
import org.hswebframework.web.id.IDGenerator;
import org.springframework.util.CollectionUtils;
@@ -49,6 +50,14 @@ public interface TreeSupportEntity extends Entity {
> List getChildren();
+ @Override
+ default void tryValidate(Class>... groups) {
+ Entity.super.tryValidate(groups);
+ if (getId() != null && Objects.equals(getId(), getParentId())) {
+ throw new ValidationException("parentId", "子节点ID不能与父节点ID相同");
+ }
+ }
+
/**
* 根据path获取父节点的path
*
@@ -180,7 +189,8 @@ public interface TreeSupportEntity extends Entity {
* @return 树形结构集合
*/
static , PK> List list2tree(Collection dataList, BiConsumer> childConsumer) {
- return list2tree(dataList, childConsumer, (Function, Predicate>) predicate -> node -> node == null || predicate.getNode(node.getParentId()) == null);
+ return list2tree(dataList, childConsumer, (Function, Predicate>) predicate -> node -> node == null || predicate
+ .getNode(node.getParentId()) == null);
}
static , PK> List list2tree(Collection dataList,
@@ -211,9 +221,9 @@ public interface TreeSupportEntity extends Entity {
Map cache = new HashMap<>();
// parentId,children
Map> treeCache = streamSupplier.get()
- .peek(node -> cache.put(node.getId(), node))
- .filter(e -> e.getParentId() != null)
- .collect(Collectors.groupingBy(TreeSupportEntity::getParentId));
+ .peek(node -> cache.put(node.getId(), node))
+ .filter(e -> e.getParentId() != null)
+ .collect(Collectors.groupingBy(TreeSupportEntity::getParentId));
Predicate rootNodePredicate = predicateFunction.apply(new TreeHelper() {
@Override
@@ -228,11 +238,11 @@ public interface TreeSupportEntity extends Entity {
});
return streamSupplier.get()
- //设置每个节点的子节点
- .peek(node -> childConsumer.accept(node, treeCache.get(node.getId())))
- //获取根节点
- .filter(rootNodePredicate)
- .collect(Collectors.toList());
+ //设置每个节点的子节点
+ .peek(node -> childConsumer.accept(node, treeCache.get(node.getId())))
+ //获取根节点
+ .filter(rootNodePredicate)
+ .collect(Collectors.toList());
}
/**
diff --git a/hsweb-commons/hsweb-commons-crud/pom.xml b/hsweb-commons/hsweb-commons-crud/pom.xml
index 48f9dc8d9..66f08720a 100644
--- a/hsweb-commons/hsweb-commons-crud/pom.xml
+++ b/hsweb-commons/hsweb-commons-crud/pom.xml
@@ -5,7 +5,7 @@
hsweb-commons
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
4.0.0
@@ -88,7 +88,6 @@
com.google.guava
guava
- 28.0-jre
test
diff --git a/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/EasyormRepositoryRegistrar.java b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/EasyormRepositoryRegistrar.java
index d99a4d75e..1f4922154 100644
--- a/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/EasyormRepositoryRegistrar.java
+++ b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/EasyormRepositoryRegistrar.java
@@ -38,6 +38,14 @@ public class EasyormRepositoryRegistrar implements ImportBeanDefinitionRegistrar
private final MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
+ @SneakyThrows
+ private Stream doGetResources(String packageStr) {
+ String path = ResourcePatternResolver
+ .CLASSPATH_ALL_URL_PREFIX
+ .concat(packageStr.replace(".", "/")).concat("/**/*.class");
+ return Arrays.stream(resourcePatternResolver.getResources(path));
+ }
+
@Override
@SneakyThrows
@SuppressWarnings("all")
@@ -47,33 +55,36 @@ public class EasyormRepositoryRegistrar implements ImportBeanDefinitionRegistrar
if (attr == null) {
return;
}
- boolean reactivePrecent = org.springframework.util.ClassUtils.isPresent("io.r2dbc.spi.ConnectionFactory", this.getClass().getClassLoader());
+ boolean reactivePrecent = org.springframework.util.ClassUtils.isPresent("io.r2dbc.spi.ConnectionFactory", this
+ .getClass()
+ .getClassLoader());
String[] arr = (String[]) attr.get("value");
- String path = Arrays.stream(arr)
- .map(str -> ResourcePatternResolver
- .CLASSPATH_ALL_URL_PREFIX
- .concat(str.replace(".", "/")).concat("/**/*.class"))
- .collect(Collectors.joining());
+ Set resources = Arrays
+ .stream(arr)
+ .flatMap(this::doGetResources)
+ .collect(Collectors.toSet());
Class[] anno = (Class[]) attr.get("annotation");
Set entityInfos = new HashSet<>();
- for (Resource resource : resourcePatternResolver.getResources(path)) {
+ for (Resource resource : resources) {
MetadataReader reader = metadataReaderFactory.getMetadataReader(resource);
String className = reader.getClassMetadata().getClassName();
- Class> entityType = org.springframework.util.ClassUtils.forName(className,null);
+ Class> entityType = org.springframework.util.ClassUtils.forName(className, null);
if (Arrays.stream(anno)
- .noneMatch(ann -> AnnotationUtils.findAnnotation(entityType, ann) != null)) {
+ .noneMatch(ann -> AnnotationUtils.findAnnotation(entityType, ann) != null)) {
continue;
}
ImplementFor implementFor = AnnotationUtils.findAnnotation(entityType, ImplementFor.class);
Reactive reactive = AnnotationUtils.findAnnotation(entityType, Reactive.class);
- Class genericType = Optional.ofNullable(implementFor)
+ Class genericType = Optional
+ .ofNullable(implementFor)
.map(ImplementFor::value)
.orElseGet(() -> {
- return Stream.of(entityType.getInterfaces())
+ return Stream
+ .of(entityType.getInterfaces())
.filter(e -> GenericEntity.class.isAssignableFrom(e))
.findFirst()
.orElse(entityType);
@@ -97,7 +108,8 @@ public class EasyormRepositoryRegistrar implements ImportBeanDefinitionRegistrar
idType = implementFor.idType();
}
- EntityInfo entityInfo = new EntityInfo(genericType, entityType, idType, reactivePrecent && (reactive == null || reactive.enable()));
+ EntityInfo entityInfo = new EntityInfo(genericType, entityType, idType, reactivePrecent && (reactive == null || reactive
+ .enable()));
if (!entityInfos.contains(entityInfo) || implementFor != null) {
entityInfos.add(entityInfo);
}
diff --git a/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/service/ReactiveTreeSortEntityService.java b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/service/ReactiveTreeSortEntityService.java
index dfa6caeae..2cf5f6c8c 100644
--- a/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/service/ReactiveTreeSortEntityService.java
+++ b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/service/ReactiveTreeSortEntityService.java
@@ -32,16 +32,16 @@ public interface ReactiveTreeSortEntityService TreeSupportEntity.list2tree(list,
- this::setChildren,
- this::createRootNodePredicate));
+ this::setChildren,
+ this::createRootNodePredicate));
}
default Mono> queryIncludeChildrenTree(QueryParamEntity paramEntity) {
return queryIncludeChildren(paramEntity)
.collectList()
.map(list -> TreeSupportEntity.list2tree(list,
- this::setChildren,
- this::createRootNodePredicate));
+ this::setChildren,
+ this::createRootNodePredicate));
}
default Flux queryIncludeChildren(Collection idList) {
@@ -68,11 +68,11 @@ public interface ReactiveTreeSortEntityService insertBatch(Publisher extends Collection> entityPublisher) {
return this.getRepository()
- .insertBatch(Flux.from(entityPublisher)
- .flatMap(Flux::fromIterable)
- .flatMap(this::applyTreeProperty)
- .flatMap(e -> Flux.fromIterable(TreeSupportEntity.expandTree2List(e, getIDGenerator())))
- .collectList());
+ .insertBatch(Flux.from(entityPublisher)
+ .flatMap(Flux::fromIterable)
+ .flatMap(this::applyTreeProperty)
+ .flatMap(e -> Flux.fromIterable(TreeSupportEntity.expandTree2List(e, getIDGenerator())))
+ .collectList());
}
default Mono applyTreeProperty(E ele) {
@@ -80,25 +80,42 @@ public interface ReactiveTreeSortEntityService ele.setPath(parent.getPath() + "-" + RandomUtil.randomChar(4)))
- .thenReturn(ele);
+
+ return this.checkCyclicDependency(ele.getId(), ele)
+ .then(this.findById(ele.getParentId())
+ .doOnNext(parent -> ele.setPath(parent.getPath() + "-" + RandomUtil.randomChar(4))))
+ .thenReturn(ele);
+ }
+
+ //校验是否有循环依赖,修改父节点为自己的子节点?
+ default Mono checkCyclicDependency(K id, E ele) {
+ if (StringUtils.isEmpty(id)) {
+ return Mono.empty();
+ }
+ return this
+ .queryIncludeChildren(Collections.singletonList(id))
+ .doOnNext(e -> {
+ if (Objects.equals(ele.getParentId(), e.getId())) {
+ throw new IllegalArgumentException("不能修改父节点为自己或者自己的子节点");
+ }
+ })
+ .then(Mono.just(ele));
}
@Override
default Mono save(Publisher entityPublisher) {
return this.getRepository()
- .save(Flux.from(entityPublisher)
- .flatMap(this::applyTreeProperty)
- //把树结构平铺
- .flatMap(e -> Flux.fromIterable(TreeSupportEntity.expandTree2List(e, getIDGenerator())))
- );
+ .save(Flux.from(entityPublisher)
+ .flatMap(this::applyTreeProperty)
+ //把树结构平铺
+ .flatMap(e -> Flux.fromIterable(TreeSupportEntity.expandTree2List(e, getIDGenerator())))
+ );
}
@Override
default Mono updateById(K id, Mono entityPublisher) {
- return save(entityPublisher
- .doOnNext(e -> e.setId(id)))
+ return this
+ .save(entityPublisher.doOnNext(e -> e.setId(id)))
.map(SaveResult::getTotal);
}
diff --git a/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/web/CommonErrorControllerAdvice.java b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/web/CommonErrorControllerAdvice.java
index 6499d305d..673442ebf 100644
--- a/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/web/CommonErrorControllerAdvice.java
+++ b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/web/CommonErrorControllerAdvice.java
@@ -1,5 +1,7 @@
package org.hswebframework.web.crud.web;
+import io.r2dbc.spi.R2dbcDataIntegrityViolationException;
+import io.r2dbc.spi.R2dbcNonTransientException;
import lombok.extern.slf4j.Slf4j;
import org.hswebframework.web.authorization.exception.AccessDenyException;
import org.hswebframework.web.authorization.exception.AuthenticationException;
@@ -42,7 +44,7 @@ public class CommonErrorControllerAdvice {
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public Mono> handleException(BusinessException e) {
return Mono.just(ResponseMessage.error(e.getCode(), e.getMessage()))
- .doOnEach(ReactiveLogger.onNext(r -> log.error(e.getMessage(), e)));
+ .doOnEach(ReactiveLogger.onNext(r -> log.error(e.getMessage(), e)));
}
@ExceptionHandler
@@ -72,7 +74,8 @@ public class CommonErrorControllerAdvice {
@ExceptionHandler
@ResponseStatus(HttpStatus.BAD_REQUEST)
public Mono>> handleException(ValidationException e) {
- return Mono.just(ResponseMessage.>error(400, "illegal_argument", e.getMessage()).result(e.getDetails()));
+ return Mono.just(ResponseMessage.>error(400, "illegal_argument", e.getMessage())
+ .result(e.getDetails()));
}
@ExceptionHandler
@@ -84,7 +87,8 @@ public class CommonErrorControllerAdvice {
@ExceptionHandler
@ResponseStatus(HttpStatus.BAD_REQUEST)
public Mono>> handleException(BindException e) {
- return handleException(new ValidationException(e.getMessage(), e.getBindingResult().getAllErrors()
+ return handleException(new ValidationException(e.getMessage(), e
+ .getBindingResult().getAllErrors()
.stream()
.filter(FieldError.class::isInstance)
.map(FieldError.class::cast)
@@ -95,7 +99,8 @@ public class CommonErrorControllerAdvice {
@ExceptionHandler
@ResponseStatus(HttpStatus.BAD_REQUEST)
public Mono>> handleException(WebExchangeBindException e) {
- return handleException(new ValidationException(e.getMessage(), e.getBindingResult().getAllErrors()
+ return handleException(new ValidationException(e.getMessage(), e
+ .getBindingResult().getAllErrors()
.stream()
.filter(FieldError.class::isInstance)
.map(FieldError.class::cast)
@@ -107,7 +112,8 @@ public class CommonErrorControllerAdvice {
@ExceptionHandler
@ResponseStatus(HttpStatus.BAD_REQUEST)
public Mono>> handleException(MethodArgumentNotValidException e) {
- return handleException(new ValidationException(e.getMessage(), e.getBindingResult().getAllErrors()
+ return handleException(new ValidationException(e.getMessage(), e
+ .getBindingResult().getAllErrors()
.stream()
.filter(FieldError.class::isInstance)
.map(FieldError.class::cast)
@@ -125,7 +131,7 @@ public class CommonErrorControllerAdvice {
@ResponseStatus(HttpStatus.GATEWAY_TIMEOUT)
public Mono> handleException(TimeoutException e) {
return Mono.just(ResponseMessage.error(504, "timeout", e.getMessage()))
- .doOnEach(ReactiveLogger.onNext(r -> log.error(e.getMessage(), e)));
+ .doOnEach(ReactiveLogger.onNext(r -> log.error(e.getMessage(), e)));
}
@@ -134,7 +140,7 @@ public class CommonErrorControllerAdvice {
@Order
public Mono> handleException(RuntimeException e) {
return Mono.just(ResponseMessage.error(e.getMessage()))
- .doOnEach(ReactiveLogger.onNext(r -> log.error(e.getMessage(), e)));
+ .doOnEach(ReactiveLogger.onNext(r -> log.error(e.getMessage(), e)));
}
@@ -143,14 +149,14 @@ public class CommonErrorControllerAdvice {
public Mono> handleException(NullPointerException e) {
return Mono.just(ResponseMessage.error(e.getMessage()))
- .doOnEach(ReactiveLogger.onNext(r -> log.error(e.getMessage(), e)));
+ .doOnEach(ReactiveLogger.onNext(r -> log.error(e.getMessage(), e)));
}
@ExceptionHandler
@ResponseStatus(HttpStatus.BAD_REQUEST)
public Mono> handleException(IllegalArgumentException e) {
return Mono.just(ResponseMessage.error(400, "illegal_argument", e.getMessage()))
- .doOnEach(ReactiveLogger.onNext(r -> log.error(e.getMessage(), e)));
+ .doOnEach(ReactiveLogger.onNext(r -> log.error(e.getMessage(), e)));
}
@ExceptionHandler
@@ -163,29 +169,40 @@ public class CommonErrorControllerAdvice {
@ResponseStatus(HttpStatus.UNSUPPORTED_MEDIA_TYPE)
public Mono> handleException(MediaTypeNotSupportedStatusException e) {
return Mono.just(ResponseMessage
- .error(415, "unsupported_media_type", "不支持的请求类型")
- .result(e.getSupportedMediaTypes()))
- .doOnEach(ReactiveLogger.onNext(r -> log.error(e.getMessage(), e)));
+ .error(415, "unsupported_media_type", "不支持的请求类型")
+ .result(e.getSupportedMediaTypes()))
+ .doOnEach(ReactiveLogger.onNext(r -> log.error(e.getMessage(), e)));
}
@ExceptionHandler
@ResponseStatus(HttpStatus.NOT_ACCEPTABLE)
public Mono> handleException(NotAcceptableStatusException e) {
return Mono.just(ResponseMessage
- .error(406, "not_acceptable_media_type", "不支持的响应类型")
- .result(e.getSupportedMediaTypes()))
- .doOnEach(ReactiveLogger.onNext(r -> log.error(e.getMessage(), e)));
+ .error(406, "not_acceptable_media_type", "不支持的响应类型")
+ .result(e.getSupportedMediaTypes()))
+ .doOnEach(ReactiveLogger.onNext(r -> log.error(e.getMessage(), e)));
}
@ExceptionHandler
@ResponseStatus(HttpStatus.NOT_ACCEPTABLE)
public Mono> handleException(MethodNotAllowedException e) {
return Mono.just(ResponseMessage
- .error(405, "method_not_allowed", "不支持的请求方法:" + e.getHttpMethod())
- .result(e.getSupportedMethods()))
- .doOnEach(ReactiveLogger.onNext(r -> log.error(e.getMessage(), e)));
+ .error(405, "method_not_allowed", "不支持的请求方法:" + e.getHttpMethod())
+ .result(e.getSupportedMethods()))
+ .doOnEach(ReactiveLogger.onNext(r -> log.error(e.getMessage(), e)));
}
+ @ExceptionHandler
+ @ResponseStatus(HttpStatus.BAD_REQUEST)
+ public Mono> handleException(R2dbcDataIntegrityViolationException exception) {
+ if (exception.getMessage().contains("Duplicate")) {
+ return Mono.just(ResponseMessage.error("存在重复的数据"));
+ }
+ log.warn(exception.getMessage(), exception);
+ return Mono.just(ResponseMessage.error("数据错误"));
+ }
+
+
@ExceptionHandler
@ResponseStatus(HttpStatus.BAD_REQUEST)
public Mono>> handleException(ServerWebInputException e) {
diff --git a/hsweb-commons/pom.xml b/hsweb-commons/pom.xml
index 56e8a605c..d8214549d 100644
--- a/hsweb-commons/pom.xml
+++ b/hsweb-commons/pom.xml
@@ -23,7 +23,7 @@
hsweb-framework
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
../pom.xml
4.0.0
diff --git a/hsweb-concurrent/hsweb-concurrent-cache/pom.xml b/hsweb-concurrent/hsweb-concurrent-cache/pom.xml
index 49d833290..aca207902 100644
--- a/hsweb-concurrent/hsweb-concurrent-cache/pom.xml
+++ b/hsweb-concurrent/hsweb-concurrent-cache/pom.xml
@@ -5,7 +5,7 @@
hsweb-concurrent
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
4.0.0
@@ -40,7 +40,6 @@
com.google.guava
guava
- 28.0-jre
true
diff --git a/hsweb-concurrent/pom.xml b/hsweb-concurrent/pom.xml
index 82a564239..7428b1c97 100644
--- a/hsweb-concurrent/pom.xml
+++ b/hsweb-concurrent/pom.xml
@@ -5,7 +5,7 @@
hsweb-framework
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
4.0.0
diff --git a/hsweb-core/pom.xml b/hsweb-core/pom.xml
index df336b0b2..f4a86905e 100644
--- a/hsweb-core/pom.xml
+++ b/hsweb-core/pom.xml
@@ -5,7 +5,7 @@
hsweb-framework
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
../pom.xml
4.0.0
diff --git a/hsweb-core/src/main/java/org/hswebframework/web/bean/FastBeanCopier.java b/hsweb-core/src/main/java/org/hswebframework/web/bean/FastBeanCopier.java
index b9deebbed..7f69ccf9c 100644
--- a/hsweb-core/src/main/java/org/hswebframework/web/bean/FastBeanCopier.java
+++ b/hsweb-core/src/main/java/org/hswebframework/web/bean/FastBeanCopier.java
@@ -17,6 +17,7 @@ import java.beans.PropertyDescriptor;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
@@ -29,7 +30,7 @@ import java.util.stream.Stream;
*/
@Slf4j
public final class FastBeanCopier {
- private static final Map CACHE = new HashMap<>();
+ private static final Map CACHE = new ConcurrentHashMap<>();
private static final PropertyUtilsBean propertyUtils = BeanUtilsBean.getInstance().getPropertyUtils();
@@ -96,7 +97,7 @@ public final class FastBeanCopier {
}
public static T copy(S source, T target, Converter converter, String... ignore) {
- return copy(source, target, converter, (ignore == null || ignore.length == 0) ? new java.util.HashSet<>() : new HashSet<>(Arrays.asList(ignore)));
+ return copy(source, target, converter, (ignore == null || ignore.length == 0) ? Collections.emptySet() : new HashSet<>(Arrays.asList(ignore)));
}
public static T copy(S source, T target, Set ignore) {
diff --git a/hsweb-datasource/hsweb-datasource-api/pom.xml b/hsweb-datasource/hsweb-datasource-api/pom.xml
index 49cc9b93c..5a570c348 100644
--- a/hsweb-datasource/hsweb-datasource-api/pom.xml
+++ b/hsweb-datasource/hsweb-datasource-api/pom.xml
@@ -5,7 +5,7 @@
hsweb-datasource
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
../pom.xml
diff --git a/hsweb-datasource/hsweb-datasource-jta/pom.xml b/hsweb-datasource/hsweb-datasource-jta/pom.xml
index 5ce0db2ac..5148627d7 100644
--- a/hsweb-datasource/hsweb-datasource-jta/pom.xml
+++ b/hsweb-datasource/hsweb-datasource-jta/pom.xml
@@ -5,7 +5,7 @@
hsweb-datasource
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
../pom.xml
diff --git a/hsweb-datasource/hsweb-datasource-web/pom.xml b/hsweb-datasource/hsweb-datasource-web/pom.xml
index 16e191a4e..d9689d365 100644
--- a/hsweb-datasource/hsweb-datasource-web/pom.xml
+++ b/hsweb-datasource/hsweb-datasource-web/pom.xml
@@ -5,7 +5,7 @@
hsweb-datasource
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
../pom.xml
diff --git a/hsweb-datasource/pom.xml b/hsweb-datasource/pom.xml
index 672ebff17..471ee8b6d 100644
--- a/hsweb-datasource/pom.xml
+++ b/hsweb-datasource/pom.xml
@@ -5,7 +5,7 @@
hsweb-framework
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
../pom.xml
diff --git a/hsweb-logging/hsweb-access-logging-aop/pom.xml b/hsweb-logging/hsweb-access-logging-aop/pom.xml
index 6e2f73c0b..1f82b474f 100644
--- a/hsweb-logging/hsweb-access-logging-aop/pom.xml
+++ b/hsweb-logging/hsweb-access-logging-aop/pom.xml
@@ -5,7 +5,7 @@
hsweb-logging
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
../pom.xml
4.0.0
diff --git a/hsweb-logging/hsweb-access-logging-api/pom.xml b/hsweb-logging/hsweb-access-logging-api/pom.xml
index 0a13dc7f3..dec654fd9 100644
--- a/hsweb-logging/hsweb-access-logging-api/pom.xml
+++ b/hsweb-logging/hsweb-access-logging-api/pom.xml
@@ -5,7 +5,7 @@
hsweb-logging
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
../pom.xml
4.0.0
diff --git a/hsweb-logging/pom.xml b/hsweb-logging/pom.xml
index 2541d0db8..57e3ea011 100644
--- a/hsweb-logging/pom.xml
+++ b/hsweb-logging/pom.xml
@@ -23,7 +23,7 @@
hsweb-framework
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
../pom.xml
4.0.0
diff --git a/hsweb-starter/pom.xml b/hsweb-starter/pom.xml
index b378bed47..3eb8613e6 100644
--- a/hsweb-starter/pom.xml
+++ b/hsweb-starter/pom.xml
@@ -5,7 +5,7 @@
hsweb-framework
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
4.0.0
diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/pom.xml b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/pom.xml
index ed7485bb3..466241364 100644
--- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/pom.xml
+++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/pom.xml
@@ -5,7 +5,7 @@
hsweb-system-authorization
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
4.0.0
diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/DimensionEntity.java b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/DimensionEntity.java
index be53968f5..0056a12ed 100644
--- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/DimensionEntity.java
+++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/DimensionEntity.java
@@ -7,29 +7,43 @@ import org.hswebframework.ezorm.rdb.mapping.annotation.ColumnType;
import org.hswebframework.ezorm.rdb.mapping.annotation.Comment;
import org.hswebframework.ezorm.rdb.mapping.annotation.JsonCodec;
import org.hswebframework.web.api.crud.entity.GenericTreeSortSupportEntity;
+import org.hswebframework.web.validator.CreateGroup;
import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
import javax.persistence.Index;
import javax.persistence.Table;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.Pattern;
import java.sql.JDBCType;
import java.util.List;
import java.util.Map;
@Getter
@Setter
-@Table(name = "s_dimension",indexes = {
- @Index(name = "idx_dims_path",columnList = "path")
+@Table(name = "s_dimension", indexes = {
+ @Index(name = "idx_dims_path", columnList = "path")
})
public class DimensionEntity extends GenericTreeSortSupportEntity {
+ @Override
+ @Pattern(
+ regexp = "^[0-9a-zA-Z_\\-]+$",
+ message = "ID只能由数字,字母,下划线和中划线组成",
+ groups = CreateGroup.class)
+ public String getId() {
+ return super.getId();
+ }
+
@Comment("维度类型ID")
- @Column(length = 32,name = "type_id")
+ @Column(length = 32, name = "type_id")
@Schema(description = "维度类型ID")
private String typeId;
@Comment("维度名称")
@Column(length = 32)
@Schema(description = "维度名称")
+ @NotBlank(message = "名称不能为空", groups = CreateGroup.class)
private String name;
@Comment("描述")
@@ -42,7 +56,7 @@ public class DimensionEntity extends GenericTreeSortSupportEntity {
@Comment("其他配置")
@JsonCodec
@Schema(description = "其他配置")
- private Map properties;
+ private Map properties;
@Schema(description = "子节点")
private List children;
diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/pom.xml b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/pom.xml
index ef1d002bb..ba3528840 100644
--- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/pom.xml
+++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/pom.xml
@@ -5,7 +5,7 @@
hsweb-system-authorization
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
4.0.0
diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-oauth2/pom.xml b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-oauth2/pom.xml
index 14f7eeb70..8eb3898bd 100644
--- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-oauth2/pom.xml
+++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-oauth2/pom.xml
@@ -5,7 +5,7 @@
hsweb-system-authorization
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
../pom.xml
4.0.0
diff --git a/hsweb-system/hsweb-system-authorization/pom.xml b/hsweb-system/hsweb-system-authorization/pom.xml
index 258f0a38f..4578f02c6 100644
--- a/hsweb-system/hsweb-system-authorization/pom.xml
+++ b/hsweb-system/hsweb-system-authorization/pom.xml
@@ -5,7 +5,7 @@
hsweb-system
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
4.0.0
pom
diff --git a/hsweb-system/hsweb-system-dictionary/pom.xml b/hsweb-system/hsweb-system-dictionary/pom.xml
index 8cd4dfd2f..04b435cc5 100644
--- a/hsweb-system/hsweb-system-dictionary/pom.xml
+++ b/hsweb-system/hsweb-system-dictionary/pom.xml
@@ -5,7 +5,7 @@
hsweb-system
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
4.0.0
diff --git a/hsweb-system/hsweb-system-file/pom.xml b/hsweb-system/hsweb-system-file/pom.xml
index 1769fd4b6..d9000a375 100644
--- a/hsweb-system/hsweb-system-file/pom.xml
+++ b/hsweb-system/hsweb-system-file/pom.xml
@@ -5,7 +5,7 @@
hsweb-system
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
4.0.0
diff --git a/hsweb-system/pom.xml b/hsweb-system/pom.xml
index 37070cfcc..dde251c8f 100644
--- a/hsweb-system/pom.xml
+++ b/hsweb-system/pom.xml
@@ -5,7 +5,7 @@
hsweb-framework
org.hswebframework.web
- 4.0.9
+ 4.0.10-SNAPSHOT
../pom.xml
4.0.0
diff --git a/pom.xml b/pom.xml
index 2f0c6853c..df680c362 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
org.hswebframework.web
hsweb-framework
- 4.0.9
+ 4.0.10-SNAPSHOT
hsweb-starter
hsweb-core
@@ -338,6 +338,12 @@
1.0.2.Final
+
+ com.google.guava
+ guava
+ 30.1.1-jre
+
+
io.vavr
vavr