public class QueryUtils extends Object
| 构造器和说明 |
|---|
QueryUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
getCompletedSQL(String relation,
String whereSql,
DatabaseType type,
CommonWrapper wrapper)
获取完整查询语句
|
static Long |
getEndCount(Long curPage,
Long limit)
获取分页end条数
|
static Long |
getEndCount(Long curPage,
Long limit,
DatabaseType type) |
static List<Map<String,Object>> |
getListResult(CommonMapper baseMapper,
QueryOptions params,
Class c,
DatabaseType type)
获取查询结果集(map)
|
static PageData |
getPageResult(CommonMapper baseMapper,
QueryOptions params,
Class c,
DatabaseType type)
获取查询返回分页结果集(map)
|
static String |
getRelation(Class c)
获取表间关系
通过注解获取当前业务表间关系,此项为必填项
|
static String |
getRelation(String relation,
List<String> columns,
List<TableInfo> tableInfos) |
static Result |
getResult(CommonMapper baseMapper,
QueryOptions params,
Class c)
获取查询结果集并封装返回数据格式
|
static Result |
getResult(CommonMapper baseMapper,
QueryOptions params,
Class c,
DatabaseType type)
获取查询返回结果集(map)
|
static Long |
getStartCount(Long curPage,
Long limit)
获取分页start条数
|
static QueryOptions |
splitOptions(QueryOptions params,
Class c)
二次拼接查询参数
|
static QueryOptions |
splitOptions(QueryOptions params,
List<TableInfo> tableInfos)
二次拼接查询参数
|
static String |
splitPage(String sql,
CommonWrapper wrapper)
拼接mysql分页参数
|
static String |
splitSql(CommonWrapper wrapper) |
static String |
splitWhereSql(CommonWrapper wrapper) |
static String |
splitWhereSql(String sql,
Map<String,Object> map)
二次拼接wrapper内条件sql
将引用参数转换为实参
|
static String |
testSql(QueryOptions params,
Class c,
DatabaseType type) |
public static String splitSql(CommonWrapper wrapper)
public static QueryOptions splitOptions(QueryOptions params, Class c)
params - c - public static QueryOptions splitOptions(QueryOptions params, List<TableInfo> tableInfos)
params - tableInfos - 反射列public static String splitWhereSql(String sql, Map<String,Object> map)
sql - sqlmap - 实参值public static String splitWhereSql(CommonWrapper wrapper)
public static String splitPage(String sql, CommonWrapper wrapper)
sql - wrapper - public static String getRelation(String relation, List<String> columns, List<TableInfo> tableInfos)
public static Long getStartCount(Long curPage, Long limit)
curPage - limit - public static Long getEndCount(Long curPage, Long limit)
curPage - limit - public static Long getEndCount(Long curPage, Long limit, DatabaseType type)
public static String getCompletedSQL(String relation, String whereSql, DatabaseType type, CommonWrapper wrapper)
relation - 表间关系 SQL语句whereSql - where后条件SQL语句type - 数据库类型wrapper - 构造器(获取返回表字段,分页参数等)public static Result getResult(CommonMapper baseMapper, QueryOptions params, Class c)
baseMapper - params - c - public static Result getResult(CommonMapper baseMapper, QueryOptions params, Class c, DatabaseType type)
baseMapper - 当前业务mapperparams - 查询参数c - 当前业务VO类type - 当前数据库类型(默认为Mysql)public static PageData getPageResult(CommonMapper baseMapper, QueryOptions params, Class c, DatabaseType type)
baseMapper - 当前业务mapperparams - 查询参数c - 当前业务VO类type - 当前数据库类型(默认为Mysql)public static List<Map<String,Object>> getListResult(CommonMapper baseMapper, QueryOptions params, Class c, DatabaseType type)
baseMapper - 当前业务mapperparams - 查询参数c - 当前业务VO类type - 当前数据库类型(默认为Mysql)public static String testSql(QueryOptions params, Class c, DatabaseType type)
Copyright © 2020. All rights reserved.