Merge pull request #3 from chillzhuang/master

merge
This commit is contained in:
Maowj98 2020-08-31 12:28:41 +08:00 committed by GitHub
commit 2b25aacf10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
73 changed files with 1632 additions and 328 deletions

View File

@ -1,9 +1,9 @@
<p align="center">
<img src="https://img.shields.io/badge/Release-V2.7.0-green.svg" alt="Downloads">
<img src="https://img.shields.io/badge/Release-V2.7.2-green.svg" alt="Downloads">
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" alt="Build Status">
<img src="https://img.shields.io/badge/license-Apache%202-blue.svg" alt="Build Status">
<img src="https://img.shields.io/badge/Spring%20Cloud-Hoxton.SR3-blue.svg" alt="Coverage Status">
<img src="https://img.shields.io/badge/Spring%20Boot-2.2.6.RELEASE-blue.svg" alt="Downloads">
<img src="https://img.shields.io/badge/Spring%20Cloud-Hoxton.SR7-blue.svg" alt="Coverage Status">
<img src="https://img.shields.io/badge/Spring%20Boot-2.2.9.RELEASE-blue.svg" alt="Downloads">
<a target="_blank" href="https://bladex.vip">
<img src="https://img.shields.io/badge/Author-Small%20Chill-ff69b4.svg" alt="Downloads">
</a>
@ -22,7 +22,7 @@
* 极简封装了多租户底层用更少的代码换来拓展性更强的SaaS多租户系统。
* 借鉴OAuth2实现了多终端认证系统可控制子系统的token权限互相隔离。
* 借鉴Security封装了Secure模块采用JWT做Token认证可拓展集成Redis等细颗粒度控制方案。
* 稳定生产了一年经历了从Camden -> Greenwich的技术架构也经历了从fat jar -> docker -> k8s + jenkins的部署架构
* 稳定生产了两年经历了从Camden -> Hoxton的技术架构也经历了从fat jar -> docker -> k8s + jenkins的部署架构
* 项目分包明确,规范微服务的开发模式,使包与包之间的分工清晰。
## 架构图
@ -58,7 +58,9 @@ SpringBlade
* 会员计划:[SpringBlade会员计划](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade会员计划)
* 交流一群:`477853168`(满)
* 交流二群:`751253339`(满)
* 交流三群:`784729540`
* 交流三群:`784729540`(满)
* 交流四群:`1034621754`(满)
* 交流五群:`946350912`
## 在线演示
* Saber-基于Vue[https://saber.bladex.vip](https://saber.bladex.vip)

View File

@ -8,7 +8,7 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.7.0</version>
<version>2.7.2</version>
</parent>
<artifactId>blade-auth</artifactId>
@ -38,6 +38,11 @@
<artifactId>blade-core-log</artifactId>
<version>${blade.tool.version}</version>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-social</artifactId>
<version>${blade.tool.version}</version>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-user-api</artifactId>

View File

@ -0,0 +1,92 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.auth.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.zhyd.oauth.model.AuthCallback;
import me.zhyd.oauth.model.AuthToken;
import me.zhyd.oauth.request.AuthRequest;
import me.zhyd.oauth.utils.AuthStateUtils;
import org.springblade.core.social.props.SocialProperties;
import org.springblade.core.social.utils.SocialUtil;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* 第三方登陆端点
*
* @author Chill
*/
@Slf4j
@RestController
@AllArgsConstructor
@ConditionalOnProperty(value = "social.enabled", havingValue = "true")
@Api(value = "第三方登陆", tags = "第三方登陆端点")
public class SocialController {
private final SocialProperties socialProperties;
/**
* 授权完毕跳转
*/
@ApiOperation(value = "授权完毕跳转")
@RequestMapping("/oauth/render/{source}")
public void renderAuth(@PathVariable("source") String source, HttpServletResponse response) throws IOException {
AuthRequest authRequest = SocialUtil.getAuthRequest(source, socialProperties);
String authorizeUrl = authRequest.authorize(AuthStateUtils.createState());
response.sendRedirect(authorizeUrl);
}
/**
* 获取认证信息
*/
@ApiOperation(value = "获取认证信息")
@RequestMapping("/oauth/callback/{source}")
public Object login(@PathVariable("source") String source, AuthCallback callback) {
AuthRequest authRequest = SocialUtil.getAuthRequest(source, socialProperties);
return authRequest.login(callback);
}
/**
* 撤销授权
*/
@ApiOperation(value = "撤销授权")
@RequestMapping("/oauth/revoke/{source}/{token}")
public Object revokeAuth(@PathVariable("source") String source, @PathVariable("token") String token) {
AuthRequest authRequest = SocialUtil.getAuthRequest(source, socialProperties);
return authRequest.revoke(AuthToken.builder().accessToken(token).build());
}
/**
* 续期accessToken
*/
@ApiOperation(value = "续期令牌")
@RequestMapping("/oauth/refresh/{source}")
public Object refreshAuth(@PathVariable("source") String source, String token) {
AuthRequest authRequest = SocialUtil.getAuthRequest(source, socialProperties);
return authRequest.refresh(AuthToken.builder().refreshToken(token).build());
}
}

View File

@ -0,0 +1,91 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.auth.granter;
import lombok.AllArgsConstructor;
import me.zhyd.oauth.model.AuthCallback;
import me.zhyd.oauth.model.AuthResponse;
import me.zhyd.oauth.model.AuthUser;
import me.zhyd.oauth.request.AuthRequest;
import org.springblade.auth.utils.TokenUtil;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.social.props.SocialProperties;
import org.springblade.core.social.utils.SocialUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.WebUtil;
import org.springblade.system.user.entity.UserInfo;
import org.springblade.system.user.entity.UserOauth;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.util.Objects;
/**
* SocialTokenGranter
*
* @author Chill
*/
@Component
@AllArgsConstructor
public class SocialTokenGranter implements ITokenGranter {
public static final String GRANT_TYPE = "social";
private static final Integer AUTH_SUCCESS_CODE = 2000;
private final IUserClient userClient;
private final SocialProperties socialProperties;
@Override
public UserInfo grant(TokenParameter tokenParameter) {
HttpServletRequest request = WebUtil.getRequest();
String tenantId = Func.toStr(request.getHeader(TokenUtil.TENANT_HEADER_KEY), TokenUtil.DEFAULT_TENANT_ID);
// 开放平台来源
String sourceParameter = request.getParameter("source");
// 匹配是否有别名定义
String source = socialProperties.getAlias().getOrDefault(sourceParameter, sourceParameter);
// 开放平台授权码
String code = request.getParameter("code");
// 开放平台状态吗
String state = request.getParameter("state");
// 获取开放平台授权数据
AuthRequest authRequest = SocialUtil.getAuthRequest(source, socialProperties);
AuthCallback authCallback = new AuthCallback();
authCallback.setCode(code);
authCallback.setState(state);
AuthResponse authResponse = authRequest.login(authCallback);
AuthUser authUser;
if (authResponse.getCode() == AUTH_SUCCESS_CODE) {
authUser = (AuthUser) authResponse.getData();
} else {
throw new ServiceException("social grant failure, auth response is not success");
}
// 组装数据
UserOauth userOauth = Objects.requireNonNull(BeanUtil.copy(authUser, UserOauth.class));
userOauth.setSource(authUser.getSource());
userOauth.setTenantId(tenantId);
userOauth.setUuid(authUser.getUuid());
// 远程调用获取认证信息
R<UserInfo> result = userClient.userAuthInfo(userOauth);
return result.getData();
}
}

View File

@ -34,12 +34,13 @@ public class TokenGranterBuilder {
/**
* TokenGranter缓存池
*/
private static Map<String, ITokenGranter> granterPool = new ConcurrentHashMap<>();
private static final Map<String, ITokenGranter> GRANTER_POOL = new ConcurrentHashMap<>();
static {
granterPool.put(PasswordTokenGranter.GRANT_TYPE, SpringUtil.getBean(PasswordTokenGranter.class));
granterPool.put(CaptchaTokenGranter.GRANT_TYPE, SpringUtil.getBean(CaptchaTokenGranter.class));
granterPool.put(RefreshTokenGranter.GRANT_TYPE, SpringUtil.getBean(RefreshTokenGranter.class));
GRANTER_POOL.put(PasswordTokenGranter.GRANT_TYPE, SpringUtil.getBean(PasswordTokenGranter.class));
GRANTER_POOL.put(CaptchaTokenGranter.GRANT_TYPE, SpringUtil.getBean(CaptchaTokenGranter.class));
GRANTER_POOL.put(RefreshTokenGranter.GRANT_TYPE, SpringUtil.getBean(RefreshTokenGranter.class));
GRANTER_POOL.put(SocialTokenGranter.GRANT_TYPE, SpringUtil.getBean(SocialTokenGranter.class));
}
/**
@ -49,7 +50,7 @@ public class TokenGranterBuilder {
* @return ITokenGranter
*/
public static ITokenGranter getGranter(String grantType) {
ITokenGranter tokenGranter = granterPool.get(Func.toStr(grantType, PasswordTokenGranter.GRANT_TYPE));
ITokenGranter tokenGranter = GRANTER_POOL.get(Func.toStr(grantType, PasswordTokenGranter.GRANT_TYPE));
if (tokenGranter == null) {
throw new SecureException("no grantType was found");
} else {

View File

@ -58,6 +58,7 @@ public class TokenUtil {
Map<String, String> param = new HashMap<>(16);
param.put(TokenConstant.TOKEN_TYPE, TokenConstant.ACCESS_TOKEN);
param.put(TokenConstant.TENANT_ID, user.getTenantId());
param.put(TokenConstant.OAUTH_ID, userInfo.getOauthId());
param.put(TokenConstant.USER_ID, Func.toStr(user.getId()));
param.put(TokenConstant.ROLE_ID, user.getRoleId());
param.put(TokenConstant.ACCOUNT, user.getAccount());
@ -66,6 +67,9 @@ public class TokenUtil {
TokenInfo accessToken = SecureUtil.createJWT(param, "audience", "issuser", TokenConstant.ACCESS_TOKEN);
AuthInfo authInfo = new AuthInfo();
authInfo.setUserId(user.getId());
authInfo.setTenantId(user.getTenantId());
authInfo.setOauthId(userInfo.getOauthId());
authInfo.setAccount(user.getAccount());
authInfo.setUserName(user.getRealName());
authInfo.setAuthority(Func.join(userInfo.getRoles()));

View File

@ -9,3 +9,8 @@ spring:
url: ${blade.datasource.dev.url}
username: ${blade.datasource.dev.username}
password: ${blade.datasource.dev.password}
#第三方登陆
social:
enabled: true
domain: http://127.0.0.1:1888

View File

@ -9,3 +9,8 @@ spring:
url: ${blade.datasource.prod.url}
username: ${blade.datasource.prod.username}
password: ${blade.datasource.prod.password}
#第三方登陆
social:
enabled: true
domain: http://127.0.0.1:1888

View File

@ -9,3 +9,8 @@ spring:
url: ${blade.datasource.test.url}
username: ${blade.datasource.test.username}
password: ${blade.datasource.test.password}
#第三方登陆
social:
enabled: true
domain: http://127.0.0.1:1888

View File

@ -0,0 +1,23 @@
#第三方登陆配置
social:
oauth:
GITHUB:
client-id: 233************
client-secret: 233************************************
redirect-uri: ${social.domain}/oauth/redirect/github
GITEE:
client-id: 233************
client-secret: 233************************************
redirect-uri: ${social.domain}/oauth/redirect/gitee
WECHAT_OPEN:
client-id: 233************
client-secret: 233************************************
redirect-uri: ${social.domain}/oauth/redirect/wechat
QQ:
client-id: 233************
client-secret: 233************************************
redirect-uri: ${social.domain}/oauth/redirect/qq
DINGTALK:
client-id: 233************
client-secret: 233************************************
redirect-uri: ${social.domain}/oauth/redirect/dingtalk

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.7.0</version>
<version>2.7.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.7.0</version>
<version>2.7.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -40,6 +40,7 @@ public class AuthProvider {
defaultSkipUrl.add("/v2/api-docs/**");
defaultSkipUrl.add("/v2/api-docs-ext/**");
defaultSkipUrl.add("/auth/**");
defaultSkipUrl.add("/oauth/**");
defaultSkipUrl.add("/log/**");
defaultSkipUrl.add("/menu/routes");
defaultSkipUrl.add("/menu/auth-routes");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.7.0</version>
<version>2.7.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,128 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.system.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 行政区划表实体类
*
* @author Chill
*/
@Data
@TableName("blade_region")
@ApiModel(value = "Region对象", description = "行政区划表")
public class Region implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 区划编号
*/
@TableId(value = "code", type = IdType.INPUT)
@ApiModelProperty(value = "区划编号")
private String code;
/**
* 父区划编号
*/
@ApiModelProperty(value = "父区划编号")
private String parentCode;
/**
* 祖区划编号
*/
@ApiModelProperty(value = "祖区划编号")
private String ancestors;
/**
* 区划名称
*/
@ApiModelProperty(value = "区划名称")
private String name;
/**
* 省级区划编号
*/
@ApiModelProperty(value = "省级区划编号")
private String provinceCode;
/**
* 省级名称
*/
@ApiModelProperty(value = "省级名称")
private String provinceName;
/**
* 市级区划编号
*/
@ApiModelProperty(value = "市级区划编号")
private String cityCode;
/**
* 市级名称
*/
@ApiModelProperty(value = "市级名称")
private String cityName;
/**
* 区级区划编号
*/
@ApiModelProperty(value = "区级区划编号")
private String districtCode;
/**
* 区级名称
*/
@ApiModelProperty(value = "区级名称")
private String districtName;
/**
* 镇级区划编号
*/
@ApiModelProperty(value = "镇级区划编号")
private String townCode;
/**
* 镇级名称
*/
@ApiModelProperty(value = "镇级名称")
private String townName;
/**
* 村级区划编号
*/
@ApiModelProperty(value = "村级区划编号")
private String villageCode;
/**
* 村级名称
*/
@ApiModelProperty(value = "村级名称")
private String villageName;
/**
* 层级
*/
@ApiModelProperty(value = "层级")
private Integer level;
/**
* 排序
*/
@ApiModelProperty(value = "排序")
private Integer sort;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String remark;
}

View File

@ -16,8 +16,10 @@
package org.springblade.system.feign;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.tool.api.R;
import org.springblade.system.entity.Dept;
import org.springblade.system.entity.Role;
import org.springblade.system.entity.Tenant;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -141,4 +143,22 @@ public interface ISysClient {
@GetMapping(API_PREFIX + "/getRoleAlias")
String getRoleAlias(@RequestParam("id") Long id);
/**
* 获取租户
*
* @param id 主键
* @return Tenant
*/
@GetMapping(API_PREFIX + "/tenant")
R<Tenant> getTenant(@RequestParam("id") Long id);
/**
* 获取租户
*
* @param tenantId 租户id
* @return Tenant
*/
@GetMapping(API_PREFIX + "/tenant-id")
R<Tenant> getTenant(@RequestParam("tenantId") String tenantId);
}

View File

@ -15,8 +15,10 @@
*/
package org.springblade.system.feign;
import org.springblade.core.tool.api.R;
import org.springblade.system.entity.Dept;
import org.springblade.system.entity.Role;
import org.springblade.system.entity.Tenant;
import org.springframework.stereotype.Component;
import java.util.List;
@ -83,4 +85,14 @@ public class ISysClientFallback implements ISysClient {
public String getRoleAlias(Long id) {
return null;
}
@Override
public R<Tenant> getTenant(Long id) {
return null;
}
@Override
public R<Tenant> getTenant(String tenantId) {
return null;
}
}

View File

@ -0,0 +1,39 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.system.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* GrantVO
*
* @author Chill
*/
@Data
public class GrantVO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "roleIds集合")
private List<Long> roleIds;
@ApiModelProperty(value = "menuIds集合")
private List<Long> menuIds;
}

View File

@ -0,0 +1,88 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.system.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tool.node.INode;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Region;
import java.util.ArrayList;
import java.util.List;
/**
* 行政区划表视图实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "RegionVO对象", description = "行政区划表")
public class RegionVO extends Region implements INode {
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 父节点ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/**
* 父节点名称
*/
private String parentName;
/**
* 是否有子孙节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Boolean hasChildren;
/**
* 子孙节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<INode> children;
@Override
public Long getId() {
return Func.toLong(this.getCode());
}
@Override
public Long getParentId() {
return Func.toLong(this.getParentCode());
}
@Override
public List<INode> getChildren() {
if (this.children == null) {
this.children = new ArrayList<>();
}
return this.children;
}
}

View File

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

View File

@ -51,4 +51,10 @@ public class UserInfo implements Serializable {
@ApiModelProperty(value = "角色集合")
private List<String> roles;
/**
* 第三方授权id
*/
@ApiModelProperty(value = "第三方授权id")
private String oauthId;
}

View File

@ -0,0 +1,107 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.system.user.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 实体类
*
* @author Chill
*/
@Data
@TableName("blade_user_oauth")
public class UserOauth implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
private Long id;
/**
* 租户ID
*/
private String tenantId;
/**
* 第三方系统用户ID
*/
private String uuid;
/**
* 用户ID
*/
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "用户主键")
private Long userId;
/**
* 用户名
*/
private String username;
/**
* 用户昵称
*/
private String nickname;
/**
* 用户头像
*/
private String avatar;
/**
* 用户网址
*/
private String blog;
/**
* 所在公司
*/
private String company;
/**
* 位置
*/
private String location;
/**
* 用户邮箱
*/
private String email;
/**
* 用户备注各平台中的用户个人介绍
*/
private String remark;
/**
* 性别
*/
private String gender;
/**
* 用户来源
*/
private String source;
}

View File

@ -19,8 +19,11 @@ package org.springblade.system.user.feign;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.tool.api.R;
import org.springblade.system.user.entity.UserInfo;
import org.springblade.system.user.entity.UserOauth;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
/**
@ -56,4 +59,13 @@ public interface IUserClient {
@GetMapping(API_PREFIX + "/user-info")
R<UserInfo> userInfo(@RequestParam("tenantId") String tenantId, @RequestParam("account") String account, @RequestParam("password") String password);
/**
* 获取第三方平台信息
*
* @param userOauth 第三方授权用户信息
* @return UserInfo
*/
@PostMapping(API_PREFIX + "/user-auth-info")
R<UserInfo> userAuthInfo(@RequestBody UserOauth userOauth);
}

