diff --git a/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/PagerResult.java b/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/PagerResult.java index 9ff27518b..17992f567 100644 --- a/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/PagerResult.java +++ b/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/PagerResult.java @@ -24,18 +24,19 @@ import lombok.Getter; import lombok.Setter; import org.hswebframework.ezorm.core.param.QueryParam; +import java.io.*; import java.util.ArrayList; import java.util.List; -import java.util.Map; /** * 分页查询结果,用于在分页查询时,定义查询结果.如果需要拓展此类,例如自定义json序列化,请使用spi方式定义拓展实现类型: - *
+ * 
{@code
  * ---resources
  * -----|--META-INF
  * -----|----services
  * -----|------org.hswebframework.web.api.crud.entity.PagerResult
- * 
+ * }
+ *

* * @param 结果类型 * @author zhouhao @@ -43,7 +44,7 @@ import java.util.Map; */ @Getter @Setter -public class PagerResult { +public class PagerResult implements Serializable { private static final long serialVersionUID = -6171751136953308027L; /** @@ -108,5 +109,4 @@ public class PagerResult { this.total = total; this.data = data; } - } diff --git a/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/QueryParamEntity.java b/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/QueryParamEntity.java index fadebf1d1..de56413c8 100644 --- a/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/QueryParamEntity.java +++ b/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/QueryParamEntity.java @@ -1,8 +1,6 @@ package org.hswebframework.web.api.crud.entity; import io.swagger.v3.oas.annotations.Hidden; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; @@ -17,7 +15,7 @@ import org.hswebframework.ezorm.core.param.TermType; import org.hswebframework.web.bean.FastBeanCopier; import org.springframework.util.StringUtils; - +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -45,26 +43,23 @@ import java.util.function.Consumer; * @see QueryParam * @since 3.0 */ +@Getter @Slf4j public class QueryParamEntity extends QueryParam { private static final long serialVersionUID = 8097500947924037523L; - @Getter @Schema(description = "where条件表达式,与terms参数不能共存.语法: name = 张三 and age > 16") private String where; - @Getter @Schema(description = "orderBy条件表达式,与sorts参数不能共存.语法: age asc,createTime desc") private String orderBy; //总数,设置了此值时,在分页查询的时候将不执行count. - @Getter @Setter @Schema(description = "设置了此值后将不重复执行count查询总数") private Integer total; - @Getter @Setter @Schema(description = "是否进行并行分页") private boolean parallelPager = false; @@ -89,12 +84,14 @@ public class QueryParamEntity extends QueryParam { @Override @Schema(description = "指定要查询的列") + @Nonnull public Set getIncludes() { return super.getIncludes(); } @Override @Schema(description = "指定不查询的列") + @Nonnull public Set getExcludes() { return super.getExcludes(); } @@ -199,7 +196,7 @@ public class QueryParamEntity extends QueryParam { */ public void setOrderBy(String orderBy) { this.orderBy = orderBy; - if (StringUtils.isEmpty(orderBy)) { + if (!StringUtils.hasText(orderBy)) { return; } setSorts(TermExpressionParser.parseOrder(orderBy)); @@ -213,13 +210,14 @@ public class QueryParamEntity extends QueryParam { */ public void setWhere(String where) { this.where = where; - if (StringUtils.isEmpty(where)) { + if (!StringUtils.hasText(where)) { return; } setTerms(TermExpressionParser.parse(where)); } @Override + @Nonnull public List getTerms() { List terms = super.getTerms(); if (CollectionUtils.isEmpty(terms) && StringUtils.hasText(where)) { @@ -228,6 +226,7 @@ public class QueryParamEntity extends QueryParam { return terms; } + @SuppressWarnings("unchecked") public QueryParamEntity noPaging() { setPaging(false); return this; diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/service/PermissionSynchronization.java b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/service/PermissionSynchronization.java index c7e9bc238..d0a2a0795 100644 --- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/service/PermissionSynchronization.java +++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/service/PermissionSynchronization.java @@ -101,10 +101,11 @@ public class PermissionSynchronization implements CommandLineRunner { .describe(definitionAction.getName()) .build()); Map properties = Optional.ofNullable(action.getProperties()).orElse(new HashMap<>()); - Set types = Optional.of(properties.computeIfAbsent("supportDataAccessTypes", t -> new HashSet<>())) + @SuppressWarnings("all") + Set types = (Set)Optional.of(properties.computeIfAbsent("supportDataAccessTypes", t -> new HashSet<>())) .filter(Collection.class::isInstance) - .>map(Collection.class::cast) - .>map(HashSet::new) + .map(Collection.class::cast) + .map(HashSet::new) .orElseGet(HashSet::new); types.addAll(definitionAction.getDataAccess().getDataAccessTypes().stream().map(DataAccessTypeDefinition::getId).collect(Collectors.toSet()));