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

The following examples show how to use com.baomidou.mybatisplus.plugins.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: BlogCommentServiceImpl.java    From mysiteforme with Apache License 2.0 6 votes vote down vote up
@Override
    public Page<BlogComment> getArticleComments(Long articleId,Integer type,Page<BlogComment> page) {
        Map<String,Object> map = Maps.newHashMap();
        if(articleId != null){
            map.put("articleId",articleId);
        }
        map.put("type",type);
//        map.put("start",page.getCurrent() == 1 ? 0 : (page.getCurrent()-1)*page.getLimit());
//        map.put("limit",page.getLimit());
//        List<BlogComment> list = baseMapper.selectArticleComments(map);
//        Integer total = baseMapper.selectArticleCommentsCount(map);
//        page.setRecords(list);
//        page.setTotal(total);
        List<BlogComment> list = baseMapper.selectArticleCommentsByPlus(map,page);
        page.setRecords(list);
        return page;
    }
 
Example 2
Source File: BasicServiceTest.java    From app-version with Apache License 2.0 6 votes vote down vote up
@Test
public void formatCreatedBy() throws Exception {
    EntityWrapper<CustomApi> wrapper = new EntityWrapper<>();
    wrapper.and().eq("app_id", ThreadLocalUtils.USER_THREAD_LOCAL.get().getAppId());
    wrapper.andNew().eq("id", 48);
    wrapper.andNew().eq("del_flag", 0);
    wrapper.orderBy("created_time", false);

    Page<CustomApi> pageEntity = new Page<>();
    pageEntity.setSize(10);
    pageEntity.setCurrent(1);
    pageEntity.setRecords(customApiMapper.selectPage(pageEntity, wrapper));
    logger.info("formatCreatedBy前:" + pageEntity.getRecords().toString());
    basicService.formatCreatedBy(pageEntity.getRecords());
    logger.info("formatCreatedBy后:" + pageEntity.getRecords().toString());
}
 
Example 3
Source File: UserServiceImpl.java    From Ffast-Java with MIT License 5 votes vote down vote up
@Override
public ServiceRowsResult findListByPage(User m, Page<User> page, String[] properties) {
    ServiceRowsResult result = new ServiceRowsResult(false);
    page.setRecords(baseMapper.listByPage(page, m));
    result.setPage(page.getRecords(), page.getTotal());
    result.setSuccess(true);
    redisCacheUtils.setCacheObject("user", result);

    return result;
}
 
Example 4
Source File: ChannelServiceImpl.java    From app-version with Apache License 2.0 5 votes vote down vote up
@Override
public ServiceResult list(int page, int pageSize, EntityWrapper<Channel> wrapper) {
    Page<Channel> pageEntity = new Page<>();
    pageEntity.setSize(pageSize);
    pageEntity.setCurrent(page);
    pageEntity.setRecords(channelMapper.selectPage(pageEntity, wrapper));
    basicService.formatCreatedBy(pageEntity.getRecords());
    return ServiceResult.ok(pageEntity);
}
 
Example 5
Source File: SiteController.java    From WebStack-Guns with MIT License 5 votes vote down vote up
/**
 * 获取网站列表
 */
@RequestMapping(value = "/list")
@ResponseBody
public Object list(@RequestParam(required = false) String title) {
    Map map = new HashMap();
    map.put("title",title);
    Page<Site> page = new PageFactory<Site>().defaultPage();
    Pager<Site> pages = siteService.getPage(map, page.getOffset(), page.getLimit());
    page.setTotal(pages.getTotal());
    page.setRecords(pages.getList());
    return new PageInfoBT<>(page);
}
 
Example 6
Source File: AdminServiceImpl.java    From app-version with Apache License 2.0 5 votes vote down vote up
@Override
public ServiceResult listApp(int page, int pageSize, EntityWrapper<App> wrapper) {
    Page<App> pageEntity = new Page<>();
    pageEntity.setSize(pageSize);
    pageEntity.setCurrent(page);
    pageEntity.setRecords(appMapper.selectPage(pageEntity, wrapper));
    basicService.formatCreatedBy(pageEntity.getRecords());
    return ServiceResult.ok(pageEntity);
}
 
