mirror of
https://github.com/chillzhuang/SpringBlade.git
synced 2024-12-22 17:19:23 +08:00
🎉 2.2.0.RELEASE
This commit is contained in:
parent
3d734c7858
commit
39d8428f80
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
## 在线演示
|
## 在线演示
|
||||||
* Sword演示地址:[https://sword.bladex.vip](https://sword.bladex.vip)
|
* Sword演示地址:[https://sword.bladex.vip](https://sword.bladex.vip)
|
||||||
* Saber演示地址:[https://saber.avue.top](https://saber.avue.top)
|
* Saber演示地址:[https://saber.bladex.vip](https://saber.bladex.vip)
|
||||||
|
|
||||||
## 后端项目地址
|
## 后端项目地址
|
||||||
* [Gitee地址](https://gitee.com/smallc/SpringBlade)
|
* [Gitee地址](https://gitee.com/smallc/SpringBlade)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>SpringBlade</artifactId>
|
<artifactId>SpringBlade</artifactId>
|
||||||
<groupId>org.springblade</groupId>
|
<groupId>org.springblade</groupId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>blade-auth</artifactId>
|
<artifactId>blade-auth</artifactId>
|
||||||
@ -48,6 +48,12 @@
|
|||||||
<artifactId>blade-core-swagger</artifactId>
|
<artifactId>blade-core-swagger</artifactId>
|
||||||
<version>${blade.tool.version}</version>
|
<version>${blade.tool.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- MySQL -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -19,6 +19,7 @@ import io.swagger.annotations.Api;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import io.swagger.annotations.ApiParam;
|
import io.swagger.annotations.ApiParam;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springblade.core.launch.constant.TokenConstant;
|
||||||
import org.springblade.core.secure.AuthInfo;
|
import org.springblade.core.secure.AuthInfo;
|
||||||
import org.springblade.core.secure.utils.SecureUtil;
|
import org.springblade.core.secure.utils.SecureUtil;
|
||||||
import org.springblade.core.tool.api.R;
|
import org.springblade.core.tool.api.R;
|
||||||
@ -48,7 +49,7 @@ public class AuthController {
|
|||||||
|
|
||||||
@PostMapping("token")
|
@PostMapping("token")
|
||||||
@ApiOperation(value = "获取认证token", notes = "传入租户编号:tenantCode,账号:account,密码:password")
|
@ApiOperation(value = "获取认证token", notes = "传入租户编号:tenantCode,账号:account,密码:password")
|
||||||
public R<AuthInfo> token(@ApiParam(value = "租户编号", required = true) @RequestParam String tenantCode,
|
public R<AuthInfo> token(@ApiParam(value = "租户编号", required = true) @RequestParam(defaultValue = "000000", required = false) String tenantCode,
|
||||||
@ApiParam(value = "账号", required = true) @RequestParam String account,
|
@ApiParam(value = "账号", required = true) @RequestParam String account,
|
||||||
@ApiParam(value = "密码", required = true) @RequestParam String password) {
|
@ApiParam(value = "密码", required = true) @RequestParam String password) {
|
||||||
|
|
||||||
@ -67,12 +68,12 @@ public class AuthController {
|
|||||||
|
|
||||||
//设置jwt参数
|
//设置jwt参数
|
||||||
Map<String, String> param = new HashMap<>(16);
|
Map<String, String> param = new HashMap<>(16);
|
||||||
param.put(SecureUtil.USER_ID, Func.toStr(user.getId()));
|
param.put(TokenConstant.USER_ID, Func.toStr(user.getId()));
|
||||||
param.put(SecureUtil.ROLE_ID, user.getRoleId());
|
param.put(TokenConstant.ROLE_ID, user.getRoleId());
|
||||||
param.put(SecureUtil.TENANT_CODE, user.getTenantCode());
|
param.put(TokenConstant.TENANT_CODE, user.getTenantCode());
|
||||||
param.put(SecureUtil.ACCOUNT, user.getAccount());
|
param.put(TokenConstant.ACCOUNT, user.getAccount());
|
||||||
param.put(SecureUtil.USER_NAME, user.getRealName());
|
param.put(TokenConstant.USER_NAME, user.getRealName());
|
||||||
param.put(SecureUtil.ROLE_NAME, Func.join(res.getData().getRoles()));
|
param.put(TokenConstant.ROLE_NAME, Func.join(res.getData().getRoles()));
|
||||||
|
|
||||||
//拼装accessToken
|
//拼装accessToken
|
||||||
String accessToken = SecureUtil.createJWT(param, "audience", "issuser", true);
|
String accessToken = SecureUtil.createJWT(param, "audience", "issuser", true);
|
||||||
@ -83,7 +84,7 @@ public class AuthController {
|
|||||||
authInfo.setUserName(user.getRealName());
|
authInfo.setUserName(user.getRealName());
|
||||||
authInfo.setAuthority(Func.join(res.getData().getRoles()));
|
authInfo.setAuthority(Func.join(res.getData().getRoles()));
|
||||||
authInfo.setAccessToken(accessToken);
|
authInfo.setAccessToken(accessToken);
|
||||||
authInfo.setTokenType(SecureUtil.BEARER);
|
authInfo.setTokenType(TokenConstant.BEARER);
|
||||||
//设置token过期时间
|
//设置token过期时间
|
||||||
authInfo.setExpiresIn(SecureUtil.getExpire());
|
authInfo.setExpiresIn(SecureUtil.getExpire());
|
||||||
return R.data(authInfo);
|
return R.data(authInfo);
|
||||||
|
11
blade-auth/src/main/resources/application-dev.yml
Normal file
11
blade-auth/src/main/resources/application-dev.yml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#服务器端口
|
||||||
|
server:
|
||||||
|
port: 8100
|
||||||
|
|
||||||
|
#数据源配置
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.jdbc.Driver
|
||||||
|
url: ${blade.datasource.dev.url}
|
||||||
|
username: ${blade.datasource.dev.username}
|
||||||
|
password: ${blade.datasource.dev.password}
|
11
blade-auth/src/main/resources/application-prod.yml
Normal file
11
blade-auth/src/main/resources/application-prod.yml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#服务器端口
|
||||||
|
server:
|
||||||
|
port: 8100
|
||||||
|
|
||||||
|
#数据源配置
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.jdbc.Driver
|
||||||
|
url: ${blade.datasource.prod.url}
|
||||||
|
username: ${blade.datasource.prod.username}
|
||||||
|
password: ${blade.datasource.prod.password}
|
11
blade-auth/src/main/resources/application-test.yml
Normal file
11
blade-auth/src/main/resources/application-test.yml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#服务器端口
|
||||||
|
server:
|
||||||
|
port: 8100
|
||||||
|
|
||||||
|
#数据源配置
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.jdbc.Driver
|
||||||
|
url: ${blade.datasource.test.url}
|
||||||
|
username: ${blade.datasource.test.username}
|
||||||
|
password: ${blade.datasource.test.password}
|
@ -1,2 +0,0 @@
|
|||||||
server:
|
|
||||||
port: 8100
|
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>SpringBlade</artifactId>
|
<artifactId>SpringBlade</artifactId>
|
||||||
<groupId>org.springblade</groupId>
|
<groupId>org.springblade</groupId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ public interface CommonConstant {
|
|||||||
/**
|
/**
|
||||||
* nacos prod 地址
|
* nacos prod 地址
|
||||||
*/
|
*/
|
||||||
String NACOS_PROD_ADDR = "192.168.186.129:8848";
|
String NACOS_PROD_ADDR = "172.30.0.48:8848";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sentinel dev 地址
|
* sentinel dev 地址
|
||||||
@ -25,7 +25,7 @@ public interface CommonConstant {
|
|||||||
/**
|
/**
|
||||||
* sentinel prod 地址
|
* sentinel prod 地址
|
||||||
*/
|
*/
|
||||||
String SENTINEL_PROD_ADDR = "192.168.186.129:8858";
|
String SENTINEL_PROD_ADDR = "172.30.0.58:8858";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sword 系统名
|
* sword 系统名
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>SpringBlade</artifactId>
|
<artifactId>SpringBlade</artifactId>
|
||||||
<groupId>org.springblade</groupId>
|
<groupId>org.springblade</groupId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>blade-ops</artifactId>
|
<artifactId>blade-ops</artifactId>
|
||||||
<groupId>org.springblade</groupId>
|
<groupId>org.springblade</groupId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springblade</groupId>
|
<groupId>org.springblade</groupId>
|
||||||
<artifactId>blade-ops</artifactId>
|
<artifactId>blade-ops</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||||
spring.datasource.url=jdbc:mysql://localhost:3306/blade?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&serverTimezone=GMT%2B8
|
spring.datasource.url=jdbc:mysql://localhost:3306/blade?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&serverTimezone=GMT%2B8
|
||||||
spring.datasource.username=root
|
spring.datasource.username=root
|
||||||
spring.datasource.password=root
|
spring.datasource.password=root
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||||
VALUES ('000000', 0, '$!{cfg.entityKey}', '$!{cfg.codeName}', 'menu', '/$!{cfg.servicePackage}/$!{cfg.entityKey}', NULL, 1, 1, 0, 1, NULL, 0);
|
VALUES (0, '$!{cfg.entityKey}', '$!{cfg.codeName}', 'menu', '/$!{cfg.servicePackage}/$!{cfg.entityKey}', NULL, 1, 1, 0, 1, NULL, 0);
|
||||||
set @parentid = (SELECT LAST_INSERT_ID());
|
set @parentid = (SELECT LAST_INSERT_ID());
|
||||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||||
VALUES ('000000', @parentid, '$!{cfg.entityKey}_add', '新增', 'add', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
VALUES (@parentid, '$!{cfg.entityKey}_add', '新增', 'add', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
||||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||||
VALUES ('000000', @parentid, '$!{cfg.entityKey}_edit', '修改', 'edit', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/edit', 'form', 2, 2, 1, 2, NULL, 0);
|
VALUES (@parentid, '$!{cfg.entityKey}_edit', '修改', 'edit', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/edit', 'form', 2, 2, 1, 2, NULL, 0);
|
||||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||||
VALUES ('000000', @parentid, '$!{cfg.entityKey}_delete', '删除', 'delete', '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/remove', 'delete', 3, 2, 1, 3, NULL, 0);
|
VALUES (@parentid, '$!{cfg.entityKey}_delete', '删除', 'delete', '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/remove', 'delete', 3, 2, 1, 3, NULL, 0);
|
||||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||||
VALUES ('000000', @parentid, '$!{cfg.entityKey}_view', '查看', 'view', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/view', 'file-text', 4, 2, 1, 2, NULL, 0);
|
VALUES (@parentid, '$!{cfg.entityKey}_view', '查看', 'view', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/view', 'file-text', 4, 2, 1, 2, NULL, 0);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||||
spring.datasource.url=jdbc:mysql://localhost:3306/blade?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&serverTimezone=GMT%2B8
|
spring.datasource.url=jdbc:mysql://localhost:3306/blade?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&serverTimezone=GMT%2B8
|
||||||
spring.datasource.username=root
|
spring.datasource.username=root
|
||||||
spring.datasource.password=root
|
spring.datasource.password=root
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||||
VALUES ('000000', 0, '$!{cfg.entityKey}', '$!{cfg.codeName}', 'menu', '/$!{cfg.servicePackage}/$!{cfg.entityKey}', NULL, 1, 1, 0, 1, NULL, 0);
|
VALUES (0, '$!{cfg.entityKey}', '$!{cfg.codeName}', 'menu', '/$!{cfg.servicePackage}/$!{cfg.entityKey}', NULL, 1, 1, 0, 1, NULL, 0);
|
||||||
set @parentid = (SELECT LAST_INSERT_ID());
|
set @parentid = (SELECT LAST_INSERT_ID());
|
||||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||||
VALUES ('000000', @parentid, '$!{cfg.entityKey}_add', '新增', 'add', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
VALUES (@parentid, '$!{cfg.entityKey}_add', '新增', 'add', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
||||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||||
VALUES ('000000', @parentid, '$!{cfg.entityKey}_edit', '修改', 'edit', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/edit', 'form', 2, 2, 1, 2, NULL, 0);
|
VALUES (@parentid, '$!{cfg.entityKey}_edit', '修改', 'edit', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/edit', 'form', 2, 2, 1, 2, NULL, 0);
|
||||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||||
VALUES ('000000', @parentid, '$!{cfg.entityKey}_delete', '删除', 'delete', '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/remove', 'delete', 3, 2, 1, 3, NULL, 0);
|
VALUES (@parentid, '$!{cfg.entityKey}_delete', '删除', 'delete', '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/remove', 'delete', 3, 2, 1, 3, NULL, 0);
|
||||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||||
VALUES ('000000', @parentid, '$!{cfg.entityKey}_view', '查看', 'view', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/view', 'file-text', 4, 2, 1, 2, NULL, 0);
|
VALUES (@parentid, '$!{cfg.entityKey}_view', '查看', 'view', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/view', 'file-text', 4, 2, 1, 2, NULL, 0);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>SpringBlade</artifactId>
|
<artifactId>SpringBlade</artifactId>
|
||||||
<groupId>org.springblade</groupId>
|
<groupId>org.springblade</groupId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>blade-service-api</artifactId>
|
<artifactId>blade-service-api</artifactId>
|
||||||
<groupId>org.springblade</groupId>
|
<groupId>org.springblade</groupId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>blade-service-api</artifactId>
|
<artifactId>blade-service-api</artifactId>
|
||||||
<groupId>org.springblade</groupId>
|
<groupId>org.springblade</groupId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>blade-service-api</artifactId>
|
<artifactId>blade-service-api</artifactId>
|
||||||
<groupId>org.springblade</groupId>
|
<groupId>org.springblade</groupId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -0,0 +1,96 @@
|
|||||||
|
/**
|
||||||
|
* 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.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.springblade.core.mp.base.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实体类
|
||||||
|
*
|
||||||
|
* @author BladeX
|
||||||
|
* @since 2019-03-24
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("blade_client")
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel(value = "Client对象", description = "Client对象")
|
||||||
|
public class AuthClient extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户端id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "客户端id")
|
||||||
|
private String clientId;
|
||||||
|
/**
|
||||||
|
* 客户端密钥
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "客户端密钥")
|
||||||
|
private String clientSecret;
|
||||||
|
/**
|
||||||
|
* 资源集合
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "资源集合")
|
||||||
|
private String resourceIds;
|
||||||
|
/**
|
||||||
|
* 授权范围
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "授权范围")
|
||||||
|
private String scope;
|
||||||
|
/**
|
||||||
|
* 授权类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "授权类型")
|
||||||
|
private String authorizedGrantTypes;
|
||||||
|
/**
|
||||||
|
* 回调地址
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "回调地址")
|
||||||
|
private String webServerRedirectUri;
|
||||||
|
/**
|
||||||
|
* 权限
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "权限")
|
||||||
|
private String authorities;
|
||||||
|
/**
|
||||||
|
* 令牌过期秒数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "令牌过期秒数")
|
||||||
|
private Integer accessTokenValidity;
|
||||||
|
/**
|
||||||
|
* 刷新令牌过期秒数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "刷新令牌过期秒数")
|
||||||
|
private Integer refreshTokenValidity;
|
||||||
|
/**
|
||||||
|
* 附加说明
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "附加说明")
|
||||||
|
private String additionalInformation;
|
||||||
|
/**
|
||||||
|
* 自动授权
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "自动授权")
|
||||||
|
private String autoapprove;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>blade-service-api</artifactId>
|
<artifactId>blade-service-api</artifactId>
|
||||||
<groupId>org.springblade</groupId>
|
<groupId>org.springblade</groupId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>SpringBlade</artifactId>
|
<artifactId>SpringBlade</artifactId>
|
||||||
<groupId>org.springblade</groupId>
|
<groupId>org.springblade</groupId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>blade-service-api</artifactId>
|
<artifactId>blade-service-api</artifactId>
|
||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<description>SpringBlade 微服务API集合</description>
|
<description>SpringBlade 微服务API集合</description>
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springblade</groupId>
|
<groupId>org.springblade</groupId>
|
||||||
<artifactId>blade-service</artifactId>
|
<artifactId>blade-service</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>blade-service</artifactId>
|
<artifactId>blade-service</artifactId>
|
||||||
<groupId>org.springblade</groupId>
|
<groupId>org.springblade</groupId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>blade-service</artifactId>
|
<artifactId>blade-service</artifactId>
|
||||||
<groupId>org.springblade</groupId>
|
<groupId>org.springblade</groupId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -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.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
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.utils.Func;
|
||||||
|
import org.springblade.system.entity.AuthClient;
|
||||||
|
import org.springblade.system.service.IAuthClientService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用管理控制器
|
||||||
|
*
|
||||||
|
* @author Chill
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@AllArgsConstructor
|
||||||
|
@RequestMapping("/client")
|
||||||
|
@ApiIgnore
|
||||||
|
@Api(value = "应用管理", tags = "接口")
|
||||||
|
public class AuthClientController extends BladeController {
|
||||||
|
|
||||||
|
private IAuthClientService clientService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail")
|
||||||
|
@ApiOperation(value = "详情", notes = "传入client", position = 1)
|
||||||
|
public R<AuthClient> detail(AuthClient authClient) {
|
||||||
|
AuthClient detail = clientService.getOne(Condition.getQueryWrapper(authClient));
|
||||||
|
return R.data(detail);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
@ApiOperation(value = "分页", notes = "传入client", position = 2)
|
||||||
|
public R<IPage<AuthClient>> list(AuthClient authClient, Query query) {
|
||||||
|
IPage<AuthClient> pages = clientService.page(Condition.getPage(query), Condition.getQueryWrapper(authClient));
|
||||||
|
return R.data(pages);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@PostMapping("/save")
|
||||||
|
@ApiOperation(value = "新增", notes = "传入client", position = 4)
|
||||||
|
public R save(@Valid @RequestBody AuthClient authClient) {
|
||||||
|
return R.status(clientService.save(authClient));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@PostMapping("/update")
|
||||||
|
@ApiOperation(value = "修改", notes = "传入client", position = 5)
|
||||||
|
public R update(@Valid @RequestBody AuthClient authClient) {
|
||||||
|
return R.status(clientService.updateById(authClient));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增或修改
|
||||||
|
*/
|
||||||
|
@PostMapping("/submit")
|
||||||
|
@ApiOperation(value = "新增或修改", notes = "传入client", position = 6)
|
||||||
|
public R submit(@Valid @RequestBody AuthClient authClient) {
|
||||||
|
return R.status(clientService.saveOrUpdate(authClient));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ApiOperation(value = "逻辑删除", notes = "传入ids", position = 7)
|
||||||
|
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
||||||
|
return R.status(clientService.deleteLogic(Func.toIntList(ids)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -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.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.springblade.system.entity.AuthClient;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapper 接口
|
||||||
|
*
|
||||||
|
* @author Chill
|
||||||
|
*/
|
||||||
|
public interface AuthClientMapper extends BaseMapper<AuthClient> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
<?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.AuthClientMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="clientResultMap" type="org.springblade.system.entity.AuthClient">
|
||||||
|
<result column="id" property="id"/>
|
||||||
|
<result column="create_user" property="createUser"/>
|
||||||
|
<result column="create_time" property="createTime"/>
|
||||||
|
<result column="update_user" property="updateUser"/>
|
||||||
|
<result column="update_time" property="updateTime"/>
|
||||||
|
<result column="status" property="status"/>
|
||||||
|
<result column="is_deleted" property="isDeleted"/>
|
||||||
|
<result column="client_id" property="clientId"/>
|
||||||
|
<result column="client_secret" property="clientSecret"/>
|
||||||
|
<result column="resources_ids" property="resourceIds"/>
|
||||||
|
<result column="scope" property="scope"/>
|
||||||
|
<result column="authorized_grant_types" property="authorizedGrantTypes"/>
|
||||||
|
<result column="web_server_redirect_uri" property="webServerRedirectUri"/>
|
||||||
|
<result column="authorities" property="authorities"/>
|
||||||
|
<result column="access_token_validity" property="accessTokenValidity"/>
|
||||||
|
<result column="refresh_token_validity" property="refreshTokenValidity"/>
|
||||||
|
<result column="additional_information" property="additionalInformation"/>
|
||||||
|
<result column="autoapprove" property="autoapprove"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
</mapper>
|
@ -35,18 +35,18 @@
|
|||||||
<select id="getValue" resultType="java.lang.String">
|
<select id="getValue" resultType="java.lang.String">
|
||||||
select
|
select
|
||||||
dict_value
|
dict_value
|
||||||
from blade_dict where code = #{param1} and dict_key = #{param2} limit 1
|
from blade_dict where code = #{param1} and dict_key = #{param2} and is_deleted = 0 limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- oracle 版本 -->
|
<!-- oracle 版本 -->
|
||||||
<!--<select id="getValue" resultType="java.lang.String">
|
<!--<select id="getValue" resultType="java.lang.String">
|
||||||
select
|
select
|
||||||
dict_value
|
dict_value
|
||||||
from blade_dict where code = #{param1, jdbcType=VARCHAR} and dict_key = #{param2} rownum 1
|
from blade_dict where code = #{param1, jdbcType=VARCHAR} and dict_key = #{param2} and dict_value >= 0 rownum 1
|
||||||
</select>-->
|
</select>-->
|
||||||
|
|
||||||
<select id="getList" resultMap="dictResultMap">
|
<select id="getList" resultMap="dictResultMap">
|
||||||
select code, dict_key, dict_value, sort, remark from blade_dict where code = #{param1}
|
select code, dict_key, dict_value, sort, remark from blade_dict where code = #{param1} and dict_key >= 0 and is_deleted = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="tree" resultMap="treeNodeResultMap">
|
<select id="tree" resultMap="treeNodeResultMap">
|
||||||
|
@ -56,6 +56,7 @@ public interface MenuMapper extends BaseMapper<Menu> {
|
|||||||
/**
|
/**
|
||||||
* 授权树形结构
|
* 授权树形结构
|
||||||
*
|
*
|
||||||
|
* @param roleId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<MenuVO> grantTreeByRole(List<Integer> roleId);
|
List<MenuVO> grantTreeByRole(List<Integer> roleId);
|
||||||
@ -93,6 +94,7 @@ public interface MenuMapper extends BaseMapper<Menu> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取配置的角色权限
|
* 获取配置的角色权限
|
||||||
|
*
|
||||||
* @param roleIds
|
* @param roleIds
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="roleMenu" resultMap="menuResultMap">
|
<select id="roleMenu" resultMap="menuResultMap">
|
||||||
select * from blade_menu where is_deleted = 0 AND id IN ( SELECT menu_id FROM blade_role_menu WHERE role_id IN
|
select * from blade_menu where is_deleted = 0 and id IN ( SELECT menu_id FROM blade_role_menu WHERE role_id IN
|
||||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach> )
|
</foreach> )
|
||||||
@ -58,8 +58,8 @@
|
|||||||
FROM
|
FROM
|
||||||
blade_menu
|
blade_menu
|
||||||
WHERE
|
WHERE
|
||||||
category = 1
|
is_deleted = 0 and category = 1
|
||||||
AND id IN ( SELECT menu_id FROM blade_role_menu WHERE role_id IN
|
and id IN ( SELECT menu_id FROM blade_role_menu WHERE role_id IN
|
||||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach> )
|
</foreach> )
|
||||||
@ -79,7 +79,7 @@
|
|||||||
FROM
|
FROM
|
||||||
blade_menu
|
blade_menu
|
||||||
WHERE
|
WHERE
|
||||||
id IN (
|
is_deleted = 0 and id IN (
|
||||||
SELECT parent_id FROM blade_menu
|
SELECT parent_id FROM blade_menu
|
||||||
WHERE ( category = 2 AND id IN ( SELECT menu_id FROM blade_role_menu WHERE role_id IN
|
WHERE ( category = 2 AND id IN ( SELECT menu_id FROM blade_role_menu WHERE role_id IN
|
||||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||||
@ -102,10 +102,10 @@
|
|||||||
FROM
|
FROM
|
||||||
blade_menu
|
blade_menu
|
||||||
WHERE
|
WHERE
|
||||||
( category = 2 AND id IN ( SELECT menu_id FROM blade_role_menu WHERE role_id IN
|
is_deleted = 0 and category = 2 AND id IN ( SELECT menu_id FROM blade_role_menu WHERE role_id IN
|
||||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>) )
|
</foreach>)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="grantTree" resultMap="treeNodeResultMap">
|
<select id="grantTree" resultMap="treeNodeResultMap">
|
||||||
@ -140,8 +140,9 @@
|
|||||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
AND m.path IS NOT NULL
|
AND m.path IS NOT NULL and m.is_deleted = 0
|
||||||
GROUP BY m.path
|
GROUP BY m.path
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -42,8 +42,9 @@ public interface RoleMapper extends BaseMapper<Role> {
|
|||||||
* 获取树形节点
|
* 获取树形节点
|
||||||
*
|
*
|
||||||
* @param tenantCode
|
* @param tenantCode
|
||||||
|
* @param excludeRole
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<RoleVO> tree(String tenantCode);
|
List<RoleVO> tree(String tenantCode, String excludeRole);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,11 @@
|
|||||||
|
|
||||||
<select id="tree" resultMap="treeNodeResultMap">
|
<select id="tree" resultMap="treeNodeResultMap">
|
||||||
select id, parent_id, role_name as title, id as 'value', id as 'key' from blade_role where is_deleted = 0
|
select id, parent_id, role_name as title, id as 'value', id as 'key' from blade_role where is_deleted = 0
|
||||||
<if test="_parameter!=null">
|
<if test="param1!=null">
|
||||||
and tenant_code = #{_parameter}
|
and tenant_code = #{param1}
|
||||||
|
</if>
|
||||||
|
<if test="param2!=null">
|
||||||
|
and role_alias <> #{param2}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -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.service;
|
||||||
|
|
||||||
|
import org.springblade.core.mp.base.BaseService;
|
||||||
|
import org.springblade.system.entity.AuthClient;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务类
|
||||||
|
*
|
||||||
|
* @author Chill
|
||||||
|
*/
|
||||||
|
public interface IAuthClientService extends BaseService<AuthClient> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* 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 org.springblade.core.mp.base.BaseServiceImpl;
|
||||||
|
import org.springblade.system.entity.AuthClient;
|
||||||
|
import org.springblade.system.mapper.AuthClientMapper;
|
||||||
|
import org.springblade.system.service.IAuthClientService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务实现类
|
||||||
|
*
|
||||||
|
* @author Chill
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AuthClientServiceImpl extends BaseServiceImpl<AuthClientMapper, AuthClient> implements IAuthClientService {
|
||||||
|
|
||||||
|
}
|
@ -19,7 +19,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springblade.core.secure.utils.SecureUtil;
|
||||||
|
import org.springblade.core.tool.constant.RoleConstant;
|
||||||
import org.springblade.core.tool.node.ForestNodeMerger;
|
import org.springblade.core.tool.node.ForestNodeMerger;
|
||||||
|
import org.springblade.core.tool.utils.CollectionUtil;
|
||||||
|
import org.springblade.core.tool.utils.Func;
|
||||||
import org.springblade.system.entity.Role;
|
import org.springblade.system.entity.Role;
|
||||||
import org.springblade.system.entity.RoleMenu;
|
import org.springblade.system.entity.RoleMenu;
|
||||||
import org.springblade.system.mapper.RoleMapper;
|
import org.springblade.system.mapper.RoleMapper;
|
||||||
@ -52,7 +56,12 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RoleVO> tree(String tenantCode) {
|
public List<RoleVO> tree(String tenantCode) {
|
||||||
return ForestNodeMerger.merge(baseMapper.tree(tenantCode));
|
String userRole = SecureUtil.getUserRole();
|
||||||
|
String excludeRole = null;
|
||||||
|
if (!CollectionUtil.contains(Func.toStrArray(userRole), RoleConstant.ADMIN)) {
|
||||||
|
excludeRole = RoleConstant.ADMIN;
|
||||||
|
}
|
||||||
|
return ForestNodeMerger.merge(baseMapper.tree(tenantCode, excludeRole));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>blade-service</artifactId>
|
<artifactId>blade-service</artifactId>
|
||||||
<groupId>org.springblade</groupId>
|
<groupId>org.springblade</groupId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -28,7 +28,6 @@ import org.springblade.core.mp.support.Query;
|
|||||||
import org.springblade.core.secure.BladeUser;
|
import org.springblade.core.secure.BladeUser;
|
||||||
import org.springblade.core.tool.api.R;
|
import org.springblade.core.tool.api.R;
|
||||||
import org.springblade.core.tool.constant.BladeConstant;
|
import org.springblade.core.tool.constant.BladeConstant;
|
||||||
import org.springblade.core.tool.utils.DigestUtil;
|
|
||||||
import org.springblade.core.tool.utils.Func;
|
import org.springblade.core.tool.utils.Func;
|
||||||
import org.springblade.system.feign.IDictClient;
|
import org.springblade.system.feign.IDictClient;
|
||||||
import org.springblade.system.user.entity.User;
|
import org.springblade.system.user.entity.User;
|
||||||
@ -88,10 +87,7 @@ public class UserController {
|
|||||||
@PostMapping("/submit")
|
@PostMapping("/submit")
|
||||||
@ApiOperation(value = "新增或修改", notes = "传入User", position = 3)
|
@ApiOperation(value = "新增或修改", notes = "传入User", position = 3)
|
||||||
public R submit(@Valid @RequestBody User user) {
|
public R submit(@Valid @RequestBody User user) {
|
||||||
if (Func.isNotEmpty(user.getPassword())) {
|
return R.status(userService.submit(user));
|
||||||
user.setPassword(DigestUtil.encrypt(user.getPassword()));
|
|
||||||
}
|
|
||||||
return R.status(userService.saveOrUpdate(user));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
FROM
|
FROM
|
||||||
blade_user
|
blade_user
|
||||||
WHERE
|
WHERE
|
||||||
tenant_code = #{param1} and account = #{param2} AND password = #{param3}
|
tenant_code = #{param1} and account = #{param2} and password = #{param3} and is_deleted = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getRoleName" resultType="java.lang.String">
|
<select id="getRoleName" resultType="java.lang.String">
|
||||||
@ -59,6 +59,7 @@
|
|||||||
<foreach collection="array" item="ids" index="index" open="(" close=")" separator=",">
|
<foreach collection="array" item="ids" index="index" open="(" close=")" separator=",">
|
||||||
#{ids}
|
#{ids}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
and is_deleted = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getRoleAlias" resultType="java.lang.String">
|
<select id="getRoleAlias" resultType="java.lang.String">
|
||||||
@ -71,6 +72,7 @@
|
|||||||
<foreach collection="array" item="ids" index="index" open="(" close=")" separator=",">
|
<foreach collection="array" item="ids" index="index" open="(" close=")" separator=",">
|
||||||
#{ids}
|
#{ids}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
and is_deleted = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDeptName" resultType="java.lang.String">
|
<select id="getDeptName" resultType="java.lang.String">
|
||||||
@ -83,6 +85,7 @@
|
|||||||
<foreach collection="array" item="ids" index="index" open="(" close=")" separator=",">
|
<foreach collection="array" item="ids" index="index" open="(" close=")" separator=",">
|
||||||
#{ids}
|
#{ids}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
and is_deleted = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -30,6 +30,13 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface IUserService extends BaseService<User> {
|
public interface IUserService extends BaseService<User> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增或修改用户
|
||||||
|
* @param user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean submit(User user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义分页
|
* 自定义分页
|
||||||
*
|
*
|
||||||
|
@ -18,6 +18,7 @@ package org.springblade.system.user.service.impl;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.exceptions.ApiException;
|
||||||
import org.springblade.common.constant.CommonConstant;
|
import org.springblade.common.constant.CommonConstant;
|
||||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||||
import org.springblade.core.tool.utils.DigestUtil;
|
import org.springblade.core.tool.utils.DigestUtil;
|
||||||
@ -39,6 +40,18 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implements IUserService {
|
public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implements IUserService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean submit(User user) {
|
||||||
|
if (Func.isNotEmpty(user.getPassword())) {
|
||||||
|
user.setPassword(DigestUtil.encrypt(user.getPassword()));
|
||||||
|
}
|
||||||
|
Integer cnt = baseMapper.selectCount(Wrappers.<User>query().lambda().eq(User::getTenantCode, user.getTenantCode()).eq(User::getAccount, user.getAccount()));
|
||||||
|
if (cnt > 0) {
|
||||||
|
throw new ApiException("当前用户已存在!");
|
||||||
|
}
|
||||||
|
return saveOrUpdate(user);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<User> selectUserPage(IPage<User> page, User user) {
|
public IPage<User> selectUserPage(IPage<User> page, User user) {
|
||||||
return page.setRecords(baseMapper.selectUserPage(page, user));
|
return page.setRecords(baseMapper.selectUserPage(page, user));
|
||||||
|
@ -7,12 +7,12 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springblade</groupId>
|
<groupId>org.springblade</groupId>
|
||||||
<artifactId>SpringBlade</artifactId>
|
<artifactId>SpringBlade</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>blade-service</artifactId>
|
<artifactId>blade-service</artifactId>
|
||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<description>SpringBlade 微服务集合</description>
|
<description>SpringBlade 微服务集合</description>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
```
|
```
|
||||||
<servers>
|
<servers>
|
||||||
<server>
|
<server>
|
||||||
<id>192.168.186.129</id>
|
<id>10.211.55.5</id>
|
||||||
<username>admin</username>
|
<username>admin</username>
|
||||||
<password>Harbor12345</password>
|
<password>Harbor12345</password>
|
||||||
<configuration>
|
<configuration>
|
||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
###2. docker开启远程访问
|
###2. docker开启远程访问
|
||||||
|
|
||||||
如果没有远程访问,会报 `Connect to 192.168.186.129:2375 [/192.168.186.129] failed: Connection refused: connect`
|
如果没有远程访问,会报 `Connect to 10.211.55.5:2375 [/10.211.55.5] failed: Connection refused: connect`
|
||||||
|
|
||||||
在`/usr/lib/systemd/system/docker.service`,配置远程访问。主要是在[Service]这个部分,加上下面两个参数:
|
在`/usr/lib/systemd/system/docker.service`,配置远程访问。主要是在[Service]这个部分,加上下面两个参数:
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
* SpringBlade的注册中心
|
* SpringBlade的注册中心
|
||||||
* 具体文档详见:https://nacos.io/zh-cn/docs/quick-start.html
|
* 具体文档详见:https://nacos.io/zh-cn/docs/quick-start.html
|
||||||
* docker部署详见:https://github.com/nacos-group/nacos-docker
|
* docker部署详见:https://github.com/nacos-group/nacos-docker
|
||||||
|
* SpringBlade配置详见:https://www.kancloud.cn/smallchill/blade/913215
|
@ -2,7 +2,7 @@
|
|||||||
spring:
|
spring:
|
||||||
redis:
|
redis:
|
||||||
##redis 单机环境配置
|
##redis 单机环境配置
|
||||||
host: 192.168.186.129
|
host: 10.211.55.5
|
||||||
port: 3379
|
port: 3379
|
||||||
password:
|
password:
|
||||||
database: 0
|
database: 0
|
||||||
@ -17,6 +17,6 @@ blade:
|
|||||||
#通用开发生产环境数据库地址(特殊情况可在对应的子工程里配置覆盖)
|
#通用开发生产环境数据库地址(特殊情况可在对应的子工程里配置覆盖)
|
||||||
datasource:
|
datasource:
|
||||||
prod:
|
prod:
|
||||||
url: jdbc:mysql://192.168.186.129:3306/blade?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://10.211.55.5:3306/blade?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: root
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
spring:
|
spring:
|
||||||
redis:
|
redis:
|
||||||
##redis 单机环境配置
|
##redis 单机环境配置
|
||||||
host: 192.168.186.129
|
host: 10.211.55.5
|
||||||
port: 3379
|
port: 3379
|
||||||
password:
|
password:
|
||||||
database: 0
|
database: 0
|
||||||
@ -17,6 +17,6 @@ blade:
|
|||||||
#通用开发生产环境数据库地址(特殊情况可在对应的子工程里配置覆盖)
|
#通用开发生产环境数据库地址(特殊情况可在对应的子工程里配置覆盖)
|
||||||
datasource:
|
datasource:
|
||||||
test:
|
test:
|
||||||
url: jdbc:mysql://192.168.186.129:3306/blade?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://10.211.55.5:3306/blade?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: root
|
||||||
|
@ -66,9 +66,21 @@ management:
|
|||||||
health:
|
health:
|
||||||
show-details: always
|
show-details: always
|
||||||
|
|
||||||
# 租户表维护
|
#blade配置
|
||||||
blade:
|
blade:
|
||||||
|
secure:
|
||||||
|
url:
|
||||||
|
exclude-patterns:
|
||||||
|
- /test/**
|
||||||
|
client:
|
||||||
|
- client-id: sword
|
||||||
|
path-patterns:
|
||||||
|
- /sword/**
|
||||||
|
- client-id: saber
|
||||||
|
path-patterns:
|
||||||
|
- /saber/**
|
||||||
tenant:
|
tenant:
|
||||||
column: tenant_code
|
column: tenant_code
|
||||||
tables:
|
tables:
|
||||||
- blade_notice
|
- blade_notice
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,60 +0,0 @@
|
|||||||
-- ----------------------------
|
|
||||||
-- 租户字段增加
|
|
||||||
-- ----------------------------
|
|
||||||
ALTER TABLE `blade`.`blade_notice`
|
|
||||||
ADD COLUMN `tenant_code` varchar(12) NULL DEFAULT '000000' COMMENT '租户编号' AFTER `id`;
|
|
||||||
ALTER TABLE `blade`.`blade_dept`
|
|
||||||
ADD COLUMN `tenant_code` varchar(12) NULL DEFAULT '000000' COMMENT '租户编号' AFTER `id`;
|
|
||||||
ALTER TABLE `blade`.`blade_role`
|
|
||||||
ADD COLUMN `tenant_code` varchar(12) NULL DEFAULT '000000' COMMENT '租户编号' AFTER `id`;
|
|
||||||
ALTER TABLE `blade`.`blade_user`
|
|
||||||
ADD COLUMN `tenant_code` varchar(12) NULL DEFAULT '000000' COMMENT '租户编号' AFTER `id`;
|
|
||||||
ALTER TABLE `blade`.`blade_log_api`
|
|
||||||
ADD COLUMN `tenant_code` varchar(12) NULL DEFAULT '000000' COMMENT '租户编号' AFTER `id`;
|
|
||||||
ALTER TABLE `blade`.`blade_log_error`
|
|
||||||
ADD COLUMN `tenant_code` varchar(12) NULL DEFAULT '000000' COMMENT '租户编号' AFTER `id`;
|
|
||||||
ALTER TABLE `blade`.`blade_log_usual`
|
|
||||||
ADD COLUMN `tenant_code` varchar(12) NULL DEFAULT '000000' COMMENT '租户编号' AFTER `id`;
|
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 租户菜单增加
|
|
||||||
-- ----------------------------
|
|
||||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
|
||||||
VALUES ('000000', 56, 'tenant', '租户管理', 'menu', '/blade-system/tenant', NULL, 1, 1, 0, 1, NULL, 0);
|
|
||||||
set @parentid = (SELECT LAST_INSERT_ID());
|
|
||||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
|
||||||
VALUES ('000000', @parentid, 'tenant_add', '新增', 'add', '/blade-system/tenant/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
|
||||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
|
||||||
VALUES ('000000', @parentid, 'tenant_edit', '修改', 'edit', '/blade-system/tenant/edit', 'form', 1, 2, 1, 1, NULL, 0);
|
|
||||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
|
||||||
VALUES ('000000', @parentid, 'tenant_delete', '删除', 'delete', '/blade-system/tenant/delete', 'delete', 1, 2, 1, 1, NULL, 0);
|
|
||||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
|
||||||
VALUES ('000000', @parentid, 'tenant_view', '查看', 'view', '/blade-system/tenant/view', 'file-text', 1, 2, 1, 1, NULL, 0);
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 租户表创建
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `blade_tenant`;
|
|
||||||
CREATE TABLE `blade_tenant` (
|
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
|
||||||
`tenant_code` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '租户编号',
|
|
||||||
`tenant_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '租户名称',
|
|
||||||
`linkman` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系人',
|
|
||||||
`contact_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系电话',
|
|
||||||
`address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系地址',
|
|
||||||
`create_user` int(11) NULL DEFAULT NULL COMMENT '创建人',
|
|
||||||
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
|
||||||
`update_user` int(11) 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 0 COMMENT '是否已删除',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 租户表数据插入
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
INSERT INTO `blade_tenant` VALUES (1, '000000', '管理组', 'admin', '666666', '管理组', 1, '2019-01-01 00:00:39', 1, '2019-01-01 00:00:39', 1, 0);
|
|
||||||
COMMIT;
|
|
8
pom.xml
8
pom.xml
@ -5,12 +5,12 @@
|
|||||||
|
|
||||||
<groupId>org.springblade</groupId>
|
<groupId>org.springblade</groupId>
|
||||||
<artifactId>SpringBlade</artifactId>
|
<artifactId>SpringBlade</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<blade.tool.version>2.1.0</blade.tool.version>
|
<blade.tool.version>2.2.0</blade.tool.version>
|
||||||
<blade.project.version>2.1.0</blade.project.version>
|
<blade.project.version>2.2.0</blade.project.version>
|
||||||
|
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<swagger.version>2.9.2</swagger.version>
|
<swagger.version>2.9.2</swagger.version>
|
||||||
@ -28,7 +28,7 @@
|
|||||||
<spring.platform.version>Cairo-SR7</spring.platform.version>
|
<spring.platform.version>Cairo-SR7</spring.platform.version>
|
||||||
|
|
||||||
<!-- 推荐使用Harbor -->
|
<!-- 推荐使用Harbor -->
|
||||||
<docker.registry.url>192.168.186.129</docker.registry.url>
|
<docker.registry.url>10.211.55.5</docker.registry.url>
|
||||||
<docker.registry.host>http://${docker.registry.url}:2375</docker.registry.host>
|
<docker.registry.host>http://${docker.registry.url}:2375</docker.registry.host>
|
||||||
<docker.plugin.version>1.2.0</docker.plugin.version>
|
<docker.plugin.version>1.2.0</docker.plugin.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
REGISTER=192.168.186.129/blade
|
REGISTER=192.168.0.157/blade
|
||||||
TAG=2.1.0
|
TAG=2.0.0.RC8
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
#使用说明,用来提示输入参数
|
#使用说明,用来提示输入参数
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: sh 执行脚本.sh [port|base|modules|stop|rm|rmiNoneTag]"
|
echo "Usage: sh 执行脚本.sh [port|mount|base|modules|stop|rm|rmiNoneTag]"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10,29 +10,38 @@ port(){
|
|||||||
firewall-cmd --add-port=88/tcp --permanent
|
firewall-cmd --add-port=88/tcp --permanent
|
||||||
firewall-cmd --add-port=8000/tcp --permanent
|
firewall-cmd --add-port=8000/tcp --permanent
|
||||||
firewall-cmd --add-port=8848/tcp --permanent
|
firewall-cmd --add-port=8848/tcp --permanent
|
||||||
|
firewall-cmd --add-port=8858/tcp --permanent
|
||||||
firewall-cmd --add-port=3306/tcp --permanent
|
firewall-cmd --add-port=3306/tcp --permanent
|
||||||
firewall-cmd --add-port=3379/tcp --permanent
|
firewall-cmd --add-port=3379/tcp --permanent
|
||||||
firewall-cmd --add-port=7002/tcp --permanent
|
firewall-cmd --add-port=7002/tcp --permanent
|
||||||
service firewalld restart
|
service firewalld restart
|
||||||
}
|
}
|
||||||
|
|
||||||
#启动基础模块
|
##放置挂载文件
|
||||||
base(){
|
mount(){
|
||||||
if test ! -f "/docker/nginx/gateway/nginx.conf" ;then
|
if test ! -f "/docker/nginx/api/nginx.conf" ;then
|
||||||
mkdir /docker/nginx/gateway
|
mkdir -p /docker/nginx/api
|
||||||
cp /nginx/gateway/nginx.conf /docker/nginx/gateway/nginx.conf
|
cp nginx/api/nginx.conf /docker/nginx/api/nginx.conf
|
||||||
fi
|
fi
|
||||||
if test ! -f "/docker/nginx/web/nginx.conf" ;then
|
if test ! -f "/docker/nginx/web/nginx.conf" ;then
|
||||||
mkdir /docker/nginx/web
|
mkdir -p /docker/nginx/web
|
||||||
cp /nginx/web/nginx.conf /docker/nginx/web/nginx.conf
|
cp nginx/web/nginx.conf /docker/nginx/web/nginx.conf
|
||||||
cp /nginx/web/html /docker/nginx/web/html
|
cp -r nginx/web/html /docker/nginx/web/html
|
||||||
fi
|
fi
|
||||||
docker-compose up -d blade-nginx blade-redis blade-gateway1 blade-gateway2 blade-gateway3 blade-admin
|
if test ! -f "/docker/nacos/init.d/custom.properties" ;then
|
||||||
|
mkdir -p /docker/nacos/init.d
|
||||||
|
cp nacos/init.d/custom.properties /docker/nacos/init.d/custom.properties
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#启动基础模块
|
||||||
|
base(){
|
||||||
|
docker-compose up -d nacos sentinel web-nginx blade-nginx blade-redis
|
||||||
}
|
}
|
||||||
|
|
||||||
#启动程序模块
|
#启动程序模块
|
||||||
modules(){
|
modules(){
|
||||||
docker-compose up -d blade-auth blade-user blade-desk blade-system blade-log
|
docker-compose up -d blade-gateway1 blade-gateway2 blade-admin blade-auth1 blade-auth2 blade-user blade-desk blade-system blade-log
|
||||||
}
|
}
|
||||||
|
|
||||||
#关闭所有模块
|
#关闭所有模块
|
||||||
@ -55,6 +64,9 @@ case "$1" in
|
|||||||
"port")
|
"port")
|
||||||
port
|
port
|
||||||
;;
|
;;
|
||||||
|
"mount")
|
||||||
|
mount
|
||||||
|
;;
|
||||||
"base")
|
"base")
|
||||||
base
|
base
|
||||||
;;
|
;;
|
||||||
|
@ -1,5 +1,28 @@
|
|||||||
version: '3'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
|
nacos:
|
||||||
|
image: nacos/nacos-server:0.9.0
|
||||||
|
hostname: "nacos-standalone"
|
||||||
|
environment:
|
||||||
|
- MODE=standalone
|
||||||
|
volumes:
|
||||||
|
- /docker/nacos/standalone-logs/:/home/nacos/logs
|
||||||
|
- /docker/nacos/init.d/custom.properties:/home/nacos/init.d/custom.properties
|
||||||
|
ports:
|
||||||
|
- 8848:8848
|
||||||
|
networks:
|
||||||
|
blade_net:
|
||||||
|
ipv4_address: 172.30.0.48
|
||||||
|
|
||||||
|
sentinel:
|
||||||
|
image: bladex/sentinel-dashboard:1.5.0
|
||||||
|
hostname: "sentinel"
|
||||||
|
ports:
|
||||||
|
- 8858:8858
|
||||||
|
restart: on-failure
|
||||||
|
networks:
|
||||||
|
blade_net:
|
||||||
|
ipv4_address: 172.30.0.58
|
||||||
|
|
||||||
blade-nginx:
|
blade-nginx:
|
||||||
image: nginx:stable-alpine-perl
|
image: nginx:stable-alpine-perl
|
||||||
@ -30,7 +53,7 @@ services:
|
|||||||
image: redis:5.0.2-alpine
|
image: redis:5.0.2-alpine
|
||||||
hostname: "blade-redis"
|
hostname: "blade-redis"
|
||||||
ports:
|
ports:
|
||||||
- "3379:6379"
|
- 3379:6379
|
||||||
volumes:
|
volumes:
|
||||||
- /docker/redis/data:/data
|
- /docker/redis/data:/data
|
||||||
command: "redis-server --appendonly yes"
|
command: "redis-server --appendonly yes"
|
||||||
@ -40,7 +63,7 @@ services:
|
|||||||
- blade_net
|
- blade_net
|
||||||
|
|
||||||
blade-admin:
|
blade-admin:
|
||||||
image: "${REGISTER}/blade-admin:${TAG}"
|
image: "${REGISTER}/blade/blade-admin:${TAG}"
|
||||||
ports:
|
ports:
|
||||||
- 7002:7002
|
- 7002:7002
|
||||||
privileged: true
|
privileged: true
|
||||||
@ -49,7 +72,7 @@ services:
|
|||||||
- blade_net
|
- blade_net
|
||||||
|
|
||||||
blade-gateway1:
|
blade-gateway1:
|
||||||
image: "${REGISTER}/blade-gateway:${TAG}"
|
image: "${REGISTER}/blade/blade-gateway:${TAG}"
|
||||||
privileged: true
|
privileged: true
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
@ -57,51 +80,52 @@ services:
|
|||||||
ipv4_address: 172.30.0.81
|
ipv4_address: 172.30.0.81
|
||||||
|
|
||||||
blade-gateway2:
|
blade-gateway2:
|
||||||
image: "${REGISTER}/blade-gateway:${TAG}"
|
image: "${REGISTER}/blade/blade-gateway:${TAG}"
|
||||||
privileged: true
|
privileged: true
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
blade_net:
|
blade_net:
|
||||||
ipv4_address: 172.30.0.82
|
ipv4_address: 172.30.0.82
|
||||||
|
|
||||||
blade-gateway3:
|
blade-auth1:
|
||||||
image: "${REGISTER}/blade-gateway:${TAG}"
|
image: "${REGISTER}/blade/blade-auth:${TAG}"
|
||||||
privileged: true
|
privileged: true
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
blade_net:
|
blade_net:
|
||||||
ipv4_address: 172.30.0.83
|
ipv4_address: 172.30.0.91
|
||||||
|
|
||||||
blade-auth:
|
blade-auth2:
|
||||||
image: "${REGISTER}/blade-auth:${TAG}"
|
image: "${REGISTER}/blade/blade-auth:${TAG}"
|
||||||
privileged: true
|
privileged: true
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- blade_net
|
blade_net:
|
||||||
|
ipv4_address: 172.30.0.92
|
||||||
|
|
||||||
blade-log:
|
blade-log:
|
||||||
image: "${REGISTER}/blade-log:${TAG}"
|
image: "${REGISTER}/blade/blade-log:${TAG}"
|
||||||
privileged: true
|
privileged: true
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- blade_net
|
- blade_net
|
||||||
|
|
||||||
blade-desk:
|
blade-desk:
|
||||||
image: "${REGISTER}/blade-desk:${TAG}"
|
image: "${REGISTER}/blade/blade-desk:${TAG}"
|
||||||
privileged: true
|
privileged: true
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- blade_net
|
- blade_net
|
||||||
|
|
||||||
blade-user:
|
blade-user:
|
||||||
image: "${REGISTER}/blade-user:${TAG}"
|
image: "${REGISTER}/blade/blade-user:${TAG}"
|
||||||
privileged: true
|
privileged: true
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- blade_net
|
- blade_net
|
||||||
|
|
||||||
blade-system:
|
blade-system:
|
||||||
image: "${REGISTER}/blade-system:${TAG}"
|
image: "${REGISTER}/blade/blade-system:${TAG}"
|
||||||
privileged: true
|
privileged: true
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
|
19
script/docker/nacos/init.d/custom.properties
Normal file
19
script/docker/nacos/init.d/custom.properties
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#spring.security.enabled=false
|
||||||
|
#management.security=false
|
||||||
|
#security.basic.enabled=false
|
||||||
|
#nacos.security.ignore.urls=/**
|
||||||
|
#management.metrics.export.elastic.host=http://localhost:9200
|
||||||
|
# metrics for prometheus
|
||||||
|
management.endpoints.web.exposure.include=*
|
||||||
|
|
||||||
|
# metrics for elastic search
|
||||||
|
#management.metrics.export.elastic.enabled=false
|
||||||
|
#management.metrics.export.elastic.host=http://localhost:9200
|
||||||
|
|
||||||
|
# metrics for influx
|
||||||
|
#management.metrics.export.influx.enabled=false
|
||||||
|
#management.metrics.export.influx.db=springboot
|
||||||
|
#management.metrics.export.influx.uri=http://localhost:8086
|
||||||
|
#management.metrics.export.influx.auto-create-db=true
|
||||||
|
#management.metrics.export.influx.consistency=one
|
||||||
|
#management.metrics.export.influx.compressed=true
|
@ -33,9 +33,12 @@ http {
|
|||||||
upstream gateway {
|
upstream gateway {
|
||||||
server 172.30.0.81;
|
server 172.30.0.81;
|
||||||
server 172.30.0.82;
|
server 172.30.0.82;
|
||||||
server 172.30.0.83;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
upstream auth {
|
||||||
|
server 172.30.0.91;
|
||||||
|
server 172.30.0.92;
|
||||||
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 88;
|
listen 88;
|
||||||
@ -49,4 +52,16 @@ http {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 9000;
|
||||||
|
server_name auth;
|
||||||
|
location / {
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_buffering off;
|
||||||
|
proxy_pass http://auth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -2,9 +2,9 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Hello SpringBlade</title>
|
<title>Hello BladeX</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div style="text-align: center">Hello SpringBlade !</div>
|
<div style="text-align: center">Hello BladeX !</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -46,13 +46,15 @@ http {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
location /api {
|
location ^~/api {
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_buffering off;
|
proxy_buffering off;
|
||||||
|
rewrite ^/api/(.*)$ /$1 break;
|
||||||
proxy_pass http://gateway;
|
proxy_pass http://gateway;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user