|
@@ -93,6 +93,7 @@ public class SysUserController {
|
|
Result<IPage<SysUser>> result = new Result<IPage<SysUser>>();
|
|
Result<IPage<SysUser>> result = new Result<IPage<SysUser>>();
|
|
QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(user, req.getParameterMap());
|
|
QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(user, req.getParameterMap());
|
|
Page<SysUser> page = new Page<SysUser>(pageNo, pageSize);
|
|
Page<SysUser> page = new Page<SysUser>(pageNo, pageSize);
|
|
|
|
+ queryWrapper.orderByAsc("create_time");
|
|
IPage<SysUser> pageList = sysUserService.page(page, queryWrapper);
|
|
IPage<SysUser> pageList = sysUserService.page(page, queryWrapper);
|
|
|
|
|
|
//批量查询用户的所属部门
|
|
//批量查询用户的所属部门
|
|
@@ -1064,4 +1065,31 @@ public class SysUserController {
|
|
return Result.ok("删除成功");
|
|
return Result.ok("删除成功");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ @RequestMapping(value = "/list2", method = RequestMethod.GET)
|
|
|
|
+ public Result<IPage<SysUser>> queryPageList2(SysUser user,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
|
+ @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
|
|
|
|
+ Result<IPage<SysUser>> result = new Result<IPage<SysUser>>();
|
|
|
|
+ QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(user, req.getParameterMap());
|
|
|
|
+ Page<SysUser> page = new Page<SysUser>(pageNo, pageSize);
|
|
|
|
+ queryWrapper.orderByAsc("convert(realname using gbk)");
|
|
|
|
+ IPage<SysUser> pageList = sysUserService.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 = sysUserService.getDepNamesByUserIds(userIds);
|
|
|
|
+ pageList.getRecords().forEach(item->{
|
|
|
|
+ //TODO 临时借用这个字段用于页面展示
|
|
|
|
+ item.setOrgCode(useDepNames.get(item.getId()));
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ result.setSuccess(true);
|
|
|
|
+ result.setResult(pageList);
|
|
|
|
+ log.info(pageList.toString());
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|