🎉 2.7.0.RELEASE,内核全面升级,增加岗位管理,用户导入导出

This commit is contained in:
smallchill 2020-04-22 18:35:13 +08:00
parent 1e30d8b839
commit f7fa46462d
28 changed files with 84 additions and 51 deletions

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<version>2.6.2</version> <version>2.7.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -77,7 +77,7 @@ mybatis-plus:
banner: false banner: false
db-config: db-config:
#主键类型 0:"数据库ID自增", 1:"不操作", 2:"用户输入ID",3:"数字型snowflake", 4:"全局唯一ID UUID", 5:"字符串型snowflake"; #主键类型 0:"数据库ID自增", 1:"不操作", 2:"用户输入ID",3:"数字型snowflake", 4:"全局唯一ID UUID", 5:"字符串型snowflake";
id-type: auto id-type: assign_id
#字段策略 #字段策略
insert-strategy: not_null insert-strategy: not_null
update-strategy: not_null update-strategy: not_null
@ -97,7 +97,7 @@ mybatis-plus:
swagger: swagger:
title: SpringBlade 接口文档系统 title: SpringBlade 接口文档系统
description: SpringBlade 接口文档系统 description: SpringBlade 接口文档系统
version: 2.6.2 version: 2.7.0
license: Powered By SpringBlade license: Powered By SpringBlade
licenseUrl: https://bladex.vip licenseUrl: https://bladex.vip
terms-of-service-url: https://bladex.vip terms-of-service-url: https://bladex.vip

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.2</version> <version>2.7.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.2</version> <version>2.7.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -160,7 +160,7 @@ public class $!{table.controllerName} {
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids") @ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String 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 #else
@ -172,7 +172,7 @@ public class $!{table.controllerName} {
@ApiOperationSupport(order = 8) @ApiOperationSupport(order = 8)
@ApiOperation(value = "删除", notes = "传入ids") @ApiOperation(value = "删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String 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 #end

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.2</version> <version>2.7.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -25,7 +25,7 @@ public interface AppConstant {
/** /**
* 应用版本 * 应用版本
*/ */
String APPLICATION_VERSION = "2.6.2"; String APPLICATION_VERSION = "2.7.0";
/** /**
* 基础包 * 基础包

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.2</version> <version>2.7.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.2</version> <version>2.7.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -18,6 +18,8 @@ package org.springblade.core.mp.base;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat; 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 io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
@ -37,8 +39,9 @@ public class BaseEntity implements Serializable {
/** /**
* 创建人 * 创建人
*/ */
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "创建人") @ApiModelProperty(value = "创建人")
private Integer createUser; private Long createUser;
/** /**
* 创建时间 * 创建时间
@ -51,8 +54,9 @@ public class BaseEntity implements Serializable {
/** /**
* 更新人 * 更新人
*/ */
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "更新人") @ApiModelProperty(value = "更新人")
private Integer updateUser; private Long updateUser;
/** /**
* 更新时间 * 更新时间

View File

@ -34,6 +34,6 @@ public interface BaseService<T> extends IService<T> {
* @param ids id集合(逗号分隔) * @param ids id集合(逗号分隔)
* @return boolean * @return boolean
*/ */
boolean deleteLogic(@NotEmpty List<Integer> ids); boolean deleteLogic(@NotEmpty List<Long> ids);
} }

View File

