public abstract class BaseDAO<T extends BaseEntity> extends java.lang.Object implements DAO<T>
| 构造器和说明 |
|---|
BaseDAO(DAOSession session) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
add(T record)
新增记录
|
void |
addOrUpdate(T record) |
long |
count(QueryCondition queryCondition) |
java.util.List<T> |
find(QueryCondition queryCondition)
查找记录
|
java.util.List<java.lang.Object> |
findInProjection(QueryCondition queryCondition,
DataColumn... columns) |
java.util.List<java.lang.Object> |
findInProjection(QueryCondition queryCondition,
java.lang.String... columns) |
T |
findOne(QueryCondition queryCondition)
查找一条记录,找不到返回null
|
DataList<T> |
findWithTotalCount(QueryCondition queryCondition)
查找记录,附带返回该查询条件下的数据总条数
|
T |
getById(java.lang.String id)
通过id获取记录
|
protected java.lang.Class<T> |
getEntityClass()
如果重写了getEntityClass方法,就可以不重写其他所有DAO
|
DAOSession |
getSession()
获取会话对象
|
void |
remove(QueryCondition queryCondition)
删除记录,根据查询条件来删除
|
void |
remove(java.lang.String id)
删除记录
|
void |
update(T record)
更新记录,根据记录id来更新
|
public BaseDAO(DAOSession session)
public DAOSession getSession()
DAOgetSession 在接口中 DAO<T extends BaseEntity>protected java.lang.Class<T> getEntityClass()
public void add(T record) throws java.lang.Exception
DataOperatoradd 在接口中 DataOperator<T extends BaseEntity>record - 记录对象java.lang.Exceptionpublic T getById(java.lang.String id) throws java.lang.Exception
DataOperatorgetById 在接口中 DataOperator<T extends BaseEntity>id - 记录idjava.lang.Exceptionpublic void update(T record) throws java.lang.Exception
DataOperatorupdate 在接口中 DataOperator<T extends BaseEntity>record - 记录对象java.lang.Exceptionpublic void remove(java.lang.String id)
throws java.lang.Exception
DataOperatorremove 在接口中 DataOperator<T extends BaseEntity>id - 记录idjava.lang.Exceptionpublic void remove(QueryCondition queryCondition) throws java.lang.Exception
DataOperatorremove 在接口中 DataOperator<T extends BaseEntity>queryCondition - 查询条件java.lang.Exceptionpublic java.util.List<T> find(QueryCondition queryCondition) throws java.lang.Exception
DataOperatorfind 在接口中 DataOperator<T extends BaseEntity>queryCondition - 查询条件java.lang.Exceptionpublic T findOne(QueryCondition queryCondition) throws java.lang.Exception
DataOperatorfindOne 在接口中 DataOperator<T extends BaseEntity>queryCondition - 查询条件java.lang.Exceptionpublic DataList<T> findWithTotalCount(QueryCondition queryCondition) throws java.lang.Exception
DataOperatorfindWithTotalCount 在接口中 DataOperator<T extends BaseEntity>queryCondition - 查询条件java.lang.Exceptionpublic long count(QueryCondition queryCondition) throws java.lang.Exception
count 在接口中 DAO<T extends BaseEntity>java.lang.Exceptionpublic java.util.List<java.lang.Object> findInProjection(QueryCondition queryCondition, java.lang.String... columns) throws java.lang.Exception
findInProjection 在接口中 DAO<T extends BaseEntity>java.lang.Exceptionpublic java.util.List<java.lang.Object> findInProjection(QueryCondition queryCondition, DataColumn... columns) throws java.lang.Exception
findInProjection 在接口中 DAO<T extends BaseEntity>java.lang.Exceptionpublic void addOrUpdate(T record) throws java.lang.Exception
addOrUpdate 在接口中 DAO<T extends BaseEntity>java.lang.Exception