示例#1
0
 /**
  * 构造方法
  *
  * @param strDialect
  */
 public SqlUtil(String strDialect) {
   if (strDialect == null || "".equals(strDialect)) {
     throw new IllegalArgumentException("Mybatis分页插件无法获取dialect参数!");
   }
   dialect = Dialect.of(strDialect);
   parser = AbstractParser.newParser(dialect);
 }
示例#2
0
 /**
  * 测试[控制台输出]count和分页sql
  *
  * @param dialect 数据库类型
  * @param originalSql 原sql
  */
 public static void testSql(Dialect dialect, String originalSql) {
   Parser parser = AbstractParser.newParser(dialect);
   if (dialect == Dialect.sqlserver) {
     setLocalPage(new Page(1, 10));
   }
   String countSql = parser.getCountSql(originalSql);
   System.out.println(countSql);
   String pageSql = parser.getPageSql(originalSql);
   System.out.println(pageSql);
   if (dialect == Dialect.sqlserver) {
     clearLocalPage();
   }
 }