use of com.ibeiliao.deployment.admin.common.PageResult in project Corgi by kevinYin.
the class ListAccountController method listAccount.
/**
* 读取管理员列表
* @param keyword 搜索的关键字
* @param page 第几页
* @param pageSize 每页多少
* @return result.object=数据列表,数据列表不为null
*/
@RequestMapping("queryAccount")
@MenuResource("读取管理员列表")
@ResponseBody
public PageResult<List<AdminAccount>> listAccount(String keyword, int page, int pageSize, HttpServletRequest request) {
List<AdminAccount> list = adminAccountService.listAccounts(keyword, page, pageSize);
int total = adminAccountService.statAccount(keyword);
for (AdminAccount account : list) {
StringBuilder buf = new StringBuilder();
List<AccountRoleRelation> tmpList = adminAccountService.listAccountRoles(account.getUid());
for (AccountRoleRelation arr : tmpList) {
Role role = roleService.getById(arr.getRoleId());
if (role != null) {
if (buf.length() > 0)
buf.append(",");
buf.append(role.getRoleName());
}
}
account.setRoleName(buf.toString());
}
PageResult<List<AdminAccount>> result = new PageResult<>(list);
result.setCurrentPage(page);
result.setPageSize(pageSize);
result.setCount(total);
return result;
}
Aggregations