[feat] 拓展 database-ptc-object 增加快捷操作工具#658
Merged
Bkm016 merged 1 commit intoTabooLib:dev/6.2.3from Feb 10, 2026
Merged
Conversation
- 引入 DataMapper<T> 接口及实现,提供类型安全的 CRUD 操作层 - 新增 mapper() 委托函数简化 DataMapper 获取 - 新增 TransactionalDataMapper 事务内操作支持 - 新增 QueryCache 两级缓存系统(Bean Cache + Query Cache) - 新增 @linktable 关联表查询,支持多层嵌套 JOIN 和级联保存 - 新增 @ColumnType 注解支持自定义列类型 - 新增 Page<T> 分页查询:findPage/sortPage/sortDescendingPage - 新增 Cursor<T> 游标查询:selectCursor/sortCursor/sortDescendingCursor - 新增 IndexedEnum 接口:枚举以数值 index 存储到数据库 - 扩展 ActionSelect 支持带参数的子查询 JOIN - 补充所有注解的 KDoc 文档和 @target 约束
b38c601 to
d21c7a7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动说明
为
database-ptc-object模块进行全面扩展,新增类型安全的 DataMapper 层、关联表查询、分页、游标、IndexedEnum 等功能。一、DataMapper 接口与类型安全 CRUD(核心新增)
引入
DataMapper<T>接口及DataMapperImpl实现,提供类型安全的数据操作层:find、findOne、findAll、insert、update、delete、has、countfindByKey、findOneByKey、hasByKey、updateByKeyfindByIds、deleteByIds、updateBatch、insertBatchsort、sortDescendingdeleteWhere(按 Filter 条件删除)insertAndGenerateKey、insertBatchAndGenerateKeysfindByRowId、deleteByRowId二、MapperDelegate(mapper 委托)
新增
mapper()委托函数,简化 DataMapper 的获取方式:三、事务支持(TransactionalDataMapper)
新增
TransactionalDataMapper,在transaction {}块中提供完整的 DataMapper 操作,事务内所有操作共享同一数据库连接,不使用缓存。四、QueryCache 缓存系统
新增两级缓存机制:
五、@linktable 关联表查询
新增
@LinkTable注解,支持数据类之间的关联关系:innerJoin、leftJoin、rightJoin带参数版本)SubQuery类和subQueryDSL 构建子查询六、分页查询(Page)
新增
Page<T>数据类,封装分页结果:findPage、sortPage、sortDescendingPage@LinkTableJOIN 查询七、游标查询(Cursor)
新增
Cursor<T>类,实现Iterable<T>+Closeable,流式逐行遍历大数据集:container.transaction { mapper.selectCursor().forEach { item -> /* 逐行处理 */ } }selectCursor、sortCursor、sortDescendingCursortransaction {}块中使用,支持提前终止和自动关闭八、IndexedEnum 接口
新增
IndexedEnum接口,枚举以数值index存储到数据库:BIGINT,SQLite:INTEGER)convertParam)九、注解增强
@ColumnType(新增):显式指定字段的 SQL / SQLite 列类型@Target约束十、ActionSelect 扩展
innerJoin、leftJoin、rightJoin方法,支持子查询作为 JOIN 条件修改文件清单
Annotations.ktContainerOperator.ktContainerOperatorImpl.ktContainerSQL.ktContainerSQLite.ktContainer.ktAnalyzedClass.ktAnalyzedClassMember.ktJoinQuery.ktPersistentContainer.ktDataMapper.ktDataMapperImpl.ktTransactionalDataMapper.ktTransactionContext.ktMapperDelegate.ktQueryCache.ktPage.ktCursor.ktIndexedEnum.ktLinkTableTest.ktTestHelper.ktActionSelect.ktJoin.ktCloses #656