| 限定符和类型 | 字段和说明 |
|---|---|
protected DataSource |
dataSource |
protected Map<String,String> |
fieldMapping |
protected String |
insertIgnoreSQL |
| 构造器和说明 |
|---|
AbstractDAO(DataSource dataSource) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
addNewColumn(Connection connection,
String tableName,
StringBuilder uniqueColumns,
com.alibaba.fastjson.JSONArray sourceProperties,
com.alibaba.fastjson.JSONArray targetProperties) |
long |
clear(Class _class)
清空表
|
long |
delete(Class _class,
long id)
根据id删除
|
long |
delete(Class _class,
String property,
Object value)
根据属性删除
|
<T> T |
fetch(Class<T> _class,
long id)
id查询
|
<T> T |
fetch(Class<T> _class,
String property,
Object value)
Property查询
|
com.alibaba.fastjson.JSONArray |
getDatabaseInfo()
获取数据库信息
|
com.alibaba.fastjson.JSONArray |
getEntityInfo(String packageName,
String[] filterPackageName)
获取实体类信息
|
protected String |
getInsertIgnoreSQL() |
protected com.alibaba.fastjson.JSONObject |
getValue(com.alibaba.fastjson.JSONArray array,
String propertyName,
String value) |
<T> Condition<T> |
query(Class<T> _class)
Property查询
|
long |
save(List instanceList)
保存实体
|
long |
save(Object instance)
保存实体
|
long |
save(Object[] instances)
保存实体
|
protected void |
setLastInsertId(Connection connection,
Object instance,
Field id) |
void |
updateDatabase(com.alibaba.fastjson.JSONArray entityList,
com.alibaba.fastjson.JSONArray dbEntityList)
执行数据库更新操作
|
protected DataSource dataSource
protected String insertIgnoreSQL
public AbstractDAO(DataSource dataSource)
public <T> T fetch(Class<T> _class, long id) throws SQLException, IllegalAccessException, InstantiationException
DAOfetch 在接口中 DAOSQLExceptionIllegalAccessExceptionInstantiationExceptionpublic <T> T fetch(Class<T> _class, String property, Object value) throws SQLException, IllegalAccessException, InstantiationException
DAOfetch 在接口中 DAOSQLExceptionIllegalAccessExceptionInstantiationExceptionprotected String getInsertIgnoreSQL()
public long save(Object instance) throws SQLException, IllegalAccessException, NoSuchFieldException
DAOsave 在接口中 DAOSQLExceptionIllegalAccessExceptionNoSuchFieldExceptionprotected void setLastInsertId(Connection connection, Object instance, Field id) throws IllegalAccessException, SQLException
public long save(Object[] instances) throws SQLException, IllegalAccessException, NoSuchFieldException
DAOsave 在接口中 DAOSQLExceptionIllegalAccessExceptionNoSuchFieldExceptionpublic long save(List instanceList) throws SQLException, IllegalAccessException, NoSuchFieldException
DAOsave 在接口中 DAOSQLExceptionIllegalAccessExceptionNoSuchFieldExceptionpublic long delete(Class _class, long id) throws SQLException
DAOdelete 在接口中 DAOSQLExceptionpublic long delete(Class _class, String property, Object value) throws SQLException
DAOdelete 在接口中 DAOSQLExceptionpublic long clear(Class _class) throws SQLException
DAOclear 在接口中 DAOSQLExceptionpublic com.alibaba.fastjson.JSONArray getEntityInfo(String packageName, String[] filterPackageName) throws IOException, ClassNotFoundException
DAOgetEntityInfo 在接口中 DAOIOExceptionClassNotFoundExceptionpublic com.alibaba.fastjson.JSONArray getDatabaseInfo()
throws SQLException
DAOgetDatabaseInfo 在接口中 DAOSQLExceptionpublic void updateDatabase(com.alibaba.fastjson.JSONArray entityList,
com.alibaba.fastjson.JSONArray dbEntityList)
throws SQLException
DAOupdateDatabase 在接口中 DAOSQLExceptionprotected void addNewColumn(Connection connection, String tableName, StringBuilder uniqueColumns, com.alibaba.fastjson.JSONArray sourceProperties, com.alibaba.fastjson.JSONArray targetProperties) throws SQLException
SQLExceptionCopyright © 2018. All rights reserved.