Java Code Examples for com.baomidou.mybatisplus.core.metadata.IPage#getTotal()

The following examples show how to use com.baomidou.mybatisplus.core.metadata.IPage#getTotal() . 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: LogErrorController.java    From SpringBlade with Apache License 2.0 5 votes vote down vote up
/**
 * 查询多条(分页)
 */
@GetMapping("/list")
public R<IPage<LogErrorVo>> list(@ApiIgnore @RequestParam Map<String, Object> logError, Query query) {
	IPage<LogError> pages = errorLogService.page(Condition.getPage(query.setDescs("create_time")), Condition.getQueryWrapper(logError, LogError.class));
	List<LogErrorVo> records = pages.getRecords().stream().map(logApi -> {
		LogErrorVo vo = BeanUtil.copy(logApi, LogErrorVo.class);
		vo.setStrId(Func.toStr(logApi.getId()));
		return vo;
	}).collect(Collectors.toList());
	IPage<LogErrorVo> pageVo = new Page<>(pages.getCurrent(), pages.getSize(), pages.getTotal());
	pageVo.setRecords(records);
	return R.data(pageVo);
}
 
Example 2
Source File: LogUsualController.java    From SpringBlade with Apache License 2.0 5 votes vote down vote up
/**
 * 查询多条(分页)
 */
@GetMapping("/list")
public R<IPage<LogUsualVo>> list(@ApiIgnore @RequestParam Map<String, Object> log, Query query) {
	IPage<LogUsual> pages = logService.page(Condition.getPage(query), Condition.getQueryWrapper(log, LogUsual.class));
	List<LogUsualVo> records = pages.getRecords().stream().map(logApi -> {
		LogUsualVo vo = BeanUtil.copy(logApi, LogUsualVo.class);
		vo.setStrId(Func.toStr(logApi.getId()));
		return vo;
	}).collect(Collectors.toList());
	IPage<LogUsualVo> pageVo = new Page<>(pages.getCurrent(), pages.getSize(), pages.getTotal());
	pageVo.setRecords(records);
	return R.data(pageVo);
}
 
Example 3
Source File: LogApiController.java    From SpringBlade with Apache License 2.0 5 votes vote down vote up
/**
 * 查询多条(分页)
 */
@GetMapping("/list")
public R<IPage<LogApiVo>> list(@ApiIgnore @RequestParam Map<String, Object> log, Query query) {
	IPage<LogApi> pages = logService.page(Condition.getPage(query.setDescs("create_time")), Condition.getQueryWrapper(log, LogApi.class));
	List<LogApiVo> records = pages.getRecords().stream().map(logApi -> {
		LogApiVo vo = BeanUtil.copy(logApi, LogApiVo.class);
		vo.setStrId(Func.toStr(logApi.getId()));
		return vo;
	}).collect(Collectors.toList());
	IPage<LogApiVo> pageVo = new Page<>(pages.getCurrent(), pages.getSize(), pages.getTotal());
	pageVo.setRecords(records);
	return R.data(pageVo);
}
 
Example 4
Source File: BaseEntityWrapper.java    From blade-tool with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 分页实体类集合包装
 *
 * @param pages 分页
 * @return Page V
 */
public IPage<V> pageVO(IPage<E> pages) {
	List<V> records = listVO(pages.getRecords());
	IPage<V> pageVo = new Page<>(pages.getCurrent(), pages.getSize(), pages.getTotal());
	pageVo.setRecords(records);
	return pageVo;
}
 
Example 5
Source File: Paging.java    From supplierShop with MIT License 4 votes vote down vote up
public Paging(IPage page) {
    this.total = page.getTotal();
    this.records = page.getRecords();
}
 
Example 6
Source File: Paging.java    From spring-boot-plus with Apache License 2.0 4 votes vote down vote up
public Paging(IPage<T> page) {
    this.total = page.getTotal();
    this.records = page.getRecords();
    this.pageIndex = page.getCurrent();
    this.pageSize = page.getSize();
}
 
