Java Code Examples for com.baomidou.mybatisplus.extension.plugins.pagination.Page#setRecords()

The following examples show how to use com.baomidou.mybatisplus.extension.plugins.pagination.Page#setRecords() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserServiceImpl.java    From sophia_scaffolding with Apache License 2.0 6 votes vote down vote up
@Override
public IPage<UserVo> queryUserList(UserSearchDto userSearchDto) {
    String deptId = UserUtils.getLoginUser().getDeptId();
    if(StringUtils.isBlank(deptId)){
        deptId =  UserUtils.getLoginUser().getCompId();
    }
    userSearchDto.setDeptPid(deptId);
    if (StringUtils.isBlank(userSearchDto.getUserId())) {
        userSearchDto.setUserId(UserUtils.getLoginUser().getId());
    }
    Role role = roleMapper.getRoleByUserId(UserUtils.getLoginUser().getId());
    if (null != role) {
        userSearchDto.setRoleCode(role.getRoleCode());
    }
    Integer currentPage = userSearchDto.getCurrentPage() == null ? 1 : userSearchDto.getCurrentPage();
    Integer pageSize = userSearchDto.getPageSize() == null ? 10 : userSearchDto.getPageSize();
    Page<UserVo> page = new Page<>(currentPage, pageSize);
    return page.setRecords(baseMapper.findUserList(page, userSearchDto));
}
 
Example 2
Source File: RestLogController.java    From Guns with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * 查询操作日志列表
 *
 * @author fengshuonan
 * @Date 2018/12/23 5:34 PM
 */
@RequestMapping("/list")
public LayuiPageInfo list(@RequestParam(required = false) String beginTime,
                          @RequestParam(required = false) String endTime,
                          @RequestParam(required = false) String logName,
                          @RequestParam(required = false) Integer logType) {

    //获取分页参数
    Page page = LayuiPageFactory.defaultPage();

    //根据条件查询操作日志
    List<Map<String, Object>> result = restOperationLogService.getOperationLogs(page, beginTime, endTime, logName, BizLogType.valueOf(logType));

    page.setRecords(new LogWrapper(result).wrap());

    return LayuiPageFactory.createPageInfo(page);
}
 
Example 3
Source File: NoticeService.java    From smart-admin with MIT License 6 votes vote down vote up
/**
 * 获取当前登录人的消息列表
 *
 * @param queryDTO
 * @param requestToken
 * @return
 */
public ResponseDTO<PageResultDTO<NoticeReceiveDTO>> queryReceiveByPage(NoticeReceiveQueryDTO queryDTO, RequestTokenBO requestToken) {
    queryDTO.setEmployeeId(requestToken.getRequestUserId());
    queryDTO.setSendStatus(JudgeEnum.YES.getValue());
    Page page = SmartPageUtil.convert2QueryPage(queryDTO);
    List<NoticeReceiveDTO> dtoList = noticeDao.queryReceiveByPage(page, queryDTO);
    dtoList.forEach(e -> {
        if (e.getReceiveTime() == null) {
            e.setReadStatus(JudgeEnum.NO.getValue());
        } else {
            e.setReadStatus(JudgeEnum.YES.getValue());
        }
    });
    page.setRecords(dtoList);
    PageResultDTO<NoticeReceiveDTO> pageResultDTO = SmartPageUtil.convert2PageResult(page);
    return ResponseDTO.succData(pageResultDTO);
}
 
Example 4
Source File: UserServiceImpl.java    From sophia_scaffolding with Apache License 2.0 6 votes vote down vote up
@Override
public IPage<UserVo> queryUserList(UserSearchDto userSearchDto) {
    String deptId = UserUtils.getLoginUser().getDeptId();
    if(StringUtils.isBlank(deptId)){
        deptId =  UserUtils.getLoginUser().getCompId();
    }
    userSearchDto.setDeptPid(deptId);
    if (StringUtils.isBlank(userSearchDto.getUserId())) {
        userSearchDto.setUserId(UserUtils.getLoginUser().getId());
    }
    Role role = roleMapper.getRoleByUserId(UserUtils.getLoginUser().getId());
    if (null != role) {
        userSearchDto.setRoleCode(role.getRoleCode());
    }
    Integer currentPage = userSearchDto.getCurrentPage() == null ? 1 : userSearchDto.getCurrentPage();
    Integer pageSize = userSearchDto.getPageSize() == null ? 10 : userSearchDto.getPageSize();
    Page<UserVo> page = new Page<>(currentPage, pageSize);
    return page.setRecords(baseMapper.findUserList(page, userSearchDto));
}
 
