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;
}
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;
}
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);
}
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);
}
}
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);
}
Aggregations