Example 7
Source File: SysUserController.java    From jeecg-cloud with Apache License 2.0 4 votes vote down vote up
/**
     * 根据 orgCode 查询用户,包括子部门下的用户
     * 针对通讯录模块做的接口,将多个部门的用户合并成一条记录,并转成对前端友好的格式
     */
    @GetMapping("/queryByOrgCodeForAddressList")
    public Result<?> queryByOrgCodeForAddressList(
            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
            @RequestParam(name = "orgCode",required = false) String orgCode,
            SysUser userParams
    ) {
        IPage page = new Page(pageNo, pageSize);
        IPage<SysUserSysDepartModel> pageList = sysUserService.queryUserByOrgCode(orgCode, userParams, page);
        List<SysUserSysDepartModel> list = pageList.getRecords();

        // 记录所有出现过的 user, key = userId
        Map<String, JSONObject> hasUser = new HashMap<>(list.size());

        JSONArray resultJson = new JSONArray(list.size());

        for (SysUserSysDepartModel item : list) {
            String userId = item.getId();
            // userId
            JSONObject getModel = hasUser.get(userId);
            // 之前已存在过该用户,直接合并数据
            if (getModel != null) {
                String departName = getModel.get("departName").toString();
                getModel.put("departName", (departName + " | " + item.getDepartName()));
            } else {
                // 将用户对象转换为json格式,并将部门信息合并到 json 中
                JSONObject json = JSON.parseObject(JSON.toJSONString(item));
                json.remove("id");
                json.put("userId", userId);
                json.put("departId", item.getDepartId());
                json.put("departName", item.getDepartName());
//                json.put("avatar", item.getSysUser().getAvatar());
                resultJson.add(json);
                hasUser.put(userId, json);
            }
        }

        IPage<JSONObject> result = new Page<>(pageNo, pageSize, pageList.getTotal());
        result.setRecords(resultJson.toJavaList(JSONObject.class));
        return Result.ok(result);
    }
 
Example 8
Source File: SysUserController.java    From jeecg-boot-with-activiti with MIT License 4 votes vote down vote up
/**
 * 根据 orgCode 查询用户,包括子部门下的用户
 * 针对通讯录模块做的接口,将多个部门的用户合并成一条记录,并转成对前端友好的格式
 */
@GetMapping("/queryByOrgCodeForAddressList")
public Result<?> queryByOrgCodeForAddressList(
        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
        @RequestParam(name = "orgCode") String orgCode,
        SysUser userParams
) {
    IPage page = new Page(pageNo, pageSize);
    IPage<SysUserSysDepartModel> pageList = sysUserService.queryUserByOrgCode(orgCode, userParams, page);
    List<SysUserSysDepartModel> list = pageList.getRecords();

    // 记录所有出现过的 user, key = userId
    Map<String, JSONObject> hasUser = new HashMap<>(list.size());

    JSONArray resultJson = new JSONArray(list.size());

    for (SysUserSysDepartModel item : list) {
        String userId = item.getSysUser().getId();
        // userId
        JSONObject getModel = hasUser.get(userId);
        // 之前已存在过该用户,直接合并数据
        if (getModel != null) {
            String departName = getModel.get("departName").toString();
            getModel.put("departName", (departName + " | " + item.getSysDepart().getDepartName()));
        } else {
            // 将用户对象转换为json格式,并将部门信息合并到 json 中
            JSONObject json = JSON.parseObject(JSON.toJSONString(item.getSysUser()));
            json.remove("id");
            json.put("userId", userId);
            json.put("departId", item.getSysDepart().getId());
            json.put("departName", item.getSysDepart().getDepartName());

            resultJson.add(json);
            hasUser.put(userId, json);
        }
    }

    IPage<JSONObject> result = new Page<>(pageNo, pageSize, pageList.getTotal());
    result.setRecords(resultJson.toJavaList(JSONObject.class));
    return Result.ok(result);
}
 
Example 9
Source File: PageUtil.java    From cymbal with Apache License 2.0 4 votes vote down vote up
public static <T> org.springframework.data.domain.Page convertToSpringPage(final IPage page,
        final Pageable pageable) {
    return new PageImpl(page.getRecords(), pageable, page.getTotal());
}
 
Example 10
Source File: Paging.java    From yshopmall with Apache License 2.0 4 votes vote down vote up
public Paging(IPage page) {
    this.total = page.getTotal();
    this.records = page.getRecords();
}
 
