com.baomidou.mybatisplus.extension.plugins.pagination.Page Java Examples

The following examples show how to use com.baomidou.mybatisplus.extension.plugins.pagination.Page. 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: JeecgDemoServiceImpl.java    From jeecg-cloud with Apache License 2.0 7 votes vote down vote up
@Override
public IPage<JeecgDemo> queryListWithPermission(int pageSize,int pageNo) {
	Page<JeecgDemo> page = new Page<>(pageNo, pageSize);
	//编程方式,获取当前请求的数据权限规则SQL片段
	String sql = QueryGenerator.installAuthJdbc(JeecgDemo.class);
	return this.baseMapper.queryListWithPermission(page, sql);
}
 
Example #2
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 #3
Source File: SysAnnouncementSendController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:获取我的消息
 * @return
 */
@GetMapping(value = "/getMyAnnouncementSend")
public Result<IPage<AnnouncementSendModel>> getMyAnnouncementSend(AnnouncementSendModel announcementSendModel,
		@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
		  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
	Result<IPage<AnnouncementSendModel>> result = new Result<IPage<AnnouncementSendModel>>();
	LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
	String userId = sysUser.getId();
	announcementSendModel.setUserId(userId);
	announcementSendModel.setPageNo((pageNo-1)*pageSize);
	announcementSendModel.setPageSize(pageSize);
	Page<AnnouncementSendModel> pageList = new Page<AnnouncementSendModel>(pageNo,pageSize);
	pageList = sysAnnouncementSendService.getMyAnnouncementSendPage(pageList, announcementSendModel);
	result.setResult(pageList);
	result.setSuccess(true);
	return result;
}
 