View File

@ -17,6 +17,7 @@ package org.springblade.system.user.feign;
import org.springblade.core.tool.api.R;
import org.springblade.system.user.entity.UserInfo;
import org.springblade.system.user.entity.UserOauth;
import org.springframework.stereotype.Component;
/**
@ -36,4 +37,9 @@ public class IUserClientFallback implements IUserClient {
public R<UserInfo> userInfo(String tenantId, String account, String password) {
return R.fail("未获取到账号信息");
}
@Override
public R<UserInfo> userAuthInfo(UserOauth userOauth) {
return R.fail("未获取到账号信息");
}
}

View File

@ -5,13 +5,13 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.7.0</version>
<version>2.7.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>blade-service-api</artifactId>
<name>${project.artifactId}</name>
<version>2.7.0</version>
<version>2.7.2</version>
<packaging>pom</packaging>
<description>SpringBlade 微服务API集合</description>

View File

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

View File

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

View File

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

View File

@ -27,6 +27,7 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringPool;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -63,7 +64,9 @@ public class LogApiController {
*/
@GetMapping("/list")
public R<IPage<LogApiVo>> list(@ApiIgnore @RequestParam Map<String, Object> log, Query query) {
IPage<LogApi> pages = logService.page(Condition.getPage(query.setDescs("create_time")), Condition.getQueryWrapper(log, LogApi.class));
query.setAscs("create_time");
query.setDescs(StringPool.EMPTY);
IPage<LogApi> pages = logService.page(Condition.getPage(query), Condition.getQueryWrapper(log, LogApi.class));
List<LogApiVo> records = pages.getRecords().stream().map(logApi -> {
LogApiVo vo = BeanUtil.copy(logApi, LogApiVo.class);
vo.setStrId(Func.toStr(logApi.getId()));

View File

@ -27,6 +27,7 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringPool;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -63,7 +64,9 @@ public class LogErrorController {
*/
@GetMapping("/list")
public R<IPage<LogErrorVo>> list(@ApiIgnore @RequestParam Map<String, Object> logError, Query query) {
IPage<LogError> pages = errorLogService.page(Condition.getPage(query.setDescs("create_time")), Condition.getQueryWrapper(logError, LogError.class));
query.setAscs("create_time");
query.setDescs(StringPool.EMPTY);
IPage<LogError> pages = errorLogService.page(Condition.getPage(query), Condition.getQueryWrapper(logError, LogError.class));
List<LogErrorVo> records = pages.getRecords().stream().map(logApi -> {
LogErrorVo vo = BeanUtil.copy(logApi, LogErrorVo.class);
vo.setStrId(Func.toStr(logApi.getId()));

View File

@ -27,6 +27,7 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringPool;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -63,6 +64,8 @@ public class LogUsualController {
*/
@GetMapping("/list")
public R<IPage<LogUsualVo>> list(@ApiIgnore @RequestParam Map<String, Object> log, Query query) {
query.setAscs("create_time");
query.setDescs(StringPool.EMPTY);
IPage<LogUsual> pages = logService.page(Condition.getPage(query), Condition.getQueryWrapper(log, LogUsual.class));
List<LogUsualVo> records = pages.getRecords().stream().map(logApi -> {
LogUsualVo vo = BeanUtil.copy(logApi, LogUsualVo.class);

View File

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

View File

@ -109,7 +109,7 @@ public class MenuController extends BladeController {
@ApiOperationSupport(order = 5)
@ApiOperation(value = "前端菜单数据", notes = "前端菜单数据")
public R<List<MenuVO>> routes(BladeUser user) {
List<MenuVO> list = menuService.routes(user.getRoleId());
List<MenuVO> list = menuService.routes((user == null || user.getUserId() == 0L) ? null : user.getRoleId());
return R.data(list);
}
@ -162,6 +162,9 @@ public class MenuController extends BladeController {
@ApiOperationSupport(order = 10)
@ApiOperation(value = "菜单的角色权限")
public R<List<Kv>> authRoutes(BladeUser user) {
if (Func.isEmpty(user) || user.getUserId() == 0L) {
return null;
}
return R.data(menuService.authRoutes(user));
}

View File

@ -0,0 +1,157 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.system.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.node.INode;
import org.springblade.system.entity.Region;
import org.springblade.system.service.IRegionService;
import org.springblade.system.vo.RegionVO;
import org.springblade.system.wrapper.RegionWrapper;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
* 行政区划表 控制器
*
* @author Chill
*/
@RestController
@AllArgsConstructor
@RequestMapping("/region")
@Api(value = "行政区划表", tags = "行政区划表接口")
public class RegionController extends BladeController {
private final IRegionService regionService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入region")
public R<RegionVO> detail(Region region) {
Region detail = regionService.getOne(Condition.getQueryWrapper(region));
return R.data(RegionWrapper.build().entityVO(detail));
}
/**
* 分页 行政区划表
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入region")
public R<IPage<Region>> list(Region region, Query query) {
IPage<Region> pages = regionService.page(Condition.getPage(query), Condition.getQueryWrapper(region));
return R.data(pages);
}
/**
* 懒加载列表
*/
@GetMapping("/lazy-list")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "区划编号", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "name", value = "区划名称", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 3)
@ApiOperation(value = "懒加载列表", notes = "传入menu")
public R<List<INode>> lazyList(String parentCode, @ApiIgnore @RequestParam Map<String, Object> menu) {
List<INode> list = regionService.lazyList(parentCode, menu);
return R.data(RegionWrapper.build().listNodeLazyVO(list));
}
/**
* 懒加载列表
*/
@GetMapping("/lazy-tree")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "区划编号", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "name", value = "区划名称", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 4)
@ApiOperation(value = "懒加载列表", notes = "传入menu")
public R<List<INode>> lazyTree(String parentCode, @ApiIgnore @RequestParam Map<String, Object> menu) {
List<INode> list = regionService.lazyTree(parentCode, menu);
return R.data(RegionWrapper.build().listNodeLazyVO(list));
}
/**
* 新增 行政区划表
*/
@PostMapping("/save")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "新增", notes = "传入region")
public R save(@Valid @RequestBody Region region) {
return R.status(regionService.save(region));
}
/**
* 修改 行政区划表
*/
@PostMapping("/update")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "修改", notes = "传入region")
public R update(@Valid @RequestBody Region region) {
return R.status(regionService.updateById(region));
}
/**
* 新增或修改 行政区划表
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "新增或修改", notes = "传入region")
public R submit(@Valid @RequestBody Region region) {
return R.status(regionService.submit(region));
}
/**
* 删除 行政区划表
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 8)
@ApiOperation(value = "删除", notes = "传入主键")
public R remove(@ApiParam(value = "主键", required = true) @RequestParam String id) {
return R.status(regionService.removeRegion(id));
}
/**
* 行政区划下拉数据源
*/
@GetMapping("/select")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "下拉数据源", notes = "传入tenant")
public R<List<Region>> select(@RequestParam(required = false, defaultValue = "00") String code) {
List<Region> list = regionService.list(Wrappers.<Region>query().lambda().eq(Region::getParentCode, code));
return R.data(list);
}
}

View File

@ -28,6 +28,7 @@ import org.springblade.core.tool.node.INode;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Role;
import org.springblade.system.service.IRoleService;
import org.springblade.system.vo.GrantVO;
import org.springblade.system.vo.RoleVO;
import org.springblade.system.wrapper.RoleWrapper;
import org.springframework.web.bind.annotation.*;
@ -114,17 +115,12 @@ public class RoleController extends BladeController {
/**
* 设置菜单权限
*
* @param roleIds
* @param menuIds
* @return
*/
@PostMapping("/grant")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "权限设置", notes = "传入roleId集合以及menuId集合")
public R grant(@ApiParam(value = "roleId集合", required = true) @RequestParam String roleIds,
@ApiParam(value = "menuId集合", required = true) @RequestParam String menuIds) {
boolean temp = roleService.grant(Func.toLongList(roleIds), Func.toLongList(menuIds));
public R grant(@RequestBody GrantVO grantVO) {
boolean temp = roleService.grant(grantVO.getRoleIds(), grantVO.getMenuIds());
return R.status(temp);
}

View File

@ -16,11 +16,14 @@
package org.springblade.system.feign;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.system.entity.Dept;
import org.springblade.system.entity.Role;
import org.springblade.system.entity.Tenant;
import org.springblade.system.service.IDeptService;
import org.springblade.system.service.IPostService;
import org.springblade.system.service.IRoleService;
import org.springblade.system.service.ITenantService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
@ -43,6 +46,8 @@ public class SysClient implements ISysClient {
private IRoleService roleService;
private ITenantService tenantService;
@Override
@GetMapping(API_PREFIX + "/getDept")
public Dept getDept(Long id) {
@ -102,4 +107,16 @@ public class SysClient implements ISysClient {
public String getRoleAlias(Long id) {
return roleService.getById(id).getRoleAlias();
}
@Override
@GetMapping(API_PREFIX + "/tenant")
public R<Tenant> getTenant(Long id) {
return R.data(tenantService.getById(id));
}
@Override
@GetMapping(API_PREFIX + "/tenant-id")
public R<Tenant> getTenant(String tenantId) {
return R.data(tenantService.getByTenantId(tenantId));
}
}

View File

@ -0,0 +1,50 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.core.tool.node.INode;
import org.springblade.system.entity.Region;
import java.util.List;
import java.util.Map;
/**
* 行政区划表 Mapper 接口
*
* @author Chill
*/
public interface RegionMapper extends BaseMapper<Region> {
/**
* 懒加载列表
*
* @param parentCode
* @param param
* @return
*/
List<INode> lazyList(String parentCode, Map<String, Object> param);
/**
* 懒加载列表
*
* @param parentCode
* @param param
* @return
*/
List<INode> lazyTree(String parentCode, Map<String, Object> param);
}

View File

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.system.mapper.RegionMapper">
<!-- 通用查询映射结果 -->
<resultMap id="regionResultMap" type="org.springblade.system.entity.Region">
<id column="code" property="code"/>
<result column="parent_code" property="parentCode"/>
<result column="ancestors" property="ancestors"/>
<result column="name" property="name"/>
<result column="province_code" property="provinceCode"/>
<result column="province_name" property="provinceName"/>
<result column="city_code" property="cityCode"/>
<result column="city_name" property="cityName"/>
<result column="district_code" property="districtCode"/>
<result column="district_name" property="districtName"/>
<result column="town_code" property="townCode"/>
<result column="town_name" property="townName"/>
<result column="village_code" property="villageCode"/>
<result column="village_name" property="villageName"/>
<result column="level" property="level"/>
<result column="sort" property="sort"/>
<result column="remark" property="remark"/>
</resultMap>
<resultMap id="regionVOResultMap" type="org.springblade.system.vo.RegionVO">
<id column="code" property="code"/>
<result column="parent_code" property="parentCode"/>
<result column="ancestors" property="ancestors"/>
<result column="name" property="name"/>
<result column="province_code" property="provinceCode"/>
<result column="province_name" property="provinceName"/>
<result column="city_code" property="cityCode"/>
<result column="city_name" property="cityName"/>
<result column="district_code" property="districtCode"/>
<result column="district_name" property="districtName"/>
<result column="town_code" property="townCode"/>
<result column="town_name" property="townName"/>
<result column="village_code" property="villageCode"/>
<result column="village_name" property="villageName"/>
<result column="level" property="level"/>
<result column="sort" property="sort"/>
<result column="remark" property="remark"/>
<result column="id" property="id"/>
<result column="parent_id" property="parentId"/>
<result column="has_children" property="hasChildren"/>
</resultMap>
<resultMap id="treeNodeResultMap" type="org.springblade.core.tool.node.TreeNode">
<id column="id" property="id"/>
<result column="parent_id" property="parentId"/>
<result column="title" property="title"/>
<result column="value" property="value"/>
<result column="key" property="key"/>
<result column="has_children" property="hasChildren"/>
</resultMap>
<select id="lazyList" resultMap="regionVOResultMap">
SELECT
region.*,
( SELECT CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END FROM blade_region WHERE parent_code = region.code ) AS "has_children"
FROM
blade_region region
<where>
<if test="param1!=null">
and region.parent_code = #{param1}
</if>
<if test="param2.code!=null and param2.code!=''">
and region.code like concat(concat('%', #{param2.code}),'%')
</if>
<if test="param2.name!=null and param2.name!=''">
and region.name like concat(concat('%', #{param2.name}),'%')
</if>
</where>
</select>
<select id="lazyTree" resultMap="treeNodeResultMap">
SELECT
region.code AS "id",
region.parent_code AS "parent_id",
region.name AS "title",
region.code AS "value",
region.code AS "key",
( SELECT CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END FROM blade_region WHERE parent_code = region.code ) AS "has_children"
FROM
blade_region region
<where>
<if test="param1!=null">
and region.parent_code = #{param1}
</if>
<if test="param2.code!=null and param2.code!=''">
and region.code like concat(concat('%', #{param2.code}),'%')
</if>
<if test="param2.name!=null and param2.name!=''">
and region.name like concat(concat('%', #{param2.name}),'%')
</if>
</where>
</select>
</mapper>

View File

@ -0,0 +1,66 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.core.tool.node.INode;
import org.springblade.system.entity.Region;
import java.util.List;
import java.util.Map;
/**
* 行政区划表 服务类
*
* @author Chill
*/
public interface IRegionService extends IService<Region> {
/**
* 提交
*
* @param region
* @return
*/
boolean submit(Region region);
/**
* 删除
*
* @param id
* @return
*/
boolean removeRegion(String id);
/**
* 懒加载列表
*
* @param parentCode
* @param param
* @return
*/
List<INode> lazyList(String parentCode, Map<String, Object> param);
/**
* 懒加载列表
*
* @param parentCode
* @param param
* @return
*/
List<INode> lazyTree(String parentCode, Map<String, Object> param);
}

View File

@ -35,6 +35,14 @@ public interface ITenantService extends BaseService<Tenant> {
*/
IPage<Tenant> selectTenantPage(IPage<Tenant> page, Tenant tenant);
/**
* 根据租户编号获取实体
*
* @param tenantId
* @return
*/
Tenant getByTenantId(String tenantId);
/**
* 新增
*

View File

@ -24,6 +24,7 @@ import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.node.ForestNodeMerger;
import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.dto.MenuDTO;
import org.springblade.system.entity.Menu;
import org.springblade.system.entity.RoleMenu;
@ -55,6 +56,9 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM
@Override
public List<MenuVO> routes(String roleId) {
if (StringUtil.isBlank(roleId)) {
return null;
}
List<Menu> allMenus = baseMapper.allMenu();
List<Menu> roleMenus = baseMapper.roleMenu(Func.toLongList(roleId));
List<Menu> routes = new LinkedList<>(roleMenus);

View File

@ -0,0 +1,98 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.system.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.node.INode;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringPool;
import org.springblade.system.entity.Region;
import org.springblade.system.mapper.RegionMapper;
import org.springblade.system.service.IRegionService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 行政区划表 服务实现类
*
* @author Chill
*/
@Service
public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> implements IRegionService {
public static final int PROVINCE_LEVEL = 1;
public static final int CITY_LEVEL = 2;
public static final int DISTRICT_LEVEL = 3;
public static final int TOWN_LEVEL = 4;
public static final int VILLAGE_LEVEL = 5;
@Override
public boolean submit(Region region) {
Integer cnt = baseMapper.selectCount(Wrappers.<Region>query().lambda().eq(Region::getCode, region.getCode()));
if (cnt > 0) {
return this.updateById(region);
}
// 设置祖区划编号
Region parent = baseMapper.selectById(region.getParentCode());
if (Func.isNotEmpty(parent) || Func.isNotEmpty(parent.getCode())) {
String ancestors = parent.getAncestors() + StringPool.COMMA + parent.getCode();
region.setAncestors(ancestors);
}
// 设置省
Integer level = region.getLevel();
String code = region.getCode();
String name = region.getName();
if (level == PROVINCE_LEVEL) {
region.setProvinceCode(code);
region.setProvinceName(name);
} else if (level == CITY_LEVEL) {
region.setCityCode(code);
region.setCityName(name);
} else if (level == DISTRICT_LEVEL) {
region.setDistrictCode(code);
region.setDistrictName(name);
} else if (level == TOWN_LEVEL) {
region.setTownCode(code);
region.setTownName(name);
} else if (level == VILLAGE_LEVEL) {
region.setVillageCode(code);
region.setVillageName(name);
}
return this.save(region);
}
@Override
public boolean removeRegion(String id) {
Integer cnt = baseMapper.selectCount(Wrappers.<Region>query().lambda().eq(Region::getParentCode, id));
if (cnt > 0) {
throw new ServiceException("请先删除子节点!");
}
return removeById(id);
}
@Override
public List<INode> lazyList(String parentCode, Map<String, Object> param) {
return baseMapper.lazyList(parentCode, param);
}
@Override
public List<INode> lazyTree(String parentCode, Map<String, Object> param) {
return baseMapper.lazyTree(parentCode, param);
}
}

View File

@ -53,6 +53,11 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> imp
return page.setRecords(baseMapper.selectTenantPage(page, tenant));
}
@Override
public Tenant getByTenantId(String tenantId) {
return getOne(Wrappers.<Tenant>query().lambda().eq(Tenant::getTenantId, tenantId));
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean saveTenant(Tenant tenant) {

View File

@ -0,0 +1,59 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.system.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.node.ForestNodeMerger;
import org.springblade.core.tool.node.INode;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.system.entity.Region;
import org.springblade.system.service.IRegionService;
import org.springblade.system.vo.RegionVO;
import java.util.List;
import java.util.Objects;
/**
* 包装类,返回视图层所需的字段
*
* @author Chill
*/
public class RegionWrapper extends BaseEntityWrapper<Region, RegionVO> {
private static IRegionService regionService;
static {
regionService = SpringUtil.getBean(IRegionService.class);
}
public static RegionWrapper build() {
return new RegionWrapper();
}
@Override
public RegionVO entityVO(Region region) {
RegionVO regionVO = Objects.requireNonNull(BeanUtil.copy(region, RegionVO.class));
Region parentRegion = regionService.getById(region.getParentCode());
regionVO.setParentName(parentRegion.getName());
return regionVO;
}
public List<INode> listNodeLazyVO(List<INode> list) {
return ForestNodeMerger.merge(list);
}
}

View File

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

View File

@ -257,5 +257,15 @@ public class UserController {
EasyExcel.write(response.getOutputStream(), UserExcel.class).sheet("用户数据表").doWrite(list);
}
/**
* 第三方注册用户
*/
@PostMapping("/register-guest")
@ApiOperationSupport(order = 15)
@ApiOperation(value = "第三方注册用户", notes = "传入user")
public R registerGuest(User user, Long oauthId) {
return R.status(userService.registerGuest(user, oauthId));
}
}

View File

@ -17,10 +17,11 @@ package org.springblade.system.user.feign;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.entity.UserInfo;
import org.springblade.system.user.entity.UserOauth;
import org.springblade.system.user.service.IUserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
/**
@ -45,4 +46,10 @@ public class UserClient implements IUserClient {
return R.data(service.userInfo(tenantId, account, password));
}
@Override
@PostMapping(API_PREFIX + "/user-auth-info")
public R<UserInfo> userAuthInfo(UserOauth userOauth) {
return R.data(service.userInfo(userOauth));
}
}

View File

@ -0,0 +1,28 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.system.user.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.system.user.entity.UserOauth;
/**
* Mapper 接口
*
* @author Chill
*/
public interface UserOauthMapper extends BaseMapper<UserOauth> {
}

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.system.user.mapper.UserOauthMapper">
<!-- 通用查询映射结果 -->
<resultMap id="userResultMap" type="org.springblade.system.user.entity.UserOauth">
<result column="id" property="id"/>
<result column="tenant_id" property="tenantId"/>
<result column="user_id" property="userId"/>
<result column="username" property="username"/>
<result column="nickname" property="nickname"/>
<result column="avatar" property="avatar"/>
<result column="blog" property="blog"/>
<result column="company" property="company"/>
<result column="location" property="location"/>
<result column="email" property="email"/>
<result column="remark" property="remark"/>
<result column="gender" property="gender"/>
<result column="source" property="source"/>
</resultMap>
</mapper>

View File

@ -0,0 +1,29 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.system.user.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.system.user.entity.UserOauth;
/**
* 服务类
*
* @author Chill
*/
public interface IUserOauthService extends IService<UserOauth> {
}

View File

@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.entity.UserInfo;
import org.springblade.system.user.entity.UserOauth;
import org.springblade.system.user.excel.UserExcel;
import java.util.List;
@ -34,7 +35,6 @@ public interface IUserService extends BaseService<User> {
/**
* 新增或修改用户
*
* @param user
* @return
*/
@ -67,6 +67,14 @@ public interface IUserService extends BaseService<User> {
*/
UserInfo userInfo(String tenantId, String account, String password);
/**
* 用户信息
*
* @param userOauth
* @return
*/
UserInfo userInfo(UserOauth userOauth);
/**
* 给用户设置角色
*
@ -126,4 +134,13 @@ public interface IUserService extends BaseService<User> {
* @return
*/
List<UserExcel> exportUser(Wrapper<User> queryWrapper);
/**
* 注册用户
*
* @param user
* @param oauthId
* @return
*/
boolean registerGuest(User user, Long oauthId);
}

View File

@ -0,0 +1,35 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.system.user.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.AllArgsConstructor;
import org.springblade.system.user.entity.UserOauth;
import org.springblade.system.user.mapper.UserOauthMapper;
import org.springblade.system.user.service.IUserOauthService;
import org.springframework.stereotype.Service;
/**
* 服务实现类
*
* @author Chill
*/
@Service
@AllArgsConstructor
public class UserOauthServiceImpl extends ServiceImpl<UserOauthMapper, UserOauth> implements IUserOauthService {
}

View File

@ -24,15 +24,21 @@ import lombok.AllArgsConstructor;
import org.springblade.common.constant.CommonConstant;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*;
import org.springblade.system.entity.Tenant;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.entity.UserInfo;
import org.springblade.system.user.entity.UserOauth;
import org.springblade.system.user.excel.UserExcel;
import org.springblade.system.user.mapper.UserMapper;
import org.springblade.system.user.service.IUserOauthService;
import org.springblade.system.user.service.IUserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
@ -44,8 +50,11 @@ import java.util.Objects;
@Service
@AllArgsConstructor
public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implements IUserService {
private static final String GUEST_NAME = "guest";
private static final String MINUS_ONE = "-1";
private ISysClient sysClient;
private IUserOauthService userOauthService;
@Override
public boolean submit(User user) {
@ -88,6 +97,30 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
return userInfo;
}
@Override
@Transactional(rollbackFor = Exception.class)
public UserInfo userInfo(UserOauth userOauth) {
UserOauth uo = userOauthService.getOne(Wrappers.<UserOauth>query().lambda().eq(UserOauth::getUuid, userOauth.getUuid()).eq(UserOauth::getSource, userOauth.getSource()));
UserInfo userInfo;
if (Func.isNotEmpty(uo) && Func.isNotEmpty(uo.getUserId())) {
userInfo = this.userInfo(uo.getUserId());
userInfo.setOauthId(Func.toStr(uo.getId()));
} else {
userInfo = new UserInfo();
if (Func.isEmpty(uo)) {
userOauthService.save(userOauth);
userInfo.setOauthId(Func.toStr(userOauth.getId()));
} else {
userInfo.setOauthId(Func.toStr(uo.getId()));
}
User user = new User();
user.setAccount(userOauth.getUsername());
userInfo.setUser(user);
userInfo.setRoles(Collections.singletonList(GUEST_NAME));
}
return userInfo;
}
@Override
public boolean grant(String userIds, String roleIds) {
User user = new User();
@ -136,7 +169,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
// 设置角色ID
user.setRoleId(sysClient.getRoleIds(userExcel.getTenantId(), userExcel.getRoleName()));
// 设置默认密码
user.setPassword(DigestUtil.encrypt(CommonConstant.DEFAULT_PASSWORD));
user.setPassword(CommonConstant.DEFAULT_PASSWORD);
this.submit(user);
});
}
@ -152,4 +185,28 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
return userList;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean registerGuest(User user, Long oauthId) {
R<Tenant> result = sysClient.getTenant(user.getTenantId());
Tenant tenant = result.getData();
if (!result.isSuccess() || tenant == null || tenant.getId() == null) {
throw new ApiException("租户信息错误!");
}
UserOauth userOauth = userOauthService.getById(oauthId);
if (userOauth == null || userOauth.getId() == null) {
throw new ApiException("第三方登陆信息错误!");
}
user.setRealName(user.getName());
user.setAvatar(userOauth.getAvatar());
user.setRoleId(MINUS_ONE);
user.setDeptId(MINUS_ONE);
user.setPostId(MINUS_ONE);
boolean userTemp = this.submit(user);
userOauth.setUserId(user.getId());
userOauth.setTenantId(user.getTenantId());
boolean oauthTemp = userOauthService.updateById(userOauth);
return (userTemp && oauthTemp);
}
}

View File

@ -7,12 +7,12 @@
<parent>
<groupId>org.springblade</groupId>
<artifactId>SpringBlade</artifactId>
<version>2.7.0</version>
<version>2.7.2</version>
</parent>
<artifactId>blade-service</artifactId>
<name>${project.artifactId}</name>
<version>2.7.0</version>
<version>2.7.2</version>
<packaging>pom</packaging>
<description>SpringBlade 微服务集合</description>

View File

@ -1 +0,0 @@
mvn install:install-file -Dfile=blade-core-1.0.jar -DgroupId=org.springblade -DartifactId=blade-core -Dversion=1.0 -Dpackaging=jar

View File

@ -1,29 +0,0 @@
## 环境变量
#### 环境划分
> dev开发、test测试、prod正式默认dev
#### 添加环境变量
##### java命令行
```
java -jar gateWay.jar --spring.profiles.active=dev
```
##### JAVA_OPS
```
set JAVA_OPTS="-Dspring.profiles.active=test"
```
##### 标注方式代码层面junit单元测试非常实用
```
@ActiveProfiles({"junittest","productprofile"})
```
##### ENV方式
```
系统环境变量SPRING_PROFILES_ACTIVE注意是大写
```

View File

@ -1,57 +0,0 @@
## HTTP 状态码
| 状态码 | 含义 |
| ------ | ------------------------------------------------------------ |
| 100 | 客户端应当继续发送请求。这个临时响应是用来通知客户端它的部分请求已经被服务器接收,且仍未被拒绝。客户端应当继续发送请求的剩余部分,或者如果请求已经完成,忽略这个响应。服务器必须在请求完成后向客户端发送一个最终响应。 |
| 101 | 服务器已经理解了客户端的请求并将通过Upgrade 消息头通知客户端采用不同的协议来完成这个请求。在发送完这个响应最后的空行后服务器将会切换到在Upgrade 消息头中定义的那些协议。 只有在切换新的协议更有好处的时候才应该采取类似措施。例如切换到新的HTTP 版本比旧版本更有优势,或者切换到一个实时且同步的协议以传送利用此类特性的资源。 |
| 102 | 由WebDAVRFC 2518扩展的状态码代表处理将被继续执行。 |
| 200 | 请求已成功,请求所希望的响应头或数据体将随此响应返回。 |
| 201 | 请求已经被实现,而且有一个新的资源已经依据请求的需要而建立,且其 URI 已经随Location 头信息返回。假如需要的资源无法及时建立的话,应当返回 '202 Accepted'。 |
| 202 | 服务器已接受请求,但尚未处理。正如它可能被拒绝一样,最终该请求可能会也可能不会被执行。在异步操作的场合下,没有比发送这个状态码更方便的做法了。 返回202状态码的响应的目的是允许服务器接受其他过程的请求例如某个每天只执行一次的基于批处理的操作而不必让客户端一直保持与服务器的连接直到批处理操作全部完成。在接受请求处理并返回202状态码的响应应当在返回的实体中包含一些指示处理当前状态的信息以及指向处理状态监视器或状态预测的指针以便用户能够估计操作是否已经完成。 |
| 203 | 服务器已成功处理了请求但返回的实体头部元信息不是在原始服务器上有效的确定集合而是来自本地或者第三方的拷贝。当前的信息可能是原始版本的子集或者超集。例如包含资源的元数据可能导致原始服务器知道元信息的超级。使用此状态码不是必须的而且只有在响应不使用此状态码便会返回200 OK的情况下才是合适的。 |
| 204 | 服务器成功处理了请求,但不需要返回任何实体内容,并且希望返回更新了的元信息。响应可能通过实体头部的形式,返回新的或更新后的元信息。如果存在这些头部信息,则应当与所请求的变量相呼应。 如果客户端是浏览器的话,那么用户浏览器应保留发送了该请求的页面,而不产生任何文档视图上的变化,即使按照规范新的或更新后的元信息应当被应用到用户浏览器活动视图中的文档。 由于204响应被禁止包含任何消息体因此它始终以消息头后的第一个空行结尾。 |
| 205 | 服务器成功处理了请求且没有返回任何内容。但是与204响应不同返回此状态码的响应要求请求者重置文档视图。该响应主要是被用于接受用户输入后立即重置表单以便用户能够轻松地开始另一次输入。 与204响应一样该响应也被禁止包含任何消息体且以消息头后的第一个空行结束。 |
| 206 | 服务器已经成功处理了部分 GET 请求。类似于 FlashGet 或者迅雷这类的 HTTP 下载工具都是使用此类响应实现断点续传或者将一个大文档分解为多个下载段同时下载。 该请求必须包含 Range 头信息来指示客户端希望得到的内容范围,并且可能包含 If-Range 来作为请求条件。 响应必须包含如下的头部域: Content-Range 用以指示本次响应中返回的内容的范围;如果是 Content-Type 为 multipart/byteranges 的多段下载,则每一 multipart 段中都应包含 Content-Range 域用以指示本段的内容范围。假如响应中包含 Content-Length那么它的数值必须匹配它返回的内容范围的真实字节数。 Date ETag 和/或 Content-Location假如同样的请求本应该返回200响应。 Expires, Cache-Control和/或 Vary假如其值可能与之前相同变量的其他响应对应的值不同的话。 假如本响应请求使用了 If-Range 强缓存验证,那么本次响应不应该包含其他实体头;假如本响应的请求使用了 If-Range 弱缓存验证那么本次响应禁止包含其他实体头这避免了缓存的实体内容和更新了的实体头信息之间的不一致。否则本响应就应当包含所有本应该返回200响应中应当返回的所有实体头部域。 假如 ETag 或 Last-Modified 头部不能精确匹配的话则客户端缓存应禁止将206响应返回的内容与之前任何缓存过的内容组合在一起。 任何不支持 Range 以及 Content-Range 头的缓存都禁止缓存206响应返回的内容。 |
| 207 | 由WebDAV(RFC 2518)扩展的状态码代表之后的消息体将是一个XML消息并且可能依照之前子请求数量的不同包含一系列独立的响应代码。 |
| 300 | 被请求的资源有一系列可供选择的回馈信息,每个都有自己特定的地址和浏览器驱动的商议信息。用户或浏览器能够自行选择一个首选的地址进行重定向。 除非这是一个 HEAD 请求,否则该响应应当包括一个资源特性及地址的列表的实体,以便用户或浏览器从中选择最合适的重定向地址。这个实体的格式由 Content-Type 定义的格式所决定。浏览器可能根据响应的格式以及浏览器自身能力自动作出最合适的选择。当然RFC 2616规范并没有规定这样的自动选择该如何进行。 如果服务器本身已经有了首选的回馈选择,那么在 Location 中应当指明这个回馈的 URI浏览器可能会将这个 Location 值作为自动重定向的地址。此外,除非额外指定,否则这个响应也是可缓存的。 |
| 301 | 被请求的资源已永久移动到新位置,并且将来任何对此资源的引用都应该使用本响应返回的若干个 URI 之一。如果可能,拥有链接编辑功能的客户端应当自动把请求的地址修改为从服务器反馈回来的地址。除非额外指定,否则这个响应也是可缓存的。 新的永久性的 URI 应当在响应的 Location 域中返回。除非这是一个 HEAD 请求,否则响应的实体中应当包含指向新的 URI 的超链接及简短说明。 如果这不是一个 GET 或者 HEAD 请求,因此浏览器禁止自动进行重定向,除非得到用户的确认,因为请求的条件可能因此发生变化。 注意:对于某些使用 HTTP/1.0 协议的浏览器,当它们发送的 POST 请求得到了一个301响应的话接下来的重定向请求将会变成 GET 方式。 |
| 302 | 请求的资源现在临时从不同的 URI 响应请求。由于这样的重定向是临时的客户端应当继续向原有地址发送以后的请求。只有在Cache-Control或Expires中进行了指定的情况下这个响应才是可缓存的。 新的临时性的 URI 应当在响应的 Location 域中返回。除非这是一个 HEAD 请求,否则响应的实体中应当包含指向新的 URI 的超链接及简短说明。 如果这不是一个 GET 或者 HEAD 请求,那么浏览器禁止自动进行重定向,除非得到用户的确认,因为请求的条件可能因此发生变化。 注意虽然RFC 1945和RFC 2068规范不允许客户端在重定向时改变请求的方法但是很多现存的浏览器将302响应视作为303响应并且使用 GET 方式访问在 Location 中规定的 URI而无视原先请求的方法。状态码303和307被添加了进来用以明确服务器期待客户端进行何种反应。 |
| 303 | 对应当前请求的响应可以在另一个 URI 上被找到,而且客户端应当采用 GET 的方式访问那个资源。这个方法的存在主要是为了允许由脚本激活的POST请求输出重定向到一个新的资源。这个新的 URI 不是原始资源的替代引用。同时303响应禁止被缓存。当然第二个请求重定向可能被缓存。 新的 URI 应当在响应的 Location 域中返回。除非这是一个 HEAD 请求,否则响应的实体中应当包含指向新的 URI 的超链接及简短说明。 注意:许多 HTTP/1.1 版以前的 浏览器不能正确理解303状态。如果需要考虑与这些浏览器之间的互动302状态码应该可以胜任因为大多数的浏览器处理302响应时的方式恰恰就是上述规范要求客户端处理303响应时应当做的。 |
| 304 | 如果客户端发送了一个带条件的 GET 请求且该请求已被允许而文档的内容自上次访问以来或者根据请求的条件并没有改变则服务器应当返回这个状态码。304响应禁止包含消息体因此始终以消息头后的第一个空行结尾。 该响应必须包含以下的头信息: Date除非这个服务器没有时钟。假如没有时钟的服务器也遵守这些规则那么代理服务器以及客户端可以自行将 Date 字段添加到接收到的响应头中去正如RFC 2068中规定的一样缓存机制将会正常工作。 ETag 和/或 Content-Location假如同样的请求本应返回200响应。 Expires, Cache-Control和/或Vary假如其值可能与之前相同变量的其他响应对应的值不同的话。 假如本响应请求使用了强缓存验证,那么本次响应不应该包含其他实体头;否则(例如,某个带条件的 GET 请求使用了弱缓存验证),本次响应禁止包含其他实体头;这避免了缓存了的实体内容和更新了的实体头信息之间的不一致。 假如某个304响应指明了当前某个实体没有缓存那么缓存系统必须忽视这个响应并且重复发送不包含限制条件的请求。 假如接收到一个要求更新某个缓存条目的304响应那么缓存系统必须更新整个条目以反映所有在响应中被更新的字段的值。 |
| 305 | 被请求的资源必须通过指定的代理才能被访问。Location 域中将给出指定的代理所在的 URI 信息接收者需要重复发送一个单独的请求通过这个代理才能访问相应资源。只有原始服务器才能建立305响应。 注意RFC 2068中没有明确305响应是为了重定向一个单独的请求而且只能被原始服务器建立。忽视这些限制可能导致严重的安全后果。 |
| 306 | 在最新版的规范中306状态码已经不再被使用。 |
| 307 | 请求的资源现在临时从不同的URI 响应请求。由于这样的重定向是临时的客户端应当继续向原有地址发送以后的请求。只有在Cache-Control或Expires中进行了指定的情况下这个响应才是可缓存的。 新的临时性的URI 应当在响应的 Location 域中返回。除非这是一个HEAD 请求否则响应的实体中应当包含指向新的URI 的超链接及简短说明。因为部分浏览器不能识别307响应因此需要添加上述必要信息以便用户能够理解并向新的 URI 发出访问请求。 如果这不是一个GET 或者 HEAD 请求,那么浏览器禁止自动进行重定向,除非得到用户的确认,因为请求的条件可能因此发生变化。 |
| 400 | 1、语义有误当前请求无法被服务器理解。除非进行修改否则客户端不应该重复提交这个请求。 2、请求参数有误。 |
| 401 | 当前请求需要用户验证。该响应必须包含一个适用于被请求资源的 WWW-Authenticate 信息头用以询问用户信息。客户端可以重复提交一个包含恰当的 Authorization 头信息的请求。如果当前请求已经包含了 Authorization 证书那么401响应代表着服务器验证已经拒绝了那些证书。如果401响应包含了与前一个响应相同的身份验证询问且浏览器已经至少尝试了一次验证那么浏览器应当向用户展示响应中包含的实体信息因为这个实体信息中可能包含了相关诊断信息。参见RFC 2617。 |
| 402 | 该状态码是为了将来可能的需求而预留的。 |
| 403 | 服务器已经理解请求但是拒绝执行它。与401响应不同的是身份验证并不能提供任何帮助而且这个请求也不应该被重复提交。如果这不是一个 HEAD 请求而且服务器希望能够讲清楚为何请求不能被执行那么就应该在实体内描述拒绝的原因。当然服务器也可以返回一个404响应假如它不希望让客户端获得任何信息。 |
| 404 | 请求失败请求所希望得到的资源未被在服务器上发现。没有信息能够告诉用户这个状况到底是暂时的还是永久的。假如服务器知道情况的话应当使用410状态码来告知旧资源因为某些内部的配置机制问题已经永久的不可用而且没有任何可以跳转的地址。404这个状态码被广泛应用于当服务器不想揭示到底为何请求被拒绝或者没有其他适合的响应可用的情况下。 |
| 405 | 请求行中指定的请求方法不能被用于请求相应的资源。该响应必须返回一个Allow 头信息用以表示出当前资源能够接受的请求方法的列表。 鉴于 PUTDELETE 方法会对服务器上的资源进行写操作因而绝大部分的网页服务器都不支持或者在默认配置下不允许上述请求方法对于此类请求均会返回405错误。 |
| 406 | 请求的资源的内容特性无法满足请求头中的条件,因而无法生成响应实体。 除非这是一个 HEAD 请求,否则该响应就应当返回一个包含可以让用户或者浏览器从中选择最合适的实体特性以及地址列表的实体。实体的格式由 Content-Type 头中定义的媒体类型决定。浏览器可以根据格式及自身能力自行作出最佳选择。但是,规范中并没有定义任何作出此类自动选择的标准。 |
| 407 | 与401响应类似只不过客户端必须在代理服务器上进行身份验证。代理服务器必须返回一个 Proxy-Authenticate 用以进行身份询问。客户端可以返回一个 Proxy-Authorization 信息头用以验证。参见RFC 2617。 |
| 408 | 请求超时。客户端没有在服务器预备等待的时间内完成一个请求的发送。客户端可以随时再次提交这一请求而无需进行任何更改。 |
| 409 | 由于和被请求的资源的当前状态之间存在冲突,请求无法完成。这个代码只允许用在这样的情况下才能被使用:用户被认为能够解决冲突,并且会重新提交新的请求。该响应应当包含足够的信息以便用户发现冲突的源头。 冲突通常发生于对 PUT 请求的处理中。例如,在采用版本检查的环境下,某次 PUT 提交的对特定资源的修改请求所附带的版本信息与之前的某个第三方请求向冲突那么此时服务器就应该返回一个409错误告知用户请求无法完成。此时响应实体中很可能会包含两个冲突版本之间的差异比较以便用户重新提交归并以后的新版本。 |
| 410 | 被请求的资源在服务器上已经不再可用而且没有任何已知的转发地址。这样的状况应当被认为是永久性的。如果可能拥有链接编辑功能的客户端应当在获得用户许可后删除所有指向这个地址的引用。如果服务器不知道或者无法确定这个状况是否是永久的那么就应该使用404状态码。除非额外说明否则这个响应是可缓存的。 410响应的目的主要是帮助网站管理员维护网站通知用户该资源已经不再可用并且服务器拥有者希望所有指向这个资源的远端连接也被删除。这类事件在限时、增值服务中很普遍。同样410响应也被用于通知客户端在当前服务器站点上原本属于某个个人的资源已经不再可用。当然是否需要把所有永久不可用的资源标记为'410 Gone',以及是否需要保持此标记多长时间,完全取决于服务器拥有者。 |
| 411 | 服务器拒绝在没有定义 Content-Length 头的情况下接受请求。在添加了表明请求消息体长度的有效 Content-Length 头之后,客户端可以再次提交该请求。 |
| 412 | 服务器在验证在请求的头字段中给出先决条件时,没能满足其中的一个或多个。这个状态码允许客户端在获取资源时在请求的元信息(请求头字段数据)中设置先决条件,以此避免该请求方法被应用到其希望的内容以外的资源上。 |
| 413 | 服务器拒绝处理当前请求,因为该请求提交的实体数据大小超过了服务器愿意或者能够处理的范围。此种情况下,服务器可以关闭连接以免客户端继续发送此请求。 如果这个状况是临时的,服务器应当返回一个 Retry-After 的响应头,以告知客户端可以在多少时间以后重新尝试。 |
| 414 | 请求的URI 长度超过了服务器能够解释的长度,因此服务器拒绝对该请求提供服务。这比较少见,通常的情况包括: 本应使用POST方法的表单提交变成了GET方法导致查询字符串Query String过长。 重定向URI “黑洞”,例如每次重定向把旧的 URI 作为新的 URI 的一部分,导致在若干次重定向后 URI 超长。 客户端正在尝试利用某些服务器中存在的安全漏洞攻击服务器。这类服务器使用固定长度的缓冲读取或操作请求的 URI当 GET 后的参数超过某个数值后,可能会产生缓冲区溢出,导致任意代码被执行[1]。没有此类漏洞的服务器应当返回414状态码。 |
| 415 | 对于当前请求的方法和所请求的资源,请求中提交的实体并不是服务器中所支持的格式,因此请求被拒绝。 |
| 416 | 如果请求中包含了 Range 请求头,并且 Range 中指定的任何数据范围都与当前资源的可用范围不重合,同时请求中又没有定义 If-Range 请求头那么服务器就应当返回416状态码。 假如 Range 使用的是字节范围那么这种情况就是指请求指定的所有数据范围的首字节位置都超过了当前资源的长度。服务器也应当在返回416状态码的同时包含一个 Content-Range 实体头,用以指明当前资源的长度。这个响应也被禁止使用 multipart/byteranges 作为其 Content-Type。 |
| 417 | 在请求头 Expect 中指定的预期内容无法被服务器满足或者这个服务器是一个代理服务器它有明显的证据证明在当前路由的下一个节点上Expect 的内容无法被满足。 |
| 421 | 从当前客户端所在的IP地址到服务器的连接数超过了服务器许可的最大范围。通常这里的IP地址指的是从服务器上看到的客户端地址比如用户的网关或者代理服务器地址。在这种情况下连接数的计算可能涉及到不止一个终端用户。 |
| 422 | 从当前客户端所在的IP地址到服务器的连接数超过了服务器许可的最大范围。通常这里的IP地址指的是从服务器上看到的客户端地址比如用户的网关或者代理服务器地址。在这种情况下连接数的计算可能涉及到不止一个终端用户。 |
| 422 | 请求格式正确但是由于含有语义错误无法响应。RFC 4918 WebDAV423 Locked 当前资源被锁定。RFC 4918 WebDAV |
| 424 | 由于之前的某个请求发生的错误,导致当前请求失败,例如 PROPPATCH。RFC 4918 WebDAV |
| 425 | 在WebDav Advanced Collections 草案中定义但是未出现在《WebDAV 顺序集协议》RFC 3658中。 |
| 426 | 客户端应当切换到TLS/1.0。RFC 2817 |
| 449 | 由微软扩展,代表请求应当在执行完适当的操作后进行重试。 |
| 500 | 服务器遇到了一个未曾预料的状况,导致了它无法完成对请求的处理。一般来说,这个问题都会在服务器的程序码出错时出现。 |
| 501 | 服务器不支持当前请求所需要的某个功能。当服务器无法识别请求的方法,并且无法支持其对任何资源的请求。 |
| 502 | 作为网关或者代理工作的服务器尝试执行请求时,从上游服务器接收到无效的响应。 |
| 503 | 由于临时的服务器维护或者过载,服务器当前无法处理请求。这个状况是临时的,并且将在一段时间以后恢复。如果能够预计延迟时间,那么响应中可以包含一个 Retry-After 头用以标明这个延迟时间。如果没有给出这个 Retry-After 信息那么客户端应当以处理500响应的方式处理它。 注意503状态码的存在并不意味着服务器在过载的时候必须使用它。某些服务器只不过是希望拒绝客户端的连接。 |
| 504 | 作为网关或者代理工作的服务器尝试执行请求时未能及时从上游服务器URI标识出的服务器例如HTTP、FTP、LDAP或者辅助服务器例如DNS收到响应。 注意某些代理服务器在DNS查询超时时会返回400或者500错误 |
| 505 | 服务器不支持,或者拒绝支持在请求中使用的 HTTP 版本。这暗示着服务器不能或不愿使用与客户端相同的版本。响应中应当包含一个描述了为何版本不被支持以及服务器支持哪些协议的实体。 |
| 506 | 由《透明内容协商协议》RFC 2295扩展代表服务器存在内部配置错误被请求的协商变元资源被配置为在透明内容协商中使用自己因此在一个协商处理中不是一个合适的重点。 |
| 507 | 服务器无法存储完成请求所必须的内容。这个状况被认为是临时的。WebDAV (RFC 4918) |
| 509 | 服务器达到带宽限制。这不是一个官方的状态码,但是仍被广泛使用。 |
| 510 | 获取资源所需要的策略并没有没满足。RFC 2774 |

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,175 +0,0 @@
-- ----------------------------
-- 修改表主键为long类型
-- ----------------------------
ALTER TABLE `blade_notice`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `create_user` bigint(64) NULL DEFAULT NULL COMMENT '创建人' AFTER `content`,
MODIFY COLUMN `update_user` bigint(64) NULL DEFAULT NULL COMMENT '修改人' AFTER `create_time`;
ALTER TABLE `blade_client`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `create_user` bigint(64) NULL DEFAULT NULL COMMENT '创建人' AFTER `autoapprove`,
MODIFY COLUMN `update_user` bigint(64) NULL DEFAULT NULL COMMENT '修改人' AFTER `create_time`;
ALTER TABLE `blade_code`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST;
ALTER TABLE `blade_datasource`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST;
ALTER TABLE `blade_dept`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `parent_id` bigint(64) NULL DEFAULT 0 COMMENT '父主键' AFTER `tenant_id`;
ALTER TABLE `blade_dict`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `parent_id` bigint(64) NULL DEFAULT 0 COMMENT '父主键' AFTER `id`;
ALTER TABLE `blade_menu`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `parent_id` bigint(64) NULL DEFAULT 0 COMMENT '父级菜单' AFTER `id`;
ALTER TABLE `blade_param`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `create_user` bigint(64) NULL DEFAULT NULL COMMENT '创建人' AFTER `remark`,
MODIFY COLUMN `update_user` bigint(64) NULL DEFAULT NULL COMMENT '修改人' AFTER `create_time`;
ALTER TABLE `blade_role`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `parent_id` bigint(64) NULL DEFAULT 0 COMMENT '父主键' AFTER `tenant_id`;
ALTER TABLE `blade_role_menu`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `menu_id` bigint(64) NULL DEFAULT NULL COMMENT '菜单id' AFTER `id`,
MODIFY COLUMN `role_id` bigint(64) NULL DEFAULT NULL COMMENT '角色id' AFTER `menu_id`;
ALTER TABLE `blade_tenant`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `create_user` bigint(64) NULL DEFAULT NULL COMMENT '创建人' AFTER `address`,
MODIFY COLUMN `update_user` bigint(64) NULL DEFAULT NULL COMMENT '修改人' AFTER `create_time`;
ALTER TABLE `blade_user`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `role_id` bigint(64) NULL DEFAULT NULL COMMENT '角色id' AFTER `sex`,
MODIFY COLUMN `dept_id` bigint(64) NULL DEFAULT NULL COMMENT '部门id' AFTER `role_id`,
MODIFY COLUMN `create_user` bigint(64) NULL DEFAULT NULL COMMENT '创建人' AFTER `dept_id`,
MODIFY COLUMN `update_user` bigint(64) NULL DEFAULT NULL COMMENT '修改人' AFTER `create_time`;
-- ----------------------------
-- 删除多余字段
-- ----------------------------
ALTER TABLE `blade_datasource`
DROP COLUMN `create_dept`;
-- ----------------------------
-- 修改表字段为雪花id
-- ----------------------------
update `blade_client` set id = id + 1123598811738675200;
update `blade_code` set id = id + 1123598812738675200, datasource_id = datasource_id + 1123598812738675200;
update `blade_datasource` set id = id + 1123598812738675200;
update `blade_dept` set id = id + 1123598813738675200;
update `blade_dept` set parent_id = parent_id + 1123598813738675200 where parent_id > 0;
update `blade_dict` set id = id + 1123598814738675200;
update `blade_dict` set parent_id = parent_id + 1123598814738675200 where parent_id > 0;
update `blade_menu` set id = id + 1123598815738675200;
update `blade_menu` set parent_id = parent_id + 1123598815738675200 where parent_id > 0;
update `blade_role` set id = id + 1123598816738675200;
update `blade_role` set parent_id = parent_id + 1123598816738675200 where parent_id > 0;
update `blade_role_menu` set id = id + 1123598817738675200;
update `blade_role_menu` set menu_id = menu_id + 1123598815738675200;
update `blade_role_menu` set role_id = role_id + 1123598816738675200;
update `blade_notice` set id = id + 1123598818738675200, create_user = create_user + 1123598821738675200, update_user = update_user + 1123598821738675200;
update `blade_param` set id = id + 1123598819738675200, create_user = create_user + 1123598821738675200, update_user = update_user + 1123598821738675200;
update `blade_tenant` set id = id + 1123598820738675200, create_user = create_user + 1123598821738675200, update_user = update_user + 1123598821738675200;
update `blade_user` set id = id + 1123598821738675200, role_id = role_id + 1123598816738675200, dept_id = dept_id + 1123598813738675200, create_user = create_user + 1123598821738675200, update_user = update_user + 1123598821738675200;
-- ----------------------------
-- 将user表字段再改回varchar
-- ----------------------------
ALTER TABLE `blade_user`
MODIFY COLUMN `role_id` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色id' AFTER `sex`,
MODIFY COLUMN `dept_id` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部门id' AFTER `role_id`;
-- ----------------------------
-- 增加用户表字段
-- ----------------------------
ALTER TABLE `blade_user`
ADD COLUMN `code` varchar(12) NULL COMMENT '用户编号' AFTER `tenant_id`,
ADD COLUMN `post_id` varchar(1000) NULL COMMENT '岗位id' AFTER `dept_id`;
update `blade_user` set post_id = 1123598817738675201 where id = 1123598821738675201;
-- ----------------------------
-- 增加岗位管理表
-- ----------------------------
CREATE TABLE `blade_post` (
`id` bigint(64) NOT NULL COMMENT '主键',
`tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID',
`category` int(11) NULL DEFAULT NULL COMMENT '岗位类型',
`post_code` varchar(12) NULL COMMENT '岗位编号',
`post_name` varchar(64) NULL COMMENT '岗位名称',
`sort` int(2) NULL COMMENT '岗位排序',
`remark` varchar(255) NULL COMMENT '岗位描述',
`create_user` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
`create_dept` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_user` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
`status` int(2) NULL DEFAULT NULL COMMENT '状态',
`is_deleted` int(2) NULL DEFAULT NULL COMMENT '是否已删除',
PRIMARY KEY (`id`)
) COMMENT = '岗位表';
-- ----------------------------
-- 增加岗位管理表数据
-- ----------------------------
INSERT INTO `blade_post`(`id`, `tenant_id`, `category`, `post_code`, `post_name`, `sort`, `remark`, `create_user`, `create_dept`, `create_time`, `update_user`, `update_time`, `status`, `is_deleted`)
VALUES (1123598817738675201, '000000', 1, 'ceo', '首席执行官', 1, '总经理', 1123598821738675201, 1123598813738675201, '2020-04-01 00:00:00', 1123598821738675201, '2020-04-01 00:00:00', 1, 0);
INSERT INTO `blade_post`(`id`, `tenant_id`, `category`, `post_code`, `post_name`, `sort`, `remark`, `create_user`, `create_dept`, `create_time`, `update_user`, `update_time`, `status`, `is_deleted`)
VALUES (1123598817738675202, '000000', 1, 'coo', '首席运营官', 2, '常务总经理', 1123598821738675201, 1123598813738675201, '2020-04-01 00:00:00', 1123598821738675201, '2020-04-01 00:00:00', 1, 0);
INSERT INTO `blade_post`(`id`, `tenant_id`, `category`, `post_code`, `post_name`, `sort`, `remark`, `create_user`, `create_dept`, `create_time`, `update_user`, `update_time`, `status`, `is_deleted`)
VALUES (1123598817738675203, '000000', 1, 'cfo', '首席财务官', 3, '财务总经理', 1123598821738675201, 1123598813738675201, '2020-04-01 00:00:00', 1123598821738675201, '2020-04-01 00:00:00', 1, 0);
INSERT INTO `blade_post`(`id`, `tenant_id`, `category`, `post_code`, `post_name`, `sort`, `remark`, `create_user`, `create_dept`, `create_time`, `update_user`, `update_time`, `status`, `is_deleted`)
VALUES (1123598817738675204, '000000', 1, 'cto', '首席技术官', 4, '技术总监', 1123598821738675201, 1123598813738675201, '2020-04-01 00:00:00', 1123598821738675201, '2020-04-01 00:00:00', 1, 0);
INSERT INTO `blade_post`(`id`, `tenant_id`, `category`, `post_code`, `post_name`, `sort`, `remark`, `create_user`, `create_dept`, `create_time`, `update_user`, `update_time`, `status`, `is_deleted`)
VALUES (1123598817738675205, '000000', 1, 'cio', '首席信息官', 5, '信息总监', 1123598821738675201, 1123598813738675201, '2020-04-01 00:00:00', 1123598821738675201, '2020-04-01 00:00:00', 1, 0);
INSERT INTO `blade_post`(`id`, `tenant_id`, `category`, `post_code`, `post_name`, `sort`, `remark`, `create_user`, `create_dept`, `create_time`, `update_user`, `update_time`, `status`, `is_deleted`)
VALUES (1123598817738675206, '000000', 2, 'pm', '技术经理', 6, '研发和产品是永远的朋友', 1123598821738675201, 1123598813738675201, '2020-04-01 00:00:00', 1123598821738675201, '2020-04-01 00:00:00', 1, 0);
INSERT INTO `blade_post`(`id`, `tenant_id`, `category`, `post_code`, `post_name`, `sort`, `remark`, `create_user`, `create_dept`, `create_time`, `update_user`, `update_time`, `status`, `is_deleted`)
VALUES (1123598817738675207, '000000', 2, 'hrm', '人力经理', 7, '人力资源部门工作管理者', 1123598821738675201, 1123598813738675201, '2020-04-01 00:00:00', 1123598821738675201, '2020-04-01 00:00:00', 1, 0);
INSERT INTO `blade_post`(`id`, `tenant_id`, `category`, `post_code`, `post_name`, `sort`, `remark`, `create_user`, `create_dept`, `create_time`, `update_user`, `update_time`, `status`, `is_deleted`)
VALUES (1123598817738675208, '000000', 3, 'staff', '普通员工', 8, '普通员工', 1123598821738675201, 1123598813738675201, '2020-04-01 00:00:00', 1123598821738675201, '2020-04-01 00:00:00', 1, 0);
-- ----------------------------
-- 增加岗位管理菜单数据
-- ----------------------------
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1164733389668962251', '1123598815738675203', 'post', '岗位管理', 'menu', '/system/post', 'iconfont iconicon_message', 2, 1, 0, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1164733389668962252', '1164733389668962251', 'post_add', '新增', 'add', '/system/post/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1164733389668962253', '1164733389668962251', 'post_edit', '修改', 'edit', '/system/post/edit', 'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1164733389668962254', '1164733389668962251', 'post_delete', '删除', 'delete', '/api/blade-system/post/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1164733389668962255', '1164733389668962251', 'post_view', '查看', 'view', '/system/post/view', 'file-text', 4, 2, 2, 1, NULL, 0);
-- ----------------------------
-- 增加岗位管理菜单权限数据
-- ----------------------------
INSERT INTO `blade_role_menu`(`id`,`menu_id`,`role_id`)
VALUES ('1161272893875225001', '1164733389668962251', '1123598816738675201');
INSERT INTO `blade_role_menu`(`id`,`menu_id`,`role_id`)
VALUES ('1161272893875225002', '1164733389668962252', '1123598816738675201');
INSERT INTO `blade_role_menu`(`id`,`menu_id`,`role_id`)
VALUES ('1161272893875225003', '1164733389668962253', '1123598816738675201');
INSERT INTO `blade_role_menu`(`id`,`menu_id`,`role_id`)
VALUES ('1161272893875225004', '1164733389668962254', '1123598816738675201');
INSERT INTO `blade_role_menu`(`id`,`menu_id`,`role_id`)
VALUES ('1161272893875225005', '1164733389668962255', '1123598816738675201');
INSERT INTO `blade_role_menu`(`id`,`menu_id`,`role_id`)
VALUES ('1161272893875225006', '1164733389668962256', '1123598816738675201');
-- ----------------------------
-- 增加岗位类型字典数据
-- ----------------------------
INSERT INTO `blade_dict`(`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_deleted`)
VALUES (1123598814738777220, 0, 'post_category', '-1', '岗位类型', 12, NULL, 0);
INSERT INTO `blade_dict`(`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_deleted`)
VALUES (1123598814738777221, 1123598814738777220, 'post_category', '1', '高层', 1, NULL, 0);
INSERT INTO `blade_dict`(`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_deleted`)
VALUES (1123598814738777222, 1123598814738777220, 'post_category', '2', '中层', 2, NULL, 0);
INSERT INTO `blade_dict`(`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_deleted`)
VALUES (1123598814738777223, 1123598814738777220, 'post_category', '3', '基层', 3, NULL, 0);
INSERT INTO `blade_dict`(`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_deleted`)
VALUES (1123598814738777224, 1123598814738777220, 'post_category', '4', '其他', 4, NULL, 0);

View File

@ -0,0 +1,17 @@
CREATE TABLE `blade_user_oauth` (
`id` bigint(64) NOT NULL COMMENT '主键',
`tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '租户ID',
`uuid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '第三方系统用户ID',
`user_id` bigint(64) NULL DEFAULT NULL COMMENT '用户ID',
`username` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '账号',
`nickname` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户名',
`avatar` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '头像',
`blog` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '应用主页',
`company` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '公司名',
`location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址',
`email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '邮件',
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
`gender` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '性别',
`source` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '来源',
PRIMARY KEY (`id`)
) COMMENT = '用户第三方认证表';

18
pom.xml
View File

@ -5,28 +5,28 @@
<groupId>org.springblade</groupId>
<artifactId>SpringBlade</artifactId>
<version>2.7.0</version>
<version>2.7.2</version>
<packaging>pom</packaging>
<properties>
<blade.tool.version>2.7.0</blade.tool.version>
<blade.project.version>2.7.0</blade.project.version>
<blade.tool.version>2.7.2</blade.tool.version>
<blade.project.version>2.7.2</blade.project.version>
<java.version>1.8</java.version>
<maven.plugin.version>3.8.1</maven.plugin.version>
<swagger.version>2.9.2</swagger.version>
<swagger.models.version>1.5.21</swagger.models.version>
<knife4j.version>2.0.2</knife4j.version>
<mybatis.plus.version>3.3.1</mybatis.plus.version>
<knife4j.version>2.0.4</knife4j.version>
<mybatis.plus.version>3.3.2</mybatis.plus.version>
<protostuff.version>1.6.0</protostuff.version>
<captcha.version>1.6.2</captcha.version>
<easyexcel.version>2.1.6</easyexcel.version>
<easyexcel.version>2.2.6</easyexcel.version>
<mica.auto.version>1.1.0</mica.auto.version>
<alibaba.cloud.version>2.2.1.RELEASE</alibaba.cloud.version>
<spring.boot.admin.version>2.2.2</spring.boot.admin.version>
<spring.boot.admin.version>2.3.0</spring.boot.admin.version>
<spring.boot.version>2.2.6.RELEASE</spring.boot.version>
<spring.cloud.version>Hoxton.SR3</spring.cloud.version>
<spring.boot.version>2.2.9.RELEASE</spring.boot.version>
<spring.cloud.version>Hoxton.SR7</spring.cloud.version>
<spring.platform.version>Cairo-SR8</spring.platform.version>
<!-- 推荐使用Harbor -->

View File

@ -1,2 +1,2 @@
REGISTER=192.168.0.157/blade
TAG=2.7.0
TAG=2.7.2

View File

@ -1,7 +1,7 @@
version: '3'
services:
nacos:
image: nacos/nacos-server:1.1.3
image: nacos/nacos-server:1.3.2
hostname: "nacos-standalone"
environment:
- MODE=standalone
@ -15,7 +15,7 @@ services:
ipv4_address: 172.30.0.48
sentinel:
image: bladex/sentinel-dashboard:1.5.0
image: bladex/sentinel-dashboard:1.7.2
hostname: "sentinel"
ports:
- 8858:8858