当前位置: 首页 > news >正文

做数学ppt工具的网站/优化营商环境发言材料

做数学ppt工具的网站,优化营商环境发言材料,免费建网站平台哪个好,合肥seo一、绪论 Java系统中,分页查询的场景随处可见,本节介com.baomidou.mybatisplus.core.metadata.IPage;来分页的工具类 二、分页工具类 public class PageUtils implements Serializable { private static final long serialVersionUID 1L; /**…

一、绪论

Java系统中,分页查询的场景随处可见,本节介com.baomidou.mybatisplus.core.metadata.IPage;来分页的工具类

二、分页工具类

public class PageUtils implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 总记录数
     */
    private int totalCount;
    /**
     * 每页记录数
     */
    private int pageSize;
    /**
     * 总页数
     */
    private int totalPage;
    /**
     * 当前页数
     */
    private int currPage;
    /**
     * 列表数据
     */
    private List<?> list;
    
    /**
     * 分页
     * @param list        列表数据
     * @param totalCount  总记录数
     * @param pageSize    每页记录数
     * @param currPage    当前页数
     */
    public PageUtils(List<?> list, int totalCount, int pageSize, int currPage) {
        this.list = list;
        this.totalCount = totalCount;
        this.pageSize = pageSize;
        this.currPage = currPage;
        this.totalPage = (int)Math.ceil((double)totalCount/pageSize);
    }

    /**
     * 分页
     */
    public PageUtils(IPage<?> page) {
        this.list = page.getRecords();
        this.totalCount = (int)page.getTotal();
        this.pageSize = (int)page.getSize();
        this.currPage = (int)page.getCurrent();
        this.totalPage = (int)page.getPages();
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public int getCurrPage() {
        return currPage;
    }

    public void setCurrPage(int currPage) {
        this.currPage = currPage;
    }

    public List<?> getList() {
        return list;
    }

    public void setList(List<?> list) {
        this.list = list;
    }
    
}
 

public class PageUtils implements Serializable {private static final long serialVersionUID = 1L;/*** 总记录数*/private int totalCount;/*** 每页记录数*/private int pageSize;/*** 总页数*/private int totalPage;/*** 当前页数*/private int currPage;/*** 列表数据*/private List<?> list;/*** 分页* @param list        列表数据* @param totalCount  总记录数* @param pageSize    每页记录数* @param currPage    当前页数*/public PageUtils(List<?> list, int totalCount, int pageSize, int currPage) {this.list = list;this.totalCount = totalCount;this.pageSize = pageSize;this.currPage = currPage;this.totalPage = (int)Math.ceil((double)totalCount/pageSize);}/*** 分页*/public PageUtils(IPage<?> page) {this.list = page.getRecords();this.totalCount = (int)page.getTotal();this.pageSize = (int)page.getSize();this.currPage = (int)page.getCurrent();this.totalPage = (int)page.getPages();}public int getTotalCount() {return totalCount;}public void setTotalCount(int totalCount) {this.totalCount = totalCount;}public int getPageSize() {return pageSize;}public void setPageSize(int pageSize) {this.pageSize = pageSize;}public int getTotalPage() {return totalPage;}public void setTotalPage(int totalPage) {this.totalPage = totalPage;}public int getCurrPage() {return currPage;}public void setCurrPage(int currPage) {this.currPage = currPage;}public List<?> getList() {return list;}public void setList(List<?> list) {this.list = list;}}

Ipage接口

/*
 * Copyright (c) 2011-2021, baomidou (jobob@qq.com).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.baomidou.mybatisplus.core.metadata;

import java.io.Serializable;
import java.util.List;
import java.util.function.Function;

import static java.util.stream.Collectors.toList;

/**
 * 分页 Page 对象接口
 *
 * @author hubin
 * @since 2018-06-09
 */
public interface IPage<T> extends Serializable {

    /**
     * 获取排序信息,排序的字段和正反序
     *
     * @return 排序信息
     */
    List<OrderItem> orders();

    /**
     * 自动优化 COUNT SQL【 默认:true 】
     *
     * @return true 是 / false 否
     */
    default boolean optimizeCountSql() {
        return true;
    }

    /**
     * {@link com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor#isOptimizeJoin()}
     * 两个参数都为 true 才会进行sql处理
     *
     * @return true 是 / false 否
     * @since 3.4.4 @2021-09-13
     */
    default boolean optimizeJoinOfCountSql() {
        return true;
    }

    /**
     * 进行 count 查询 【 默认: true 】
     *
     * @return true 是 / false 否
     */
    default boolean searchCount() {
        return true;
    }

    /**
     * 计算当前分页偏移量
     */
    default long offset() {
        long current = getCurrent();
        if (current <= 1L) {
            return 0L;
        }
        return Math.max((current - 1) * getSize(), 0L);
    }

    /**
     * 最大每页分页数限制,优先级高于分页插件内的 maxLimit
     *
     * @since 3.4.0 @2020-07-17
     */
    default Long maxLimit() {
        return null;
    }

    /**
     * 当前分页总页数
     */
    default long getPages() {
        if (getSize() == 0) {
            return 0L;
        }
        long pages = getTotal() / getSize();
        if (getTotal() % getSize() != 0) {
            pages++;
        }
        return pages;
    }

    /**
     * 内部什么也不干
     * <p>只是为了 json 反序列化时不报错</p>
     */
    default IPage<T> setPages(long pages) {
        // to do nothing
        return this;
    }

    /**
     * 分页记录列表
     *
     * @return 分页对象记录列表
     */
    List<T> getRecords();

    /**
     * 设置分页记录列表
     */
    IPage<T> setRecords(List<T> records);

    /**
     * 当前满足条件总行数
     *
     * @return 总条数
     */
    long getTotal();

    /**
     * 设置当前满足条件总行数
     */
    IPage<T> setTotal(long total);

    /**
     * 获取每页显示条数
     *
     * @return 每页显示条数
     */
    long getSize();

    /**
     * 设置每页显示条数
     */
    IPage<T> setSize(long size);

    /**
     * 当前页
     *
     * @return 当前页
     */
    long getCurrent();

    /**
     * 设置当前页
     */
    IPage<T> setCurrent(long current);

    /**
     * IPage 的泛型转换
     *
     * @param mapper 转换函数
     * @param <R>    转换后的泛型
     * @return 转换泛型后的 IPage
     */
    @SuppressWarnings("unchecked")
    default <R> IPage<R> convert(Function<? super T, ? extends R> mapper) {
        List<R> collect = this.getRecords().stream().map(mapper).collect(toList());
        return ((IPage<R>) this).setRecords(collect);
    }

    /**
     * 老分页插件不支持
     * <p>
     * MappedStatement 的 id
     *
     * @return id
     * @since 3.4.0 @2020-06-19
     */
    default String countId() {
        return null;
    }
}
 

/** Copyright (c) 2011-2021, baomidou (jobob@qq.com).** Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**     http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/
package com.baomidou.mybatisplus.core.metadata;import java.io.Serializable;
import java.util.List;
import java.util.function.Function;import static java.util.stream.Collectors.toList;/*** 分页 Page 对象接口** @author hubin* @since 2018-06-09*/
public interface IPage<T> extends Serializable {/*** 获取排序信息,排序的字段和正反序** @return 排序信息*/List<OrderItem> orders();/*** 自动优化 COUNT SQL【 默认:true 】** @return true 是 / false 否*/default boolean optimizeCountSql() {return true;}/*** {@link com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor#isOptimizeJoin()}* 两个参数都为 true 才会进行sql处理** @return true 是 / false 否* @since 3.4.4 @2021-09-13*/default boolean optimizeJoinOfCountSql() {return true;}/*** 进行 count 查询 【 默认: true 】** @return true 是 / false 否*/default boolean searchCount() {return true;}/*** 计算当前分页偏移量*/default long offset() {long current = getCurrent();if (current <= 1L) {return 0L;}return Math.max((current - 1) * getSize(), 0L);}/*** 最大每页分页数限制,优先级高于分页插件内的 maxLimit** @since 3.4.0 @2020-07-17*/default Long maxLimit() {return null;}/*** 当前分页总页数*/default long getPages() {if (getSize() == 0) {return 0L;}long pages = getTotal() / getSize();if (getTotal() % getSize() != 0) {pages++;}return pages;}/*** 内部什么也不干* <p>只是为了 json 反序列化时不报错</p>*/default IPage<T> setPages(long pages) {// to do nothingreturn this;}/*** 分页记录列表** @return 分页对象记录列表*/List<T> getRecords();/*** 设置分页记录列表*/IPage<T> setRecords(List<T> records);/*** 当前满足条件总行数** @return 总条数*/long getTotal();/*** 设置当前满足条件总行数*/IPage<T> setTotal(long total);/*** 获取每页显示条数** @return 每页显示条数*/long getSize();/*** 设置每页显示条数*/IPage<T> setSize(long size);/*** 当前页** @return 当前页*/long getCurrent();/*** 设置当前页*/IPage<T> setCurrent(long current);/*** IPage 的泛型转换** @param mapper 转换函数* @param <R>    转换后的泛型* @return 转换泛型后的 IPage*/@SuppressWarnings("unchecked")default <R> IPage<R> convert(Function<? super T, ? extends R> mapper) {List<R> collect = this.getRecords().stream().map(mapper).collect(toList());return ((IPage<R>) this).setRecords(collect);}/*** 老分页插件不支持* <p>* MappedStatement 的 id** @return id* @since 3.4.0 @2020-06-19*/default String countId() {return null;}
}

三、运用

    /**
     * 分页查询权限信息
    * @param param
    * @return
    */
   public PageUtils queryPage(Map<String, Object> param) {

       IPage<TMenu> page = new Query<TMenu>().getPage(param);
       QueryWrapper<TMenu> wrapper = new QueryWrapper<>();
       if (param.containsKey("leftId")) {
           wrapper.eq("left_id", param.get("leftId").toString());
       }
       wrapper.eq("state", "0");
       wrapper.orderByAsc("sort");
       IPage<TMenu> tMenuIPage = tMenuMapper.selectPage(page, wrapper);
       return new PageUtils(tMenuIPage);

   }

    /*** 分页查询权限信息* @param param* @return*/public PageUtils queryPage(Map<String, Object> param) {IPage<TMenu> page = new Query<TMenu>().getPage(param);QueryWrapper<TMenu> wrapper = new QueryWrapper<>();if (param.containsKey("leftId")) {wrapper.eq("left_id", param.get("leftId").toString());}wrapper.eq("state", "0");wrapper.orderByAsc("sort");IPage<TMenu> tMenuIPage = tMenuMapper.selectPage(page, wrapper);return new PageUtils(tMenuIPage);}

相关文章:

【开端】Java 分页工具类运用

一、绪论 Java系统中&#xff0c;分页查询的场景随处可见&#xff0c;本节介com.baomidou.mybatisplus.core.metadata.IPage;来分页的工具类 二、分页工具类 public class PageUtils implements Serializable { private static final long serialVersionUID 1L; /**…...

leetcode每日一题48

143.环形链表ii 快慢指针 至于入环点的计算 设链表中环外部分的长度为 a。slow 指针进入环后&#xff0c;又走了 b 的距离与 fast 相遇。此时&#xff0c;fast 指针已经走完了环的 n 圈&#xff0c;因此它走过的总距离为 an(bc)ba(n1)bnc。 任意时刻&#xff0c;fast 指针走过…...

源码工具文档手册

手册文档工具 TinaSDK开发文档&#xff1a;https://tina.100ask.net/ 开发板使用文档&#xff1a;https://allwinner-docs.100ask.net/ 教程示例 一板懂百板通&#xff1a;https://www.bilibili.com/video/BV1Nx4y1w7AF/?spm_id_from333.999.0.0 T113 LVGLUI开发&#xff1…...

hive之greatest和least函数

1、greatest函数&#xff1a; greatest(col_a, col_b, ..., col_n)比较n个column的大小&#xff0c;过滤掉null或对null值进行处理&#xff0c;当某个column中是string&#xff0c;而其他是int/double/float等时&#xff0c;返回null&#xff1b; 举例&#xff1a; select g…...

C:数组传参的本质

1、一维数组传参的本质 数组传参是指在函数调用时将数组作为参数传递给函数。 int main() {int arr[10] { 1,2,3,4,5,6,7,8,9,10 };test(arr);return 0;}数组传参只需要写数组名就可以了。注意&#xff1a;数组名是arr&#xff0c;而不是arr[10] 数组传参形参该怎么写呢&am…...

excel 2019版本的index match搜索功能

{TEXTJOIN("", TRUE, IF((sheet2!A:A"文字")*(sheet2!C:CC5), sheet2!G:G, ""))} excel单元格输入公式后&#xff1a; TEXTJOIN("", TRUE, IF((sheet2!A:A"文字")*(sheet2!C:CC5), sheet2!G:G, "")) 按CtrlShi…...

【问题解决】apache.poi 3.1.4版本升级到 5.2.3,导出文件报错版本无法解析

【问题解决】apache.poi 3.1.4版本升级到 5.2.3&#xff0c;导出文件报错无法解析 3.1.4版本代码&#xff1a; /*** 创建workbook* param inp* return* throws Exception*/public Workbook createworkbook(InputStream inp) throws Exception {if (!inp.markSupported()) {inp…...

(亲测有效)SpringBoot项目集成腾讯云COS对象存储(2)

接上文&#xff08;亲测有效&#xff09;SpringBoot项目集成腾讯云COS对象存储&#xff08;1&#xff09;-CSDN博客 目录 3、通用能力类 文件下载 测试 3、通用能力类 文件下载 官方文档介绍了2种文件下载方式。一种是直接下载 COS 的文件到后端服务器&#xff08;适合服务…...

界面优化 - QSS

目录 1、背景介绍 2、基本语法 3、QSS 设置方式 3.1 指定控件样式设置 代码示例: 子元素受到影响 3.2 全局样式设置 代码示例: 使用全局样式 代码示例: 样式的层叠特性 代码示例: 样式的优先级 3.3 从文件加载样式表 代码示例: 从文件加载全局样式 3.4 使用 Qt Desi…...

实现基于TCP协议的服务器与客户机间简单通信

服务器端程序 #include <myhead.h> #define SER_PORT 6666 //服务器端口号 #define SER_IP "192.168.2.53" //服务器ip地址 int main(int argc, char const *argv[]) { /*创建套接字 int socket(int domain, int type, int protocol);*/ …...

在uniapp中使用navigator.MediaDevices.getUserMedia()拍照并上传服务器

产品提了这样一个需求&#xff1a; 移动端拍照上传后图片不保存在用户设备上&#xff0c;试了好几种方法&#xff0c;uni-file-picker、uni.chooseImage、input type‘file’&#xff0c;安卓手机都会默认把图片保存在手机&#xff0c;于是各种查资料&#xff0c;找到了以下方法…...

PULLUP

重要提示&#xff1a;PULLUP属性已被弃用&#xff0c;应替换为PULLTYPE 财产。 PULLUP在三态输出或双向端口上应用弱逻辑高&#xff0c;以防止 它从漂浮。PULLUP属性保证逻辑高电平&#xff0c;以允许三态网络 以避免在不被驱动时漂浮。 输入缓冲器&#xff08;如IBUF&#xff…...

【无标题】乐天HIQ壁挂炉使用

这里写自定义目录标题 1.按键①&#xff1a; 按一下&#xff0c;小液晶显示的温度是所设定的供暖温度&#xff1b; 按二下&#xff0c;小液晶显示的温度是所设定的生活热水温度&#xff1b; 按三下&#xff0c;小液晶显示的温度是所设定的室内温度&#xff1b; 如果忘记按几下的…...

使用Python编写AI程序,让机器变得更智能

人工智能&#xff08;AI&#xff09;是当今科技领域最热门的话题之一。随着Python编程语言的逐渐流行&#xff0c;它已经成为许多人工智能编程的首选语言。本文将介绍如何使用Python编写AI程序&#xff0c;让机器变得更智能。 首先&#xff0c;Python提供了大量的AI库和工具&a…...

VScode + PlatformIO 和 Keil 开发 STM32

以前经常使用 KEIL 写 STM32 的代码&#xff0c;自从使用 VScode 写 ESP32 后感觉 KEIL 的开发环境不美观不智能了&#xff0c;后面学习了 VScode 开发 STM32 。 使用过程中发现 串口重定向在 KEIL 中可以用&#xff0c;搬到 VScode 后不能用&#xff0c;不用勾选 Use Micro LI…...

PostgreSQL 练习 ---- psql 新增连接参数

目标 添加一个连接参数&#xff0c;默认为 false 。当 psql 连接时&#xff0c;若该连接参数非 “true” 时&#xff0c;用户 “u1“ 对表对象无操作权限&#xff0c;包括自己拥有的表。 连接机制简介 连接过程如下所述&#xff1a; 客户端初始化一个空连接&#xff0c;设置…...

pdf翻译软件哪个好用?多语言轻松转

想知道怎么用pdf翻译器在线翻译吗&#xff1f;无需复杂操作&#xff0c;一键即可解锁语言障碍。 在这个全球化日益加深的时代&#xff0c;掌握pdf文件的快速翻译技巧尤为重要。 无论是学习、工作还是国际交流&#xff0c;以下4个免费pdf翻译技巧都将是你不可或缺的得力助手。…...

培训第三十天(ansible模块的使用)

上午 ansible是⼀种由Python开发的⾃动化运维⼯具&#xff0c;集合了众多运维⼯ 具&#xff08;puppet、cfengine、chef、func、fabric&#xff09;的优点&#xff0c;实现了批量 系统配置、批量程序部署、批量运⾏命令等功能。 1、学习ansible的使用 ansible 主机ip|域名|组…...

关于Log4net的使用记录——无法生成日志文件输出

关于Log4net的使用记录 前言遇到的问题具体使用总结前言 最近在使用log4net进行日志记录,保存一些需要的数据,以便后期使用需要。在使用的时候出现没有生成日志文件,针对这些问题,发现解决的办法! 遇到的问题 报错,提示没有找到对应的文件。 log4net:ERROR Failed to f…...

golang Kratos 概念

"Kratos"指的是一个开源的微服务框架&#xff0c;它用于构建高性能和可扩展的云原生应用。Kratos框架提供了一套丰富的工具和库&#xff0c;旨在简化微服务的开发和维护。下面是Kratos框架的一些基本概念&#xff1a; 服务构建与注册&#xff1a; gRPC与HTTP服务&…...

入门 MySQL 数据库:基础指南

简介 MySQL 是一个非常流行的开源关系型数据库管理系统&#xff08;RDBMS&#xff09;&#xff0c;广泛用于 Web 应用、企业应用和数据仓库。本博客将引导你从零开始&#xff0c;学习 MySQL 数据库的基础知识。 什么是 MySQL&#xff1f; MySQL 是一个基于 SQL&#xff08;Str…...

【Hexo系列】【3】使用GitHub自带的自定义域名解析

上一期我们通过学习【Hexo系列】【2】使用Vercel加速Hexo博客访问使用Vercel进行GitHub同步与加速&#xff0c;有时候Vercel也不太稳定访问不了。本身GitHub也是支持自定义域名的&#xff0c;本次教程将讲解如何使用GitHub自带的自定义域名解析。 1. GitHub设置 1.1 登录GitH…...

智能监控,无忧仓储:EasyCVR视频汇聚+AI智能分享技术为药品仓库安全保驾护航

随着科技的飞速发展&#xff0c;药品仓库的安全管理正迎来前所未有的变革。药品作为直接关系到公众健康的重要物资&#xff0c;其安全存储和监管显得尤为重要。在这个背景下&#xff0c;视频汇聚平台EasyCVR视频智能管理系统的应用&#xff0c;为药品仓库的安全监管提供了强有力…...

本地创建PyPI镜像

背景: 在安装一些库时,经常需要反复下载包(有的体积比较大,所以会比较慢),所以考虑在本地创建一个pypi镜像,把常用的库缓存下来,这样安装就会很省事.比较从本地安装库和从服务器下载会快很多. 安装使用 安装:pip install devpi 初始化: devpi-init --serverdirF:\pypioutput…...

使用 Elasticsearch RestHighLevelClient 进行查询

Elasticsearch 提供了多种客户端库&#xff0c;以方便不同编程语言的用户进行操作。其中&#xff0c;Java 的 RestHighLevelClient 是 Elasticsearch 官方推荐的客户端之一&#xff0c;用于 Java 应用程序中。本文将介绍如何使用 Java 的 RestHighLevelClient 进行 Elasticsear…...

【jvm】符号引用

目录 1. 说明2. 特点3. 组成与格式4. 作用5. 过程 1. 说明 1.在Java虚拟机中&#xff0c;符号引用&#xff08;Symbolic Reference&#xff09;是一种重要的引用机制。2.它主要用于在编译阶段和类加载阶段之间建立对类、方法、字段等元素的引用关系。3.符号引用是指用一个符号…...

征服云端:Java微服务与Docker容器化之旅

引言 随着云计算技术的迅猛发展&#xff0c;越来越多的企业开始拥抱云原生技术。在这个过程中&#xff0c;微服务架构以其独特的魅力成为了众多开发者的首选方案。而Docker作为容器化领域的佼佼者&#xff0c;在微服务部署与管理方面扮演着不可或缺的角色。本文将带你深入了解…...

python 如何实现执行selenium自动化测试用例自动录屏?

做自动化测试已经好多年了&#xff0c;随着项目技术的正增长提升&#xff0c;我们也不断完善并提高自己的技术能力&#xff0c; 下面给大家分享一个 selenium 自动化执行测试用例的录屏功能。希望对大家有帮助&#xff01; 首先&#xff0c;我们为什么要执行自动化录屏功能呢…...

03 网络编程 TCP传输控制协议

目录 1、TCP基本特征 2、TCP通信流程基本原理 &#xff08;1&#xff09;基本原理 &#xff08;2&#xff09;TCP通信代码实现 &#xff08;3&#xff09;核心API解析 1&#xff09;地址绑定--bind 2)设置监听-listen 3)等待连接请求-accept-产生一个已连接套接字 4&a…...

1. 数据结构——顺序表的主要操作

1. 内容 顺序表的初始化、插入、删除、按值查找、输出以及其时间复杂度的计算。 2.代码 #include<stdio.h> #include<stdlib.h> //函数结果状态代码 #define OK 1 #define OVERFLOW -2 #define ERROR 0 #define MAXSIZE 100typedef int ElemType; //顺序表每个…...