-
Notifications
You must be signed in to change notification settings - Fork 70
增加登录用户上下文接口,无需硬编码写死,格式化部分代码 #198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
app/src/main/java/com/tinyengine/it/config/context/DefaultLoginUserContext.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /** | ||
| * Copyright (c) 2023 - present TinyEngine Authors. | ||
| * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. | ||
| * | ||
| * Use of this source code is governed by an MIT-style license. | ||
| * | ||
| * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, | ||
| * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR | ||
| * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. | ||
| */ | ||
|
|
||
| package com.tinyengine.it.config.context; | ||
|
|
||
| import com.tinyengine.it.common.context.LoginUserContext; | ||
|
|
||
| /** | ||
| * 默认的登录用户Context实现 | ||
| */ | ||
| public class DefaultLoginUserContext implements LoginUserContext { | ||
| @Override | ||
| public String getTenantId() { | ||
| return "1"; | ||
| } | ||
|
|
||
| @Override | ||
| public String getLoginUserId() { | ||
| return "1"; | ||
| } | ||
|
|
||
| @Override | ||
| public String getRenterId() { | ||
| return "1"; | ||
| } | ||
|
|
||
| @Override | ||
| public int getAppId() { | ||
| return 1; | ||
| } | ||
|
|
||
| @Override | ||
| public int getPlatformId() { | ||
| return 1; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
base/src/main/java/com/tinyengine/it/common/context/LoginUserContext.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| /** | ||
| * Copyright (c) 2023 - present TinyEngine Authors. | ||
| * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. | ||
| * <p> | ||
| * Use of this source code is governed by an MIT-style license. | ||
| * <p> | ||
| * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, | ||
| * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR | ||
| * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. | ||
| */ | ||
|
|
||
| package com.tinyengine.it.common.context; | ||
|
|
||
| /** | ||
| * 保存用户信息的上下文 | ||
| * 由集成方自行实现接口 | ||
| */ | ||
| public interface LoginUserContext { | ||
| /** | ||
| * 返回当前用户所诉的业务租户信息 | ||
| * @return 租户ID | ||
| */ | ||
| public String getTenantId(); | ||
|
|
||
| /** | ||
| * 返回当前用户信息 | ||
| * @return 用户ID | ||
| */ | ||
| public String getLoginUserId(); | ||
|
|
||
| /** | ||
| * 返回当前用户所属业务租户信息 | ||
| * @return 业务租户ID | ||
| */ | ||
| public String getRenterId(); | ||
|
|
||
| /** | ||
| * 返回当前应用信息 | ||
| * @return 应用ID | ||
| */ | ||
| public int getAppId(); | ||
|
|
||
| /** | ||
| * 返回当前设计器信息 | ||
| * @return 设计器ID | ||
| */ | ||
| public int getPlatformId(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
base/src/main/java/com/tinyengine/it/common/utils/TestUtil.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /** | ||
| * Copyright (c) 2023 - present TinyEngine Authors. | ||
| * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. | ||
| * <p> | ||
| * Use of this source code is governed by an MIT-style license. | ||
| * <p> | ||
| * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, | ||
| * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR | ||
| * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. | ||
| */ | ||
|
|
||
| package com.tinyengine.it.common.utils; | ||
|
|
||
| import java.lang.reflect.Field; | ||
|
|
||
| /** | ||
| * 测试工工具类 | ||
| */ | ||
| public class TestUtil { | ||
| /** | ||
| * 设置私有字段的属性值 | ||
| * | ||
| * @param obj 对象 | ||
| * @param field 字段名 | ||
| * @param value 值 | ||
| * @throws NoSuchFieldException 异常 | ||
| * @throws IllegalAccessException 异常 | ||
| */ | ||
| public static void setPrivateValue(Object obj, String field, Object value) | ||
| throws NoSuchFieldException, IllegalAccessException { | ||
| Field declaredField = obj.getClass().getDeclaredField(field); | ||
| declaredField.setAccessible(true); | ||
| declaredField.set(obj, value); | ||
| } | ||
lu-yg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
base/src/main/java/com/tinyengine/it/mapper/BlockGroupBlockMapper.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
base/src/main/java/com/tinyengine/it/model/dto/PageHistoryVo.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
base/src/main/java/com/tinyengine/it/service/app/PageHistoryService.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.