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

ylbtech-Java-Class-C:com.github.pagehelper.PageHelper

 

1. Back to top
 
2. Return to top
1.1、

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

1.2.1, List collection
    / ** 
     * showdoc 
     * 
     * @catalog management platform 
     * @title in school list 
     * @description in school list 
     * @method POST 
     * @url ip: Port / the Order / OrderList 
     * Required @return_param pno num page numbers 
     * @return_param psize Required num page size 
     * @return_param organizationID Required string agencies the above mentioned 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 course the above mentioned id 
     * @return_param buyTime String buy time 
     * @return_param channel string payment channels (1 merchants Alipay; 2 - merchants micro-channel; 3- individual Alipay; 4 individual micro-channel) 
     * @return_param the Comment String Remarks 
     * @return_param courseID string course the above mentioned id 
     * @return_param leaveMsg String message 
     * @return_param mobile string phone 
     * @return_param orderID string order the above mentioned id 
     * @return_param String organizationID 
     * @return_param payState String pay state 0- to be paid; 1- paid; -1- retreat section 
     * @return_param price string price 
     * @remark here is information Remarks 
     * @number 1 
     * / 
    @ApiOperation (value = "list in school" ) 
    @PostMapping ( "/ studentOrderList")
     Public the Result studentOrderList (the HttpServletRequest Request, @RequestBody (= required to false ) StudentOrder studentOrder) {
         the try { 

            / ** 
             * payment status query to a completion of payment, 2 for the two states of data 
             * / 
            PageHelper.startPage (studentOrder.getPno ( ), studentOrder.getPsize ()); 
            List List = studentOrderService.selectStudentOrderList1 (studentOrder); 
            PageInfo <Course,> = PageInfo PageInfo.of (List);
             return ResultGenerator.genOkResult (PageInfo); 
        } the catch (Exception E) { 
            log.error ( "query abnormal course list", E);
             return ResultGenerator.genFailedResult (500, "the system abnormality" ); 
        } 

    }

1.2.2, List <Map> collection

 @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. Back to top
 
4. Top
1、
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2014-2017 [email protected]
 *
 * 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 the extends PageMethod the implements the Dialect {
     Private PageParams pageParams;
     Private PageAutoDialect autoDialect; 

    @Override 
    public  Boolean Skip (MappedStatement MS, Object parameterObject, RowBounds RowBounds) {
         IF (ms.getId (). endsWith (MSUtils.COUNT)) {
             the throw  new new a RuntimeException ( "found in the system a plurality of plug-in tab, check the system configuration!" ) ; 
        }
        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) {
        returnautoDialect.getDelegate () getPageSql (MS, boundSql, parameterObject, RowBounds, pageKey);. 
    } 

    public String getPageSql (String SQL, Page Page, RowBounds RowBounds, the CacheKey pageKey) {
         return autoDialect.getDelegate () getPageSql (SQL, Page,. pageKey); 
    } 

    @Override 
    public Object afterpage (List pageList, Object parameterObject, RowBounds RowBounds) {
         // this method will be executed without paging, so determined null 
        AbstractHelperDialect the delegate = autoDialect.getDelegate ();
         IF (the delegate =! null ) {
             return delegate.afterPage (pageList, parameterObject, RowBounds); 
        }
        return pageList; 
    } 

    @Override 
    public  void Afterall () {
         // This method will be executed without paging, so determined null 
        AbstractHelperDialect the delegate = autoDialect.getDelegate ();
         IF (! the delegate = null ) { 
            delegate.afterAll () ; 
            autoDialect.clearDelegate (); 
        } 
        clearpage (); 
    } 

    @Override 
    public  void the setProperties (the Properties Properties) { 
        setStaticProperties (Properties); 
        pageParams = new new pageParams (); 
        autoDialect= New new PageAutoDialect (); 
        pageParams.setProperties (Properties); 
        autoDialect.setProperties (Properties); 
        // 20,180,902 new aggregateFunctions, allowed to manually add aggregate function (affecting the number of rows) 
        CountSqlParser.addAggregateFunctions (Properties.getProperty ( "aggregateFunctions" )) ; 
    } 
}
2、
5. Top
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; 

    / ** creation time * / 
    @JsonFormat (pattern = "the MM-dd-YYYY HH: mm: SS" )
     Private a Date createTime; 

    / ** updater * / 
    Private String updateBy; 

    / ** Update time * / 
    @JsonFormat (pattern = "the mM-dd-YYYY HH: mm: SS" )
     Private a Date updateTime; 

    / ** Remarks * / 
    Private String the remark;
     / ** 
     * page numbers 
     * / 
    Private  int PNO =. 1 ;
     / ** 
     * page size 
     * / 
    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. Back to top
 
warn Author: ylbtech
Source: http://ylbtech.cnblogs.com/
This article belongs to the author and blog Park total, welcome to reprint, but without the author's consent declared by this section must be retained, and given the original connection in the apparent position of the article page, otherwise We reserve the right to pursue legal responsibilities.

Guess you like

Origin www.cnblogs.com/storebook/p/11103221.html