From 0f521694e6d2c46e6869490a7d6610b5fc959b42 Mon Sep 17 00:00:00 2001 From: smallchill Date: Sun, 3 Mar 2019 12:44:01 +0800 Subject: [PATCH] =?UTF-8?q?:tada:=20=E5=A2=9E=E5=8A=A0=E5=A4=9A=E7=A7=9F?= =?UTF-8?q?=E6=88=B7=E6=A8=A1=E5=9D=97=EF=BC=8C=E4=BF=AE=E5=A4=8D=E9=83=A8?= =?UTF-8?q?=E5=88=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/AuthController.java | 8 +- .../org/springblade/desk/entity/Notice.java | 4 +- .../org/springblade/system/entity/Param.java | 4 +- .../springblade/system/user/entity/User.java | 4 +- .../system/user/feign/IUserClient.java | 4 +- blade-service-api/pom.xml | 5 + .../desk/service/impl/NoticeServiceImpl.java | 2 +- .../springblade/system/mapper/DeptMapper.xml | 2 +- .../springblade/system/mapper/DictMapper.xml | 9 +- .../springblade/system/mapper/MenuMapper.xml | 4 +- .../springblade/system/mapper/RoleMapper.xml | 2 +- .../system/user/feign/UserClient.java | 4 +- .../system/user/mapper/UserMapper.java | 3 +- .../system/user/mapper/UserMapper.xml | 3 +- .../system/user/service/IUserService.java | 3 +- .../user/service/impl/UserServiceImpl.java | 4 +- blade-service/pom.xml | 5 + doc/nacos/blade.yaml | 7 + doc/sql/bladex-oracle.sql | 1109 +++++++++++++++++ doc/sql/bladex-saber-mysql.sql | 47 +- doc/sql/bladex-sword-mysql.sql | 53 +- doc/sql/bladex-tenant-mysql-update-RC5.sql | 22 + 22 files changed, 1246 insertions(+), 62 deletions(-) create mode 100644 doc/sql/bladex-oracle.sql create mode 100644 doc/sql/bladex-tenant-mysql-update-RC5.sql diff --git a/blade-auth/src/main/java/org/springblade/auth/controller/AuthController.java b/blade-auth/src/main/java/org/springblade/auth/controller/AuthController.java index fea550b5..5cd29291 100644 --- a/blade-auth/src/main/java/org/springblade/auth/controller/AuthController.java +++ b/blade-auth/src/main/java/org/springblade/auth/controller/AuthController.java @@ -50,15 +50,16 @@ public class AuthController { @ApiLog("登录用户验证") @PostMapping("token") - @ApiOperation(value = "获取认证token", notes = "传入账号:account,密码:password") - public R token(@ApiParam(value = "账号", required = true) @RequestParam String account, + @ApiOperation(value = "获取认证token", notes = "传入租户编号:code,账号:account,密码:password") + public R token(@ApiParam(value = "租户编号", required = true) @RequestParam String code, + @ApiParam(value = "账号", required = true) @RequestParam String account, @ApiParam(value = "密码", required = true) @RequestParam String password) { if (Func.hasEmpty(account, password)) { return R.fail("接口调用不合法"); } - R res = client.userInfo(account, DigestUtil.encrypt(password)); + R res = client.userInfo(code, account, DigestUtil.encrypt(password)); User user = res.getData().getUser(); @@ -71,6 +72,7 @@ public class AuthController { Map param = new HashMap<>(16); param.put(SecureUtil.USER_ID, Func.toStr(user.getId())); param.put(SecureUtil.ROLE_ID, user.getRoleId()); + param.put(SecureUtil.TENANT_CODE, user.getTenantCode()); param.put(SecureUtil.ACCOUNT, user.getAccount()); param.put(SecureUtil.USER_NAME, user.getRealName()); param.put(SecureUtil.ROLE_NAME, Func.join(res.getData().getRoles())); diff --git a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/entity/Notice.java b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/entity/Notice.java index 75c03f29..293e154c 100644 --- a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/entity/Notice.java +++ b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/entity/Notice.java @@ -20,7 +20,7 @@ import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; -import org.springblade.core.mp.base.BaseEntity; +import org.springblade.core.tenant.mp.TenantEntity; import java.util.Date; @@ -32,7 +32,7 @@ import java.util.Date; @Data @EqualsAndHashCode(callSuper = true) @TableName("blade_notice") -public class Notice extends BaseEntity { +public class Notice extends TenantEntity { private static final long serialVersionUID = 1L; diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Param.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Param.java index 8e3c0cc3..3d8af5ba 100644 --- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Param.java +++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Param.java @@ -21,7 +21,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; -import org.springblade.core.mp.base.BaseEntity; +import org.springblade.core.tenant.mp.TenantEntity; /** * 实体类 @@ -32,7 +32,7 @@ import org.springblade.core.mp.base.BaseEntity; @TableName("blade_param") @EqualsAndHashCode(callSuper = true) @ApiModel(value = "Param对象", description = "Param对象") -public class Param extends BaseEntity { +public class Param extends TenantEntity { private static final long serialVersionUID = 1L; diff --git a/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/User.java b/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/User.java index d6fdbf5a..aec7895e 100644 --- a/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/User.java +++ b/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/User.java @@ -19,7 +19,7 @@ package org.springblade.system.user.entity; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; -import org.springblade.core.mp.base.BaseEntity; +import org.springblade.core.tenant.mp.TenantEntity; import java.time.LocalDateTime; @@ -31,7 +31,7 @@ import java.time.LocalDateTime; @Data @TableName("blade_user") @EqualsAndHashCode(callSuper = true) -public class User extends BaseEntity { +public class User extends TenantEntity { private static final long serialVersionUID = 1L; diff --git a/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClient.java b/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClient.java index 56d36ea9..438675f0 100644 --- a/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClient.java +++ b/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClient.java @@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.RequestParam; /** * User Feign接口类 + * * @author Chill */ @FeignClient( @@ -38,11 +39,12 @@ public interface IUserClient { /** * 获取用户信息 * + * @param code 租户编号 * @param account 账号 * @param password 密码 * @return */ @GetMapping(API_PREFIX + "/user-info") - R userInfo(@RequestParam("account") String account, @RequestParam("password") String password); + R userInfo(@RequestParam("code") String code, @RequestParam("account") String account, @RequestParam("password") String password); } diff --git a/blade-service-api/pom.xml b/blade-service-api/pom.xml index dd1ed75a..cd2f41b7 100644 --- a/blade-service-api/pom.xml +++ b/blade-service-api/pom.xml @@ -28,6 +28,11 @@ blade-starter-mybatis ${bladex.tool.version} + + org.springblade + blade-starter-tenant + ${bladex.tool.version} + org.springframework.cloud spring-cloud-starter-openfeign diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/service/impl/NoticeServiceImpl.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/service/impl/NoticeServiceImpl.java index 837fa74f..5ac10336 100644 --- a/blade-service/blade-desk/src/main/java/org/springblade/desk/service/impl/NoticeServiceImpl.java +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/service/impl/NoticeServiceImpl.java @@ -18,8 +18,8 @@ package org.springblade.desk.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.core.mp.base.BaseServiceImpl; -import org.springblade.desk.mapper.NoticeMapper; import org.springblade.desk.entity.Notice; +import org.springblade.desk.mapper.NoticeMapper; import org.springblade.desk.service.INoticeService; import org.springframework.stereotype.Service; diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/mapper/DeptMapper.xml b/blade-service/blade-system/src/main/java/org/springblade/system/mapper/DeptMapper.xml index 03261ff7..b7b9a3a9 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/mapper/DeptMapper.xml +++ b/blade-service/blade-system/src/main/java/org/springblade/system/mapper/DeptMapper.xml @@ -32,7 +32,7 @@ diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/mapper/DictMapper.xml b/blade-service/blade-system/src/main/java/org/springblade/system/mapper/DictMapper.xml index 57236bad..18f5744c 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/mapper/DictMapper.xml +++ b/blade-service/blade-system/src/main/java/org/springblade/system/mapper/DictMapper.xml @@ -38,12 +38,19 @@ from blade_dict where code = #{param1} and dict_key = #{param2} limit 1 + + + diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/mapper/MenuMapper.xml b/blade-service/blade-system/src/main/java/org/springblade/system/mapper/MenuMapper.xml index a2b70a55..c3a507f9 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/mapper/MenuMapper.xml +++ b/blade-service/blade-system/src/main/java/org/springblade/system/mapper/MenuMapper.xml @@ -38,7 +38,7 @@ diff --git a/blade-service/blade-user/src/main/java/org/springblade/system/user/feign/UserClient.java b/blade-service/blade-user/src/main/java/org/springblade/system/user/feign/UserClient.java index 0d34cf2f..6df47f84 100644 --- a/blade-service/blade-user/src/main/java/org/springblade/system/user/feign/UserClient.java +++ b/blade-service/blade-user/src/main/java/org/springblade/system/user/feign/UserClient.java @@ -36,8 +36,8 @@ public class UserClient implements IUserClient { @Override @GetMapping(API_PREFIX + "/user-info") - public R userInfo(String account, String password) { - return R.data(service.userInfo(account, password)); + public R userInfo(String code, String account, String password) { + return R.data(service.userInfo(code, account, password)); } } diff --git a/blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.java b/blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.java index 40083da1..7bf502a6 100644 --- a/blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.java +++ b/blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.java @@ -41,11 +41,12 @@ public interface UserMapper extends BaseMapper { /** * 获取用户 * + * @param code * @param account * @param password * @return */ - User getUser(String account, String password); + User getUser(String code, String account, String password); /** * 获取角色名 diff --git a/blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.xml b/blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.xml index 8cbd7d08..c4eada6f 100644 --- a/blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.xml +++ b/blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.xml @@ -5,6 +5,7 @@ + @@ -45,7 +46,7 @@ FROM blade_user WHERE - account = #{param1} AND password = #{param2} + tenant_code = #{param1} and account = #{param2} AND password = #{param3}