mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-26 00:53:54 +08:00
管理员控制层分页获取用户接口改回使用ExtendPageData。符合设计接口定义
--AdminController.java --SysUserService.java --SysUserServiceImpl.java
This commit is contained in:
@@ -51,7 +51,7 @@ public class AdminController {
|
|||||||
@Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true),
|
@Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true),
|
||||||
@Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true),
|
@Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true),
|
||||||
})
|
})
|
||||||
public Result<PageData<AdminPageUserVO>> pageUser(
|
public Result<ExtendPageData<AdminPageUserVO>> pageUser(
|
||||||
@Parameter(hidden = true) @RequestParam Map<String, Object> params) {
|
@Parameter(hidden = true) @RequestParam Map<String, Object> params) {
|
||||||
AdminPageUserDTO dto = new AdminPageUserDTO();
|
AdminPageUserDTO dto = new AdminPageUserDTO();
|
||||||
dto.setMobile((String) params.get("mobile"));
|
dto.setMobile((String) params.get("mobile"));
|
||||||
@@ -59,8 +59,8 @@ public class AdminController {
|
|||||||
dto.setPage((String) params.get("pages"));
|
dto.setPage((String) params.get("pages"));
|
||||||
|
|
||||||
ValidatorUtils.validateEntity(dto);
|
ValidatorUtils.validateEntity(dto);
|
||||||
PageData<AdminPageUserVO> page = sysUserService.page(dto);
|
ExtendPageData<AdminPageUserVO> page = sysUserService.page(dto);
|
||||||
return new Result<PageData<AdminPageUserVO>>().ok(page);
|
return new Result<ExtendPageData<AdminPageUserVO>>().ok(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/users/{id}")
|
@PutMapping("/users/{id}")
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package xiaozhi.modules.sys.service;
|
package xiaozhi.modules.sys.service;
|
||||||
|
|
||||||
import xiaozhi.common.page.PageData;
|
import xiaozhi.common.page.ExtendPageData;
|
||||||
import xiaozhi.common.service.BaseService;
|
import xiaozhi.common.service.BaseService;
|
||||||
import xiaozhi.modules.sys.dto.AdminPageUserDTO;
|
import xiaozhi.modules.sys.dto.AdminPageUserDTO;
|
||||||
import xiaozhi.modules.sys.dto.PasswordDTO;
|
import xiaozhi.modules.sys.dto.PasswordDTO;
|
||||||
@@ -55,5 +55,5 @@ public interface SysUserService extends BaseService<SysUserEntity> {
|
|||||||
* @param dto 分页查找参数
|
* @param dto 分页查找参数
|
||||||
* @return 用户列表分页数据
|
* @return 用户列表分页数据
|
||||||
*/
|
*/
|
||||||
PageData<AdminPageUserVO> page(AdminPageUserDTO dto);
|
ExtendPageData<AdminPageUserVO> page(AdminPageUserDTO dto);
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -18,7 +18,7 @@ import lombok.AllArgsConstructor;
|
|||||||
import xiaozhi.common.constant.Constant;
|
import xiaozhi.common.constant.Constant;
|
||||||
import xiaozhi.common.exception.ErrorCode;
|
import xiaozhi.common.exception.ErrorCode;
|
||||||
import xiaozhi.common.exception.RenException;
|
import xiaozhi.common.exception.RenException;
|
||||||
import xiaozhi.common.page.PageData;
|
import xiaozhi.common.page.ExtendPageData;
|
||||||
import xiaozhi.common.service.impl.BaseServiceImpl;
|
import xiaozhi.common.service.impl.BaseServiceImpl;
|
||||||
import xiaozhi.common.utils.ConvertUtils;
|
import xiaozhi.common.utils.ConvertUtils;
|
||||||
import xiaozhi.modules.agent.service.AgentService;
|
import xiaozhi.modules.agent.service.AgentService;
|
||||||
@@ -151,7 +151,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageData<AdminPageUserVO> page(AdminPageUserDTO dto) {
|
public ExtendPageData<AdminPageUserVO> page(AdminPageUserDTO dto) {
|
||||||
Map<String, Object> params = new HashMap<String, Object>();
|
Map<String, Object> params = new HashMap<String, Object>();
|
||||||
params.put(Constant.PAGE, dto.getPage());
|
params.put(Constant.PAGE, dto.getPage());
|
||||||
params.put(Constant.LIMIT, dto.getLimit());
|
params.put(Constant.LIMIT, dto.getLimit());
|
||||||
@@ -171,7 +171,9 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
|
|||||||
adminPageUserVO.setStatus(user.getStatus().toString());
|
adminPageUserVO.setStatus(user.getStatus().toString());
|
||||||
return adminPageUserVO;
|
return adminPageUserVO;
|
||||||
}).toList();
|
}).toList();
|
||||||
return new PageData<>(list, page.getTotal());
|
//计算页数
|
||||||
|
long num = page.getTotal() / Long.parseLong(dto.getPage());
|
||||||
|
return new ExtendPageData<>(list, page.getTotal(),num);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isStrongPassword(String password) {
|
private boolean isStrongPassword(String password) {
|
||||||
|
|||||||
Reference in New Issue
Block a user