修改问题

dev
王家东 5 months ago
parent b49a7cb1ec
commit 5a7e5a0f59
  1. 63
      jeecg-boot-master/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java

@ -141,7 +141,70 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
queryWrapper.ne("username", "_reserve_user_external");
Page<SysUser> page = new Page<SysUser>(pageNo, pageSize);
IPage<SysUser> pageList = this.page(page, queryWrapper);
//批量查询用户的所属部门
//step.1 先拿到全部的 useids
//step.2 通过 useids,一次性查询用户的所属部门名字
List<String> userIds = pageList.getRecords().stream().map(SysUser::getId).collect(Collectors.toList());
if (userIds != null && userIds.size() > 0) {
Map<String, String> useDepNames = this.getDepNamesByUserIds(userIds);
pageList.getRecords().forEach(item -> {
item.setOrgCodeTxt(useDepNames.get(item.getId()));
//查询用户的租户ids
List<Integer> list = userTenantMapper.getTenantIdsByUserId(item.getId());
if (oConvertUtils.isNotEmpty(list)) {
item.setRelTenantIds(StringUtils.join(list.toArray(), SymbolConstant.COMMA));
} else {
item.setRelTenantIds("");
}
});
}
result.setSuccess(true);
result.setResult(pageList);
//log.info(pageList.toString());
return result;
}
@Override
public Result<IPage<SysUser>> queryPageListzdzx(HttpServletRequest req, QueryWrapper<SysUser> queryWrapper, Integer pageSize, Integer pageNo) {
Result<IPage<SysUser>> result = new Result<IPage<SysUser>>();
//update-begin-Author:wangshuai--Date:20211119--for:【vue3】通过部门id查询用户,通过code查询id
//部门ID
String departId = req.getParameter("departId");
if (oConvertUtils.isNotEmpty(departId)) {
LambdaQueryWrapper<SysUserDepart> query = new LambdaQueryWrapper<>();
query.eq(SysUserDepart::getDepId, departId);
List<SysUserDepart> list = sysUserDepartMapper.selectList(query);
List<String> userIds = list.stream().map(SysUserDepart::getUserId).collect(Collectors.toList());
//update-begin---author:wangshuai ---date:20220322 for:[issues/I4XTYB]查询用户时,当部门id 下没有分配用户时接口报错------------
if (oConvertUtils.listIsNotEmpty(userIds)) {
queryWrapper.in("id", userIds);
} else {
return Result.OK();
}
//update-end---author:wangshuai ---date:20220322 for:[issues/I4XTYB]查询用户时,当部门id 下没有分配用户时接口报错------------
}
//用户ID
String code = req.getParameter("code");
if (oConvertUtils.isNotEmpty(code)) {
queryWrapper.in("id", Arrays.asList(code.split(",")));
pageSize = code.split(",").length;
}
//update-end-Author:wangshuai--Date:20211119--for:【vue3】通过部门id查询用户,通过code查询id
//update-begin-author:taoyan--date:20220104--for: JTC-372 【用户冻结问题】 online授权、用户组件,选择用户都能看到被冻结的用户
String status = req.getParameter("status");
if (oConvertUtils.isNotEmpty(status)) {
queryWrapper.eq("status", Integer.parseInt(status));
}
//update-end-author:taoyan--date:20220104--for: JTC-372 【用户冻结问题】 online授权、用户组件,选择用户都能看到被冻结的用户
//TODO 外部模拟登陆临时账号,列表不显示
queryWrapper.ne("username", "_reserve_user_external");
LoginUser user= (LoginUser)SecurityUtils.getSubject().getPrincipal();
queryWrapper.eq("username",user.getUsername());
Page<SysUser> page = new Page<SysUser>(pageNo, pageSize);
IPage<SysUser> pageList = this.page(page, queryWrapper);
//批量查询用户的所属部门
//step.1 先拿到全部的 useids
//step.2 通过 useids,一次性查询用户的所属部门名字

Loading…
Cancel
Save