From f7fa46462d5195b080f3bc4102920adf090d551d Mon Sep 17 00:00:00 2001 From: smallchill Date: Wed, 22 Apr 2020 18:35:13 +0800 Subject: [PATCH] =?UTF-8?q?:tada:=202.7.0.RELEASE,=E5=86=85=E6=A0=B8?= =?UTF-8?q?=E5=85=A8=E9=9D=A2=E5=8D=87=E7=BA=A7,=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=B2=97=E4=BD=8D=E7=AE=A1=E7=90=86,=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blade-core-boot/pom.xml | 2 +- .../src/main/resources/bootstrap.yml | 4 ++-- blade-core-cloud/pom.xml | 2 +- blade-core-develop/pom.xml | 2 +- .../resources/templates/controller.java.vm | 4 ++-- blade-core-launch/pom.xml | 2 +- .../core/launch/constant/AppConstant.java | 2 +- blade-core-log/pom.xml | 2 +- blade-core-mybatis/pom.xml | 2 +- .../springblade/core/mp/base/BaseEntity.java | 8 +++++-- .../springblade/core/mp/base/BaseService.java | 2 +- .../core/mp/base/BaseServiceImpl.java | 2 +- blade-core-oss/pom.xml | 2 +- blade-core-secure/pom.xml | 2 +- .../springblade/core/secure/BladeUser.java | 2 +- .../core/secure/utils/SecureUtil.java | 22 +++++++++++++++---- blade-core-swagger/pom.xml | 2 +- .../core/swagger/SwaggerProperties.java | 2 +- blade-core-test/pom.xml | 2 +- blade-core-tool/pom.xml | 2 +- .../springblade/core/tool/node/BaseNode.java | 10 +++++++-- .../core/tool/node/ForestNode.java | 4 +++- .../core/tool/node/ForestNodeManager.java | 8 +++---- .../org/springblade/core/tool/node/INode.java | 7 +++--- .../springblade/core/tool/node/NodeTest.java | 20 ++++++++--------- .../springblade/core/tool/node/TreeNode.java | 10 +++++++-- blade-core-transaction/pom.xml | 2 +- pom.xml | 4 ++-- 28 files changed, 84 insertions(+), 51 deletions(-) diff --git a/blade-core-boot/pom.xml b/blade-core-boot/pom.xml index 0c33a36..4efe168 100644 --- a/blade-core-boot/pom.xml +++ b/blade-core-boot/pom.xml @@ -5,7 +5,7 @@ org.springblade blade-tool - 2.6.2 + 2.7.0 4.0.0 diff --git a/blade-core-boot/src/main/resources/bootstrap.yml b/blade-core-boot/src/main/resources/bootstrap.yml index fbd909f..be1e653 100644 --- a/blade-core-boot/src/main/resources/bootstrap.yml +++ b/blade-core-boot/src/main/resources/bootstrap.yml @@ -77,7 +77,7 @@ mybatis-plus: banner: false db-config: #主键类型 0:"数据库ID自增", 1:"不操作", 2:"用户输入ID",3:"数字型snowflake", 4:"全局唯一ID UUID", 5:"字符串型snowflake"; - id-type: auto + id-type: assign_id #字段策略 insert-strategy: not_null update-strategy: not_null @@ -97,7 +97,7 @@ mybatis-plus: swagger: title: SpringBlade 接口文档系统 description: SpringBlade 接口文档系统 - version: 2.6.2 + version: 2.7.0 license: Powered By SpringBlade licenseUrl: https://bladex.vip terms-of-service-url: https://bladex.vip diff --git a/blade-core-cloud/pom.xml b/blade-core-cloud/pom.xml index e2a94e1..6c468ce 100644 --- a/blade-core-cloud/pom.xml +++ b/blade-core-cloud/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.6.2 + 2.7.0 4.0.0 diff --git a/blade-core-develop/pom.xml b/blade-core-develop/pom.xml index 83b559f..605f7db 100644 --- a/blade-core-develop/pom.xml +++ b/blade-core-develop/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.6.2 + 2.7.0 4.0.0 diff --git a/blade-core-develop/src/main/resources/templates/controller.java.vm b/blade-core-develop/src/main/resources/templates/controller.java.vm index 3f0d5e9..00f9721 100644 --- a/blade-core-develop/src/main/resources/templates/controller.java.vm +++ b/blade-core-develop/src/main/resources/templates/controller.java.vm @@ -160,7 +160,7 @@ public class $!{table.controllerName} { @ApiOperationSupport(order = 7) @ApiOperation(value = "逻辑删除", notes = "传入ids") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status($!{table.entityPath}Service.deleteLogic(Func.toIntList(ids))); + return R.status($!{table.entityPath}Service.deleteLogic(Func.toLongList(ids))); } #else @@ -172,7 +172,7 @@ public class $!{table.controllerName} { @ApiOperationSupport(order = 8) @ApiOperation(value = "删除", notes = "传入ids") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status($!{table.entityPath}Service.removeByIds(Func.toIntList(ids))); + return R.status($!{table.entityPath}Service.removeByIds(Func.toLongList(ids))); } #end diff --git a/blade-core-launch/pom.xml b/blade-core-launch/pom.xml index fda2a37..cc99a40 100644 --- a/blade-core-launch/pom.xml +++ b/blade-core-launch/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.6.2 + 2.7.0 4.0.0 diff --git a/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java b/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java index b88f433..b7faea7 100644 --- a/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java +++ b/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java @@ -25,7 +25,7 @@ public interface AppConstant { /** * 应用版本 */ - String APPLICATION_VERSION = "2.6.2"; + String APPLICATION_VERSION = "2.7.0"; /** * 基础包 diff --git a/blade-core-log/pom.xml b/blade-core-log/pom.xml index 6d3e857..93fd88c 100644 --- a/blade-core-log/pom.xml +++ b/blade-core-log/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.6.2 + 2.7.0 4.0.0 diff --git a/blade-core-mybatis/pom.xml b/blade-core-mybatis/pom.xml index 6be7a34..1c7f7f0 100644 --- a/blade-core-mybatis/pom.xml +++ b/blade-core-mybatis/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.6.2 + 2.7.0 4.0.0 diff --git a/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseEntity.java b/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseEntity.java index ed7c5ac..bf31156 100644 --- a/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseEntity.java +++ b/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseEntity.java @@ -18,6 +18,8 @@ package org.springblade.core.mp.base; import com.baomidou.mybatisplus.annotation.TableLogic; import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springblade.core.tool.utils.DateUtil; @@ -37,8 +39,9 @@ public class BaseEntity implements Serializable { /** * 创建人 */ + @JsonSerialize(using = ToStringSerializer.class) @ApiModelProperty(value = "创建人") - private Integer createUser; + private Long createUser; /** * 创建时间 @@ -51,8 +54,9 @@ public class BaseEntity implements Serializable { /** * 更新人 */ + @JsonSerialize(using = ToStringSerializer.class) @ApiModelProperty(value = "更新人") - private Integer updateUser; + private Long updateUser; /** * 更新时间 diff --git a/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseService.java b/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseService.java index cf9dcfb..c1f356f 100644 --- a/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseService.java +++ b/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseService.java @@ -34,6 +34,6 @@ public interface BaseService extends IService { * @param ids id集合(逗号分隔) * @return boolean */ - boolean deleteLogic(@NotEmpty List ids); + boolean deleteLogic(@NotEmpty List ids); } diff --git a/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseServiceImpl.java b/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseServiceImpl.java index b7b592a..2ce62ab 100644 --- a/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseServiceImpl.java +++ b/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseServiceImpl.java @@ -65,7 +65,7 @@ public class BaseServiceImpl, T extends BaseEntity> exte } @Override - public boolean deleteLogic(@NotEmpty List ids) { + public boolean deleteLogic(@NotEmpty List ids) { return super.removeByIds(ids); } diff --git a/blade-core-oss/pom.xml b/blade-core-oss/pom.xml index d7690ed..7f39b9a 100644 --- a/blade-core-oss/pom.xml +++ b/blade-core-oss/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.6.2 + 2.7.0 4.0.0 diff --git a/blade-core-secure/pom.xml b/blade-core-secure/pom.xml index 2367341..69e2973 100644 --- a/blade-core-secure/pom.xml +++ b/blade-core-secure/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.6.2 + 2.7.0 4.0.0 diff --git a/blade-core-secure/src/main/java/org/springblade/core/secure/BladeUser.java b/blade-core-secure/src/main/java/org/springblade/core/secure/BladeUser.java index 43d94b6..37647dd 100644 --- a/blade-core-secure/src/main/java/org/springblade/core/secure/BladeUser.java +++ b/blade-core-secure/src/main/java/org/springblade/core/secure/BladeUser.java @@ -39,7 +39,7 @@ public class BladeUser implements Serializable { * 用户id */ @ApiModelProperty(hidden = true) - private Integer userId; + private Long userId; /** * 租户ID */ diff --git a/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java b/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java index 4c72de5..eadae24 100644 --- a/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java +++ b/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java @@ -27,6 +27,7 @@ import org.springblade.core.secure.constant.SecureConstant; import org.springblade.core.secure.exception.SecureException; import org.springblade.core.secure.provider.IClientDetails; import org.springblade.core.secure.provider.IClientDetailsService; +import org.springblade.core.tool.constant.RoleConstant; import org.springblade.core.tool.utils.*; import javax.crypto.spec.SecretKeySpec; @@ -94,7 +95,7 @@ public class SecureUtil { return null; } String clientId = Func.toStr(claims.get(SecureUtil.CLIENT_ID)); - Integer userId = Func.toInt(claims.get(SecureUtil.USER_ID)); + Long userId = Func.toLong(claims.get(SecureUtil.USER_ID)); String tenantId = Func.toStr(claims.get(SecureUtil.TENANT_ID)); String roleId = Func.toStr(claims.get(SecureUtil.ROLE_ID)); String account = Func.toStr(claims.get(SecureUtil.ACCOUNT)); @@ -111,13 +112,21 @@ public class SecureUtil { return bladeUser; } + /** + * 是否为超管 + * + * @return boolean + */ + public static boolean isAdministrator() { + return StringUtil.containsAny(getUserRole(), RoleConstant.ADMIN); + } /** * 获取用户id * * @return userId */ - public static Integer getUserId() { + public static Long getUserId() { BladeUser user = getUser(); return (null == user) ? -1 : user.getUserId(); } @@ -128,7 +137,7 @@ public class SecureUtil { * @param request request * @return userId */ - public static Integer getUserId(HttpServletRequest request) { + public static Long getUserId(HttpServletRequest request) { BladeUser user = getUser(request); return (null == user) ? -1 : user.getUserId(); } @@ -246,12 +255,17 @@ public class SecureUtil { */ public static Claims getClaims(HttpServletRequest request) { String auth = request.getHeader(SecureUtil.HEADER); - if ((auth != null) && (auth.length() > AUTH_LENGTH)) { + if (StringUtil.isNotBlank(auth) && auth.length() > AUTH_LENGTH) { String headStr = auth.substring(0, 6).toLowerCase(); if (headStr.compareTo(SecureUtil.BEARER) == 0) { auth = auth.substring(7); return SecureUtil.parseJWT(auth); } + } else { + String parameter = request.getParameter(SecureUtil.HEADER); + if (StringUtil.isNotBlank(parameter)) { + return SecureUtil.parseJWT(parameter); + } } return null; } diff --git a/blade-core-swagger/pom.xml b/blade-core-swagger/pom.xml index 4f8da10..9884200 100644 --- a/blade-core-swagger/pom.xml +++ b/blade-core-swagger/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.6.2 + 2.7.0 4.0.0 diff --git a/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java b/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java index b51f6b6..660ef89 100644 --- a/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java +++ b/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java @@ -55,7 +55,7 @@ public class SwaggerProperties { /** * 版本 **/ - private String version = "2.6.2"; + private String version = "2.7.0"; /** * 许可证 **/ diff --git a/blade-core-test/pom.xml b/blade-core-test/pom.xml index 8a67b41..1af4380 100644 --- a/blade-core-test/pom.xml +++ b/blade-core-test/pom.xml @@ -5,7 +5,7 @@ org.springblade blade-tool - 2.6.2 + 2.7.0 4.0.0 diff --git a/blade-core-tool/pom.xml b/blade-core-tool/pom.xml index 9f433eb..4fc7f23 100644 --- a/blade-core-tool/pom.xml +++ b/blade-core-tool/pom.xml @@ -6,7 +6,7 @@ org.springblade blade-tool - 2.6.2 + 2.7.0 4.0.0 diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/node/BaseNode.java b/blade-core-tool/src/main/java/org/springblade/core/tool/node/BaseNode.java index 95ab993..aebbfbc 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/node/BaseNode.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/node/BaseNode.java @@ -16,6 +16,8 @@ package org.springblade.core.tool.node; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import lombok.Data; import java.util.ArrayList; @@ -29,15 +31,19 @@ import java.util.List; @Data public class BaseNode implements INode { + private static final long serialVersionUID = 1L; + /** * 主键ID */ - protected Integer id; + @JsonSerialize(using = ToStringSerializer.class) + protected Long id; /** * 父节点ID */ - protected Integer parentId; + @JsonSerialize(using = ToStringSerializer.class) + protected Long parentId; /** * 子孙节点 diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/node/ForestNode.java b/blade-core-tool/src/main/java/org/springblade/core/tool/node/ForestNode.java index 8e28b41..cc23a36 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/node/ForestNode.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/node/ForestNode.java @@ -28,12 +28,14 @@ import lombok.EqualsAndHashCode; @EqualsAndHashCode(callSuper = false) public class ForestNode extends BaseNode { + private static final long serialVersionUID = 1L; + /** * 节点内容 */ private Object content; - public ForestNode(Integer id, Integer parentId, Object content) { + public ForestNode(Long id, Long parentId, Object content) { this.id = id; this.parentId = parentId; this.content = content; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/node/ForestNodeManager.java b/blade-core-tool/src/main/java/org/springblade/core/tool/node/ForestNodeManager.java index 98a552a..97319e8 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/node/ForestNodeManager.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/node/ForestNodeManager.java @@ -33,7 +33,7 @@ public class ForestNodeManager { /** * 森林的父节点ID */ - private List parentIds = new ArrayList<>(); + private List parentIds = new ArrayList<>(); public ForestNodeManager(List items) { list = items; @@ -45,9 +45,9 @@ public class ForestNodeManager { * @param id 节点ID * @return 对应的节点对象 */ - public INode getTreeNodeAT(int id) { + public INode getTreeNodeAT(Long id) { for (INode forestNode : list) { - if (forestNode.getId() == id) { + if (forestNode.getId().longValue() == id) { return forestNode; } } @@ -59,7 +59,7 @@ public class ForestNodeManager { * * @param parentId 父节点ID */ - public void addParentId(Integer parentId) { + public void addParentId(Long parentId) { parentIds.add(parentId); } diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/node/INode.java b/blade-core-tool/src/main/java/org/springblade/core/tool/node/INode.java index 0fa909c..92659bf 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/node/INode.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/node/INode.java @@ -15,6 +15,7 @@ */ package org.springblade.core.tool.node; +import java.io.Serializable; import java.util.List; /** @@ -22,21 +23,21 @@ import java.util.List; * * @author Chill */ -public interface INode { +public interface INode extends Serializable { /** * 主键 * * @return Integer */ - Integer getId(); + Long getId(); /** * 父主键 * * @return Integer */ - Integer getParentId(); + Long getParentId(); /** * 子孙节点 diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/node/NodeTest.java b/blade-core-tool/src/main/java/org/springblade/core/tool/node/NodeTest.java index b13964b..d8c5532 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/node/NodeTest.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/node/NodeTest.java @@ -14,16 +14,16 @@ public class NodeTest { public static void main(String[] args) { List list = new ArrayList<>(); - list.add(new ForestNode(1, 0, "1")); - list.add(new ForestNode(2, 0, "2")); - list.add(new ForestNode(3, 1, "3")); - list.add(new ForestNode(4, 2, "4")); - list.add(new ForestNode(5, 3, "5")); - list.add(new ForestNode(6, 4, "6")); - list.add(new ForestNode(7, 3, "7")); - list.add(new ForestNode(8, 5, "8")); - list.add(new ForestNode(9, 6, "9")); - list.add(new ForestNode(10, 9, "10")); + list.add(new ForestNode(1L, 0L, "1")); + list.add(new ForestNode(2L, 0L, "2")); + list.add(new ForestNode(3L, 1L, "3")); + list.add(new ForestNode(4L, 2L, "4")); + list.add(new ForestNode(5L, 3L, "5")); + list.add(new ForestNode(6L, 4L, "6")); + list.add(new ForestNode(7L, 3L, "7")); + list.add(new ForestNode(8L, 5L, "8")); + list.add(new ForestNode(9L, 6L, "9")); + list.add(new ForestNode(10L, 9L, "10")); List tns = ForestNodeMerger.merge(list); tns.forEach(node -> System.out.println(JsonUtil.toJson(node)) diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/node/TreeNode.java b/blade-core-tool/src/main/java/org/springblade/core/tool/node/TreeNode.java index fafaca0..a26a937 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/node/TreeNode.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/node/TreeNode.java @@ -15,6 +15,8 @@ */ package org.springblade.core.tool.node; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import lombok.Data; import lombok.EqualsAndHashCode; @@ -27,10 +29,14 @@ import lombok.EqualsAndHashCode; @EqualsAndHashCode(callSuper = false) public class TreeNode extends BaseNode { + private static final long serialVersionUID = 1L; + private String title; - private Integer key; + @JsonSerialize(using = ToStringSerializer.class) + private Long key; - private Integer value; + @JsonSerialize(using = ToStringSerializer.class) + private Long value; } diff --git a/blade-core-transaction/pom.xml b/blade-core-transaction/pom.xml index 7324d01..38027e1 100644 --- a/blade-core-transaction/pom.xml +++ b/blade-core-transaction/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.6.2 + 2.7.0 4.0.0 diff --git a/pom.xml b/pom.xml index 7b0b300..efefeb7 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springblade blade-tool - 2.6.2 + 2.7.0 pom blade-tool @@ -36,7 +36,7 @@ - 2.6.2 + 2.7.0 1.8 3.8.0