Search in sources :

Example 31 with IPage

use of com.baomidou.mybatisplus.core.metadata.IPage in project RG by ADrWondertainment.

the class SheetServiceImpl method getSheetsInPages.

@Override
public Result getSheetsInPages(Integer id, Integer pageIndex, Integer sizePerPage) {
    IPage<Sheet> page = new Page(pageIndex, sizePerPage);
    QueryWrapper<Sheet> query = Wrappers.query();
    query.eq("uid", id);
    IPage<Sheet> sheetIPage = sheetMapper.selectPage(page, query);
    if (sheetIPage == null) {
        throw new BackException(ErrorCode.SHEET_SELECT_FAILURE, "分页数据查询失败");
    }
    JSONArray jsonArray = JSONUtil.parseArray(sheetIPage.getRecords());
    ResultUtil.quickSet(result, ErrorCode.ALL_SET, "查询成功", JSONUtil.toJsonPrettyStr(jsonArray));
    return result;
}
Also used : BackException(ruangong.root.exception.BackException) JSONArray(cn.hutool.json.JSONArray) Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) IPage(com.baomidou.mybatisplus.core.metadata.IPage)

Example 32 with IPage

use of com.baomidou.mybatisplus.core.metadata.IPage in project RG by ADrWondertainment.

the class TemplateServiceImpl method getTemplatesInPages.

@Override
public Result getTemplatesInPages(Integer id, Integer pageNum, Integer size) {
    IPage<Template> page = new Page(pageNum, size);
    QueryWrapper<Template> query = Wrappers.query();
    query.eq("uid", id);
    IPage<Template> templateIPage = templateMapper.selectPage(page, query);
    if (templateIPage == null) {
        throw new BackException(ErrorCode.TEMPLATE_SELECT_FAILURE, "分页数据查询失败");
    }
    List<Template> records = templateIPage.getRecords();
    List<TemplateTransfer> transfers = new ArrayList<>();
    for (Template t : records) {
        TemplateTransfer temp = new TemplateTransfer();
        temp.setId(t.getId());
        temp.setUid(t.getUid());
        temp.setName(t.getName());
        temp.setTime(t.getTime());
        temp.setLength(t.getLength());
        temp.setDescription(t.getDescription());
        temp.setData(JSONUtil.parseObj(t.getData()));
        transfers.add(temp);
    }
    JSONArray jsonArray = JSONUtil.parseArray(transfers);
    ResultUtil.quickSet(result, ErrorCode.ALL_SET, "查询成功", JSONUtil.toJsonPrettyStr(jsonArray));
    return result;
}
Also used : BackException(ruangong.root.exception.BackException) TemplateTransfer(ruangong.root.bean.TemplateTransfer) ArrayList(java.util.ArrayList) JSONArray(cn.hutool.json.JSONArray) Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) IPage(com.baomidou.mybatisplus.core.metadata.IPage) JsonBeanTemplate(ruangong.root.bean.JsonBeanTemplate) Template(ruangong.root.bean.Template)

Example 33 with IPage

use of com.baomidou.mybatisplus.core.metadata.IPage in project qiwen-file by qiwenshare.

the class UserFileService method userFileList.

@Override
public IPage<FileListVo> userFileList(Long userId, String filePath, Long currentPage, Long pageCount) {
    Page<FileListVo> page = new Page<>(currentPage, pageCount);
    UserFile userFile = new UserFile();
    JwtUser sessionUserBean = SessionUtil.getSession();
    if (userId == null) {
        userFile.setUserId(sessionUserBean.getUserId());
    } else {
        userFile.setUserId(userId);
    }
    userFile.setFilePath(UFOPUtils.urlDecode(filePath));
    return userFileMapper.selectPageVo(page, userFile, null);
}
Also used : UserFile(com.qiwenshare.file.domain.UserFile) Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) IPage(com.baomidou.mybatisplus.core.metadata.IPage) JwtUser(com.qiwenshare.common.util.security.JwtUser) FileListVo(com.qiwenshare.file.vo.file.FileListVo)

Example 34 with IPage

use of com.baomidou.mybatisplus.core.metadata.IPage in project spring-boot-web by wangchengming666.

the class AbstructTableProcessor method doProcess.

/**
 * <tr fwk:role="" id="11" var="it">
 */