Example #4
Source File: SysLogController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:查询日志记录
 * @param syslog
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysLog>> queryPageList(SysLog syslog,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysLog>> result = new Result<IPage<SysLog>>();
	QueryWrapper<SysLog> queryWrapper = QueryGenerator.initQueryWrapper(syslog, req.getParameterMap());
	Page<SysLog> page = new Page<SysLog>(pageNo, pageSize);
	//日志关键词
	String keyWord = req.getParameter("keyWord");
	if(oConvertUtils.isNotEmpty(keyWord)) {
		queryWrapper.like("log_content",keyWord);
	}
	//TODO 过滤逻辑处理
	//TODO begin、end逻辑处理
	//TODO 一个强大的功能,前端传一个字段字符串,后台只返回这些字符串对应的字段
	//创建时间/创建人的赋值
	IPage<SysLog> pageList = sysLogService.page(page, queryWrapper);
	log.info("查询当前页:"+pageList.getCurrent());
	log.info("查询当前页数量:"+pageList.getSize());
	log.info("查询结果数量:"+pageList.getRecords().size());
	log.info("数据总数:"+pageList.getTotal());
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example #5
Source File: CategoryServiceImpl.java    From plumemo with Apache License 2.0 6 votes vote down vote up
@Override
public Result getCategoryTagsList(CategoryVO categoryVO) {
    Page page = Optional.ofNullable(PageUtil.checkAndInitPage(categoryVO)).orElse(PageUtil.initPage());
    IPage<Category> categoryIPage = this.categoryDao.selectListPage(page,categoryVO);
    List<Category> categoryList = categoryIPage.getRecords();

    List<CategoryVO> categoryVOList = new ArrayList<>();
    if (!CollectionUtils.isEmpty(categoryList)) {
        categoryList.forEach(category -> {
            List<CategoryTags> categoryTags =
                    categoryTagsDao.selectList(new LambdaQueryWrapper<CategoryTags>().eq(CategoryTags::getCategoryId, category.getId()));
            List<TagsVO> tagsVOList = new ArrayList<>();
            if (!CollectionUtils.isEmpty(categoryTags)) {
                categoryTags.forEach(categoryTags1 -> {
                    Tags tags =
                            Optional.ofNullable(this.tagsDao.selectById(categoryTags1.getTagsId())).orElse(new Tags());
                    tagsVOList.add(new TagsVO().setName(tags.getName()));
                });
            }
            categoryVOList.add(new CategoryVO().setId(category.getId()).setName(category.getName()).setTagsList(tagsVOList));
        });
    }

    return Result.createWithPaging(categoryVOList, PageUtil.initPageInfo(page));
}
 
Example #6
Source File: PostController.java    From SENS with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 待审核文章列表
 *
 * @param model model
 * @return 模板路径admin/admin_post
 */
@GetMapping("/check")
public String postCheckList(Model model,
                            @RequestParam(value = "page", defaultValue = "1") Integer pageNumber,
                            @RequestParam(value = "size", defaultValue = "15") Integer pageSize,
                            @RequestParam(value = "sort", defaultValue = "createTime") String sort,
                            @RequestParam(value = "order", defaultValue = "desc") String order,
                            @ModelAttribute SearchVo searchVo) {
    Post condition = new Post();
    condition.setPostType(PostTypeEnum.POST_TYPE_POST.getValue());
    condition.setPostStatus(PostStatusEnum.CHECKING.getCode());
    Page page = PageUtil.initMpPage(pageNumber, pageSize, sort, order);
    Page<Post> posts = postService.findAll(
            page,
            new QueryCondition<>(condition, searchVo));
    List<Post> postList = posts.getRecords();
    postList.forEach(post -> userService.get(post.getUserId()));
    model.addAttribute("posts", postList);
    model.addAttribute("pageInfo", PageUtil.convertPageVo(page));
    model.addAttribute("order", order);
    model.addAttribute("sort", sort);
    return "admin/admin_post_check";
}
 
Example #7
Source File: BlogInfoServiceImpl.java    From My-Blog-layui with Apache License 2.0 6 votes vote down vote up
@Override
public List<SimpleBlogListVO> getNewBlog() {
    List<SimpleBlogListVO> simpleBlogListVOS = new ArrayList<>();
    Page<BlogInfo> page = new Page<>(1,5);
    blogInfoMapper.selectPage(page,new QueryWrapper<BlogInfo>()
            .lambda()
            .eq(BlogInfo::getBlogStatus, BlogStatusConstants.ONE)
            .eq(BlogInfo::getIsDeleted,BlogStatusConstants.ZERO)
            .orderByDesc(BlogInfo::getCreateTime));
    for (BlogInfo blogInfo : page.getRecords()){
        SimpleBlogListVO simpleBlogListVO = new SimpleBlogListVO();
        BeanUtils.copyProperties(blogInfo, simpleBlogListVO);
        simpleBlogListVOS.add(simpleBlogListVO);
    }
    return simpleBlogListVOS;
}
 
Example #8
Source File: BlogInfoServiceImpl.java    From My-Blog-layui with Apache License 2.0 6 votes vote down vote up
@Override
public List<SimpleBlogListVO> getHotBlog() {
    List<SimpleBlogListVO> simpleBlogListVOS = new ArrayList<>();
    Page<BlogInfo> page = new Page<>(1,5);
    blogInfoMapper.selectPage(page,new QueryWrapper<BlogInfo>()
            .lambda()
            .eq(BlogInfo::getBlogStatus, BlogStatusConstants.ONE)
            .eq(BlogInfo::getIsDeleted,BlogStatusConstants.ZERO)
            .orderByDesc(BlogInfo::getBlogViews));
    for (BlogInfo blogInfo : page.getRecords()){
        SimpleBlogListVO simpleBlogListVO = new SimpleBlogListVO();
        BeanUtils.copyProperties(blogInfo, simpleBlogListVO);
        simpleBlogListVOS.add(simpleBlogListVO);
    }
    return simpleBlogListVOS;
}
 
Example #9
Source File: LogController.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")
@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 page = LayuiPageFactory.defaultPage();

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

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

    return LayuiPageFactory.createPageInfo(page);
}
 
