fix: 新建用户或LDAP用户如果没有选择项目登录报错

--bug=1007818 --user=lyh [github#7652] 新建用户或LDAP用户如果没有选择项目登录报错
https://www.tapd.cn/55049933/s/1066213
This commit is contained in:
shiziyuan9527 2021-11-11 10:37:02 +08:00 committed by shiziyuan9527
parent ff22e4fbc8
commit ec0fbfa500
2 changed files with 10 additions and 5 deletions

View File

@ -26,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
@ -144,6 +145,9 @@ public class WorkspaceService {
.map(RelatedSource::getWorkspaceId)
.distinct()
.collect(Collectors.toList());
if (CollectionUtils.isEmpty(wsIds)) {
return new ArrayList<>();
}
WorkspaceExample workspaceExample = new WorkspaceExample();
workspaceExample.createCriteria().andIdIn(wsIds);
return workspaceMapper.selectByExample(workspaceExample);

View File

@ -1,14 +1,15 @@
<template>
<el-dropdown size="medium" @command="changeWs" placement="bottom" class="align-right">
<el-dropdown size="medium" @command="changeWs" placement="bottom" class="align-right"
v-permission="['PROJECT_TRACK_CASE:READ','PROJECT_TRACK_PLAN:READ','PROJECT_TRACK_REVIEW:READ',
'PROJECT_API_DEFINITION:READ','PROJECT_API_SCENARIO:READ','PROJECT_API_REPORT:READ',
'PROJECT_USER:READ', 'PROJECT_ENVIRONMENT:READ', 'PROJECT_FILE:READ+JAR', 'PROJECT_FILE:READ+FILE', 'PROJECT_OPERATING_LOG:READ', 'PROJECT_CUSTOM_CODE:READ',
'PROJECT_PERFORMANCE_TEST:READ','PROJECT_PERFORMANCE_REPORT:READ']" >
<span class="dropdown-link">
{{ currentWorkspaceName }}
<i class="el-icon-caret-bottom el-icon--right"/>
</span>
<template v-slot:dropdown>
<el-dropdown-menu v-permission="['PROJECT_TRACK_CASE:READ','PROJECT_TRACK_PLAN:READ','PROJECT_TRACK_REVIEW:READ',
'PROJECT_API_DEFINITION:READ','PROJECT_API_SCENARIO:READ','PROJECT_API_REPORT:READ',
'PROJECT_USER:READ', 'PROJECT_ENVIRONMENT:READ', 'PROJECT_FILE:READ+JAR', 'PROJECT_FILE:READ+FILE', 'PROJECT_OPERATING_LOG:READ', 'PROJECT_CUSTOM_CODE:READ',
'PROJECT_PERFORMANCE_TEST:READ','PROJECT_PERFORMANCE_REPORT:READ']" style="margin-top: 5px;">
<el-dropdown-menu style="margin-top: 5px;">
<el-input :placeholder="$t('project.search_by_name')"
prefix-icon="el-icon-search"
v-model="searchString"