程序包 cn.myafx.data
接口 IDatabase
- 所有超级接口:
AutoCloseable
- 所有已知实现类:
Database
database
-
方法概要
修饰符和类型方法说明intadd row<TModel extends Model>
intadd modelvoidbegin transactionvoidbeginTransaction(IsolationLevel level) begin transactionvoidcommit()commit<TModel extends Model>
intdeleteintdeleteintexecute sql<TModel extends Model>
TModelget first modelget List modelbooleanisClose()is closebooleanis transactionvoidopen()open<T> List<T>query ListqueryListMap(String sql, Object... param) query List Map<String, Object><T> Tquery first modelqueryOneMap(String sql, Object... param) query first Map<String, Object>voidrollback()rollback<TModel extends Model>
intupdateintupdate从接口继承的方法 java.lang.AutoCloseable
close
-
方法详细资料
-
isClose
boolean isClose()is close- 返回:
- boolean
-
isTransaction
boolean isTransaction()is transaction- 返回:
- boolean
-
open
open- 抛出:
Exception
-
beginTransaction
begin transaction- 抛出:
Exception
-
beginTransaction
begin transaction- 参数:
level- IsolationLevel- 抛出:
Exception
-
commit
commit- 抛出:
Exception
-
rollback
rollback- 抛出:
Exception
-
execute
execute sql- 参数:
sql- update/delete/insert; param: ? or ${name} or #{name}param- update tb set name = ? where id = ? param is Object[]; update tb set name = ${mame} where id = ${id} param is model or Map<String, Object>- 返回:
- int
- 抛出:
Exception
-
queryOne
query first model- 类型参数:
T- model- 参数:
sql- select sql; param: ? or ${name} or #{name}clazz- T.classparam- select id, name from tb where id = ? param is Object[]; select id, name from tb where id = ${id} param is model or Map<String, Object>- 返回:
- first model
- 抛出:
Exception
-
queryList
query List- 类型参数:
T- model- 参数:
sql- select sql; param: ? or ${name} or #{name}clazz- T.classparam- select id, name from tb where id = ? param is Object[]; select id, name from tb where id = ${id} param is model or Map<String, Object>- 返回:
- List
- 抛出:
Exception
-
queryOneMap
query first Map<String, Object>- 参数:
sql- select sql; param: ? or ${name} or #{name}param- select id, name from tb where id = ? param is Object[]; select id, name from tb where id = ${id} param is model or Map<String, Object>- 返回:
- first Map<String, Object>
- 抛出:
Exception
-
queryListMap
query List Map<String, Object>- 参数:
sql- select sql; param: ? or ${name} or #{name}param- select id, name from tb where id = ? param is Object[]; select id, name from tb where id = ${id} param is model or Map<String, Object>- 返回:
- List Map String, Object
- 抛出:
Exception
-
get
get first model- 类型参数:
TModel- Model- 参数:
clazz- TModel.classparam- where param- 返回:
- first Model
- 抛出:
Exception
-
getList
<TModel extends Model> List<TModel> getList(Class<TModel> clazz, Map<String, Object> param) throws Exceptionget List model- 类型参数:
TModel- Model- 参数:
clazz- TModel.classparam- where param- 返回:
- List Model
- 抛出:
Exception
-
add
add row- 参数:
table- table nameparam- insert param- 返回:
- int
- 抛出:
Exception
-
add
add model- 类型参数:
TModel- Model- 参数:
m- modelignore- ignore model property name- 返回:
- int
- 抛出:
Exception
-
update
int update(String table, Map<String, Object> setParam, Map<String, throws ExceptionObject> whereParam) update- 参数:
table- table namesetParam- update paramwhereParam- where param- 返回:
- int
- 抛出:
Exception
-
update
<TModel extends Model> int update(Class<TModel> clazz, Map<String, Object> setParam, Map<String, throws ExceptionObject> whereParam) update- 类型参数:
TModel- Model- 参数:
clazz- Model.classsetParam- update paramwhereParam- where param- 返回:
- int
- 抛出:
Exception
-
delete
delete- 参数:
table- table namewhereParam- where param- 返回:
- int
- 抛出:
Exception
-
delete
<TModel extends Model> int delete(Class<TModel> clazz, Map<String, Object> whereParam) throws Exceptiondelete- 类型参数:
TModel- Model- 参数:
clazz- Model.classwhereParam- where param- 返回:
- int
- 抛出:
Exception
-