Example 7
Source File: LogController.java    From MeetingFilm with Apache License 2.0 5 votes vote down vote up
/**
 * 查询操作日志列表
 */
@RequestMapping("/list")
@Permission(Const.ADMIN_NAME)
@ResponseBody
public Object list(@RequestParam(required = false) String beginTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String logName, @RequestParam(required = false) Integer logType) {
    Page<OperationLog> page = new PageFactory<OperationLog>().defaultPage();
    List<Map<String, Object>> result = operationLogService.getOperationLogs(page, beginTime, endTime, logName, BizLogType.valueOf(logType), page.getOrderByField(), page.isAsc());
    page.setRecords((List<OperationLog>) new LogWarpper(result).warp());
    return super.packForBT(page);
}
 
Example 8
Source File: LogServiceImpl.java    From Ffast-Java with MIT License 5 votes vote down vote up
@Override
public ServiceRowsResult findListByPage(Log m, Page<Log> page, String[] properties) {
    ServiceRowsResult result = new ServiceRowsResult(false);
    page.setRecords(baseMapper.listByPage(page, m));
    result.setPage(page.getRecords(), page.getTotal());
    result.setSuccess(true);
    return result;
}
 
Example 9
Source File: AndroidVersionServiceImpl.java    From app-version with Apache License 2.0 5 votes vote down vote up
@Override
public ServiceResult list(int page, int pageSize, EntityWrapper<AndroidVersion> wrapper) {
    Page<AndroidVersion> pageEntity = new Page<>(page, pageSize);
    pageEntity.setRecords(androidVersionMapper.selectPage(pageEntity, wrapper));
    basicService.formatCreatedBy(pageEntity.getRecords());
    return ServiceResult.ok(pageEntity);
}
 
Example 10
Source File: AndroidVersionServiceImpl.java    From app-version with Apache License 2.0 5 votes vote down vote up
@Override
public ServiceResult listSort(int page, int pageSize, EntityWrapper<AndroidVersion> wrapper) {
    Page<AndroidVersion> pageEntity = new Page<>(page, pageSize);
    List<AndroidVersion> androidVersions = androidVersionMapper.selectList(wrapper);
    androidVersions.sort((o1, o2) -> VersionCompareUtils.compareVersion(o2.getAppVersion(),o1.getAppVersion()));
    List<AndroidVersion> pageList = androidVersions.subList((page-1) * pageSize, pageSize * page >= androidVersions.size() ? androidVersions.size() : pageSize * page);
    pageEntity.setRecords(pageList);
    pageEntity.setTotal(androidVersions.size());
    basicService.formatCreatedBy(pageEntity.getRecords());
    return ServiceResult.ok(pageEntity);
}
 
Example 11
Source File: UserContainerDTOConvert.java    From paas with Apache License 2.0 5 votes vote down vote up
public Page<UserContainerDTO> convert(Page<UserContainer> page) {
    List<UserContainer> containers = page.getRecords();
    List<UserContainerDTO> containerDTOS = convert(containers);

    Page<UserContainerDTO> page1 = new Page<>();
    BeanUtils.copyProperties(page, page1);
    page1.setRecords(containerDTOS);

    return page1;
}
 
Example 12
Source File: AppServiceImpl.java    From app-version with Apache License 2.0 5 votes vote down vote up
@Override
public ServiceResult getAppListWithUserId(int page, int pageSize, String userId) {
    EntityWrapper<UserAppRel> entityWrapper = new EntityWrapper<>();
    entityWrapper.and().eq("user_id", userId);
    Page<UserAppRel> userAppRelPage = new Page<>();
    userAppRelPage.setCurrent(page);
    userAppRelPage.setSize(pageSize);
    userAppRelPage.setRecords(userAppRelMapper.selectPage(userAppRelPage, entityWrapper));
    List<App> collect = userAppRelPage.getRecords().stream().map(mapper -> {
        Integer appId = mapper.getAppId();
        App app = new App();
        app.setId(appId);
        app.setDelFlag(0);
        return appMapper.selectOne(app);
    }).collect(Collectors.toList());

    collect.removeAll(Collections.singleton(null));
    Page<App> appPage = new Page<>();
    try {
        $.bean.copyProperties(appPage, userAppRelPage);
        appPage.setRecords(collect);
        return ServiceResult.ok(appPage);
    } catch (InvocationTargetException | IllegalAccessException e) {
        logger.error("App参数转换出错", e);
    }
    return ServiceResultConstants.ERROR_500;
}
 
