|  | @@ -2,11 +2,13 @@ package com.ruoyi.system.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.util.ArrayList;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
		
			
				|  |  | +import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  import org.slf4j.Logger;
 | 
	
		
			
				|  |  |  import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | +import org.springframework.util.CollectionUtils;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.core.constant.UserConstants;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.core.exception.ServiceException;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.core.utils.SpringUtils;
 | 
	
	
		
			
				|  | @@ -127,16 +129,11 @@ public class SysUserServiceImpl implements ISysUserService
 | 
	
		
			
				|  |  |      public String selectUserRoleGroup(String userName)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          List<SysRole> list = roleMapper.selectRolesByUserName(userName);
 | 
	
		
			
				|  |  | -        StringBuffer idsStr = new StringBuffer();
 | 
	
		
			
				|  |  | -        for (SysRole role : list)
 | 
	
		
			
				|  |  | +        if (CollectionUtils.isEmpty(list))
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -            idsStr.append(role.getRoleName()).append(",");
 | 
	
		
			
				|  |  | +            return StringUtils.EMPTY;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        if (StringUtils.isNotEmpty(idsStr.toString()))
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | -            return idsStr.substring(0, idsStr.length() - 1);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        return idsStr.toString();
 | 
	
		
			
				|  |  | +        return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(","));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
	
		
			
				|  | @@ -149,16 +146,11 @@ public class SysUserServiceImpl implements ISysUserService
 | 
	
		
			
				|  |  |      public String selectUserPostGroup(String userName)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          List<SysPost> list = postMapper.selectPostsByUserName(userName);
 | 
	
		
			
				|  |  | -        StringBuffer idsStr = new StringBuffer();
 | 
	
		
			
				|  |  | -        for (SysPost post : list)
 | 
	
		
			
				|  |  | +        if (CollectionUtils.isEmpty(list))
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -            idsStr.append(post.getPostName()).append(",");
 | 
	
		
			
				|  |  | +            return StringUtils.EMPTY;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        if (StringUtils.isNotEmpty(idsStr.toString()))
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | -            return idsStr.substring(0, idsStr.length() - 1);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        return idsStr.toString();
 | 
	
		
			
				|  |  | +        return list.stream().map(SysPost::getPostName).collect(Collectors.joining(","));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
	
		
			
				|  | @@ -179,7 +171,7 @@ public class SysUserServiceImpl implements ISysUserService
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  | -     * 校验用户名称是否唯一
 | 
	
		
			
				|  |  | +     * 校验手机号码是否唯一
 | 
	
		
			
				|  |  |       *
 | 
	
		
			
				|  |  |       * @param user 用户信息
 | 
	
		
			
				|  |  |       * @return
 |