Example 5
Source File: ApiLoggerServiceImpl.java    From sophia_scaffolding with Apache License 2.0 6 votes vote down vote up
@Override
public IPage<ApiLoggerVo> queryApiLoggerList(ApiLoggerSearchDto param) {
    Integer currentPage = param.getCurrentPage() == null ? 1 : param.getCurrentPage();
    Integer pageSize = param.getPageSize() == null ? 10 : param.getPageSize();
    Page<ApiLoggerVo> result = new Page<>(currentPage, pageSize);
    Page<ApiLogger> page = new Page<>(currentPage, pageSize);
    QueryWrapper<ApiLogger> queryWrapper = new QueryWrapper<>();
    queryWrapper.like(StringUtils.isNotBlank(param.getUserName()), "USER_NAME", param.getUserName());
    queryWrapper.like(StringUtils.isNotBlank(param.getMethod()), "METHOD", param.getMethod());
    queryWrapper.like(StringUtils.isNotBlank(param.getMethodName()), "METHOD_NAME", param.getMethodName());
    queryWrapper.ge(null != param.getStartTime(), "CREATE_TIME", param.getStartTime());
    queryWrapper.le(null != param.getEndTime(), "CREATE_TIME", param.getEndTime());
    queryWrapper.orderByDesc("CREATE_TIME");
    IPage<ApiLogger> iPage = baseMapper.selectPage(page, queryWrapper);
    BeanUtils.copyProperties(iPage, result);
    return result.setRecords(new ApiLoggerVo().buildVoList(iPage.getRecords()));
}
 
Example 6
Source File: RoleServiceImpl.java    From kvf-admin with MIT License 5 votes vote down vote up
@Override
public Page<Role> listRolePage(Role role) {
    Page<Role> page = new Page<>(role.getCurrent(), role.getSize());
    // 当名称为空,即不是查询操作;设置parentId,否则不需要区分parentId
    if (StrUtil.isBlank(role.getName())) {
        role.setParentId(role.getId() == null ? 0L : role.getId()); // treegrid默认传的id作为parentId
    }
    List<Role> roles = baseMapper.selectRoleList(role, page);
    return page.setRecords(roles);
}
 
Example 7
Source File: MenuServiceImpl.java    From kvf-admin with MIT License 5 votes vote down vote up
@Override
public Page<Menu> listMenuPage(Menu menu) {
    Page<Menu> page = new Page<>(menu.getCurrent(), menu.getSize());
    // 当名称为空,即不是查询操作;设置parentId,否则不需要区分parentId
    if (StrUtil.isBlank(menu.getName())) {
        menu.setParentId(menu.getId() == null ? 0L : menu.getId()); // treegrid默认传的id作为parentId
    }
    List<Menu> menus = baseMapper.selectMenuList(menu, page);
    return page.setRecords(menus);
}
 
Example 8
Source File: PermissionServiceImpl.java    From sophia_scaffolding with Apache License 2.0 5 votes vote down vote up
@Override
public IPage<PermissionVo> queryPermissionList(PageDto param) {
    Integer currentPage = param.getCurrentPage() == null ? 1 : param.getCurrentPage();
    Integer pageSize = param.getPageSize() == null ? 10 : param.getPageSize();
    Page<PermissionVo> page = new Page<>(currentPage, pageSize);
    return page.setRecords(baseMapper.selectPermissionList(page));
}
 
Example 9
Source File: CategoryServiceImpl.java    From SENS with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Page<Category> findByUserIdWithCountAndLevel(Long userId, Page<Category> page) {
    List<Category> categories = categoryMapper.findByUserIdWithCount(userId, page);
    categories.forEach(category -> {
        String str = "";
        for (int i = 1; i < category.getCateLevel(); i++) {
            str += "——";
        }
        category.setCateName(str + category.getCateName());
    });
    return page.setRecords(CategoryUtil.getCategoryList(categories));
}
 
Example 10
Source File: ProdPropServiceImpl.java    From mall4j with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public IPage<ProdProp> pagePropAndValue(ProdProp prodProp, Page<ProdProp> page) {

    page.setRecords(prodPropMapper.listPropAndValue(new PageAdapter(page), prodProp));
    page.setTotal(prodPropMapper.countPropAndValue(prodProp));
    return page;
}
 
Example 11
Source File: UserServiceImpl.java    From SENS with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Page<User> findByRoleAndCondition(String roleName, User condition, Page<User> page) {
    Role role = roleService.findByRoleName(roleName);
    List<User> users;
    if (role != null && !Objects.equals(roleName, RoleEnum.NONE.getValue())) {
        users = userMapper.findByRoleIdAndCondition(role.getId(), condition, page);
    } else {
        users = userMapper.findByWithoutRole(page);
    }
    return page.setRecords(users);
}
 