Example #10
Source File: SysBaseApiImpl.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
@Override
  public JSONObject queryAllUser(String[] userIds,int pageNo,int pageSize) {
JSONObject json = new JSONObject();
QueryWrapper<SysUser> queryWrapper = new QueryWrapper<SysUser>().eq("status",1).eq("del_flag",0);
      List<ComboModel> list = new ArrayList<ComboModel>();
Page<SysUser> page = new Page<SysUser>(pageNo, pageSize);
IPage<SysUser> pageList = userMapper.selectPage(page, queryWrapper);
      for(SysUser user : pageList.getRecords()){
          ComboModel model = new ComboModel();
          model.setUsername(user.getUsername());
          model.setTitle(user.getRealname());
          model.setId(user.getId());
          model.setEmail(user.getEmail());
          if(oConvertUtils.isNotEmpty(userIds)){
              for(int i = 0; i<userIds.length;i++){
                  if(userIds[i].equals(user.getId())){
                      model.setChecked(true);
                  }
              }
          }
          list.add(model);
      }
json.put("list",list);
      json.put("total",pageList.getTotal());
      return json;
  }
 
Example #11
Source File: LogServiceImpl.java    From FEBS-Cloud with Apache License 2.0 6 votes vote down vote up
@Override
public IPage<Log> findLogs(Log log, QueryRequest request) {
    QueryWrapper<Log> queryWrapper = new QueryWrapper<>();

    if (StringUtils.isNotBlank(log.getUsername())) {
        queryWrapper.lambda().eq(Log::getUsername, log.getUsername().toLowerCase());
    }
    if (StringUtils.isNotBlank(log.getOperation())) {
        queryWrapper.lambda().like(Log::getOperation, log.getOperation());
    }
    if (StringUtils.isNotBlank(log.getLocation())) {
        queryWrapper.lambda().like(Log::getLocation, log.getLocation());
    }
    if (StringUtils.isNotBlank(log.getCreateTimeFrom()) && StringUtils.isNotBlank(log.getCreateTimeTo())) {
        queryWrapper.lambda()
                .ge(Log::getCreateTime, log.getCreateTimeFrom())
                .le(Log::getCreateTime, log.getCreateTimeTo());
    }

    Page<Log> page = new Page<>(request.getPageNum(), request.getPageSize());
    SortUtil.handlePageSort(request, page, "createTime", FebsConstant.ORDER_DESC, true);

    return this.page(page, queryWrapper);
}
 
Example #12
Source File: PictureSortServiceImpl.java    From mogu_blog_v2 with Apache License 2.0 6 votes vote down vote up
@Override
public String stickPictureSort(PictureSortVO pictureSortVO) {
    PictureSort pictureSort = pictureSortService.getById(pictureSortVO.getUid());
    //查找出最大的那一个
    QueryWrapper<PictureSort> queryWrapper = new QueryWrapper<>();
    queryWrapper.orderByDesc(SQLConf.SORT);
    Page<PictureSort> page = new Page<>();
    page.setCurrent(0);
    page.setSize(1);
    IPage<PictureSort> pageList = pictureSortService.page(page, queryWrapper);
    List<PictureSort> list = pageList.getRecords();
    PictureSort maxSort = list.get(0);
    if (StringUtils.isEmpty(maxSort.getUid())) {
        return ResultUtil.result(SysConf.ERROR, MessageConf.PARAM_INCORRECT);
    }
    if (maxSort.getUid().equals(pictureSort.getUid())) {
        return ResultUtil.result(SysConf.ERROR, MessageConf.THIS_SORT_IS_TOP);
    }
    Integer sortCount = maxSort.getSort() + 1;
    pictureSort.setSort(sortCount);
    pictureSort.setUpdateTime(new Date());
    pictureSort.updateById();
    return ResultUtil.result(SysConf.SUCCESS, MessageConf.OPERATION_SUCCESS);
}
 
Example #13
Source File: SysCheckRuleController.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
 * 分页列表查询
 *
 * @param sysCheckRule
 * @param pageNo
 * @param pageSize
 * @param request
 * @return
 */
