public interface Dao
| 限定符和类型 | 方法和说明 |
|---|---|
List |
batchSave(List objList) |
List |
batchSave(List objList,
String lang) |
List |
batchSave(Object account_id,
List objList)
批量保存所使用的方法
|
boolean |
batchUpdate(List objects)
对于保存在单库的数据,如数据字典,采用如下方式更新
|
boolean |
batchUpdate(List objects,
String lang)
对于保存在单库的数据,如数据字典,采用如下方式更新
|
boolean |
batchUpdate(Object account_id,
List objects)
更新指定account_id(账号)的一批持久化对象,参数account_id(用户ID)以方便策略选择更新哪个库或者CACHE中数据,如果输入是null就从默认的库和CACHE中更新
|
int |
count(Object account_id,
String list_name,
Object param)
查询指定param(key)的对象列表的长度。
|
int |
count(Object account_id,
String list_name,
Object[] params)
查询指定param(key)的对象列表的长度。
|
int |
count(String list_name,
Object param) |
int |
count(String list_name,
Object[] params) |
boolean |
delete(Class clazz,
Serializable id)
对于保存在单库的数据,如数据字典,采用如下方式删除
|
boolean |
delete(Class clazz,
Serializable id,
String lang)
对于保存在单库的数据,如数据字典,采用如下方式删除
|
boolean |
delete(Object account_id,
Class clazz,
Serializable id)
删除一个指定account_id(用户)一个持久化对象,参数account_id(用户ID)以方便策略选择删除哪个库或者CACHE中数据,如果输入是null就从默认的库和CACHE中删除
注意:在删除以前要保证数据确实是account_id用户的
|
boolean |
deleteList(Class clazz,
List ids)
对于保存在单库的数据,如数据字典,采用如下方式批量删除
|
boolean |
deleteList(Object account_id,
Class clazz,
List ids)
删除一个指定account_id(用户)的多个持久化对象,参数account_id(用户ID)以方便策略选择删除哪个库或者CACHE中数据,如果输入是null就从默认的库和CACHE中删除
注意:在删除以前要保证数据确实是account_id用户的
|
boolean |
deleteList(Object account_id,
String list_name,
Object param) |
boolean |
deleteList(Object account_id,
String list_name,
Object[] params)
根据list_name 自动转化为对应的delete 语句,执行删除。
|
boolean |
deleteList(String list_name,
Object param) |
boolean |
deleteList(String list_name,
Object[] params) |
Object |
excuteHardSimpleSql(String sql,
Class clazz)
TODO : 暂时是假设clazz不分库的前提下,或者当前线线程已经并正确绑定数据库
如果针对了分库的clazz,并且指定了clazz,程序则会到clazz配置中的第一个数据库中执行sql,结果是不确定的,
后期如果有相关需求,需要改进该方法
根据单独的sql,执行出结果
|
Object |
excuteSimpleSql(String sql,
Class clazz)
TODO : 暂时是假设clazz不分库的前提下,或者当前线线程已经并正确绑定数据库
如果针对了分库的clazz,并且指定了clazz,程序则会到clazz配置中的第一个数据库中执行sql,结果是不确定的,
后期如果有相关需求,需要改进该方法
根据单独的sql,执行出结果
|
boolean |
fakeDelete(Class clazz,
Serializable id)
对于保存在单库的数据,如数据字典,采用如下方式删除
|
boolean |
fakeDelete(Object account_id,
Class clazz,
Serializable id)
删除一个指定account_id(用户)一个持久化对象,参数account_id(用户ID)以方便策略选择删除哪个库或者CACHE中数据,如果输入是null就从默认的库和CACHE中删除
注意:在删除以前要保证数据确实是account_id用户的
|
boolean |
fakeDeleteList(Class clazz,
List ids)
对于保存在单库的数据,如数据字典,采用如下方式批量删除
|
boolean |
fakeDeleteList(Object account_id,
Class clazz,
List ids)
删除一个指定account_id(用户)的多个持久化对象,参数account_id(用户ID)以方便策略选择删除哪个库或者CACHE中数据,如果输入是null就从默认的库和CACHE中删除
注意:在删除以前要保证数据确实是account_id用户的
|
boolean |
fakeDeleteList(Object account_id,
String list_name,
Object param) |
boolean |
fakeDeleteList(Object account_id,
String list_name,
Object[] params)
根据list_name 自动转化为对应的delete 语句,执行删除。
|
boolean |
fakeDeleteList(String list_name,
Object param) |
boolean |
fakeDeleteList(String list_name,
Object[] params) |
Object |
get(Class clazz,
Serializable id)
对于保存在单库的数据,如数据字典,采用如下方式读取
|
Object |
get(Class clazz,
Serializable id,
String lang)
对于保存在单库的数据,如数据字典,采用如下方式读取
|
Object |
get(Object account_id,
Class clazz,
Serializable id)
从DB或者CACHE中装载一个对象,需要指定一个account_id(用户ID)以方便策略选择从那个库或者CACHE中装载数据,如果输入是null就从默认的库或CACHE中转载
注意:检查装载的数据中的account_id和指定的account_id是否一致。
|
List |
getIdList(Object account_id,
String list_name,
Object[] params,
boolean forward)
查询指定param(key)的对象列表的长度。
|
List |
getIdList(Object account_id,
String list_name,
Object[] params,
Integer start,
Integer count,
boolean forward)
查询指定param(key)的对象列表的长度。
|
List |
getIdList(Object account_id,
String list_name,
Object param,
boolean forward)
查询指定param(key)的对象列表,需要指定account_id(用户ID)以方便策略选择从哪个库或者CACHE中选择数据,如果输入是null就从默认的库或者CACHE中选择。
|
List |
getIdList(Object account_id,
String list_name,
Object param,
Integer start,
Integer count,
boolean forward)
查询指定param(key)的对象列表,需要指定account_id(用户ID)以方便策略选择从哪个库或者CACHE中选择数据,如果输入是null就从默认的库或者CACHE中选择。
|
List |
getIdList(String list_name,
Object[] params,
boolean forward)
查询指定param(key)的对象列表的长度。
|
List |
getIdList(String list_name,
Object[] params,
Integer start,
Integer count,
boolean forward)
查询指定param(key)的对象列表的长度。
|
List |
getIdList(String list_name,
Object param,
boolean forward) |
List |
getIdList(String list_sql_name,
Object param,
Integer start,
Integer count,
boolean forward)
对于保存在单库的数据,如数据字典,采用如下方式查询
list的名称
|
List |
getList(Class clazz,
List ids) |
List |
getList(Class clazz,
List ids,
String lang) |
List |
getList(Object account_id,
Class clazz,
List ids)
通过给出指定持久化对象标识的列表查询持久化对象,需要指定一个account_id(用户ID)以方便策略选择从那个库或者CACHE中查询数据,如果输入是null就从默认的库和CACHE中查询
注意:在实现改接口是要保证返回的持久化对象确实是指定账号的。
|
List |
getListWithNULLOBJ(Class clazz,
List ids) |
List |
getListWithNULLOBJ(Object account_id,
Class clazz,
List ids) |
List |
getMapList(List accountIdList,
String mapname,
List<Object[]> paramsList) |
Object |
getMapping(Object account_id,
String mappingName,
Object key) |
Object |
getMapping(Object account_id,
String mappingName,
Object[] keys)
通过一个持久化对象的属性值找一个持久化对象。
|
Object |
getMapping(String mappingName,
Object key) |
Object |
getMapping(String mappingName,
Object[] keys) |
List |
getMappings(Object accountId,
String mapName,
List<Object[]> paramsList) |
Map |
getMappingsMap(Object accountId,
String mapName,
List<Object[]> paramsList) |
Long |
getMaxIdOfClass(Class clazz)
根据类的名称获取数据库中该对象的id的最大值
支持多库
原理是:从每个分库中查出ID最大值,然后返回其中最大的一个
|
List |
save(List objects)
对于不需要存储策略的数据,如数据字典,采用如下方式保存
|
Serializable |
save(Object object)
对于不需要存储策略的数据,如数据字典,采用如下方式保存
|
List |
save(Object account_id,
List objects)
保存一组持久化对象
当批量保存持久化对象时,需要指定一个account_id(用户账号ID),这个account_id可以帮助我们把同一个用户的数据保存在一起(同一机器,同一数据库,等)。
|
Serializable |
save(Object account_id,
Object object)
保存一个持久化对象
当保存一个持久化对象时,需要指定一个account_id(用户账号ID),这个account_id可以帮助我们把同一个用户的数据保存在一起(同一机器,同一数据库,等)。
|
Serializable |
save(Object object,
String lang)
对于不需要存储策略的数据,如数据字典,采用如下方式保存
|
boolean |
update(Object object)
对于保存在单库的数据,如数据字典,采用如下方式更新
|
boolean |
update(Object account_id,
Object object)
更新指定用户的持久化对象,参数account_id(用户ID)以方便策略选择更新哪个库或者CACHE中数据,如果输入是null就从默认的库和CACHE中更新
注意:检查要更新对象是否是指定账号的。
|
boolean |
update(Object object,
String lang)
对于保存在单库的数据,如数据字典,采用如下方式更新
|
boolean |
updateObjs(List objList) |
Serializable save(Object account_id, Object object) throws DaoException
account_id - :用户Account_id,
在DAL中用他来作为策略的依据参数,如果是NULL策略会默认处理,比如数据字典的数据,不存在account_id,策略就会选择默认的方式处理object - :持久化对象ExceptionDaoExceptionSerializable save(Object object) throws DaoException
object:带保存对象 - DaoExceptionSerializable save(Object object, String lang) throws DaoException, ClassNotFoundException, IllegalAccessException, InstantiationException
object:带保存对象 - object:语言 - DaoExceptionClassNotFoundExceptionIllegalAccessExceptionInstantiationExceptionList save(Object account_id, List objects) throws DaoException
account_id - :用户Account_id 如果account_id是null就会保存或者更新默认的库和CACHEobjects - :要保存的持久化对象列表DaoExceptionList save(List objects) throws DaoException
objects - :对象数组DaoExceptionList batchSave(Object account_id, List objList) throws DaoException
account_id - objList - DaoExceptionList batchSave(List objList) throws DaoException
DaoExceptionList batchSave(List objList, String lang) throws DaoException, ClassNotFoundException, IllegalAccessException, InstantiationException
Object get(Object account_id, Class clazz, Serializable id) throws DaoException
account_id:用户Account_id - clazz - :要重载的持久化对象类别,id - :持久化对象的标识DaoExceptionObject get(Class clazz, Serializable id) throws DaoException
clazz - id - :对象的主键DaoExceptionObject get(Class clazz, Serializable id, String lang) throws DaoException, ClassNotFoundException, IllegalAccessException, InstantiationException
clazz - id - :对象的主键id - :语言DaoExceptionClassNotFoundExceptionIllegalAccessExceptionInstantiationExceptionList getList(Object account_id, Class clazz, List ids) throws DaoException
account_id - :用户Account_idclazz - :要装载的持久化对象。ids - :要装载的持久化对象标识列表DaoExceptionList getList(Class clazz, List ids) throws DaoException
DaoExceptionList getList(Class clazz, List ids, String lang) throws DaoException, ClassNotFoundException, IllegalAccessException, InstantiationException
List getListWithNULLOBJ(Object account_id, Class clazz, List ids) throws DaoException
DaoExceptionList getListWithNULLOBJ(Class clazz, List ids) throws DaoException
DaoExceptionboolean update(Object account_id, Object object) throws DaoException
object - :要更新的持久化对象DaoExceptionboolean update(Object object) throws DaoException
object - DaoExceptionboolean update(Object object, String lang) throws DaoException, ClassNotFoundException, IllegalAccessException, InstantiationException
object - DaoExceptionClassNotFoundExceptionIllegalAccessExceptionInstantiationExceptionboolean batchUpdate(Object account_id, List objects) throws DaoException
objects - :要更新的持久化对象列表DaoExceptionboolean batchUpdate(List objects) throws DaoException
object - DaoExceptionboolean batchUpdate(List objects, String lang) throws DaoException, ClassNotFoundException, IllegalAccessException, InstantiationException
object - DaoExceptionClassNotFoundExceptionIllegalAccessExceptionInstantiationExceptionboolean delete(Object account_id, Class clazz, Serializable id) throws DaoException
account_id - :用户Account_id,clazz - :
要删除的持久化对象的类型id - :要删除的持久化对象的标识DaoExceptionboolean delete(Class clazz, Serializable id) throws DaoException
object - DaoExceptionboolean delete(Class clazz, Serializable id, String lang) throws DaoException, ClassNotFoundException, IllegalAccessException, InstantiationException
object - DaoExceptionClassNotFoundExceptionIllegalAccessExceptionInstantiationExceptionboolean fakeDelete(Object account_id, Class clazz, Serializable id) throws DaoException
account_id - :用户Account_id,clazz - :
要删除的持久化对象的类型id - :要删除的持久化对象的标识DaoExceptionboolean fakeDelete(Class clazz, Serializable id) throws DaoException
object - DaoExceptionboolean deleteList(Object account_id, Class clazz, List ids) throws DaoException
account_id - :用户Account_id,clazz - :
要删除的持久化对象的类型ids - :要删除的持久化对象的标识列表DaoExceptionboolean deleteList(Class clazz, List ids) throws DaoException
object - DaoExceptionboolean fakeDeleteList(Object account_id, Class clazz, List ids) throws DaoException
account_id - :用户Account_id,clazz - :
要删除的持久化对象的类型ids - :要删除的持久化对象的标识列表DaoExceptionboolean fakeDeleteList(Class clazz, List ids) throws DaoException
object - DaoExceptionboolean deleteList(Object account_id, String list_name, Object[] params) throws DaoException
account_id - :用户Account_id,list_name - :待删除的List所对应的list_nameparams - :
执行list_name对应sql语句,所需要的参数DaoExceptionboolean deleteList(String list_name, Object[] params) throws DaoException
DaoExceptionboolean deleteList(Object account_id, String list_name, Object param) throws DaoException
DaoExceptionboolean deleteList(String list_name, Object param) throws DaoException
DaoExceptionboolean fakeDeleteList(Object account_id, String list_name, Object[] params) throws DaoException
account_id - :用户Account_id,list_name - :待删除的List所对应的list_nameparams - :
执行list_name对应sql语句,所需要的参数DaoExceptionboolean fakeDeleteList(String list_name, Object[] params) throws DaoException
DaoExceptionboolean fakeDeleteList(Object account_id, String list_name, Object param) throws DaoException
DaoExceptionboolean fakeDeleteList(String list_name, Object param) throws DaoException
DaoExceptionList getIdList(Object account_id, String list_name, Object param, Integer start, Integer count, boolean forward) throws DaoException
account_id - :用户Account_idlist_name - :
list的名称param - :
列表中的关键字(标识)start - :
指定列表的中的开始位置count - :
装载的长度。如果存在的数据小于count就返回实际的count数据forward:装载的反向,是向前还是向后 - DaoExceptionList getIdList(String list_sql_name, Object param, Integer start, Integer count, boolean forward) throws DaoException
param - :
列表中的关键字(标识)start - :
指定列表的中的开始位置count - :
装载的长度。如果存在的数据小于count就返回实际的count数据forward:装载的反向,是向前还是向后 - DaoExceptionList getIdList(Object account_id, String list_name, Object param, boolean forward) throws DaoException
account_id - :用户Account_idlist_name - :
list的名称param - :
列表中的关键字(标识)forward:装载的反向,是向前还是向后 - DaoExceptionList getIdList(String list_name, Object param, boolean forward) throws DaoException
DaoExceptionList getIdList(Object account_id, String list_name, Object[] params, Integer start, Integer count, boolean forward) throws DaoException
account_id - :用户Account_id
需要指定account_id(用户ID)以方便策略选择从哪个库或者CACHE中查询数据,如果输入是null就从默认的库或者CACHE中删除list_name - :要查询的列表名称param - :列表的标识IDDaoExceptionList getIdList(String list_name, Object[] params, Integer start, Integer count, boolean forward) throws DaoException
account_id - :用户Account_id
需要指定account_id(用户ID)以方便策略选择从哪个库或者CACHE中查询数据,如果输入是null就从默认的库或者CACHE中删除list_name - :要查询的列表名称param - :列表的标识IDDaoExceptionList getIdList(Object account_id, String list_name, Object[] params, boolean forward) throws DaoException
account_id - :用户Account_id
需要指定account_id(用户ID)以方便策略选择从哪个库或者CACHE中查询数据,如果输入是null就从默认的库或者CACHE中删除list_name - :要查询的列表名称param - :列表的标识IDDaoExceptionList getIdList(String list_name, Object[] params, boolean forward) throws DaoException
account_id - :用户Account_id
需要指定account_id(用户ID)以方便策略选择从哪个库或者CACHE中查询数据,如果输入是null就从默认的库或者CACHE中删除list_name - :要查询的列表名称param - :列表的标识IDDaoExceptionint count(Object account_id, String list_name, Object param) throws DaoException
account_id - :用户Account_id
需要指定account_id(用户ID)以方便策略选择从哪个库或者CACHE中查询数据,如果输入是null就从默认的库或者CACHE中删除list_name - :要查询的列表名称param - :列表的标识IDDaoExceptionint count(String list_name, Object param) throws DaoException
DaoExceptionint count(Object account_id, String list_name, Object[] params) throws DaoException
account_id - :用户Account_id
需要指定account_id(用户ID)以方便策略选择从哪个库或者CACHE中查询数据,如果输入是null就从默认的库或者CACHE中删除list_name - :要查询的列表名称param - :列表的标识IDDaoExceptionint count(String list_name, Object[] params) throws DaoException
DaoExceptionObject getMapping(Object account_id, String mappingName, Object[] keys) throws DaoException
account_id - :用户Account_idmappingName - :持久化对象属性的名称标识key - :对象的属性值DaoExceptionObject getMapping(String mappingName, Object[] keys) throws DaoException
DaoExceptionObject getMapping(Object account_id, String mappingName, Object key) throws DaoException
DaoExceptionObject getMapping(String mappingName, Object key) throws DaoException
DaoExceptionList getMappings(Object accountId, String mapName, List<Object[]> paramsList) throws DaoException
DaoExceptionMap getMappingsMap(Object accountId, String mapName, List<Object[]> paramsList) throws DaoException
DaoExceptionList getMapList(List accountIdList, String mapname, List<Object[]> paramsList) throws DaoException
DaoExceptionboolean updateObjs(List objList) throws DaoException
DaoExceptionLong getMaxIdOfClass(Class clazz) throws DaoException
clazz - 对象的类名DaoExceptionObject excuteSimpleSql(String sql, Class clazz) throws DaoException
sql - DaoExceptionObject excuteHardSimpleSql(String sql, Class clazz) throws DaoException
sql - DaoExceptionCopyright © 2021. All rights reserved.