Class CountJSqlParser47

  • All Implemented Interfaces:
    com.github.pagehelper.parser.CountSqlParser

    public class CountJSqlParser47
    extends Object
    implements com.github.pagehelper.parser.CountSqlParser
    sql解析类,提供更智能的count查询sql
    Author:
    liuzh
    • Field Detail

      • TABLE_ALIAS

        protected static final net.sf.jsqlparser.expression.Alias TABLE_ALIAS
      • skipFunctions

        protected final Set<String> skipFunctions
      • falseFunctions

        protected final Set<String> falseFunctions
    • Constructor Detail

      • CountJSqlParser47

        public CountJSqlParser47()
    • Method Detail

      • getSmartCountSql

        public String getSmartCountSql​(String sql,
                                       String countColumn)
        获取智能的countSql
        Specified by:
        getSmartCountSql in interface com.github.pagehelper.parser.CountSqlParser
        Parameters:
        sql -
        countColumn - 列名,默认 0
        Returns:
      • getSimpleCountSql

        public String getSimpleCountSql​(String sql)
        获取普通的Count-sql
        Parameters:
        sql - 原查询sql
        Returns:
        返回count查询sql
      • getSimpleCountSql

        public String getSimpleCountSql​(String sql,
                                        String name)
        获取普通的Count-sql
        Parameters:
        sql - 原查询sql
        Returns:
        返回count查询sql
      • sqlToCount

        public net.sf.jsqlparser.statement.select.Select sqlToCount​(net.sf.jsqlparser.statement.select.Select select,
                                                                    String name)
        将sql转换为count查询
        Parameters:
        select -
      • isSimpleCount

        public boolean isSimpleCount​(net.sf.jsqlparser.statement.select.PlainSelect select)
        是否可以用简单的count查询方式
        Parameters:
        select -
        Returns:
      • processSelect

        public void processSelect​(net.sf.jsqlparser.statement.select.Select select)
        处理selectBody去除Order by
        Parameters:
        select -
      • processPlainSelect

        public void processPlainSelect​(net.sf.jsqlparser.statement.select.PlainSelect plainSelect)
        处理PlainSelect类型的selectBody
        Parameters:
        plainSelect -
      • processWithItemsList

        public void processWithItemsList​(List<net.sf.jsqlparser.statement.select.WithItem> withItemsList)
        处理WithItem
        Parameters:
        withItemsList -
      • processFromItem

        public void processFromItem​(net.sf.jsqlparser.statement.select.FromItem fromItem)
        处理子查询
        Parameters:
        fromItem -
      • keepOrderBy

        protected boolean keepOrderBy()
        保留 order by
      • keepSubSelectOrderBy

        protected boolean keepSubSelectOrderBy()
        保留子查询 order by
      • orderByHashParameters

        public boolean orderByHashParameters​(List<net.sf.jsqlparser.statement.select.OrderByElement> orderByElements)
        判断Orderby是否包含参数,有参数的不能去
        Parameters:
        orderByElements -
        Returns: