Interface PageUtil


  • public interface PageUtil
    Calculate offset and limit parameters in SQL queries.
    Since:
    2021-12-08
    Version:
    1.0.3
    Author:
    fantasticmao
    • Method Summary

      Static Methods 
      Modifier and Type Method Description
      static int limit​(int size)
      Calculate the page size
      static int offset​(int page, int size)
      Calculate the page offset.
    • Method Detail

      • offset

        static int offset​(int page,
                          int size)
        Calculate the page offset.
        Parameters:
        page - greater or equals than 0
        size - greater or equals than 1, and less or equals than 500
        Returns:
        valid page offset
      • limit

        static int limit​(int size)
        Calculate the page size
        Parameters:
        size - greater or equals than 1, and less or equals than 500
        Returns:
        valid page size