@Override
protected void doProcess(ITemplateContext context, IProcessableElementTag tag, AttributeName attributeName, String attributeValue, IElementTagStructureHandler structureHandler) {
    WebEngineContext _context = null;
    if (context instanceof WebEngineContext) {
        _context = (WebEngineContext) context;
    }
    ElementTagWrapper tagHelper = new ElementTagWrapper(tag);
    String iterableName = tagHelper.getString("_var", "it");
    String statName = tagHelper.getString("_stat", "stat");
    String varPageName = tagHelper.getString("_page", "page");
    Long count = tagHelper.getLong("_count", 10);
    Long index = tagHelper.getLong("_index", 1);
    String[] asc = tagHelper.getStringArray("_asc");
    String[] desc = tagHelper.getStringArray("_desc");
    Page page = new Page(index, count);
    page.setAsc(asc);
    page.setDesc(desc);
    IPage resultPage = tableProcess(context, tagHelper, page, structureHandler);
    structureHandler.iterateElement(iterableName, statName, resultPage.getRecords());
    structureHandler.removeAttribute("_var");
    structureHandler.removeAttribute("_stat");
    // XXX 可能有更好的方法
    if (_context.getRequest().getAttribute(varPageName) != null) {
        logger.warn("当前页码,存在同名的page变量名,自动+1");
        String number = StringUtils.substringAfterLast(varPageName, "_");
        if (StringUtils.isBlank(number)) {
            _context.getRequest().setAttribute(varPageName + "_1", resultPage);
        } else {
            _context.getRequest().setAttribute(varPageName + "_" + Integer.parseInt(number) + 1, resultPage);
        }
    } else {
        _context.getRequest().setAttribute(varPageName, resultPage);
    }
}
Also used : IPage(com.baomidou.mybatisplus.core.metadata.IPage) WebEngineContext(org.thymeleaf.context.WebEngineContext) ElementTagWrapper(com.web.framework.common.wrapper.ElementTagWrapper) Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) IPage(com.baomidou.mybatisplus.core.metadata.IPage)

Example 35 with IPage

use of com.baomidou.mybatisplus.core.metadata.IPage in project jun_springboot_api_service by wujun728.

the class SysContentController method findListByPage.

@ApiOperation(value = "查询分页数据")
@PostMapping("/listByPage")
@RequiresPermissions("sysContent:list")
@DataScope
public DataResult findListByPage(@RequestBody SysContentEntity sysContent) {
    Page page = new Page(sysContent.getPage(), sysContent.getLimit());
    LambdaQueryWrapper<SysContentEntity> queryWrapper = Wrappers.lambdaQuery();
    // 查询条件示例
    if (!StringUtils.isEmpty(sysContent.getTitle())) {
        queryWrapper.like(SysContentEntity::getTitle, sysContent.getTitle());
    }
    // 数据权限示例, 需手动添加此条件 begin
    if (!CollectionUtils.isEmpty(sysContent.getCreateIds())) {
        queryWrapper.in(SysContentEntity::getCreateId, sysContent.getCreateIds());
    }
    // 数据权限示例, 需手动添加此条件 end
    IPage<SysContentEntity> iPage = sysContentService.page(page, queryWrapper);
    return DataResult.success(iPage);
}
Also used : Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) IPage(com.baomidou.mybatisplus.core.metadata.IPage) SysContentEntity(com.jun.plugin.system.entity.SysContentEntity) RequiresPermissions(org.apache.shiro.authz.annotation.RequiresPermissions) DataScope(com.jun.plugin.system.common.aop.annotation.DataScope) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

IPage (com.baomidou.mybatisplus.core.metadata.IPage)197 Page (com.baomidou.mybatisplus.extension.plugins.pagination.Page)152 QueryWrapper (com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)73 ApiOperation (io.swagger.annotations.ApiOperation)28 ArrayList (java.util.ArrayList)21 Test (org.junit.Test)20 PageDTO (com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO)19 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)18 LoginUser (org.jeecg.common.system.vo.LoginUser)16 JSONObject (com.alibaba.fastjson.JSONObject)15 RequiresPermissions (org.apache.shiro.authz.annotation.RequiresPermissions)15 PageInfo (org.apache.dolphinscheduler.api.utils.PageInfo)13 LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)11 Result (org.jeecg.common.api.vo.Result)10 List (java.util.List)9 User (org.apache.dolphinscheduler.dao.entity.User)9 Field (java.lang.reflect.Field)8 Date (java.util.Date)8 Collectors (java.util.stream.Collectors)7 UserRolesVo (top.hcode.hoj.pojo.vo.UserRolesVo)7