Example 12
Source File: RoleServiceImpl.java    From sophia_scaffolding with Apache License 2.0 5 votes vote down vote up
@Override
public IPage<RoleVo> queryRoleList(RoleSearchDto param) {
    Integer currentPage = param.getCurrentPage() == null ? 1 : param.getCurrentPage();
    Integer pageSize = param.getPageSize() == null ? 10 : param.getPageSize();
    Page<RoleVo> page = new Page<>(currentPage, pageSize);
    return page.setRecords(baseMapper.selectRoleList(page, param));
}
 
Example 13
Source File: QuartzTaskService.java    From smart-admin with MIT License 5 votes vote down vote up
/**
 * 查询列表
 *
 * @param queryDTO
 * @return
 */
public ResponseDTO<PageResultDTO<QuartzTaskVO>> query(QuartzQueryDTO queryDTO) {
    Page pageParam = SmartPageUtil.convert2QueryPage(queryDTO);
    List<QuartzTaskVO> taskList = quartzTaskDao.queryList(pageParam, queryDTO);
    pageParam.setRecords(taskList);
    return ResponseDTO.succData(SmartPageUtil.convert2PageResult(pageParam));
}
 
Example 14
Source File: RestLoginLogController.java    From Guns with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 查询登录日志列表
 *
 * @author fengshuonan
 * @Date 2018/12/23 5:51 PM
 */
@RequestMapping("/list")
public LayuiPageInfo list(@RequestParam(required = false) String beginTime,
                          @RequestParam(required = false) String endTime,
                          @RequestParam(required = false) String logName) {

    //获取分页参数
    Page page = LayuiPageFactory.defaultPage();

    //根据条件查询日志
    List<Map<String, Object>> result = restLoginLogService.getLoginLogs(page, beginTime, endTime, logName);
    page.setRecords(new LogWrapper(result).wrap());

    return LayuiPageFactory.createPageInfo(page);
}
 
Example 15
Source File: UserOperateLogService.java    From smart-admin with MIT License 5 votes vote down vote up
/**
 * @author yandanyang
 * @description 分页查询
 * @date 2019-05-15 11:32:14
 */
public ResponseDTO<PageResultDTO<UserOperateLogDTO>> queryByPage(UserOperateLogQueryDTO queryDTO) {
    Page page = SmartPageUtil.convert2QueryPage(queryDTO);
    List<UserOperateLogEntity> entities = userOperateLogDao.queryByPage(page, queryDTO);
    List<UserOperateLogDTO> dtoList = SmartBeanUtil.copyList(entities, UserOperateLogDTO.class);
    page.setRecords(dtoList);
    PageResultDTO<UserOperateLogDTO> pageResultDTO = SmartPageUtil.convert2PageResult(page);
    return ResponseDTO.succData(pageResultDTO);
}
 
Example 16
Source File: PostServiceImpl.java    From SENS with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Page<Post> findPostByYearAndMonth(String year, String month, Page<Post> page) {
    return page.setRecords(postMapper.pagingPostByYearAndMonth(year, month, null));
}
 
Example 17
Source File: SysAnnouncementSendServiceImpl.java    From jeecg-cloud with Apache License 2.0 4 votes vote down vote up
@Override
public Page<AnnouncementSendModel> getMyAnnouncementSendPage(Page<AnnouncementSendModel> page,
		AnnouncementSendModel announcementSendModel) {
	 return page.setRecords(sysAnnouncementSendMapper.getMyAnnouncementSendList(page, announcementSendModel));
}
 
Example 18
Source File: PostServiceImpl.java    From SENS with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Page<Post> findPostByCateName(String cateName, Page<Post> page) {
    return page.setRecords(postMapper.findPostByCateName(cateName, page));
}
 
Example 19
Source File: MyOrderServiceImpl.java    From mall4j with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public IPage<MyOrderDto> pageMyOrderByUserIdAndStatus(Page<MyOrderDto> page, String userId, Integer status) {
    page.setRecords(orderMapper.listMyOrderByUserIdAndStatus(new PageAdapter(page), userId, status));
    page.setTotal(orderMapper.countMyOrderByUserIdAndStatus(userId, status));
    return page;
}
 
Example 20
Source File: TeachingCourseDeptServiceImpl.java    From teaching with Apache License 2.0 4 votes vote down vote up
@Override
public Page list(Page page, QueryWrapper queryWrapper) {
    return page.setRecords(this.baseMapper.list(page, queryWrapper));
}