@ -65,7 +65,7 @@ public class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseEntity> exte
} }
@Override @Override
public boolean deleteLogic(@NotEmpty List<Integer> ids) { public boolean deleteLogic(@NotEmpty List<Long> ids) {
return super.removeByIds(ids); return super.removeByIds(ids);
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.2</version> <version>2.7.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.2</version> <version>2.7.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -39,7 +39,7 @@ public class BladeUser implements Serializable {
* 用户id * 用户id
*/ */
@ApiModelProperty(hidden = true) @ApiModelProperty(hidden = true)
private Integer userId; private Long userId;
/** /**
* 租户ID * 租户ID
*/ */

View File

@ -27,6 +27,7 @@ import org.springblade.core.secure.constant.SecureConstant;
import org.springblade.core.secure.exception.SecureException; import org.springblade.core.secure.exception.SecureException;
import org.springblade.core.secure.provider.IClientDetails; import org.springblade.core.secure.provider.IClientDetails;
import org.springblade.core.secure.provider.IClientDetailsService; import org.springblade.core.secure.provider.IClientDetailsService;
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.core.tool.utils.*; import org.springblade.core.tool.utils.*;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
@ -94,7 +95,7 @@ public class SecureUtil {
return null; return null;
} }
String clientId = Func.toStr(claims.get(SecureUtil.CLIENT_ID)); 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 tenantId = Func.toStr(claims.get(SecureUtil.TENANT_ID));
String roleId = Func.toStr(claims.get(SecureUtil.ROLE_ID)); String roleId = Func.toStr(claims.get(SecureUtil.ROLE_ID));
String account = Func.toStr(claims.get(SecureUtil.ACCOUNT)); String account = Func.toStr(claims.get(SecureUtil.ACCOUNT));
@ -111,13 +112,21 @@ public class SecureUtil {
return bladeUser; return bladeUser;
} }
/**
* 是否为超管
*
* @return boolean
*/
public static boolean isAdministrator() {
return StringUtil.containsAny(getUserRole(), RoleConstant.ADMIN);
}
/** /**
* 获取用户id * 获取用户id
* *
* @return userId * @return userId
*/ */
public static Integer getUserId() { public static Long getUserId() {
BladeUser user = getUser(); BladeUser user = getUser();
return (null == user) ? -1 : user.getUserId(); return (null == user) ? -1 : user.getUserId();
} }
@ -128,7 +137,7 @@ public class SecureUtil {
* @param request request * @param request request
* @return userId * @return userId
*/ */
public static Integer getUserId(HttpServletRequest request) { public static Long getUserId(HttpServletRequest request) {
BladeUser user = getUser(request); BladeUser user = getUser(request);
return (null == user) ? -1 : user.getUserId(); return (null == user) ? -1 : user.getUserId();
} }
@ -246,12 +255,17 @@ public class SecureUtil {
*/ */
public static Claims getClaims(HttpServletRequest request) { public static Claims getClaims(HttpServletRequest request) {
String auth = request.getHeader(SecureUtil.HEADER); 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(); String headStr = auth.substring(0, 6).toLowerCase();
if (headStr.compareTo(SecureUtil.BEARER) == 0) { if (headStr.compareTo(SecureUtil.BEARER) == 0) {
auth = auth.substring(7); auth = auth.substring(7);
return SecureUtil.parseJWT(auth); return SecureUtil.parseJWT(auth);
} }
} else {
String parameter = request.getParameter(SecureUtil.HEADER);
if (StringUtil.isNotBlank(parameter)) {
return SecureUtil.parseJWT(parameter);
}
} }
return null; return null;
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.2</version> <version>2.7.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -55,7 +55,7 @@ public class SwaggerProperties {
/** /**
* 版本 * 版本
**/ **/
private String version = "2.6.2"; private String version = "2.7.0";
/** /**
* 许可证 * 许可证
**/ **/

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<version>2.6.2</version> <version>2.7.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<version>2.6.2</version> <version>2.7.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -16,6 +16,8 @@
package org.springblade.core.tool.node; package org.springblade.core.tool.node;
import com.fasterxml.jackson.annotation.JsonInclude; 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 lombok.Data;
import java.util.ArrayList; import java.util.ArrayList;
@ -29,15 +31,19 @@ import java.util.List;
@Data @Data
public class BaseNode implements INode { public class BaseNode implements INode {
private static final long serialVersionUID = 1L;
/** /**
* 主键ID * 主键ID
*/ */
protected Integer id; @JsonSerialize(using = ToStringSerializer.class)
protected Long id;
/** /**
* 父节点ID * 父节点ID
*/ */
protected Integer parentId; @JsonSerialize(using = ToStringSerializer.class)
protected Long parentId;
/** /**
* 子孙节点 * 子孙节点

View File

@ -28,12 +28,14 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public class ForestNode extends BaseNode { public class ForestNode extends BaseNode {
private static final long serialVersionUID = 1L;
/** /**
* 节点内容 * 节点内容
*/ */
private Object content; private Object content;
public ForestNode(Integer id, Integer parentId, Object content) { public ForestNode(Long id, Long parentId, Object content) {
this.id = id; this.id = id;
this.parentId = parentId; this.parentId = parentId;
this.content = content; this.content = content;

View File

@ -33,7 +33,7 @@ public class ForestNodeManager<T extends INode> {
/** /**
* 森林的父节点ID * 森林的父节点ID
*/ */
private List<Integer> parentIds = new ArrayList<>(); private List<Long> parentIds = new ArrayList<>();
public ForestNodeManager(List<T> items) { public ForestNodeManager(List<T> items) {
list = items; list = items;
@ -45,9 +45,9 @@ public class ForestNodeManager<T extends INode> {
* @param id 节点ID * @param id 节点ID
* @return 对应的节点对象 * @return 对应的节点对象
*/ */
public INode getTreeNodeAT(int id) { public INode getTreeNodeAT(Long id) {
for (INode forestNode : list) { for (INode forestNode : list) {
if (forestNode.getId() == id) { if (forestNode.getId().longValue() == id) {
return forestNode; return forestNode;
} }
} }
@ -59,7 +59,7 @@ public class ForestNodeManager<T extends INode> {
* *
* @param parentId 父节点ID * @param parentId 父节点ID
*/ */
public void addParentId(Integer parentId) { public void addParentId(Long parentId) {
parentIds.add(parentId); parentIds.add(parentId);
} }

View File

@ -15,6 +15,7 @@
*/ */
package org.springblade.core.tool.node; package org.springblade.core.tool.node;
import java.io.Serializable;
import java.util.List; import java.util.List;
/** /**
@ -22,21 +23,21 @@ import java.util.List;
* *
* @author Chill * @author Chill
*/ */
public interface INode { public interface INode extends Serializable {
/** /**
* 主键 * 主键
* *
* @return Integer * @return Integer
*/ */
Integer getId(); Long getId();
/** /**
* 父主键 * 父主键
* *
* @return Integer * @return Integer
*/ */
Integer getParentId(); Long getParentId();
/** /**
* 子孙节点 * 子孙节点

View File

@ -14,16 +14,16 @@ public class NodeTest {
public static void main(String[] args) { public static void main(String[] args) {
List<ForestNode> list = new ArrayList<>(); List<ForestNode> list = new ArrayList<>();
list.add(new ForestNode(1, 0, "1")); list.add(new ForestNode(1L, 0L, "1"));
list.add(new ForestNode(2, 0, "2")); list.add(new ForestNode(2L, 0L, "2"));
list.add(new ForestNode(3, 1, "3")); list.add(new ForestNode(3L, 1L, "3"));
list.add(new ForestNode(4, 2, "4")); list.add(new ForestNode(4L, 2L, "4"));
list.add(new ForestNode(5, 3, "5")); list.add(new ForestNode(5L, 3L, "5"));
list.add(new ForestNode(6, 4, "6")); list.add(new ForestNode(6L, 4L, "6"));
list.add(new ForestNode(7, 3, "7")); list.add(new ForestNode(7L, 3L, "7"));
list.add(new ForestNode(8, 5, "8")); list.add(new ForestNode(8L, 5L, "8"));
list.add(new ForestNode(9, 6, "9")); list.add(new ForestNode(9L, 6L, "9"));
list.add(new ForestNode(10, 9, "10")); list.add(new ForestNode(10L, 9L, "10"));
List<ForestNode> tns = ForestNodeMerger.merge(list); List<ForestNode> tns = ForestNodeMerger.merge(list);
tns.forEach(node -> tns.forEach(node ->
System.out.println(JsonUtil.toJson(node)) System.out.println(JsonUtil.toJson(node))

View File

@ -15,6 +15,8 @@
*/ */
package org.springblade.core.tool.node; 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.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -27,10 +29,14 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public class TreeNode extends BaseNode { public class TreeNode extends BaseNode {
private static final long serialVersionUID = 1L;
private String title; private String title;
private Integer key; @JsonSerialize(using = ToStringSerializer.class)
private Long key;
private Integer value; @JsonSerialize(using = ToStringSerializer.class)
private Long value;
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.2</version> <version>2.7.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<version>2.6.2</version> <version>2.7.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>blade-tool</name> <name>blade-tool</name>
<description> <description>
@ -36,7 +36,7 @@
</scm> </scm>
<properties> <properties>
<blade.tool.version>2.6.2</blade.tool.version> <blade.tool.version>2.7.0</blade.tool.version>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<maven.plugin.version>3.8.0</maven.plugin.version> <maven.plugin.version>3.8.0</maven.plugin.version>