Example 13
Source File: OperationRecordLogServiceImpl.java    From app-version with Apache License 2.0 5 votes vote down vote up
@Override
public ServiceResult list(int page, int pageSize, EntityWrapper<OperationRecordLog> wrapper) {
    Page<OperationRecordLog> pageEntity = new Page<>();
    pageEntity.setSize(pageSize);
    pageEntity.setCurrent(page);
    pageEntity.setRecords(operationRecordLogMapper.selectPage(pageEntity, wrapper));
    basicService.formatCreatedBy(pageEntity.getRecords());
    return ServiceResult.ok(pageEntity);
}
 
Example 14
Source File: OperationRecordLogServiceImpl.java    From app-version with Apache License 2.0 5 votes vote down vote up
@Override
public ServiceResult getListByQuery(int page, int pageSize, String phone, String nickName, Integer appId, String operationResource, String operationDescription, String operationType, String startDate, String endDate) {
    Page<OperationRecordLogExt> logPage = new Page<>();
    logPage.setCurrent(page);
    logPage.setSize(pageSize);
    List<OperationRecordLogExt> list = operationRecordLogMapper.selectLogExtByQuery(logPage, phone, nickName, appId, operationResource, operationDescription, operationType, startDate, endDate);
    logPage.setRecords(list);
    return ServiceResult.ok(logPage);
}
 
Example 15
Source File: SysImageServiceImpl.java    From paas with Apache License 2.0 4 votes vote down vote up
@Override
public Page<SysImage> selfImage(String userId, Page<SysImage> page) {
    List<SysImage> records = imageMapper.listSelfImage(userId, page);

    return page.setRecords(records);
}
 
Example 16
Source File: BlogTagsServiceImpl.java    From mysiteforme with Apache License 2.0 4 votes vote down vote up
@Override
public Page<BlogTags> selectTagsPage(Map<String, Object> map, Page<BlogTags> page) {
    List<BlogTags> blogTagsList = baseMapper.selectTagsPage(map,page);
    page.setRecords(blogTagsList);
    return page;
}
 
Example 17
Source File: SysNetworkServiceImpl.java    From paas with Apache License 2.0 4 votes vote down vote up
@Override
public Page<SysNetwork> listSelfNetwork(Page<SysNetwork> page, String userId) {
    List<SysNetwork> list = networkMapper.listSelfNetwork(page, userId);

    return page.setRecords(list);
}
 
Example 18
Source File: ArticleServiceImpl.java    From MI-S with MIT License 4 votes vote down vote up
@Override
public Page<ArticleVo> selectArticleByArchive(Page<ArticleVo> page) {
    List<ArticleVo> list = articleMapper.selectArticleList(page);
    page.setRecords(list);
    return page;
}
 
Example 19
Source File: NoticeServiceImpl.java    From paas with Apache License 2.0 4 votes vote down vote up
@Override
public Page<NoticeDTO> listSelfNotice(String userId, Integer type, Page<NoticeDTO> page) {
    List<NoticeDTO> noticeDTOS = noticeMapper.listUserNotice(userId, type, page);

    return page.setRecords(noticeDTOS);
}
 
Example 20
Source File: SysImageServiceImpl.java    From paas with Apache License 2.0 4 votes vote down vote up
@Override
public Page<SysImageDTO> listLocalPublicImage(String name, Page<SysImageDTO> page) {
    return page.setRecords(imageMapper.listLocalPublicImage(page, name));
}