@AutoLog(value = "编码校验规则-分页列表查询")
@ApiOperation(value = "编码校验规则-分页列表查询", notes = "编码校验规则-分页列表查询")
@GetMapping(value = "/list")
public Result queryPageList(
        SysCheckRule sysCheckRule,
        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
        HttpServletRequest request
) {
    QueryWrapper<SysCheckRule> queryWrapper = QueryGenerator.initQueryWrapper(sysCheckRule, request.getParameterMap());
    Page<SysCheckRule> page = new Page<>(pageNo, pageSize);
    IPage<SysCheckRule> pageList = sysCheckRuleService.page(page, queryWrapper);
    return Result.ok(pageList);
}
 
Example #14
Source File: OSSFileController.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
@ResponseBody
@GetMapping("/list")
public Result<IPage<OSSFile>> queryPageList(OSSFile file,
		@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
		@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
	Result<IPage<OSSFile>> result = new Result<>();
	QueryWrapper<OSSFile> queryWrapper = QueryGenerator.initQueryWrapper(file, req.getParameterMap());
	Page<OSSFile> page = new Page<>(pageNo, pageSize);
	IPage<OSSFile> pageList = ossFileService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example #15
Source File: BlogController.java    From My-Blog-layui with Apache License 2.0 5 votes vote down vote up
/**
 * 文章分页列表
 * @param ajaxPutPage 分页参数
 * @param condition 筛选条件
 * @return com.site.blog.dto.AjaxResultPage<com.site.blog.entity.BlogInfo>
 * @date 2019/8/28 16:43
 */
@ResponseBody
@GetMapping("/v1/blog/list")
public AjaxResultPage<BlogInfo> getContractList(AjaxPutPage<BlogInfo> ajaxPutPage, BlogInfo condition){
    QueryWrapper<BlogInfo> queryWrapper = new QueryWrapper<>(condition);
    queryWrapper.lambda().orderByDesc(BlogInfo::getUpdateTime);
    Page<BlogInfo> page = ajaxPutPage.putPageToPage();
    blogInfoService.page(page,queryWrapper);
    AjaxResultPage<BlogInfo> result = new AjaxResultPage<>();
    result.setData(page.getRecords());
    result.setCount(page.getTotal());
    return result;
}
 
Example #16
Source File: SystemConfigService.java    From smart-admin with MIT License 5 votes vote down vote up
/**
 * 分页获取系统配置
 *
 * @param queryDTO
 * @return
 */
public ResponseDTO<PageResultDTO<SystemConfigVO>> getSystemConfigPage(SystemConfigQueryDTO queryDTO) {
    Page page = SmartPageUtil.convert2QueryPage(queryDTO);
    if(queryDTO.getKey() != null){
        queryDTO.setKey(queryDTO.getKey().toLowerCase());
    }
    List<SystemConfigEntity> entityList = systemConfigDao.selectSystemSettingList(page, queryDTO);
    PageResultDTO<SystemConfigVO> pageResultDTO = SmartPageUtil.convert2PageResult(page, entityList, SystemConfigVO.class);
    return ResponseDTO.succData(pageResultDTO);
}
 
Example #17
Source File: R.java    From kvf-admin with MIT License 5 votes vote down vote up
private R(int code, String msg, Object data) {
    this.code = code;
    this.msg = msg;
    if (data instanceof Page<?>) {
        Page<?> page = (Page<?>) data;
        this.total = page.getTotal();
        this.data = page.getRecords();
    } else {
        this.data = data;
    }
}
 
Example #18
Source File: DataPermissionTestServiceImpl.java    From FEBS-Cloud with Apache License 2.0 5 votes vote down vote up
@Override
public IPage<DataPermissionTest> findDataPermissionTests(QueryRequest request, DataPermissionTest dataPermissionTest) {
    LambdaQueryWrapper<DataPermissionTest> queryWrapper = new LambdaQueryWrapper<>();
    queryWrapper.orderByAsc(DataPermissionTest::getCreateTime);
    Page<DataPermissionTest> page = new Page<>(request.getPageNum(), request.getPageSize());
    return this.page(page, queryWrapper);
}
 
Example #19
Source File: AuthUserLogServiceImpl.java    From plumemo with Apache License 2.0 5 votes vote down vote up
@Override
public Result<AuthUserLogVO> getLogsList(AuthUserLogVO authUserLogVO) {
    logger.debug("queryPage AuthUserLog ,the entity is {}", authUserLogVO.toString());
    authUserLogVO = Optional.ofNullable(authUserLogVO).orElse(new AuthUserLogVO());

    Page page = Optional.ofNullable(PageUtil.checkAndInitPage(authUserLogVO)).orElse(PageUtil.initPage());
    if (StringUtils.isNotBlank(authUserLogVO.getKeywords())) {
        authUserLogVO.setKeywords("%" + authUserLogVO.getKeywords() + "%");
    }
    List<AuthUserLogVO> logVOList = authUserLogDao.selectLogsList(page, authUserLogVO);
    logVOList.forEach(obj->obj.setCodeName(OperateEnum.getName(obj.getCode())));
    return Result.createWithPaging(logVOList, PageUtil.initPageInfo(page));
}
 
Example #20
Source File: LabelBindServiceImpl.java    From iot-dc3 with Apache License 2.0 5 votes vote down vote up
@Override
@Cacheable(value = Common.Cache.LABEL_BIND + Common.Cache.LIST, keyGenerator = "commonKeyGenerator", unless = "#result==null")
public Page<LabelBind> list(LabelBindDto labelBindDto) {
    if (!Optional.ofNullable(labelBindDto.getPage()).isPresent()) {
        labelBindDto.setPage(new Pages());
    }
    return labelBindMapper.selectPage(labelBindDto.getPage().convert(), fuzzyQuery(labelBindDto));
}
 
Example #21
Source File: DriverCommonServiceImpl.java    From iot-dc3 with Apache License 2.0 5 votes vote down vote up
/**
 * load driver profile
 *
 * @param driverId Driver Id
 * @return Array
 */
public List<Long> loadProfile(long driverId) {
    log.info("Load profile into memory");
    List<Long> profileList = new ArrayList<>();
    ProfileDto profileDto = new ProfileDto();
    profileDto.setPage(new Pages().setSize(-1L)).setDriverId(driverId);
    R<Page<Profile>> rp = profileClient.list(profileDto);
    if (!rp.isOk()) {
        close();
        throw new ServiceException(rp.getMessage());
    }
    rp.getData().getRecords().forEach(profile -> profileList.add(profile.getId()));
    return profileList;
}
 
Example #22
Source File: TeachingCourseController.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
 * 分页列表查询
 *
 * @param teachingCourse
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@AutoLog(value = "课程-分页列表查询")
@ApiOperation(value="课程-分页列表查询", notes="课程-分页列表查询")
@GetMapping(value = "/list")
@PermissionData
public Result<?> queryPageList(TeachingCourse teachingCourse,
							   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
							   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
							   HttpServletRequest req) {
	QueryWrapper<TeachingCourse> queryWrapper = QueryGenerator.initQueryWrapper(teachingCourse, req.getParameterMap());
	Page<TeachingCourse> page = new Page<TeachingCourse>(pageNo, pageSize);
	IPage<TeachingCourse> pageList = teachingCourseService.page(page, queryWrapper);
	return Result.ok(pageList);
}
 
Example #23
Source File: SysRoleController.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
  * 分页列表查询
 * @param role
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysRole>> queryPageList(SysRole role,
								  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								  HttpServletRequest req) {
	Result<IPage<SysRole>> result = new Result<IPage<SysRole>>();
	QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(role, req.getParameterMap());
	Page<SysRole> page = new Page<SysRole>(pageNo, pageSize);
	IPage<SysRole> pageList = sysRoleService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example #24
Source File: TagController.java    From My-Blog-layui with Apache License 2.0 5 votes vote down vote up
/**
 * 标签分页
 * @param ajaxPutPage
 * @param condition
 * @return com.site.blog.dto.AjaxResultPage<com.site.blog.entity.BlogTag>
 * @date 2019/9/1 11:20
 */
@ResponseBody
@GetMapping("/v1/tags/paging")
public AjaxResultPage<BlogTag> getCategoryList(AjaxPutPage<BlogTag> ajaxPutPage, BlogTag condition){
    QueryWrapper<BlogTag> queryWrapper = new QueryWrapper<>(condition);
    queryWrapper.lambda()
            .ne(BlogTag::getTagId,1);
    Page<BlogTag> page = ajaxPutPage.putPageToPage();
    blogTagService.page(page,queryWrapper);
    AjaxResultPage<BlogTag> result = new AjaxResultPage<>();
    result.setData(page.getRecords());
    result.setCount(page.getTotal());
    return result;
}
 
Example #25
Source File: PositionService.java    From smart-admin with MIT License 5 votes vote down vote up
/**
 * 查询岗位
 *
 * @param queryDTO
 * @return
 */
public ResponseDTO<PageResultDTO<PositionResultVO>> queryPositionByPage(PositionQueryDTO queryDTO) {
    Page page = SmartPageUtil.convert2QueryPage(queryDTO);
    List<PositionEntity> entityList = positionDao.selectByPage(page, queryDTO);
    page.setRecords(entityList.stream().map(e -> SmartBeanUtil.copy(e, PositionResultVO.class)).collect(Collectors.toList()));
    PageResultDTO<PositionResultVO> pageResultDTO = SmartPageUtil.convert2PageResult(page);
    return ResponseDTO.succData(pageResultDTO);
}
 
Example #26
Source File: RoleServiceImpl.java    From mogu_blog_v2 with Apache License 2.0 5 votes vote down vote up
@Override
public IPage<Role> getPageList(RoleVO roleVO) {
    QueryWrapper<Role> queryWrapper = new QueryWrapper<>();
    if (StringUtils.isNotEmpty(roleVO.getKeyword()) && StringUtils.isNotEmpty(roleVO.getKeyword().trim())) {
        queryWrapper.like(SQLConf.ROLENAEM, roleVO.getKeyword().trim());
    }
    queryWrapper.eq(SQLConf.STATUS, EStatus.ENABLE);
    Page<Role> page = new Page<>();
    page.setCurrent(roleVO.getCurrentPage());
    page.setSize(roleVO.getPageSize());
    IPage<Role> pageList = roleService.page(page, queryWrapper);
    return pageList;
}
 
Example #27
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 #28
Source File: SysRoleController.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
/**
  * 分页列表查询
 * @param role
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysRole>> queryPageList(SysRole role,
								  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								  HttpServletRequest req) {
	Result<IPage<SysRole>> result = new Result<IPage<SysRole>>();
	QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(role, req.getParameterMap());
	Page<SysRole> page = new Page<SysRole>(pageNo, pageSize);
	IPage<SysRole> pageList = sysRoleService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example #29
Source File: SysUserServiceImpl.java    From teaching with Apache License 2.0 5 votes vote down vote up
@Override
public IPage<SysUserSysDepartModel> queryUserByOrgCode(String orgCode, SysUser userParams, IPage page) {
	List<SysUserSysDepartModel> list = baseMapper.getUserByOrgCode(page, orgCode, userParams);
	Integer total = baseMapper.getUserByOrgCodeTotal(orgCode, userParams);

	IPage<SysUserSysDepartModel> result = new Page<>(page.getCurrent(), page.getSize(), total);
	result.setRecords(list);

	return result;
}
 
Example #30
Source File: JeecgDemoController.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
 * 【数据权限示例 - 编程】mybatisPlus java类方式加载权限
 *
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@GetMapping(value = "/mpList")
@PermissionData(pageComponent = "jeecg/JeecgDemoList")
public Result<?> loadMpPermissonList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                     HttpServletRequest req) {
    QueryWrapper<JeecgDemo> queryWrapper = new QueryWrapper<JeecgDemo>();
    //编程方式,给queryWrapper装载数据权限规则
    QueryGenerator.installAuthMplus(queryWrapper, JeecgDemo.class);
    Page<JeecgDemo> page = new Page<JeecgDemo>(pageNo, pageSize);
    IPage<JeecgDemo> pageList = jeecgDemoService.page(page, queryWrapper);
    return Result.ok(pageList);
}