Example 11
Source File: SysUserController.java    From teaching with Apache License 2.0 4 votes vote down vote up
/**
 * 根据 orgCode 查询用户,包括子部门下的用户
 * 针对通讯录模块做的接口,将多个部门的用户合并成一条记录,并转成对前端友好的格式
 */
@GetMapping("/queryByOrgCodeForAddressList")
public Result<?> queryByOrgCodeForAddressList(
        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
        @RequestParam(name = "orgCode",required = false) String orgCode,
        SysUser userParams
) {
    IPage page = new Page(pageNo, pageSize);
    IPage<SysUserSysDepartModel> pageList = sysUserService.queryUserByOrgCode(orgCode, userParams, page);
    List<SysUserSysDepartModel> list = pageList.getRecords();

    // 记录所有出现过的 user, key = userId
    Map<String, JSONObject> hasUser = new HashMap<>(list.size());

    JSONArray resultJson = new JSONArray(list.size());

    for (SysUserSysDepartModel item : list) {
        String userId = item.getSysUser().getId();
        // userId
        JSONObject getModel = hasUser.get(userId);
        // 之前已存在过该用户,直接合并数据
        if (getModel != null) {
            String departName = getModel.get("departName").toString();
            getModel.put("departName", (departName + " | " + item.getSysDepart().getDepartName()));
        } else {
            // 将用户对象转换为json格式,并将部门信息合并到 json 中
            JSONObject json = JSON.parseObject(JSON.toJSONString(item.getSysUser()));
            json.remove("id");
            json.put("userId", userId);
            json.put("departId", item.getSysDepart().getId());
            json.put("departName", item.getSysDepart().getDepartName());

            resultJson.add(json);
            hasUser.put(userId, json);
        }
    }

    IPage<JSONObject> result = new Page<>(pageNo, pageSize, pageList.getTotal());
    result.setRecords(resultJson.toJavaList(JSONObject.class));
    return Result.ok(result);
}
 
Example 12
Source File: SysUserController.java    From jeecg-boot with Apache License 2.0 4 votes vote down vote up
/**
     * 根据 orgCode 查询用户,包括子部门下的用户
     * 针对通讯录模块做的接口,将多个部门的用户合并成一条记录,并转成对前端友好的格式
     */
    @GetMapping("/queryByOrgCodeForAddressList")
    public Result<?> queryByOrgCodeForAddressList(
            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
            @RequestParam(name = "orgCode",required = false) String orgCode,
            SysUser userParams
    ) {
        IPage page = new Page(pageNo, pageSize);
        IPage<SysUserSysDepartModel> pageList = sysUserService.queryUserByOrgCode(orgCode, userParams, page);
        List<SysUserSysDepartModel> list = pageList.getRecords();

        // 记录所有出现过的 user, key = userId
        Map<String, JSONObject> hasUser = new HashMap<>(list.size());

        JSONArray resultJson = new JSONArray(list.size());

        for (SysUserSysDepartModel item : list) {
            String userId = item.getId();
            // userId
            JSONObject getModel = hasUser.get(userId);
            // 之前已存在过该用户,直接合并数据
            if (getModel != null) {
                String departName = getModel.get("departName").toString();
                getModel.put("departName", (departName + " | " + item.getDepartName()));
            } else {
                // 将用户对象转换为json格式,并将部门信息合并到 json 中
                JSONObject json = JSON.parseObject(JSON.toJSONString(item));
                json.remove("id");
                json.put("userId", userId);
                json.put("departId", item.getDepartId());
                json.put("departName", item.getDepartName());
//                json.put("avatar", item.getSysUser().getAvatar());
                resultJson.add(json);
                hasUser.put(userId, json);
            }
        }

        IPage<JSONObject> result = new Page<>(pageNo, pageSize, pageList.getTotal());
        result.setRecords(resultJson.toJavaList(JSONObject.class));
        return Result.ok(result);
    }
 
Example 13
Source File: PageResultWrapper.java    From magic-starter with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * 构造分页对象
 *
 * @param pageData 当前页数据
 * @param <T>泛型
 * @return 分页对象
 */
public static <T> PageResult<T> wrapper(IPage<T> pageData) {
	return new PageResult<>((int) pageData.getCurrent(), (int) pageData.getSize(), (int) pageData.getPages(), pageData.getTotal(), pageData.getRecords());
}