Interface DataOperator<T extends BaseDataEntity<String>>
- Type Parameters:
T- 数据类型,继承自BaseDataEntity
- All Known Implementing Classes:
AbstractRelationalDataOperator,MysqlDataOperator,SimpleJsonDataOperator,SQLiteDataOperator
public interface DataOperator<T extends BaseDataEntity<String>>
Data operation interface.
数据操作接口
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoiddel(WhereCondition... whereConditions) Delete data record by conditions.voidDelete data record by ID.booleanexist(WhereCondition... whereConditions) Check if the data record exists.booleanCheck if the data record exists.getAll()Get all data record.getAll(WhereCondition... whereConditions) Get all data record by conditions.Get data record by ID.getLike(String column, String value, DataOperator.LikeType likeType) Fuzzy QueryvoidInsert data record.default voidInsert multiple entities atomically.page(int page, int size, WhereCondition... whereConditions) Get data record by page.query()Returns a new fluent query builder for this data operator.default voidtransaction(Runnable action) Execute operations within a transaction (void variant).default <R> Rtransaction(Callable<R> action) Execute operations within a transaction.voidUpdate one field of one record.voidUpdate data record by object.default voidUpdate multiple entities atomically.
-
Method Details
-
exist
Check if the data record exists.查询记录数据是否存在。
- Parameters:
object- Data record entity
数据记录实体- Returns:
- Whether the record exists
记录是否存在
-
exist
Check if the data record exists.使用条件查询记录是否存在
- Parameters:
whereConditions- Conditions
条件参数- Returns:
- Whether the record exists
记录是否存在
-
getById
Get data record by ID.使用ID获取记录
- Parameters:
id- Record ID
记录ID- Returns:
- Data record
数据记录
-
getAll
Get all data record.查询所有记录
- Returns:
- Data record list
数据记录列表
-
getAll
Get all data record by conditions.查询所有符合条件的记录
- Parameters:
whereConditions- Conditions
条件参数- Returns:
- Data record list
数据记录列表
-
getLike
Fuzzy Query模糊查询
- Parameters:
column- Column name
列名value- Query value
查询值likeType- Like type
模糊查询类型DataOperator.LikeType- Returns:
- Data record list
数据记录列表
-
page
Get data record by page.分页查询
- Parameters:
page- Page number
页码size- Page size
页大小whereConditions- Conditions
条件参数- Returns:
- Data record list
数据记录列表
-
insert
Insert data record.新增记录
- Parameters:
obj- Data record
数据记录
-
del
Delete data record by conditions.按照条件删除记录
- Parameters:
whereConditions- Conditions
条件参数
-
delById
Delete data record by ID.按照ID删除记录
- Parameters:
id- Record ID
记录ID
-
update
Update one field of one record.更新某个记录的某个值
- Parameters:
column- Column name
列名value- New value
新值id- Record ID
记录ID
-
update
Update data record by object. It will not update the fields that the incoming entity does not have.使用实体更新记录。不会更新传入实体没有的字段。
- Parameters:
obj- Data record
数据记录- Throws:
IllegalAccessException- Please referIllegalAccessException
-
query
Returns a new fluent query builder for this data operator.返回此数据操作器的新流式查询构建器。
- Returns:
- a new Query builder
-
transaction
Execute operations within a transaction. All operations commit together or roll back on exception. For SQL backends, uses database transactions. For JSON, uses snapshot-based rollback.在事务中执行操作。所有操作一起提交或在异常时回滚。
- Type Parameters:
R- the return type- Parameters:
action- the operations to execute- Returns:
- the result of the action
- Throws:
Exception- if the action fails
-
transaction
Execute operations within a transaction (void variant).在事务中执行操作(无返回值)。
- Parameters:
action- the operations to execute
-
insertAll
Insert multiple entities atomically. Uses JDBC batch for SQL backends.批量原子插入。SQL后端使用JDBC批处理。
- Parameters:
entities- the entities to insert
-
updateAll
Update multiple entities atomically. Uses JDBC batch for SQL backends.批量原子更新。SQL后端使用JDBC批处理。
- Parameters:
entities- the entities to update- Throws:
IllegalAccessException- if field access fails
-