public abstract class GeneralJsonObjectDao extends Object implements JsonObjectDao
| 限定符和类型 | 类和说明 |
|---|---|
class |
GeneralJsonObjectDao.JSONObjectComparator |
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
SELF_ORDER_BY
用户自定义排序描述, 放到 filterDesc 中
|
static String |
TABLE_SORT_FIELD
用户自定义排序字段 , 放到 filterDesc 中
|
static String |
TABLE_SORT_ORDER
用户自定义排序字段的排序顺序 , 放到 filterDesc 中
|
| 构造器和说明 |
|---|
GeneralJsonObjectDao() |
GeneralJsonObjectDao(Connection conn) |
GeneralJsonObjectDao(Connection conn,
TableInfo tableInfo) |
GeneralJsonObjectDao(TableInfo tableInfo) |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
buildFieldSql(TableInfo ti,
String alias)
返回 sql 语句 和 属性名数组
|
static org.apache.commons.lang3.tuple.Pair<String,String[]> |
buildFieldSqlWithFieldName(TableInfo ti,
String alias)
返回 sql 语句 和 属性名数组
|
static String |
buildFilterSql(TableInfo ti,
String alias,
Collection<String> properties) |
static String |
buildFilterSqlByPk(TableInfo ti,
String alias) |
static org.apache.commons.lang3.tuple.Pair<String,String[]> |
buildGetObjectSqlByPk(TableInfo ti) |
static String |
buildInsertSql(TableInfo ti,
Collection<String> fields) |
static String |
buildPartFieldSql(TableInfo ti,
Collection<String> fields,
String alias)
返回 sql 语句 和 属性名数组
|
static org.apache.commons.lang3.tuple.Pair<String,String[]> |
buildPartFieldSqlWithFieldName(TableInfo ti,
Collection<String> fields,
String alias)
返回 sql 语句 和 属性名数组
|
static org.apache.commons.lang3.tuple.Pair<String,String[]> |
buildQuerySqlByProperties(TableInfo tableInfo,
Map<String,Object> properties) |
static String |
buildUpdateSql(TableInfo ti,
Collection<String> fields,
boolean exceptPk) |
boolean |
checkHasAllPkColumns(Map<String,Object> properties) |
static boolean |
checkHasAllPkColumns(TableInfo tableInfo,
Map<String,Object> properties) |
static GeneralJsonObjectDao |
createJsonObjectDao(Connection conn) |
static GeneralJsonObjectDao |
createJsonObjectDao(Connection conn,
TableInfo tableInfo) |
static GeneralJsonObjectDao |
createJsonObjectDao(DBType dbtype,
Connection conn) |
int |
deleteObjectById(Object keyValue)
删除,单主键
|
int |
deleteObjects(List<Object> objects)
批量删除
|
int |
deleteObjectsAsTabulation(Map<String,Object> properties)
根据外键批量删除,符合外键
|
int |
deleteObjectsAsTabulation(String propertyName,
Object propertyValue)
根据外键批量删除,单外键
|
int |
deleteObjectsByProperties(Map<String,Object> properties)
根据属性 批量删除
|
int |
doExecuteNamedSql(String sSql,
Map<String,Object> values)
执行一个带命名参数的sql语句
|
boolean |
doExecuteSql(String sSql) |
int |
doExecuteSql(String sSql,
Object[] values)
直接运行行带参数的 SQL,update delete insert
|
Long |
fetchObjectsCount(Map<String,Object> properties)
根据属性进行并获取总数
|
static String |
fetchSelfOrderSql(String querySql,
Map<String,Object> filterMap)
querySql 用户检查order by 中的字段属性 对应的查询标识 比如,
select a+b as ab from table
在 filterMap 中的 CodeBook.TABLE_SORT_FIELD (sort) 为 ab 字段 返回的排序语句为 a+b
|
static String |
fetchSelfOrderSql(TableInfo ti,
Map<String,Object> filterMap) |
com.alibaba.fastjson.JSONArray |
findObjectsAsJSON(String sSql,
Object[] values,
String[] fieldnames) |
List<Object[]> |
findObjectsByNamedSql(String sSql,
Map<String,Object> values) |
com.alibaba.fastjson.JSONArray |
findObjectsByNamedSqlAsJSON(String sSql,
Map<String,Object> values,
String[] fieldnames) |
List<Object[]> |
findObjectsBySql(String sSql,
Object[] values)
查询带参数的SQL语句
|
Connection |
getConnect() |
com.alibaba.fastjson.JSONObject |
getObjectById(Object keyValue)
单主键表
|
com.alibaba.fastjson.JSONObject |
getObjectByProperties(Map<String,Object> properties)
根据属性查询对象
|
Long |
getSimulateSequenceNextValue(String sequenceName)
用表来模拟sequence
create table simulate_sequence (seqname varchar(100) not null primary key,
currvalue integer, increment integer);
|
TableInfo |
getTableInfo() |
int |
insertObjectsAsTabulation(List<Map<String,Object>> objects)
批量添加多条记录
|
static boolean |
isPkColumn(TableInfo ti,
String propertyName) |
com.alibaba.fastjson.JSONArray |
listObjectsByProperties(Map<String,Object> properties) |
Map<String,Object> |
makePkFieldMap(Object keyValue) |
static String |
mapFieldToColumnPiece(String querySql,
String fieldName)
在sql语句中找到属性对应的字段语句
|
Map<String,Object> |
mapObjectProperties(Map<String,Object> properties) |
static Map<String,Object> |
mapObjectProperties(TableInfo tableInfo,
Map<String,Object> properties) |
int |
mergeObject(Collection<String> fields,
Map<String,Object> object)
更改部分属性
|
int |
mergeObject(Map<String,Object> object)
合并
|
int |
replaceObjectsAsTabulation(List<Map<String,Object>> newObjects,
List<Map<String,Object>> dbObjects)
用新的列表覆盖数据库中的列表
|
int |
replaceObjectsAsTabulation(List<Map<String,Object>> newObjects,
Map<String,Object> properties)
用新的列表覆盖数据库中的内容,通过复合外键查询列表
|
int |
replaceObjectsAsTabulation(List<Map<String,Object>> newObjects,
String propertyName,
Object propertyValue)
用新的列表覆盖数据库中的内容,通过单外键查询列表
|
int |
saveNewObject(Map<String,Object> object) |
void |
setConnect(Connection conn) |
void |
setTableInfo(TableInfo tableInfo) |
int |
updateObject(Collection<String> fields,
Map<String,Object> object)
更改部分属性
|
int |
updateObject(Map<String,Object> object)
更改部分属性
|
int |
updateObjectsByProperties(Collection<String> fields,
Map<String,Object> fieldValues,
Map<String,Object> properties)
根据条件批量更新 对象
|
int |
updateObjectsByProperties(Map<String,Object> fieldValues,
Map<String,Object> properties)
根据条件批量更新 对象
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfindObjectsAsJSON, findObjectsByNamedSql, findObjectsByNamedSqlAsJSON, findObjectsBySql, getSequenceNextValue, listObjectsByPropertiespublic static final String TABLE_SORT_FIELD
public GeneralJsonObjectDao()
public GeneralJsonObjectDao(TableInfo tableInfo)
public GeneralJsonObjectDao(Connection conn)
public GeneralJsonObjectDao(Connection conn, TableInfo tableInfo)
public static Map<String,Object> mapObjectProperties(TableInfo tableInfo, Map<String,Object> properties)
public static GeneralJsonObjectDao createJsonObjectDao(Connection conn, TableInfo tableInfo) throws SQLException
SQLExceptionpublic static GeneralJsonObjectDao createJsonObjectDao(DBType dbtype, Connection conn) throws SQLException
SQLExceptionpublic static GeneralJsonObjectDao createJsonObjectDao(Connection conn) throws SQLException
SQLExceptionpublic void setConnect(Connection conn)
public Connection getConnect()
public void setTableInfo(TableInfo tableInfo)
public TableInfo getTableInfo()
getTableInfo 在接口中 JsonObjectDaopublic static String buildFieldSql(TableInfo ti, String alias)
ti - TableInfoalias - Stringpublic static String buildPartFieldSql(TableInfo ti, Collection<String> fields, String alias)
ti - TableInfofields - String 值返回对应的字段alias - Stringpublic static org.apache.commons.lang3.tuple.Pair<String,String[]> buildFieldSqlWithFieldName(TableInfo ti, String alias)
ti - TableInfoalias - Stringpublic static org.apache.commons.lang3.tuple.Pair<String,String[]> buildPartFieldSqlWithFieldName(TableInfo ti, Collection<String> fields, String alias)
ti - TableInfofields - String 值返回对应的字段alias - Stringpublic static boolean checkHasAllPkColumns(TableInfo tableInfo, Map<String,Object> properties)
public static String mapFieldToColumnPiece(String querySql, String fieldName)
querySql - sql语句fieldName - 属性public static String fetchSelfOrderSql(String querySql, Map<String,Object> filterMap)
querySql - SQL语句 用来检查字段对应的查询语句 片段filterMap - 查询条件map其中包含排序属性public static String fetchSelfOrderSql(TableInfo ti, Map<String,Object> filterMap)
public static String buildFilterSql(TableInfo ti, String alias, Collection<String> properties)
public static org.apache.commons.lang3.tuple.Pair<String,String[]> buildGetObjectSqlByPk(TableInfo ti)
public Map<String,Object> makePkFieldMap(Object keyValue) throws SQLException
SQLExceptionpublic com.alibaba.fastjson.JSONObject getObjectById(Object keyValue) throws SQLException, IOException
JsonObjectDaogetObjectById 在接口中 JsonObjectDaokeyValue - keyValueSQLException - SQLExceptionIOException - IOExceptionpublic com.alibaba.fastjson.JSONObject getObjectByProperties(Map<String,Object> properties) throws SQLException, IOException
JsonObjectDaogetObjectByProperties 在接口中 JsonObjectDaoproperties - propertiesSQLException - SQLExceptionIOException - IOExceptionpublic static org.apache.commons.lang3.tuple.Pair<String,String[]> buildQuerySqlByProperties(TableInfo tableInfo, Map<String,Object> properties)
public com.alibaba.fastjson.JSONArray listObjectsByProperties(Map<String,Object> properties) throws SQLException, IOException
listObjectsByProperties 在接口中 JsonObjectDaoproperties - propertiesSQLException - SQLExceptionIOException - IOExceptionpublic Long fetchObjectsCount(Map<String,Object> properties) throws SQLException, IOException
JsonObjectDaofetchObjectsCount 在接口中 JsonObjectDaoproperties - propertiesSQLException - SQLExceptionIOException - IOExceptionpublic static String buildInsertSql(TableInfo ti, Collection<String> fields)
public int saveNewObject(Map<String,Object> object) throws SQLException
saveNewObject 在接口中 JsonObjectDaoSQLExceptionpublic static String buildUpdateSql(TableInfo ti, Collection<String> fields, boolean exceptPk)
public int updateObject(Collection<String> fields, Map<String,Object> object) throws SQLException
updateObject 在接口中 JsonObjectDaofields - 更改部分属性 属性名 集合,应为有的Map 不允许 值为null,这样这些属性 用map就无法修改为 nullobject - MapSQLException - SQLExceptionpublic int updateObject(Map<String,Object> object) throws SQLException
JsonObjectDaoupdateObject 在接口中 JsonObjectDaoobject - objectSQLException - SQLExceptionpublic int mergeObject(Collection<String> fields, Map<String,Object> object) throws SQLException, IOException
JsonObjectDaomergeObject 在接口中 JsonObjectDaofields - 更改部分属性 属性名 集合,应为有的Map 不允许 值为null,这样这些属性 用map就无法修改为 nullobject - objectSQLException - SQLExceptionIOException - IOExceptionpublic int mergeObject(Map<String,Object> object) throws SQLException, IOException
JsonObjectDaomergeObject 在接口中 JsonObjectDaoobject - objectSQLException - SQLExceptionIOException - IOExceptionpublic int updateObjectsByProperties(Collection<String> fields, Map<String,Object> fieldValues, Map<String,Object> properties) throws SQLException
JsonObjectDaoupdateObjectsByProperties 在接口中 JsonObjectDaofields - 更改部分属性 属性名 集合,应为有的Map 不允许 值为null,这样这些属性 用map就无法修改为 nullfieldValues - fieldValuesproperties - propertiesSQLException - SQLExceptionpublic int updateObjectsByProperties(Map<String,Object> fieldValues, Map<String,Object> properties) throws SQLException
JsonObjectDaoupdateObjectsByProperties 在接口中 JsonObjectDaofieldValues - propertiesproperties - propertiesSQLException - SQLExceptionpublic int deleteObjectById(Object keyValue) throws SQLException
JsonObjectDaodeleteObjectById 在接口中 JsonObjectDaokeyValue - keyValueSQLException - SQLExceptionpublic int deleteObjectsByProperties(Map<String,Object> properties) throws SQLException
JsonObjectDaodeleteObjectsByProperties 在接口中 JsonObjectDaoproperties - propertiesSQLException - SQLExceptionpublic int insertObjectsAsTabulation(List<Map<String,Object>> objects) throws SQLException
JsonObjectDaoinsertObjectsAsTabulation 在接口中 JsonObjectDaoobjects - JSONArraySQLException - SQLExceptionpublic int deleteObjects(List<Object> objects) throws SQLException
JsonObjectDaodeleteObjects 在接口中 JsonObjectDaoobjects - JSONArraySQLException - SQLExceptionpublic int deleteObjectsAsTabulation(String propertyName, Object propertyValue) throws SQLException
JsonObjectDaodeleteObjectsAsTabulation 在接口中 JsonObjectDaopropertyName - StringpropertyValue - ObjectSQLException - SQLExceptionpublic int deleteObjectsAsTabulation(Map<String,Object> properties) throws SQLException
JsonObjectDaodeleteObjectsAsTabulation 在接口中 JsonObjectDaoproperties - ObjectSQLException - SQLExceptionpublic int replaceObjectsAsTabulation(List<Map<String,Object>> newObjects, List<Map<String,Object>> dbObjects) throws SQLException
JsonObjectDaoreplaceObjectsAsTabulation 在接口中 JsonObjectDaonewObjects - JSONArraydbObjects - JSONArraySQLException - SQLExceptionpublic int replaceObjectsAsTabulation(List<Map<String,Object>> newObjects, String propertyName, Object propertyValue) throws SQLException, IOException
JsonObjectDaoreplaceObjectsAsTabulation 在接口中 JsonObjectDaonewObjects - JSONArraypropertyName - StringpropertyValue - ObjectSQLException - SQLExceptionIOException - IOExceptionpublic int replaceObjectsAsTabulation(List<Map<String,Object>> newObjects, Map<String,Object> properties) throws SQLException, IOException
JsonObjectDaoreplaceObjectsAsTabulation 在接口中 JsonObjectDaonewObjects - newObjectsproperties - propertiesSQLException - SQLExceptionIOException - IOExceptionpublic Long getSimulateSequenceNextValue(String sequenceName) throws SQLException, IOException
sequenceName - sequenceNameSQLException - SQLExceptionIOException - IOExceptionpublic List<Object[]> findObjectsBySql(String sSql, Object[] values) throws SQLException, IOException
JsonObjectDaofindObjectsBySql 在接口中 JsonObjectDaosSql - String sql语句values - Object [] 参数SQLException - SQLExceptionIOException - IOExceptionpublic List<Object[]> findObjectsByNamedSql(String sSql, Map<String,Object> values) throws SQLException, IOException
findObjectsByNamedSql 在接口中 JsonObjectDaoSQLExceptionIOExceptionpublic com.alibaba.fastjson.JSONArray findObjectsAsJSON(String sSql, Object[] values, String[] fieldnames) throws SQLException, IOException
findObjectsAsJSON 在接口中 JsonObjectDaoSQLExceptionIOExceptionpublic com.alibaba.fastjson.JSONArray findObjectsByNamedSqlAsJSON(String sSql, Map<String,Object> values, String[] fieldnames) throws SQLException, IOException
findObjectsByNamedSqlAsJSON 在接口中 JsonObjectDaoSQLExceptionIOExceptionpublic boolean doExecuteSql(String sSql) throws SQLException
doExecuteSql 在接口中 JsonObjectDaoSQLExceptionpublic int doExecuteSql(String sSql, Object[] values) throws SQLException
doExecuteSql 在接口中 JsonObjectDaosSql - Stringvalues - Object[]SQLException - SQLExceptionpublic int doExecuteNamedSql(String sSql, Map<String,Object> values) throws SQLException
doExecuteNamedSql 在接口中 JsonObjectDaosSql - Stringvalues - valuesSQLException - SQLExceptionCopyright © 2025 江苏南大先腾信息产业股份有限公司. All rights reserved.