public class SessionUtil extends Object
| 构造器和说明 |
|---|
SessionUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
batchUpdate(Connection connection,
List<String> sql) |
static void |
batchUpdate(Connection connection,
String sql,
List<Map<String,Object>> params)
批量更新
|
static long |
count(Connection connection,
String sql) |
static long |
count(Connection connection,
String sql,
Object param) |
static List<Map<String,Object>> |
execute(Connection connection,
String sql) |
static <T> List<T> |
limit(Connection connection,
String sql,
Class<T> clazz,
int offset,
int count) |
static <T> List<T> |
limit(Connection connection,
String sql,
Class<T> clazz,
Object param,
int offset,
int count) |
static List<Map<String,Object>> |
limit(Connection connection,
String sql,
int offset,
int count) |
static List<Map<String,Object>> |
limit(Connection connection,
String sql,
Object param,
int offset,
int count) |
static List<Map<String,Object>> |
query(Connection connection,
String sql) |
static <T> List<T> |
query(Connection connection,
String sql,
Class<T> clazz) |
static <T> List<T> |
query(Connection connection,
String sql,
Class<T> clazz,
Object param)
查询并且将结果转换为java对象
|
static List<Map<String,Object>> |
query(Connection connection,
String sql,
Object param)
查询
|
static <T> List<T> |
toJavaObjectList(Class<T> clazz,
List<Map<String,Object>> data)
List Map转换为List clazz
|
static int |
update(Connection connection,
String sql) |
static int |
update(Connection connection,
String sql,
Object param) |
public static <T> List<T> query(Connection connection, String sql, Class<T> clazz, Object param) throws SQLException
T - 泛型connection - 连接sql - sqlclazz - 结果要转换的类型param - sql占位参数SQLExceptionpublic static <T> List<T> query(Connection connection, String sql, Class<T> clazz) throws SQLException
SQLExceptionpublic static List<Map<String,Object>> query(Connection connection, String sql, Object param) throws SQLException
connection - 连接sql - sqlparam - sql占位参数SQLExceptionpublic static List<Map<String,Object>> query(Connection connection, String sql) throws SQLException
SQLExceptionpublic static <T> List<T> limit(Connection connection, String sql, Class<T> clazz, Object param, int offset, int count) throws SQLException
SQLExceptionpublic static <T> List<T> limit(Connection connection, String sql, Class<T> clazz, int offset, int count) throws SQLException
SQLExceptionpublic static List<Map<String,Object>> limit(Connection connection, String sql, Object param, int offset, int count) throws SQLException
SQLExceptionpublic static List<Map<String,Object>> limit(Connection connection, String sql, int offset, int count) throws SQLException
SQLExceptionpublic static long count(Connection connection, String sql, Object param) throws SQLException
SQLExceptionpublic static long count(Connection connection, String sql) throws SQLException
SQLExceptionpublic static <T> List<T> toJavaObjectList(Class<T> clazz, List<Map<String,Object>> data)
T - 泛型clazz - 转换后的List元素类型data - 转换前的数据public static int update(Connection connection, String sql) throws SQLException
SQLExceptionpublic static int update(Connection connection, String sql, Object param) throws SQLException
SQLExceptionpublic static void batchUpdate(Connection connection, List<String> sql) throws SQLException
SQLExceptionpublic static void batchUpdate(Connection connection, String sql, List<Map<String,Object>> params) throws SQLException
connection - 连接sql - sqlparams - sql的占位参数集合,一个元素就是一条数据SQLExceptionCopyright © 2022. All rights reserved.