• Java-Class-C:com.github.pagehelper.PageHelper.java


    ylbtech-Java-Class-C:com.github.pagehelper.PageHelper.java
    1.返回顶部
     
    2.返回顶部
    1.1、

    import com.github.pagehelper.PageHelper;
    import com.github.pagehelper.PageInfo;

    1.2.1、List集合
        /**
         * showdoc
         *
         * @catalog 管理平台
         * @title 在学列表
         * @description 在学列表
         * @method post
         * @url ip:port/order/orderList
         * @return_param pno            必选 num 分页页码
         * @return_param psize          必选 num 分页大小
         * @return_param organizationID 必选 string 机构id
         * @return {"code":200,"data":{"endRow":5,"hasNextPage":false,"hasPreviousPage":false,"isFirstPage":true,"isLastPage":true,"list":[{"buyTime":"2019-02-19 17:47:09","channel":4,"comment":"test","courseID":"b180117000001","leaveMsg":"test","mobile":"13800000000","orderID":"o190219174710","organizationID":"ylbtech","params":{},"payState":0,"pno":1,"price":0,"psize":10,"studentID":"test"},{"buyTime":"2019-02-19 17:45:47","channel":4,"comment":"test","courseID":"b180117000001","leaveMsg":"test","mobile":"13800000000","orderID":"o190219174547","organizationID":"ylbtech","params":{},"payState":0,"pno":1,"price":0,"psize":10,"studentID":"test"},{"buyTime":"2019-02-19 17:45:47","channel":4,"comment":"test","courseID":"b180117000001","leaveMsg":"test","mobile":"13800000000","orderID":"o190219174548","organizationID":"ylbtech","params":{},"payState":0,"pno":1,"price":0,"psize":10,"studentID":"test"},{"buyTime":"2019-02-19 17:45:42","channel":4,"comment":"test","courseID":"b180117000001","leaveMsg":"test","mobile":"13800000000","orderID":"o190219174542","organizationID":"ylbtech","params":{},"payState":0,"pno":1,"price":0,"psize":10,"studentID":"test"},{"buyTime":"2019-02-19 17:01:04","channel":4,"comment":"test","courseID":"b180117000001","leaveMsg":"test","mobile":"13800000000","orderID":"o190219170104","organizationID":"ylbtech","params":{},"payState":0,"pno":1,"price":0,"psize":10,"studentID":"test"}],"navigateFirstPage":1,"navigateLastPage":1,"navigatePages":8,"navigatepageNums":[1],"nextPage":0,"pageNum":1,"pageSize":10,"pages":1,"prePage":0,"size":5,"startRow":1,"total":5}}
         * @return_param courseID  string 课程id
         * @return_param buyTime string 购买时间
         * @return_param channel string 支付渠道(1-商户支付宝;2-商户微信;3-个人支付宝;4个人微信)
         * @return_param comment string  备注
         * @return_param courseID string 课程id
         * @return_param leaveMsg string 留言
         * @return_param mobile string 联系电话
         * @return_param orderID string 订单id
         * @return_param organizationID string
         * @return_param payState string 支付状态0-待支付; 1-已支付;-1-退款
         * @return_param price string 价格
         * @remark 这里是备注信息
         * @number 1
         */
        @ApiOperation(value = "在学列表")
        @PostMapping("/studentOrderList")
        public Result studentOrderList(HttpServletRequest request, @RequestBody(required = false) StudentOrder studentOrder) {
            try {
    
                /**
                 * 查询 支付状态 为 1 支付完成, 2 进行中 两种状态 数据
                 */
                PageHelper.startPage(studentOrder.getPno(), studentOrder.getPsize());
                List list = studentOrderService.selectStudentOrderList1(studentOrder);
                PageInfo<Course> pageInfo = PageInfo.of(list);
                return ResultGenerator.genOkResult(pageInfo);
            } catch (Exception e) {
                log.error("查询课程列表异常", e);
                return ResultGenerator.genFailedResult(500, "系统异常");
            }
    
        }

    1.2.2、List<Map>集合

     @ApiOperation(value = "查询拼团情况列表")
        @PostMapping("/selectGroupSituationListById")
        public Result selectGroupSituationListById(HttpServletRequest request, @RequestBody() Map pa) {
            try {
                String organizationId = TokenUtils.getOrganizationId(request, jwtUtil);
    
                int pno = (int) pa.get("pno");
                int psize = (int) pa.get("psize");
                PageHelper.startPage(pno, psize);
                pa.put("organizationId",organizationId);
                List<Map> list = grouactivityMapper.selectGroupSituationListById(pa);
                PageInfo<Map> pageInfo = PageInfo.of(list);
                return ResultGenerator.genOkResult(pageInfo);
            } catch (Exception e) {
                log.error("列表异常", e);
                return ResultGenerator.genFailedResult(500, "系统异常");
            }
        }
    1.3、
    3.返回顶部
     
    4.返回顶部
    1、
    /*
     * The MIT License (MIT)
     *
     * Copyright (c) 2014-2017 abel533@gmail.com
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    
    package com.github.pagehelper;
    
    import com.github.pagehelper.dialect.AbstractHelperDialect;
    import com.github.pagehelper.page.PageAutoDialect;
    import com.github.pagehelper.page.PageMethod;
    import com.github.pagehelper.page.PageParams;
    import com.github.pagehelper.parser.CountSqlParser;
    import com.github.pagehelper.util.MSUtils;
    import com.github.pagehelper.util.StringUtil;
    import org.apache.ibatis.cache.CacheKey;
    import org.apache.ibatis.mapping.BoundSql;
    import org.apache.ibatis.mapping.MappedStatement;
    import org.apache.ibatis.session.RowBounds;
    
    import java.util.List;
    import java.util.Properties;
    
    /**
     * Mybatis - 通用分页拦截器<br/>
     * 项目地址 : http://git.oschina.net/free/Mybatis_PageHelper
     *
     * @author liuzh/abel533/isea533
     * @version 5.0.0
     */
    public class PageHelper extends PageMethod implements Dialect {
        private PageParams pageParams;
        private PageAutoDialect autoDialect;
    
        @Override
        public boolean skip(MappedStatement ms, Object parameterObject, RowBounds rowBounds) {
            if (ms.getId().endsWith(MSUtils.COUNT)) {
                throw new RuntimeException("在系统中发现了多个分页插件,请检查系统配置!");
            }
            Page page = pageParams.getPage(parameterObject, rowBounds);
            if (page == null) {
                return true;
            } else {
                //设置默认的 count 列
                if (StringUtil.isEmpty(page.getCountColumn())) {
                    page.setCountColumn(pageParams.getCountColumn());
                }
                autoDialect.initDelegateDialect(ms);
                return false;
            }
        }
    
        @Override
        public boolean beforeCount(MappedStatement ms, Object parameterObject, RowBounds rowBounds) {
            return autoDialect.getDelegate().beforeCount(ms, parameterObject, rowBounds);
        }
    
        @Override
        public String getCountSql(MappedStatement ms, BoundSql boundSql, Object parameterObject, RowBounds rowBounds, CacheKey countKey) {
            return autoDialect.getDelegate().getCountSql(ms, boundSql, parameterObject, rowBounds, countKey);
        }
    
        @Override
        public boolean afterCount(long count, Object parameterObject, RowBounds rowBounds) {
            return autoDialect.getDelegate().afterCount(count, parameterObject, rowBounds);
        }
    
        @Override
        public Object processParameterObject(MappedStatement ms, Object parameterObject, BoundSql boundSql, CacheKey pageKey) {
            return autoDialect.getDelegate().processParameterObject(ms, parameterObject, boundSql, pageKey);
        }
    
        @Override
        public boolean beforePage(MappedStatement ms, Object parameterObject, RowBounds rowBounds) {
            return autoDialect.getDelegate().beforePage(ms, parameterObject, rowBounds);
        }
    
        @Override
        public String getPageSql(MappedStatement ms, BoundSql boundSql, Object parameterObject, RowBounds rowBounds, CacheKey pageKey) {
            return autoDialect.getDelegate().getPageSql(ms, boundSql, parameterObject, rowBounds, pageKey);
        }
    
        public String getPageSql(String sql, Page page, RowBounds rowBounds, CacheKey pageKey) {
            return autoDialect.getDelegate().getPageSql(sql, page, pageKey);
        }
    
        @Override
        public Object afterPage(List pageList, Object parameterObject, RowBounds rowBounds) {
            //这个方法即使不分页也会被执行,所以要判断 null
            AbstractHelperDialect delegate = autoDialect.getDelegate();
            if (delegate != null) {
                return delegate.afterPage(pageList, parameterObject, rowBounds);
            }
            return pageList;
        }
    
        @Override
        public void afterAll() {
            //这个方法即使不分页也会被执行,所以要判断 null
            AbstractHelperDialect delegate = autoDialect.getDelegate();
            if (delegate != null) {
                delegate.afterAll();
                autoDialect.clearDelegate();
            }
            clearPage();
        }
    
        @Override
        public void setProperties(Properties properties) {
            setStaticProperties(properties);
            pageParams = new PageParams();
            autoDialect = new PageAutoDialect();
            pageParams.setProperties(properties);
            autoDialect.setProperties(properties);
            //20180902新增 aggregateFunctions, 允许手动添加聚合函数(影响行数)
            CountSqlParser.addAggregateFunctions(properties.getProperty("aggregateFunctions"));
        }
    }
    2、
    5.返回顶部
    1.1、Class.java
    package com.ylbtech.edu.pclass.domain;
    
    import com.ylbtech.common.base.BaseEntity;
    
    /**
     * class表 class
     * 
     * @author ylbtech
     * @date 2019-02-22
     */
    public class Class extends BaseEntity
    {
        
    }
    View Code
    1.2、BaseEntity.java
    package com.ylbtech.common.base;
    
    import java.io.Serializable;
    import java.util.Date;
    import java.util.HashMap;
    import java.util.Map;
    import com.fasterxml.jackson.annotation.JsonFormat;
    
    /**
     * Entity基类
     * 
     * @author ylbtech
     */
    public class BaseEntity implements Serializable
    {
        private static final long serialVersionUID = 1L;
    
        /** 搜索值 */
        private String searchValue;
    
        /** 创建者 */
        private String createBy;
    
        /** 创建时间 */
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private Date createTime;
    
        /** 更新者 */
        private String updateBy;
    
        /** 更新时间 */
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private Date updateTime;
    
        /** 备注 */
        private String remark;
        /**
         * 分页 页码
         */
        private int pno =1;
        /**
         * 分页 大小
         */
        private int psize =10;
    
        /** 请求参数 */
        private Map<String, Object> params;
    
        public String getSearchValue()
        {
            return searchValue;
        }
    
        public void setSearchValue(String searchValue)
        {
            this.searchValue = searchValue;
        }
    
        public String getCreateBy()
        {
            return createBy;
        }
    
        public void setCreateBy(String createBy)
        {
            this.createBy = createBy;
        }
    
        public Date getCreateTime()
        {
            return createTime;
        }
    
        public void setCreateTime(Date createTime)
        {
            this.createTime = createTime;
        }
    
        public String getUpdateBy()
        {
            return updateBy;
        }
    
        public void setUpdateBy(String updateBy)
        {
            this.updateBy = updateBy;
        }
    
        public Date getUpdateTime()
        {
            return updateTime;
        }
    
        public void setUpdateTime(Date updateTime)
        {
            this.updateTime = updateTime;
        }
    
        public String getRemark()
        {
            return remark;
        }
    
        public void setRemark(String remark)
        {
            this.remark = remark;
        }
    
        public Map<String, Object> getParams()
        {
            if (params == null)
            {
                params = new HashMap<>();
            }
            return params;
        }
    
        public int getPno() {
            return pno;
        }
    
        public void setPno(int pno) {
            this.pno = pno;
        }
    
        public int getPsize() {
            return psize;
        }
    
        public void setPsize(int psize) {
            this.psize = psize;
        }
    
        public void setParams(Map<String, Object> params)
        {
            this.params = params;
        }
    }
    BaseEntity.java
    1.3、
     
    6.返回顶部
     
    warn 作者:ylbtech
    出处:http://ylbtech.cnblogs.com/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    一年来把自己从学.Net到用.Net,收集的资料共享出来B/s中的存储过程(二)
    收集的.Net文章(十五)ASP.NET 2.0 Caching For performance
    收集的.Net文章(十六)SQL Server日期计算
    P.V操作原语和信号量
    2004年2008年系分论文题目整理,考SA的可以看一下
    2010年个人总结
    MASM,NASM和AT&T汇编格式备注
    Unity Application Block 学习笔记之一使用配置文件
    Javascript 学习笔记之String类测试
    javascript学习笔记之Object类型测试
  • 原文地址:https://www.cnblogs.com/storebook/p/11103221.html
Copyright © 2020-2023  润新知