fix(系统设置): 项目列表移除用户不展示

This commit is contained in:
wxg0103 2023-08-25 15:38:33 +08:00 committed by 刘瑞斌
parent c5982c8424
commit 32bdecb415
2 changed files with 8 additions and 4 deletions

View File

@ -39,7 +39,8 @@
o.name as organizationName,
p.module_setting
FROM project p
LEFT JOIN user_role_relation u on p.id = u.source_id
LEFT JOIN user_role_relation ur on p.id = ur.source_id
left join user u on u.id = ur.user_id and u.deleted = 0
INNER JOIN organization o on p.organization_id = o.id
<include refid="queryWhereCondition"/>
group by p.id
@ -47,7 +48,7 @@
<select id="getProjectAdminList" resultType="io.metersphere.system.domain.User">
SELECT `user`.*
FROM user_role_relation
LEFT JOIN `user` ON user_role_relation.user_id = `user`.id
LEFT JOIN `user` ON user_role_relation.user_id = `user`.id and `user`.deleted = 0
<where>
user_role_relation.source_id = #{projectId}
and user_role_relation.role_id = 'project_admin'

View File

@ -322,7 +322,7 @@ public class CommonProjectService {
private Map<String, String> addUserPre(ProjectAddMemberBatchRequest request, String createUser, String path, String module, String projectId, Project project) {
checkProjectNotExist(projectId);
UserExample userExample = new UserExample();
userExample.createCriteria().andIdIn(request.getUserIds());
userExample.createCriteria().andIdIn(request.getUserIds()).andDeletedEqualTo(false);
List<User> users = userMapper.selectByExample(userExample);
if (request.getUserIds().size() != users.size()) {
throw new MSException(Translator.get("user_not_exist"));
@ -376,7 +376,10 @@ public class CommonProjectService {
public int removeProjectMember(String projectId, String userId, String createUser, String module, String path) {
checkProjectNotExist(projectId);
User user = userMapper.selectByPrimaryKey(userId);
UserExample userExample = new UserExample();
userExample.createCriteria().andIdEqualTo(userId).andDeletedEqualTo(false);
List<User> users = userMapper.selectByExample(userExample);
User user = CollectionUtils.isNotEmpty(users) ? users.get(0) : null;
if (user == null) {
throw new MSException(Translator.get("user_not_exist"));
}