Search in sources :

Example 1 with UserResponse

use of com.webank.wedatasphere.qualitis.response.user.UserResponse in project Qualitis by WeBankFinTech.

the class UserServiceImpl method findAllUser.

@Override
public GeneralResponse<GetAllResponse<UserResponse>> findAllUser(PageRequest request) throws UnExpectedRequestException {
    // Check Arguments
    PageRequest.checkRequest(request);
    int page = request.getPage();
    int size = request.getSize();
    List<User> users = userDao.findAllUser(page, size);
    long total = userDao.countAll();
    List<UserResponse> userResponses = new ArrayList<>();
    for (User user : users) {
        UserResponse tmp = new UserResponse(user);
        userResponses.add(tmp);
    }
    GetAllResponse<UserResponse> response = new GetAllResponse<>();
    response.setTotal(total);
    response.setData(userResponses);
    LOGGER.info("Succeed to find all users, response: {}, current_user: {}", response, HttpUtils.getUserName(httpServletRequest));
    return new GeneralResponse<>("200", "{&FIND_ALL_USERS_SUCCESSFULLY}", response);
}
Also used : UserResponse(com.webank.wedatasphere.qualitis.response.user.UserResponse) AddUserResponse(com.webank.wedatasphere.qualitis.response.user.AddUserResponse) GeneralResponse(com.webank.wedatasphere.qualitis.response.GeneralResponse) User(com.webank.wedatasphere.qualitis.entity.User) ArrayList(java.util.ArrayList) GetAllResponse(com.webank.wedatasphere.qualitis.response.GetAllResponse)

Aggregations

User (com.webank.wedatasphere.qualitis.entity.User)1 GeneralResponse (com.webank.wedatasphere.qualitis.response.GeneralResponse)1 GetAllResponse (com.webank.wedatasphere.qualitis.response.GetAllResponse)1 AddUserResponse (com.webank.wedatasphere.qualitis.response.user.AddUserResponse)1 UserResponse (com.webank.wedatasphere.qualitis.response.user.UserResponse)1 ArrayList (java.util.ArrayList)1