|
|
@ -35,6 +35,7 @@ import com.yxt.common.base.utils.*; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
import org.apache.commons.collections.map.HashedMap; |
|
|
|
import org.apache.ibatis.annotations.Param; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -856,7 +857,31 @@ public class SysUserService extends MybatisBaseService<SysUserMapper, SysUser> { |
|
|
|
|
|
|
|
public ResultBean getUsersByRoleSid(String roleSid) { |
|
|
|
List<SysUserVo> users = baseMapper.getUsersByRoleSid(roleSid); |
|
|
|
ResultBean<Object> objectResultBean = ResultBean.fireSuccess().setData(users); |
|
|
|
List<String> l=new ArrayList<>(); |
|
|
|
for(SysUserVo s:users){ |
|
|
|
l.add(s.getDepartmentName()==null?"":s.getDepartmentName()); |
|
|
|
} |
|
|
|
HashSet set = new HashSet(l); |
|
|
|
//把List集合所有元素清空
|
|
|
|
l.clear(); |
|
|
|
//把HashSet对象添加至List集合
|
|
|
|
l.addAll(set); |
|
|
|
List<Map<String,Object>> r=new ArrayList<>(); |
|
|
|
for(String s:l){ |
|
|
|
if(StringUtils.isNotBlank(s)){ |
|
|
|
Map<String,Object> m=new HashMap<>(); |
|
|
|
List<SysUserVo> us=new ArrayList<>(); |
|
|
|
for(SysUserVo su:users){ |
|
|
|
if(s!=null&&s.equals(su.getDepartmentName())){ |
|
|
|
us.add(su); |
|
|
|
} |
|
|
|
} |
|
|
|
m.put("dept",s); |
|
|
|
m.put("users",us); |
|
|
|
r.add(m); |
|
|
|
} |
|
|
|
} |
|
|
|
ResultBean<Object> objectResultBean = ResultBean.fireSuccess().setData(r); |
|
|
|
return objectResultBean; |
|
|
|
} |
|
|
|
} |