diff --git a/.gitee/ISSUE_TEMPLATE/bug.yml b/.gitee/ISSUE_TEMPLATE/bug.yml index e6447795..4d9d2c8f 100644 --- a/.gitee/ISSUE_TEMPLATE/bug.yml +++ b/.gitee/ISSUE_TEMPLATE/bug.yml @@ -7,7 +7,7 @@ body: attributes: label: 这个 Bug 是否已经存在: options: - - label: 我确定已经把 MyBatis-Flex 升级到最新版本 v1.7.6,并已搜索过现有的问题 (https://gitee.com/mybatis-flex/mybatis-flex/issues) + - label: 我确定已经把 MyBatis-Flex 升级到最新版本 v1.7.7,并已搜索过现有的问题 (https://gitee.com/mybatis-flex/mybatis-flex/issues) required: true - type: textarea attributes: diff --git a/.gitee/ISSUE_TEMPLATE/question.yml b/.gitee/ISSUE_TEMPLATE/question.yml index 0a8e8361..553d630b 100644 --- a/.gitee/ISSUE_TEMPLATE/question.yml +++ b/.gitee/ISSUE_TEMPLATE/question.yml @@ -13,7 +13,7 @@ body: attributes: label: 这个问题是否已经存在: options: - - label: 我确定已经把 MyBatis-Flex 升级到最新版本 v1.7.6,并已搜索过现有的问题 (https://gitee.com/mybatis-flex/mybatis-flex/issues) + - label: 我确定已经把 MyBatis-Flex 升级到最新版本 v1.7.7,并已搜索过现有的问题 (https://gitee.com/mybatis-flex/mybatis-flex/issues) required: true - type: textarea id: question-description diff --git a/changes.md b/changes.md index 4e249f93..32dedbc1 100644 --- a/changes.md +++ b/changes.md @@ -2,6 +2,22 @@ 查看 [全部代码贡献者](/zh/intro/what-is-mybatisflex.html#贡献者)。 + +## v1.7.7 20240104: +- 新增:添加 spring-boot3 新模块,用于 springboot v3 下使用,感谢 @Suomm +- 新增:QueryMethods 添加 NOT (column) 函数,感谢 @wittplus +- 优化:更新 Solon 下的 @ProxyComponent 为 @Component,感谢 @citysoft +- 优化:修改 com.mybatisflex.annotation.SetListener 的注释错误,感谢 @whzzone +- 优化:修改 GBase_8s 数据库类型 sql 语句无反义处理 +- 优化:升级 MyBatis 到 3.5.15 最新版本 #I8PQLC +- 修复:IService.getOne 没有添加 limit 1 的问题 +- 修复:Db.updateEntitiesBatch 更新部分字段时报错的问题,感谢 @617054137 +- 文档:更新在 Kotlin 下使用的相关文档,感谢 @kamo-sama +- 文档:优化示例代码提交语言标识,感谢 @bf109f +- 文档:更新存在一个为 is_deleted 的字段中拼写错误,感谢 @shuangtao + + + ## v1.7.6 20231223: - 新增:Db.selectFirstAndSecondColumnsAsMap 方法:查询结果的第一列作为 key,第二列作为 value,感谢 @617054137 - 新增:方言添加添加权限处理统一入口 prepareAuth,感谢 @bf109f diff --git a/docs/.vitepress/theme/MyLayout.vue b/docs/.vitepress/theme/MyLayout.vue index 1c8cc228..5979486e 100644 --- a/docs/.vitepress/theme/MyLayout.vue +++ b/docs/.vitepress/theme/MyLayout.vue @@ -78,8 +78,8 @@ const {Layout} = DefaultTheme diff --git a/docs/.vitepress/theme/style.css b/docs/.vitepress/theme/style.css index 0fc6f6c5..f878ec0d 100644 --- a/docs/.vitepress/theme/style.css +++ b/docs/.vitepress/theme/style.css @@ -1,12 +1,8 @@ :root { - --vp-c-brand: #F06C33; - --vp-c-brand-light: #FFCC00; - --vp-c-brand-lighter: #FFCC99; - --vp-c-brand-dark: #FF9933; - --vp-c-brand-darker: #CC6600; - - --vp-custom-block-tip-border: #FFCC99; - --vp-custom-block-tip-text: #F06C33; + --vp-c-brand-1:#F06C33; + --vp-home-hero-name-color:#F06C33; + --vp-button-brand-bg:#F06C33; + --vp-button-brand-hover-bg:#ff986b; } .vp-doc .custom-block p { diff --git a/docs/assets/images/ad/admin-banner.jpg b/docs/assets/images/ad/admin-banner.jpg new file mode 100644 index 00000000..7dd2cb06 Binary files /dev/null and b/docs/assets/images/ad/admin-banner.jpg differ diff --git a/docs/package.json b/docs/package.json index c3620a3e..236dc957 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,11 +1,11 @@ { "type": "module", - "scripts": { - "docs:dev": "vitepress dev", - "docs:build": "vitepress build", - "docs:preview": "vitepress preview" - }, - "devDependencies": { - "vitepress": "^1.0.0-beta.3 " - } + "scripts": { + "docs:dev": "vitepress dev", + "docs:build": "vitepress build", + "docs:preview": "vitepress preview" + }, + "devDependencies": { + "vitepress": "^1.0.0-rc.32" + } } diff --git a/docs/zh/becoming-a-sponsor.md b/docs/zh/becoming-a-sponsor.md index 4bc19aa1..a143e3f7 100644 --- a/docs/zh/becoming-a-sponsor.md +++ b/docs/zh/becoming-a-sponsor.md @@ -9,10 +9,10 @@ MyBatis-Flex 展示的机会。 在本站对应的位置放置您的 LOGO 及跳转链接。 -| 位置 | 素材 | 宽高 | 赞助费 | 名额 | -| ---------------- | ---------------- | ------------- | ---------- |------------ | -| 全站右侧边栏 1 | 图片+链接 | 105*50px | ¥200/月 | 8 | -| 全站右侧边栏 2 | 图片+链接 | 122*50px | ¥400/月 |1 | +| 位置 | 素材 | 宽高 | 赞助费 | 名额 | +| ---------------- | ---------------- |----------| ---------- |----| +| 全站右侧边栏 1 | 图片+链接 | 105*50px | ¥200/月 | 8 | +| 全站右侧边栏 2 | 图片+链接 | 222*50px | ¥400/月 | 1 | 您可以联系微信 `fuh99888` 就展示位的详细事宜。 diff --git a/docs/zh/changes.md b/docs/zh/changes.md index 4e249f93..32dedbc1 100644 --- a/docs/zh/changes.md +++ b/docs/zh/changes.md @@ -2,6 +2,22 @@ 查看 [全部代码贡献者](/zh/intro/what-is-mybatisflex.html#贡献者)。 + +## v1.7.7 20240104: +- 新增:添加 spring-boot3 新模块,用于 springboot v3 下使用,感谢 @Suomm +- 新增:QueryMethods 添加 NOT (column) 函数,感谢 @wittplus +- 优化:更新 Solon 下的 @ProxyComponent 为 @Component,感谢 @citysoft +- 优化:修改 com.mybatisflex.annotation.SetListener 的注释错误,感谢 @whzzone +- 优化:修改 GBase_8s 数据库类型 sql 语句无反义处理 +- 优化:升级 MyBatis 到 3.5.15 最新版本 #I8PQLC +- 修复:IService.getOne 没有添加 limit 1 的问题 +- 修复:Db.updateEntitiesBatch 更新部分字段时报错的问题,感谢 @617054137 +- 文档:更新在 Kotlin 下使用的相关文档,感谢 @kamo-sama +- 文档:优化示例代码提交语言标识,感谢 @bf109f +- 文档:更新存在一个为 is_deleted 的字段中拼写错误,感谢 @shuangtao + + + ## v1.7.6 20231223: - 新增:Db.selectFirstAndSecondColumnsAsMap 方法:查询结果的第一列作为 key,第二列作为 value,感谢 @617054137 - 新增:方言添加添加权限处理统一入口 prepareAuth,感谢 @bf109f diff --git a/docs/zh/core/data-permission.md b/docs/zh/core/data-permission.md index 4056de2c..52c61d2f 100644 --- a/docs/zh/core/data-permission.md +++ b/docs/zh/core/data-permission.md @@ -119,7 +119,7 @@ public class AuthDialectImpl extends CommonsDialectImpl { 对`QueryWrapper`的表做筛选可参考 **方式1** 在项目启动时通过 `DialectFactory` 注册 `AuthDialectImpl`,以spring boot项目为例: -``` +```java @Configuration public class MybatisFlexConfig implements MyBatisFlexCustomizer { diff --git a/docs/zh/core/logic-delete.md b/docs/zh/core/logic-delete.md index 108bff4b..cb841973 100644 --- a/docs/zh/core/logic-delete.md +++ b/docs/zh/core/logic-delete.md @@ -10,7 +10,7 @@ ## MyBatis-Flex 逻辑删除示例 -假设在 tb_account 表中,存在一个为 is_deleted 的字段,用来标识该数据的逻辑删除,那么 tb_account 表 +假设在 tb_account 表中,存在一个为 is_delete 的字段,用来标识该数据的逻辑删除,那么 tb_account 表 对应的 "Account.java" 实体类应该配置如下: ```java diff --git a/docs/zh/intro/getting-started.md b/docs/zh/intro/getting-started.md index 5c127c90..d6b10942 100644 --- a/docs/zh/intro/getting-started.md +++ b/docs/zh/intro/getting-started.md @@ -57,12 +57,11 @@ VALUES (1, '张三', 18, '2020-01-11'), 需要添加的 Maven 主要依赖示例: ```xml - com.mybatis-flex mybatis-flex-spring-boot-starter - 1.7.6 + 1.7.7 com.mysql @@ -82,6 +81,35 @@ VALUES (1, '张三', 18, '2020-01-11'), ``` +**注意**: 如果您当前使用的是 SpringBoot v3.x 版本,需要把依赖 `mybatis-flex-spring-boot-starter` 修改为:`mybatis-flex-spring-boot3-starter`, +如下代码所示: + +```xml 4 + + + com.mybatis-flex + mybatis-flex-spring-boot3-starter + 1.7.7 + + + com.mysql + mysql-connector-j + runtime + + + com.zaxxer + HikariCP + + + + org.springframework.boot + spring-boot-starter-test + test + + +``` + + **第 3 步:对 Spring Boot 项目进行配置** 在 application.yml 中配置数据源: diff --git a/docs/zh/intro/gradle.md b/docs/zh/intro/gradle.md index 284de463..c46d186f 100644 --- a/docs/zh/intro/gradle.md +++ b/docs/zh/intro/gradle.md @@ -10,7 +10,7 @@ ```kotlin dependencies { - implementation("com.mybatis-flex:mybatis-flex-core:1.7.6") + implementation("com.mybatis-flex:mybatis-flex-core:1.7.7") } ``` @@ -18,7 +18,7 @@ dependencies { ```groovy dependencies { - implementation 'com.mybatis-flex:mybatis-flex-core:1.7.6' + implementation 'com.mybatis-flex:mybatis-flex-core:1.7.7' } ``` @@ -28,7 +28,7 @@ dependencies { ```kotlin dependencies { - implementation("com.mybatis-flex:mybatis-flex-spring:1.7.6") + implementation("com.mybatis-flex:mybatis-flex-spring:1.7.7") } ``` @@ -36,7 +36,7 @@ dependencies { ```groovy dependencies { - implementation 'com.mybatis-flex:mybatis-flex-spring:1.7.6' + implementation 'com.mybatis-flex:mybatis-flex-spring:1.7.7' } ``` @@ -46,7 +46,7 @@ dependencies { ```kotlin dependencies { - implementation("com.mybatis-flex:mybatis-flex-spring-boot-starter:1.7.6") + implementation("com.mybatis-flex:mybatis-flex-spring-boot-starter:1.7.7") } ``` @@ -54,7 +54,7 @@ dependencies { ```groovy dependencies { - implementation 'com.mybatis-flex:mybatis-flex-spring-boot-starter:1.7.6' + implementation 'com.mybatis-flex:mybatis-flex-spring-boot-starter:1.7.7' } ``` @@ -70,7 +70,7 @@ dependencies { ```kotlin dependencies { - annotationProcessor("com.mybatis-flex:mybatis-flex-processor:1.7.6") + annotationProcessor("com.mybatis-flex:mybatis-flex-processor:1.7.7") } ``` @@ -78,6 +78,6 @@ dependencies { ```groovy dependencies { - annotationProcessor 'com.mybatis-flex:mybatis-flex-processor:1.7.6' + annotationProcessor 'com.mybatis-flex:mybatis-flex-processor:1.7.7' } ``` diff --git a/docs/zh/intro/maven.md b/docs/zh/intro/maven.md index 84ac8455..78614843 100644 --- a/docs/zh/intro/maven.md +++ b/docs/zh/intro/maven.md @@ -12,12 +12,12 @@ com.mybatis-flex mybatis-flex-core - 1.7.6 + 1.7.7 com.mybatis-flex mybatis-flex-processor - 1.7.6 + 1.7.7 provided ``` @@ -28,33 +28,49 @@ com.mybatis-flex mybatis-flex-spring - 1.7.6 + 1.7.7 com.mybatis-flex mybatis-flex-processor - 1.7.6 + 1.7.7 provided `````` -3、用到了 Spring Boot 的场景 +3、用到了 SpringBoot v2.x 的场景 -```xml +```xml 3 com.mybatis-flex mybatis-flex-spring-boot-starter - 1.7.6 + 1.7.7 com.mybatis-flex mybatis-flex-processor - 1.7.6 + 1.7.7 provided ``` -4、配置 annotationProcessor +4、用到了 SpringBoot v3.x 的场景 + +```xml 3 + + com.mybatis-flex + mybatis-flex-spring-boot3-starter + 1.7.7 + + + com.mybatis-flex + mybatis-flex-processor + 1.7.7 + provided + +``` + +5、配置 annotationProcessor `mybatis-flex-processor`提供APT服务,可以配置到annotationProcessorPaths,配置后,无需在依赖中声明`mybatis-flex-processor`依赖。 @@ -72,14 +88,14 @@ com.mybatis-flex mybatis-flex-processor - 1.7.6 + 1.7.7 ``` -5、配置依赖管理 +6、配置依赖管理 MyBatis-Flex 提供了 `mybatis-flex-dependencies` 模块进行依赖管理,只需要在 `` 标签下进行配置就可以了。 diff --git a/docs/zh/intro/parts/contributors.md b/docs/zh/intro/parts/contributors.md index 71239de2..14264890 100644 --- a/docs/zh/intro/parts/contributors.md +++ b/docs/zh/intro/parts/contributors.md @@ -1,23 +1,28 @@ | | | | | | |-----|-----|-----|-----|-----| -|![](https://foruda.gitee.com/avatar/1676898191051702081/61279_fuhai_1578915942.png!avatar60)Michael Yang|![](https://foruda.gitee.com/avatar/1698661375322784129/7984572_suomm_1698661375.png!avatar60)王帅|![](https://api.dicebear.com/7.x/initials/svg?seed=丌冰)丌冰|![](https://foruda.gitee.com/avatar/1691636027051962328/11233353_kamo-sama_1691636027.png!avatar60)卡莫sama|![](https://foruda.gitee.com/avatar/1691044597656855579/7563907_lifejwang11_1691044597.png!avatar60)life| -|![](https://api.dicebear.com/7.x/initials/svg?seed=snyk-bot)snyk-bot|![](https://api.dicebear.com/7.x/initials/svg?seed=lhzsdnu)lhzsdnu|![](https://foruda.gitee.com/avatar/1683858335519306352/15535_noear_admin_1683858335.png!avatar60)西东|![](https://api.dicebear.com/7.x/initials/svg?seed=Font_C)Font_C|![](https://api.dicebear.com/7.x/initials/svg?seed=pengpeng)pengpeng| -|![](https://api.dicebear.com/7.x/initials/svg?seed=庄佳彬)庄佳彬|![](https://api.dicebear.com/7.x/initials/svg?seed=Ice-samll)Ice-samll|![](https://api.dicebear.com/7.x/initials/svg?seed=guanmengyuan)guanmengyuan|![](https://foruda.gitee.com/avatar/1697612161781835336/7870258_wchopper_1697612161.png!avatar60)王超|![](https://api.dicebear.com/7.x/initials/svg?seed=笨小孩)笨小孩| -|![](https://api.dicebear.com/7.x/initials/svg?seed=chenjh3)chenjh3|![](https://api.dicebear.com/7.x/initials/svg?seed=CloudPlayer)CloudPlayer|![](https://api.dicebear.com/7.x/initials/svg?seed=Jerry)Jerry|![](https://api.dicebear.com/7.x/initials/svg?seed=snow)snow|![](https://api.dicebear.com/7.x/initials/svg?seed=草语)草语| -|![](https://foruda.gitee.com/avatar/1694759381586775676/568596_qq925966998_1694759381.png!avatar60)李楠|![](https://api.dicebear.com/7.x/initials/svg?seed=菜鸟3853)菜鸟3853|![](https://api.dicebear.com/7.x/initials/svg?seed=Jerry_Zheng)Jerry_Zheng|![](https://api.dicebear.com/7.x/initials/svg?seed=tangxin)tangxin|![](https://api.dicebear.com/7.x/initials/svg?seed=wujl)wujl| -|![](https://foruda.gitee.com/avatar/1676895504036051867/8807_piggsoft_1578914592.jpg!avatar60)piggsoft|![](https://foruda.gitee.com/avatar/1674286432514482953/4807650_fandai_fandaidzsw_1674286432.png!avatar60)赤兮丷|![](https://api.dicebear.com/7.x/initials/svg?seed=黄沐鸿)黄沐鸿|![](https://api.dicebear.com/7.x/initials/svg?seed=loong0306)loong0306|![](https://api.dicebear.com/7.x/initials/svg?seed=沈君锋)沈君锋| -|![](https://foruda.gitee.com/avatar/1691034002435340221/1920167_qimincow_1691034002.png!avatar60)英雄路|![](https://api.dicebear.com/7.x/initials/svg?seed=natsufumij)natsufumij|![](https://api.dicebear.com/7.x/initials/svg?seed=aqnghu)aqnghu|![](https://api.dicebear.com/7.x/initials/svg?seed=BQ60ziOxlFI0R0)BQ60ziOxlFI0R0|![](https://api.dicebear.com/7.x/initials/svg?seed=tan90)tan90| -|![](https://api.dicebear.com/7.x/initials/svg?seed=张继续)张继续|![](https://api.dicebear.com/7.x/initials/svg?seed=font-C)font-C|![](https://foruda.gitee.com/avatar/1677053740056224121/5462387_i_tell_you_1618064317.png!avatar60)liibang|![](https://api.dicebear.com/7.x/initials/svg?seed=cainiao3853)cainiao3853|![](https://api.dicebear.com/7.x/initials/svg?seed=barql)barql| -|![](https://api.dicebear.com/7.x/initials/svg?seed=yangs)yangs|![](https://foruda.gitee.com/avatar/1677086127012961929/7598208_robot-l_1590219712.png!avatar60)Robot.L|![](https://foruda.gitee.com/avatar/1695378372753910643/2130728_lemonbx_1695378372.png!avatar60)落羽er|![](https://api.dicebear.com/7.x/initials/svg?seed=qixy)qixy|![](https://api.dicebear.com/7.x/initials/svg?seed=yuanbaolong)yuanbaolong| -|![](https://foruda.gitee.com/avatar/1678377314939642686/1604115_handy-git_1678377314.png!avatar60)handy|![](https://api.dicebear.com/7.x/initials/svg?seed=zhijieqing)zhijieqing|![](https://foruda.gitee.com/avatar/1674121508509280199/9288653_saoforestt_1674121508.png!avatar60)Saoforest|![](https://foruda.gitee.com/avatar/1677237805724097193/11485875_bygkn_1660893367.png!avatar60)bygkn|![](https://api.dicebear.com/7.x/initials/svg?seed=XiaoLin)XiaoLin| -|![](https://api.dicebear.com/7.x/initials/svg?seed=zhongyong)zhongyong|![](https://foruda.gitee.com/avatar/1676978624694631546/1600987_youthdream_1592959590.png!avatar60)锟斤拷|![](https://api.dicebear.com/7.x/initials/svg?seed=Watcher.Wang)Watcher.Wang|![](https://foruda.gitee.com/avatar/1677111694079591934/8088436_yang-zzu_1604969134.png!avatar60)yang_zzu|![](https://foruda.gitee.com/avatar/1676895416224286260/8331_chaosforever_1578914555.png!avatar60)锁力| -|![](https://api.dicebear.com/7.x/initials/svg?seed=shaoerkuai)shaoerkuai|![](https://foruda.gitee.com/avatar/1679885039814030308/5151444_yangbuyi_1679885039.png!avatar60)阿志同学|![](https://api.dicebear.com/7.x/initials/svg?seed=chenjian835)chenjian835|![](https://foruda.gitee.com/avatar/1676896586274105369/20327_cnscoo_1578915320.jpg!avatar60)Haru|![](https://foruda.gitee.com/avatar/1676896562075035262/20021_duxlei_1578915302.png!avatar60)duxlei| -|![](https://foruda.gitee.com/avatar/1676905453682965545/327218_gm173119755_1648555045.png!avatar60)豌豆粉|![](https://api.dicebear.com/7.x/initials/svg?seed=matthew)matthew|![](https://api.dicebear.com/7.x/initials/svg?seed=凌尘)凌尘|![](https://api.dicebear.com/7.x/initials/svg?seed=luy)luy|![](https://api.dicebear.com/7.x/initials/svg?seed=gongzhongqiang)gongzhongqiang| -|![](https://api.dicebear.com/7.x/initials/svg?seed=Alex)Alex|![](https://api.dicebear.com/7.x/initials/svg?seed=EafonYoung)EafonYoung|![](https://foruda.gitee.com/avatar/1677170868635098448/9319924_pioneer-sun_1624354686.png!avatar60)Pioneer-Sun|![](https://foruda.gitee.com/avatar/1677166292370951564/9173563_q-alex_1627784508.png!avatar60)Q_Alex|![](https://foruda.gitee.com/avatar/1677052070334379576/5421002_wlf213_1612139033.png!avatar60)wlf| -|![](https://foruda.gitee.com/avatar/1676898238064465096/61541_whitedolphin_1578915956.png!avatar60)CrazyAirhead|![](https://api.dicebear.com/7.x/initials/svg?seed=winnerself)winnerself|![](https://foruda.gitee.com/avatar/1677182504887358627/9655223_animal553_1631088642.png!avatar60)她出去赚钱了|![](https://foruda.gitee.com/avatar/1694921912224475489/8702036_dataprince_1694921912.png!avatar60)数据小王子|![](https://api.dicebear.com/7.x/initials/svg?seed=XiaoLin)XiaoLin| -|![](https://api.dicebear.com/7.x/initials/svg?seed=Freeman Liu)Freeman Liu|![](https://api.dicebear.com/7.x/initials/svg?seed=大周)大周|![](https://api.dicebear.com/7.x/initials/svg?seed=欢乐码农)欢乐码农|![](https://api.dicebear.com/7.x/initials/svg?seed=2han9wen71an)2han9wen71an|![](https://api.dicebear.com/7.x/initials/svg?seed=Shark)Shark| -|![](https://api.dicebear.com/7.x/initials/svg?seed=庄佳彬)庄佳彬|![](https://api.dicebear.com/7.x/initials/svg?seed=hans)hans|![](https://foruda.gitee.com/avatar/1677173250729036908/9369933_hunnyovo_1650792499.png!avatar60)HunnyOvO|![](https://foruda.gitee.com/avatar/1696779720632916032/13315404_guan-meng-yuan_1696779720.png!avatar60)关梦园|![](https://api.dicebear.com/7.x/initials/svg?seed=lcxw)lcxw| -|![](https://api.dicebear.com/7.x/initials/svg?seed=dgmico)dgmico|![](https://foruda.gitee.com/avatar/1677162544015233775/9094323_lymph_java_1624796992.png!avatar60)Ikko Eltociear Ashimine|![](https://api.dicebear.com/7.x/initials/svg?seed=wanggaoquan)wanggaoquan|![](https://foruda.gitee.com/avatar/1689673717825068611/9856206_aohanaohan_1689673717.png!avatar60)Aohan-Zhang|![](https://foruda.gitee.com/avatar/1691737477130376308/1673084_wang_yong_ji_1691737477.png!avatar60)老吉丶| -|![](https://foruda.gitee.com/avatar/1684129987239221781/1731138_toycat93_1684129987.png!avatar60)玩具猫|![](https://api.dicebear.com/7.x/initials/svg?seed=meng.liu3)meng.liu3|![](https://api.dicebear.com/7.x/initials/svg?seed=yaochen4)yaochen4|![](https://foruda.gitee.com/avatar/1676959401839738321/1269497_zhy_balck_1578947791.png!avatar60)zhy_black|![](https://foruda.gitee.com/avatar/1676974596171836113/1532463_1395961821_1578953848.png!avatar60)ζั͡ ั͡ ั͡ ั͡Wm| -|![](https://foruda.gitee.com/avatar/1676894749123859490/2132_hopper_1578914095.jpg!avatar60)陈国正|![](https://foruda.gitee.com/avatar/1691805683099463215/8904907_zhuhjay_1691805683.png!avatar60)ZhuHJay|![](https://foruda.gitee.com/avatar/1677071665480088881/6561865_zoufang162_1585144118.png!avatar60)zoufang162|![](https://api.dicebear.com/7.x/initials/svg?seed=乌鸦笑猪黑)乌鸦笑猪黑|![](https://api.dicebear.com/7.x/initials/svg?seed=wnp)wnp| +|![](https://foruda.gitee.com/avatar/1676898191051702081/61279_fuhai_1578915942.png!avatar30)Michael Yang|![](https://foruda.gitee.com/avatar/1698661375322784129/7984572_suomm_1698661375.png!avatar30)王帅|![](https://foruda.gitee.com/avatar/1691636027051962328/11233353_kamo-sama_1691636027.png!avatar30)卡莫sama|丌冰|![](https://foruda.gitee.com/avatar/1691044597656855579/7563907_lifejwang11_1691044597.png!avatar30)life| +|snyk-bot|lhzsdnu|![](https://foruda.gitee.com/avatar/1683858335519306352/15535_noear_admin_1683858335.png!avatar30)西东|tangxin|Font_C| +|pengpeng|庄佳彬|Ice-samll|guanmengyuan|![](https://foruda.gitee.com/avatar/1697612161781835336/7870258_wchopper_1697612161.png!avatar30)王超| +|笨小孩|bf109f|chenjh3|CloudPlayer|Jerry| +|snow|草语|farukonfly|![](https://foruda.gitee.com/avatar/1694759381586775676/568596_qq925966998_1694759381.png!avatar30)李楠|菜鸟3853| +|mofan|Jerry_Zheng|wujl|Martin7-1|![](https://foruda.gitee.com/avatar/1676895504036051867/8807_piggsoft_1578914592.jpg!avatar30)piggsoft| +|![](https://foruda.gitee.com/avatar/1674286432514482953/4807650_fandai_fandaidzsw_1674286432.png!avatar30)赤兮丷|黄沐鸿|loong0306|沈君锋|![](https://foruda.gitee.com/avatar/1691034002435340221/1920167_qimincow_1691034002.png!avatar30)英雄路| +|natsufumij|BQ60ziOxlFI0R0|tan90|aqnghu|张继续| +|font-C|![](https://foruda.gitee.com/avatar/1677053740056224121/5462387_i_tell_you_1618064317.png!avatar30)liibang|cainiao3853|![](https://foruda.gitee.com/avatar/1702438316292746960/8789215_barql_1702438316.png!avatar30)barql|yangs| +|lcxw|![](https://foruda.gitee.com/avatar/1677086127012961929/7598208_robot-l_1590219712.png!avatar30)Robot.L|![](https://foruda.gitee.com/avatar/1695378372753910643/2130728_lemonbx_1695378372.png!avatar30)落羽er|Faputa|qixy| +|yuanbaolong|zhijieqing|![](https://foruda.gitee.com/avatar/1678377314939642686/1604115_handy-git_1678377314.png!avatar30)handy|![](https://foruda.gitee.com/avatar/1677237805724097193/11485875_bygkn_1660893367.png!avatar30)bygkn|![](https://foruda.gitee.com/avatar/1674121508509280199/9288653_saoforestt_1674121508.png!avatar30)Saoforest| +|![](https://foruda.gitee.com/avatar/1676906219947351575/342237_tangzc_1629796763.png!avatar30)唐振超|Watcher.Wang|![](https://foruda.gitee.com/avatar/1676978624694631546/1600987_youthdream_1592959590.png!avatar30)锟斤拷|zhongyong|XiaoLin| +|![](https://foruda.gitee.com/avatar/1677111694079591934/8088436_yang-zzu_1604969134.png!avatar30)yang_zzu|![](https://foruda.gitee.com/avatar/1676895416224286260/8331_chaosforever_1578914555.png!avatar30)锁力|shaoerkuai|meichenhui|![](https://foruda.gitee.com/avatar/1679885039814030308/5151444_yangbuyi_1679885039.png!avatar30)阿志同学| +|chenjian835|![](https://foruda.gitee.com/avatar/1676896586274105369/20327_cnscoo_1578915320.jpg!avatar30)Haru|![](https://foruda.gitee.com/avatar/1676896562075035262/20021_duxlei_1578915302.png!avatar30)duxlei|![](https://foruda.gitee.com/avatar/1676905453682965545/327218_gm173119755_1648555045.png!avatar30)豌豆粉|涛声依旧| +|matthew|gongzhongqiang|luy|凌尘|Alex| +|EafonYoung|![](https://foruda.gitee.com/avatar/1677170868635098448/9319924_pioneer-sun_1624354686.png!avatar30)Pioneer-Sun|![](https://foruda.gitee.com/avatar/1677166292370951564/9173563_q-alex_1627784508.png!avatar30)Q_Alex|![](https://foruda.gitee.com/avatar/1677052070334379576/5421002_wlf213_1612139033.png!avatar30)wlf|1332987| +|Lionel|winnerself|![](https://foruda.gitee.com/avatar/1676898238064465096/61541_whitedolphin_1578915956.png!avatar30)CrazyAirhead|![](https://foruda.gitee.com/avatar/1677182504887358627/9655223_animal553_1631088642.png!avatar30)她出去赚钱了|![](https://foruda.gitee.com/avatar/1694921912224475489/8702036_dataprince_1694921912.png!avatar30)数据小王子| +|XiaoLin|丿风轻灬云淡|![](https://foruda.gitee.com/avatar/1703832348210958955/7966959_zhang-bo-bo_1703832348.png!avatar30)张博|Freeman Liu|大周| +|欢乐码农|2han9wen71an|shark771|庄佳彬|_FLOW__| +|![](https://foruda.gitee.com/avatar/1677062003782215413/5643954_wei_hua_zhou_1653878946.png!avatar30)weihuazhou|hans|![](https://foruda.gitee.com/avatar/1677162544015233775/9094323_lymph_java_1624796992.png!avatar30)Ikko Eltociear Ashimine|guanmengyuan|dgmico| +|![](https://foruda.gitee.com/avatar/1677173250729036908/9369933_hunnyovo_1650792499.png!avatar30)HunnyOvO|wanggaoquan|![](https://foruda.gitee.com/avatar/1689673717825068611/9856206_aohanaohan_1689673717.png!avatar30)Aohan-Zhang|![](https://foruda.gitee.com/avatar/1691737477130376308/1673084_wang_yong_ji_1691737477.png!avatar30)老吉丶|![](https://foruda.gitee.com/avatar/1684129987239221781/1731138_toycat93_1684129987.png!avatar30)玩具猫| +|meng.liu3|yaochen4|![](https://foruda.gitee.com/avatar/1676959401839738321/1269497_zhy_balck_1578947791.png!avatar30)zhy_black|![](https://foruda.gitee.com/avatar/1676974596171836113/1532463_1395961821_1578953848.png!avatar30)ζั͡ ั͡ ั͡ ั͡Wm|![](https://foruda.gitee.com/avatar/1676894749123859490/2132_hopper_1578914095.jpg!avatar30)陈国正| +|![](https://foruda.gitee.com/avatar/1691805683099463215/8904907_zhuhjay_1691805683.png!avatar30)ZhuHJay|![](https://foruda.gitee.com/avatar/1677071665480088881/6561865_zoufang162_1585144118.png!avatar30)zoufang162|乌鸦笑猪黑|wnp|![](https://foruda.gitee.com/avatar/1676901646505077446/106613_myron_1578917779.png!avatar30)MyronLi| +|norkts|拓宇在思考|张春根|![](https://foruda.gitee.com/avatar/1699925437720003320/5656388_wittplus_1699925437.png!avatar30)witt|![](https://foruda.gitee.com/avatar/1676983827162237415/1697554_xinjump_1654653784.png!avatar30)xinjump| +|![](https://foruda.gitee.com/avatar/1693449200752633970/11209107_jl_0417_1693449200.png!avatar30)疾浪|sppan|![](https://foruda.gitee.com/avatar/1662084101462823713/2079235_djxchi_1662084101.png!avatar30)时间淡忘一切| diff --git a/docs/zh/intro/use-in-kotlin.md b/docs/zh/intro/use-in-kotlin.md index fb2d7649..f5b80c54 100644 --- a/docs/zh/intro/use-in-kotlin.md +++ b/docs/zh/intro/use-in-kotlin.md @@ -19,68 +19,70 @@ - 快速构建启动:通过DSL➕重载运算符,快速配置 MybatisFlexBootstrap 实例并启动: ```kotlin - buildBootstrap { + runFlex { // 配置数据源 相当于 setDataSource(dataSource) +dataSource // 配置Mapper 相当于 addMapper(AccountMapper::class.java) +AccountMapper::class // 配置日志输出 相当于 setLogImpl(StdOutImpl::class.java) logImpl = StdOutImpl::class - }.start() + } ``` - 快速查询数据:通过DSL➕泛型快速编写查询语句并查询: (快速查询提供三个函数:all, filter 和 query ) >- `all<实体类>()` 查泛型对应的表的所有数据 >- `filter<实体类>(vararg KProperty<*>, ()->QueryCondition)` 按条件查泛型对应的表的数据 >- `query<实体类>(QueryScope.()->Unit)` 较复杂查泛型对应的表的数据 (如: 分组,排序等) - + >- `paginateWith(pageNumber: Number, pageSize: Number, totalRow: Number? = null, queryConditionGet: () -> QueryCondition): Page<实体类>` + 与 `paginate(pageNumber: Number, pageSize: Number, totalRow: Number? = null, init: QueryScope.() -> Unit): Page<实体类>` 使用分页的条件查询与较复杂查询 - 简明地构建查询:通过中缀表达式➕扩展方法能更加简单明了的构建条件: - * **【对比原生】** - * **原生** - ```kotlin - val queryWrapper = QueryWrapper.create() - .select(Account::id.column(), Account::userName.column()) - .where(Account::age.column().isNotNull()).and(Account::age.column().ge(17)) - .orderBy(Account::id.column().desc()) - mapper().selectListByQuery(queryWrapper) - ``` - * **扩展后** - ```kotlin - query { - select(Account::id, Account::userName) - where(Account::age.isNotNull) and { Account::age ge 17 } orderBy -Account::id - } - ``` - 执行的SQL: - ```sql - SELECT `id`, `user_name` FROM `tb_account` WHERE `age` IS NOT NULL AND `age` >= 17 ORDER BY `id` DESC - ``` + * **【对比原生】** + * **原生** + ```kotlin + val queryWrapper = QueryWrapper.create() + .select(QueryColumn("id"), QueryColumn("user_name")) + .where(QueryColumn("age").isNotNull()).and(QueryColumn("age").ge(17)) + .orderBy(QueryColumn("id").desc()) + mapper().selectListByQuery(queryWrapper) + ``` - * **【条件优化】** - - 例如: 查询属性是否在一个连续的区间时,会自动将 IN 转为 BETWEEN 调用 - ```kotlin - filter { Account::age `in` (17..19) } - ``` + * **扩展后** + ```kotlin + // 无需注册Mapper与APT/KSP即可查询操作 + val accountList: List = query { + select(Account::id, Account::userName) + where(Account::age.isNotNull) and { Account::age ge 17 } orderBy -Account::id + } + ``` 执行的SQL: ```sql - SELECT * FROM `tb_account` WHERE `age` BETWEEN 17 AND 19 - ``` - - 例如: 构建多属性组合 IN (最多支持三个属性) - ```kotlin - filter { - (Account::id to Account::userName to Account::age).inTriple( - 1 to "张三" to 18, - 2 to "李四" to 19, - ) - } - ``` - 执行的SQL: - ```sql - SELECT * FROM `tb_account` - WHERE (`id` = 1 AND `user_name` = '张三' AND `age` = 18) - OR (`id` = 2 AND `user_name` = '李四' AND `age` = 19) + SELECT `id`, `user_name` FROM `tb_account` WHERE `age` IS NOT NULL AND `age` >= 17 ORDER BY `id` DESC ``` + * **【条件优化】** + - 例如: 查询属性是否在一个连续的区间时,会自动将 IN 转为 BETWEEN 调用 + ```kotlin + filter { Account::age `in` (17..19) } + ``` + 执行的SQL: + ```sql + SELECT * FROM `tb_account` WHERE `age` BETWEEN 17 AND 19 + ``` + - 例如: 构建多属性组合 IN (最多支持三个属性) + ```kotlin + filter { + (Account::id to Account::userName to Account::age).inTriple( + 1 to "张三" to 18, + 2 to "李四" to 19, + ) + } + ``` + 执行的SQL: + ```sql + SELECT * FROM `tb_account` + WHERE (`id` = 1 AND `user_name` = '张三' AND `age` = 18) + OR (`id` = 2 AND `user_name` = '李四' AND `age` = 19) + ``` - 摆脱APT: 使用扩展方法摆脱对 APT(注解处理器) 的使用,直接使用属性引用让代码更加灵活优雅: > 使用APT: `ACCOUNT.ID eq 1` ,使用属性引用: `Account::id eq 1` > diff --git a/docs/zh/others/apt.md b/docs/zh/others/apt.md index 9c056bd9..213f7222 100644 --- a/docs/zh/others/apt.md +++ b/docs/zh/others/apt.md @@ -220,7 +220,7 @@ pom.xml 添加 `annotationProcessorPaths` 配置, ``` dependencies { ... - annotationProcessor 'com.mybatis-flex:mybatis-flex-processor:1.7.6' + annotationProcessor 'com.mybatis-flex:mybatis-flex-processor:1.7.7' } ``` diff --git a/docs/zh/others/codegen.md b/docs/zh/others/codegen.md index 48d9d28d..a0643150 100644 --- a/docs/zh/others/codegen.md +++ b/docs/zh/others/codegen.md @@ -10,7 +10,7 @@ com.mybatis-flex mybatis-flex-codegen - 1.7.6 + 1.7.7 ``` diff --git a/mybatis-flex-annotation/pom.xml b/mybatis-flex-annotation/pom.xml index f1612b12..4bd5cad8 100644 --- a/mybatis-flex-annotation/pom.xml +++ b/mybatis-flex-annotation/pom.xml @@ -5,7 +5,7 @@ parent com.mybatis-flex - 1.7.6 + 1.7.7 4.0.0 diff --git a/mybatis-flex-annotation/src/main/java/com/mybatisflex/annotation/SetListener.java b/mybatis-flex-annotation/src/main/java/com/mybatisflex/annotation/SetListener.java index c64993bf..59b9603b 100644 --- a/mybatis-flex-annotation/src/main/java/com/mybatisflex/annotation/SetListener.java +++ b/mybatis-flex-annotation/src/main/java/com/mybatisflex/annotation/SetListener.java @@ -26,7 +26,7 @@ public interface SetListener extends Listener { * @param entity 实体类 * @param property 属性名 * @param value 属性值 - * @return 实体类 + * @return 属性值 */ Object onSet(Object entity, String property, Object value); diff --git a/mybatis-flex-codegen/pom.xml b/mybatis-flex-codegen/pom.xml index 53600f03..96e560be 100644 --- a/mybatis-flex-codegen/pom.xml +++ b/mybatis-flex-codegen/pom.xml @@ -5,7 +5,7 @@ parent com.mybatis-flex - 1.7.6 + 1.7.7 4.0.0 @@ -23,7 +23,7 @@ com.mybatis-flex mybatis-flex-core - 1.7.6 + 1.7.7 com.mybatis-flex diff --git a/mybatis-flex-codegen/src/main/resources/templates/enjoy/serviceImpl-Solon.tpl b/mybatis-flex-codegen/src/main/resources/templates/enjoy/serviceImpl-Solon.tpl index 5b8a8f7c..c7e6ca02 100644 --- a/mybatis-flex-codegen/src/main/resources/templates/enjoy/serviceImpl-Solon.tpl +++ b/mybatis-flex-codegen/src/main/resources/templates/enjoy/serviceImpl-Solon.tpl @@ -4,7 +4,7 @@ import com.mybatisflex.solon.service.impl.ServiceImpl; import #(packageConfig.entityPackage).#(table.buildEntityClassName()); import #(packageConfig.mapperPackage).#(table.buildMapperClassName()); import #(packageConfig.servicePackage).#(table.buildServiceClassName()); -import org.noear.solon.annotation.ProxyComponent; +import org.noear.solon.annotation.Component; /** * #(table.getComment()) 服务层实现。 @@ -12,7 +12,7 @@ import org.noear.solon.annotation.ProxyComponent; * @author #(javadocConfig.getAuthor()) * @since #(javadocConfig.getSince()) */ -@ProxyComponent +@Component public class #(table.buildServiceImplClassName()) extends ServiceImpl<#(table.buildMapperClassName()), #(table.buildEntityClassName())> implements #(table.buildServiceClassName()) { } diff --git a/mybatis-flex-core/pom.xml b/mybatis-flex-core/pom.xml index 0d005352..b46bc50e 100644 --- a/mybatis-flex-core/pom.xml +++ b/mybatis-flex-core/pom.xml @@ -5,7 +5,7 @@ parent com.mybatis-flex - 1.7.6 + 1.7.7 4.0.0 @@ -101,7 +101,7 @@ com.mybatis-flex mybatis-flex-annotation - 1.7.6 + 1.7.7 compile diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/FlexConsts.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/FlexConsts.java index fb20d428..feaa5ea4 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/FlexConsts.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/FlexConsts.java @@ -27,7 +27,7 @@ public class FlexConsts { } public static final String NAME = "MyBatis-Flex"; - public static final String VERSION = "1.7.6"; + public static final String VERSION = "1.7.7"; public static final String SQL = "$$sql"; diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/dialect/DialectFactory.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/dialect/DialectFactory.java index c46802ff..3409b7ec 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/dialect/DialectFactory.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/dialect/DialectFactory.java @@ -127,6 +127,7 @@ public class DialectFactory { case DORIS: return new CommonsDialectImpl(KeywordWrap.BACK_QUOTE, LimitOffsetProcessor.MYSQL); case CLICK_HOUSE: + case GBASE_8S: return new CommonsDialectImpl(KeywordWrap.NONE, LimitOffsetProcessor.MYSQL); case DM: return new DmDialect(); diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/mybatis/FlexDefaultResultSetHandler.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/mybatis/FlexDefaultResultSetHandler.java index 2c8dcdb1..578a8dad 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/mybatis/FlexDefaultResultSetHandler.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/mybatis/FlexDefaultResultSetHandler.java @@ -479,7 +479,7 @@ public class FlexDefaultResultSetHandler extends DefaultResultSetHandler { private boolean applyPropertyMappings(ResultSetWrapper rsw, ResultMap resultMap, MetaObject metaObject, ResultLoaderMap lazyLoader, String columnPrefix) throws SQLException { - final List mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix); + final Collection mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix); boolean foundValues = false; final List propertyMappings = resultMap.getPropertyResultMappings(); for (ResultMapping propertyMapping : propertyMappings) { @@ -1178,7 +1178,7 @@ public class FlexDefaultResultSetHandler extends DefaultResultSetHandler { if (resultMapping.isSimple()) { final String column = prependPrefix(resultMapping.getColumn(), columnPrefix); final TypeHandler th = resultMapping.getTypeHandler(); - List mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix); + Collection mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix); // Issue #114 if (column != null && mappedColumnNames.contains(column.toUpperCase(Locale.ENGLISH))) { final Object value = th.getResult(rsw.getResultSet(), column); diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/mybatis/FlexResultSetHandler.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/mybatis/FlexResultSetHandler.java index f38c1c9a..7678b1c3 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/mybatis/FlexResultSetHandler.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/mybatis/FlexResultSetHandler.java @@ -30,6 +30,7 @@ import org.apache.ibatis.type.TypeHandler; import java.sql.SQLException; import java.sql.Statement; +import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Locale; @@ -84,7 +85,7 @@ public class FlexResultSetHandler extends FlexDefaultResultSetHandler { String columnName = prependPrefix(mapping.getColumn(), columnPrefix); TypeHandler typeHandler = mapping.getTypeHandler(); - List mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix); + Collection mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix); if (columnName != null && mappedColumnNames.contains(columnName.toUpperCase(Locale.ENGLISH))) { return typeHandler.getResult(rsw.getResultSet(), columnName); } diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/provider/RowSqlProvider.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/provider/RowSqlProvider.java index 6ea5246b..57c3dbef 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/provider/RowSqlProvider.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/provider/RowSqlProvider.java @@ -247,8 +247,8 @@ public class RowSqlProvider { FlexAssert.notNull(entity, "entity can not be null"); // 该 Mapper 是通用 Mapper 无法通过 ProviderContext 获取,直接使用 TableInfoFactory - TableInfo tableInfo = TableInfoFactory.ofEntityClass(ClassUtil.getUsefulClass(entity.getClass())); + TableInfo tableInfo = TableInfoFactory.ofEntityClass(ClassUtil.getUsefulClass(entity.getClass())); // 执行 onUpdate 监听器 tableInfo.invokeOnUpdateListener(entity); diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/query/QueryMethods.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/query/QueryMethods.java index 574dd58d..190b74e7 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/query/QueryMethods.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/query/QueryMethods.java @@ -22,6 +22,7 @@ import com.mybatisflex.core.util.LambdaGetter; import com.mybatisflex.core.util.LambdaUtil; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import static com.mybatisflex.core.constant.FuncName.*; @@ -2346,6 +2347,12 @@ public class QueryMethods { return new DistinctQueryColumn(columns); } + @SafeVarargs + public static DistinctQueryColumn distinct(LambdaGetter... columns) { + return new DistinctQueryColumn(Arrays.stream(columns) + .map(LambdaUtil::getQueryColumn).toArray(QueryColumn[]::new)); + } + // === CASE THEN ELSE === /** @@ -2564,6 +2571,13 @@ public class QueryMethods { return new OperatorQueryCondition("NOT ", childCondition); } + /** + * {@code NOT (column)} 或 {@code NOT column} + */ + public static QueryColumn not(LambdaGetter column) { + return new FunctionQueryColumn("NOT", LambdaUtil.getQueryColumn(column)); + } + /** * 空条件。 */ diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/service/IService.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/service/IService.java index 74a5fb3d..9f26fd1b 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/service/IService.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/service/IService.java @@ -376,7 +376,7 @@ public interface IService { * @return 查询结果数据 */ default T getOne(QueryCondition condition) { - return getOne(query().where(condition)); + return getOne(query().where(condition).limit(1)); } /** diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/table/ColumnInfo.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/table/ColumnInfo.java index 20af6847..d184a27d 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/table/ColumnInfo.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/table/ColumnInfo.java @@ -149,7 +149,9 @@ public class ColumnInfo { if (configuration == null) { configuration = FlexGlobalConfig.getDefaultConfig().getConfiguration(); } - buildTypeHandler = configuration.getTypeHandlerRegistry().getTypeHandler(propertyType); + if (configuration != null) { + buildTypeHandler = configuration.getTypeHandlerRegistry().getTypeHandler(propertyType); + } } return buildTypeHandler; diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/util/ClassUtil.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/util/ClassUtil.java index f2037541..e76c1e5e 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/util/ClassUtil.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/util/ClassUtil.java @@ -70,14 +70,15 @@ public class ClassUtil { } public static Class getUsefulClass(Class clazz) { + + if (ProxyObject.class.isAssignableFrom(clazz)) { + return (Class) clazz.getSuperclass(); + } + if (isProxy(clazz)) { return getJdkProxySuperClass(clazz); } -// if (ProxyObject.class.isAssignableFrom(clazz)){ -// return (Class) clazz.getSuperclass(); -// } - //ControllerTest$ServiceTest$$EnhancerByGuice$$40471411#hello -------> Guice //com.demo.blog.Blog$$EnhancerByCGLIB$$69a17158 ----> CGLIB //io.jboot.test.app.TestAppListener_$$_jvstb9f_0 ------> javassist diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/util/FieldWrapper.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/util/FieldWrapper.java index 4438df55..15ff3bce 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/util/FieldWrapper.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/util/FieldWrapper.java @@ -58,13 +58,9 @@ public class FieldWrapper { String setterName = "set" + StringUtil.firstCharToUpperCase(fieldName); Method setter = ClassUtil.getFirstMethod(clazz, method -> - method.getParameterCount() == 1 - && Modifier.isPublic(method.getModifiers()) - && method.getName().equals(setterName)); - - if (setter == null) { - throw new IllegalStateException("Can not find method \"set" + StringUtil.firstCharToUpperCase(fieldName) + "\" in class: " + clazz); - } + method.getParameterCount() == 1 + && Modifier.isPublic(method.getModifiers()) + && method.getName().equals(setterName)); fieldWrapper = new FieldWrapper(); fieldWrapper.field = findField; @@ -80,8 +76,8 @@ public class FieldWrapper { String[] getterNames = new String[]{"get" + StringUtil.firstCharToUpperCase(fieldName), "is" + StringUtil.firstCharToUpperCase(fieldName)}; fieldWrapper.getterMethod = ClassUtil.getFirstMethod(clazz, method -> method.getParameterCount() == 0 - && Modifier.isPublic(method.getModifiers()) - && ArrayUtil.contains(getterNames, method.getName())); + && Modifier.isPublic(method.getModifiers()) + && ArrayUtil.contains(getterNames, method.getName())); wrapperMap.put(fieldName, fieldWrapper); } @@ -120,6 +116,9 @@ public class FieldWrapper { public void set(Object value, Object to) { try { + if (setterMethod == null) { + throw new IllegalStateException("Can not find method \"set" + StringUtil.firstCharToUpperCase(field.getName()) + "\" in class: " + to.getClass()); + } setterMethod.invoke(to, value); } catch (Exception e) { throw new RuntimeException(e); @@ -128,6 +127,9 @@ public class FieldWrapper { public Object get(Object target) { try { + if (getterMethod == null) { + throw new IllegalStateException("Can not find method \"get" + StringUtil.firstCharToUpperCase(field.getName()) + ", is" + StringUtil.firstCharToUpperCase(field.getName()) + "\" in class: " + target.getClass()); + } return getterMethod.invoke(target); } catch (Exception e) { throw new RuntimeException(e); @@ -153,4 +155,4 @@ public class FieldWrapper { public boolean isIgnore() { return isIgnore; } -} +} \ No newline at end of file diff --git a/mybatis-flex-dependencies/pom.xml b/mybatis-flex-dependencies/pom.xml index c6b33349..703b23d9 100644 --- a/mybatis-flex-dependencies/pom.xml +++ b/mybatis-flex-dependencies/pom.xml @@ -6,7 +6,7 @@ com.mybatis-flex parent - 1.7.6 + 1.7.7 mybatis-flex-dependencies diff --git a/mybatis-flex-processor/pom.xml b/mybatis-flex-processor/pom.xml index 94005f6f..d21bc5a6 100644 --- a/mybatis-flex-processor/pom.xml +++ b/mybatis-flex-processor/pom.xml @@ -5,7 +5,7 @@ parent com.mybatis-flex - 1.7.6 + 1.7.7 4.0.0 @@ -22,7 +22,7 @@ com.mybatis-flex mybatis-flex-annotation - 1.7.6 + 1.7.7 diff --git a/mybatis-flex-solon-plugin/pom.xml b/mybatis-flex-solon-plugin/pom.xml index ad1d44d9..aa86d233 100644 --- a/mybatis-flex-solon-plugin/pom.xml +++ b/mybatis-flex-solon-plugin/pom.xml @@ -5,7 +5,7 @@ parent com.mybatis-flex - 1.7.6 + 1.7.7 4.0.0 diff --git a/mybatis-flex-spring-boot-starter/pom.xml b/mybatis-flex-spring-boot-starter/pom.xml index a7006f00..a67ad2f0 100644 --- a/mybatis-flex-spring-boot-starter/pom.xml +++ b/mybatis-flex-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ parent com.mybatis-flex - 1.7.6 + 1.7.7 4.0.0 @@ -23,7 +23,7 @@ com.mybatis-flex mybatis-flex-spring - 1.7.6 + 1.7.7 @@ -104,7 +104,7 @@ com.mybatis-flex mybatis-flex-core - 1.7.6 + 1.7.7 diff --git a/mybatis-flex-spring-boot3-starter/pom.xml b/mybatis-flex-spring-boot3-starter/pom.xml new file mode 100644 index 00000000..fa81e211 --- /dev/null +++ b/mybatis-flex-spring-boot3-starter/pom.xml @@ -0,0 +1,38 @@ + + + 4.0.0 + + com.mybatis-flex + parent + 1.7.7 + + + mybatis-flex-spring-boot3-starter + + + UTF-8 + + + + + com.mybatis-flex + mybatis-flex-spring-boot-starter + 1.7.7 + + + org.mybatis + mybatis-spring + + + + + + org.mybatis + mybatis-spring + 3.0.3 + + + + diff --git a/mybatis-flex-spring/pom.xml b/mybatis-flex-spring/pom.xml index 9cb19cef..77b2367a 100644 --- a/mybatis-flex-spring/pom.xml +++ b/mybatis-flex-spring/pom.xml @@ -5,7 +5,7 @@ parent com.mybatis-flex - 1.7.6 + 1.7.7 4.0.0 @@ -22,7 +22,7 @@ com.mybatis-flex mybatis-flex-core - 1.7.6 + 1.7.7 diff --git a/mybatis-flex-test/mybatis-flex-native-test/pom.xml b/mybatis-flex-test/mybatis-flex-native-test/pom.xml index 80ac5708..ff522064 100644 --- a/mybatis-flex-test/mybatis-flex-native-test/pom.xml +++ b/mybatis-flex-test/mybatis-flex-native-test/pom.xml @@ -5,7 +5,7 @@ mybatis-flex-test com.mybatis-flex - 1.7.6 + 1.7.7 4.0.0 diff --git a/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/ContributorsDocGen.java b/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/ContributorsDocGen.java index e76dc7cb..010227cb 100644 --- a/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/ContributorsDocGen.java +++ b/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/ContributorsDocGen.java @@ -30,6 +30,7 @@ public class ContributorsDocGen { List urls = Arrays.asList( "https://gitee.com/mybatis-flex/mybatis-flex/contributors?ref=main" , "https://gitee.com/mybatis-flex/mybatis-flex/contributors?page=2&ref=main" + , "https://gitee.com/mybatis-flex/mybatis-flex/contributors?page=3&ref=main" ); StringBuilder markdown = new StringBuilder(); markdown.append("| | | | | |\n" + @@ -73,12 +74,16 @@ public class ContributorsDocGen { if (userName.contains("@")) { userName = userName.substring(0, userName.indexOf("@")); } - if (StringUtil.isBlank(src)) { - src = "https://api.dicebear.com/7.x/initials/svg?seed=" + userName; - } +// if (StringUtil.isBlank(src)) { +// src = "https://api.dicebear.com/7.x/initials/svg?seed=" + userName; +// } markdown.append("|"); - markdown.append("![](" + src + ")"); + + if (StringUtil.isNotBlank(src)) { + markdown.append("![](" + src + ")"); + } + markdown.append(userName); startIndex++; diff --git a/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/DbTest.java b/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/DbTest.java index d2517e0e..ec8ffb83 100644 --- a/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/DbTest.java +++ b/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/DbTest.java @@ -82,19 +82,28 @@ public class DbTest { Map map2 = Db.selectFirstAndSecondColumnsAsMap("select * from tb_account"); System.out.println(map); System.out.println(map2); + assert map.equals(map2); } @Test public void test03() { - Account account = UpdateEntity.of(Account.class,1); - account.setAge(1); - List accounts = new ArrayList<>(); - accounts.add(account); - Account account2 = UpdateEntity.of(Account.class,2); - account2.setAge(2); - UpdateWrapper updateWrapper = UpdateWrapper.of(account2); - updateWrapper.setRaw("age","age+1"); - accounts.add(account2); - Db.updateEntitiesBatch(accounts); + try { + Account account = UpdateEntity.of(Account.class, 1); + account.setAge(1); + List accounts = new ArrayList<>(); + accounts.add(account); + Account account2 = UpdateEntity.of(Account.class, 2); + account2.setAge(2); + UpdateWrapper updateWrapper = UpdateWrapper.of(account2); + updateWrapper.setRaw("age", "age+1"); + accounts.add(account2); + Account account3 = new Account(); + account3.setId(3L); + account3.setAge(4); + accounts.add(account3); + Db.updateEntitiesBatch(accounts); + }catch (Exception e){ + assert false; + } } } diff --git a/mybatis-flex-test/mybatis-flex-seata-test/pom.xml b/mybatis-flex-test/mybatis-flex-seata-test/pom.xml index ef485c68..59bc0f72 100644 --- a/mybatis-flex-test/mybatis-flex-seata-test/pom.xml +++ b/mybatis-flex-test/mybatis-flex-seata-test/pom.xml @@ -4,7 +4,7 @@ mybatis-flex-test com.mybatis-flex - 1.7.6 + 1.7.7 4.0.0 diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/pom.xml b/mybatis-flex-test/mybatis-flex-spring-boot-test/pom.xml index 18cff34c..3d62505f 100644 --- a/mybatis-flex-test/mybatis-flex-spring-boot-test/pom.xml +++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/pom.xml @@ -5,7 +5,7 @@ mybatis-flex-test com.mybatis-flex - 1.7.6 + 1.7.7 4.0.0 @@ -83,6 +83,24 @@ test + + org.testcontainers + testcontainers + test + + + com.fasterxml.jackson.core + jackson-annotations + + + + + + org.testcontainers + mysql + test + + diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/TestInfrastructure.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/TestInfrastructure.java new file mode 100644 index 00000000..128a4c0e --- /dev/null +++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/TestInfrastructure.java @@ -0,0 +1,33 @@ +package com.mybatisflex.test; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.testcontainers.containers.BindMode; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.MySQLContainer; +import org.testcontainers.containers.wait.strategy.Wait; +import org.testcontainers.utility.DockerImageName; + +import java.util.Collections; + +public class TestInfrastructure { + + static final String FLEX_TEST_DDL = TestInfrastructure.class.getClassLoader().getResource("flex_test.sql").getPath(); + static final String FIELD_MAPPING_TEST_DDL = TestInfrastructure.class.getClassLoader().getResource("field_mapping_test.sql").getPath(); + static final String PATIENT_DATA_SPLIT_TEST_DDL = TestInfrastructure.class.getClassLoader().getResource("patient_data_split_test.sql").getPath(); + static final String DOCKER_INITDB_PATH = "/docker-entrypoint-initdb.d/"; + static GenericContainer mysql = new MySQLContainer<>(DockerImageName.parse("mysql:8.2.0")) + .waitingFor(Wait.forLogMessage(".*ready for connections.*\\n", 1)) + .withFileSystemBind(FLEX_TEST_DDL, DOCKER_INITDB_PATH + "flex_test.sql", BindMode.READ_ONLY) + .withFileSystemBind(FIELD_MAPPING_TEST_DDL, DOCKER_INITDB_PATH + "field_mapping_test.sql", BindMode.READ_ONLY) + .withFileSystemBind(PATIENT_DATA_SPLIT_TEST_DDL, DOCKER_INITDB_PATH + "patient_data_split_test.sql", BindMode.READ_ONLY) + .withDatabaseName("flex_test") + .withReuse(true) + .withPassword("123456"); + + @BeforeAll + public static void start() { + mysql.setPortBindings(Collections.singletonList("3306:3306")); + mysql.start(); + } +} diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/common/SerialUtil.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/common/SerialUtil.java index eed874b5..df280840 100644 --- a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/common/SerialUtil.java +++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/common/SerialUtil.java @@ -19,6 +19,11 @@ package com.mybatisflex.test.common; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONReader; import com.alibaba.fastjson2.JSONWriter; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.mybatisflex.core.query.QueryCondition; import java.io.*; @@ -71,4 +76,26 @@ public class SerialUtil { return parseObject(toJSONString(obj), tClass); } + + /** + * 使用jackson对QueryWrapper进行序列化反序列化操作,需要注意QueryCondition的protected属性以及prev和next的递归问题。 + * + * @return Jackson序列化映射 + */ + public static ObjectMapper jacksonMapper(){ + ObjectMapper mapper = new ObjectMapper(); + // 为了将QueryWrapper里的protected属性可见 + mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.PROTECTED_AND_PUBLIC); + // 避免QueryCondition里的prev和next在序列化时出现递归调用错误 + mapper.addMixIn(QueryCondition.class,QueryConditionMixIn.class); + return mapper; + } + + /** + * 因无法修改QueryCondition而添加的映射属性包装 + */ + class QueryConditionMixIn{ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + protected QueryCondition prev; + } } diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/AccountMapperTest.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/AccountMapperTest.java index 36e9c849..f0b2ebe6 100644 --- a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/AccountMapperTest.java +++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/AccountMapperTest.java @@ -19,18 +19,16 @@ package com.mybatisflex.test.mapper; import com.mybatisflex.core.logicdelete.LogicDeleteManager; import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.row.Db; -import com.mybatisflex.core.row.Row; +import com.mybatisflex.test.TestInfrastructure; import com.mybatisflex.test.model.Account; import com.mybatisflex.test.model.AccountVO; import com.mybatisflex.test.model.AccountVO2; -import lombok.val; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import java.util.Date; -import java.util.List; import static com.mybatisflex.core.query.QueryMethods.*; import static com.mybatisflex.test.model.table.AccountTableDef.ACCOUNT; @@ -44,7 +42,7 @@ import static com.mybatisflex.test.model.table.UserTableDef.USER; */ @SpringBootTest @SuppressWarnings("all") -class AccountMapperTest { +class AccountMapperTest extends TestInfrastructure { @Autowired private AccountMapper accountMapper; diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/ActiveRecordTest.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/ActiveRecordTest.java index fbb101a6..82c185eb 100644 --- a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/ActiveRecordTest.java +++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/ActiveRecordTest.java @@ -18,6 +18,7 @@ package com.mybatisflex.test.mapper; import com.mybatisflex.core.mybatis.Mappers; import com.mybatisflex.core.query.QueryWrapper; +import com.mybatisflex.test.TestInfrastructure; import com.mybatisflex.test.model.Good; import com.mybatisflex.test.model.User; import org.junit.jupiter.api.Assertions; @@ -34,7 +35,7 @@ import static com.mybatisflex.test.model.table.UserTableDef.USER; * @since 2023-07-23 */ @SpringBootTest -class ActiveRecordTest { +class ActiveRecordTest extends TestInfrastructure { @Test void testMapper() { diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/CombinedMapperTest.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/CombinedMapperTest.java index 0b1e401a..c62bece2 100644 --- a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/CombinedMapperTest.java +++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/CombinedMapperTest.java @@ -17,6 +17,7 @@ package com.mybatisflex.test.mapper; import com.mybatisflex.core.query.QueryWrapper; +import com.mybatisflex.test.TestInfrastructure; import com.mybatisflex.test.model.Account; import com.mybatisflex.test.model.Article; import org.junit.jupiter.api.Test; @@ -26,7 +27,7 @@ import org.springframework.boot.test.context.SpringBootTest; import java.util.List; @SpringBootTest -public class CombinedMapperTest { +public class CombinedMapperTest extends TestInfrastructure { @Autowired private AccountMapper accountMapper; diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/MyAccountMapperTest.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/MyAccountMapperTest.java index cecbc390..948510ab 100644 --- a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/MyAccountMapperTest.java +++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/MyAccountMapperTest.java @@ -16,6 +16,7 @@ package com.mybatisflex.test.mapper; +import com.mybatisflex.test.TestInfrastructure; import com.mybatisflex.test.model.Account; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -32,7 +33,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; * @since 2023/4/24 19:37 */ @SpringBootTest -class MyAccountMapperTest { +class MyAccountMapperTest extends TestInfrastructure { @Autowired private MyAccountMapper mapper; diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/OuterMapperTest.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/OuterMapperTest.java index 6dfe5c9c..b672e963 100644 --- a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/OuterMapperTest.java +++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/OuterMapperTest.java @@ -17,7 +17,7 @@ package com.mybatisflex.test.mapper; import com.mybatisflex.core.query.QueryWrapper; -import com.mybatisflex.test.entity.Inner; +import com.mybatisflex.test.TestInfrastructure; import com.mybatisflex.test.entity.Outer; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -32,7 +32,7 @@ import static com.mybatisflex.test.entity.table.OuterTableDef.OUTER; * @since 2023-07-01 */ @SpringBootTest -class OuterMapperTest { +class OuterMapperTest extends TestInfrastructure { @Autowired private OuterMapper outerMapper; diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/PatientMapperTest.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/PatientMapperTest.java index 6a53111a..c2058846 100644 --- a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/PatientMapperTest.java +++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/PatientMapperTest.java @@ -1,5 +1,6 @@ package com.mybatisflex.test.mapper; +import com.mybatisflex.test.TestInfrastructure; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @@ -13,7 +14,7 @@ import javax.annotation.Resource; */ @SpringBootTest @SuppressWarnings("all") -public class PatientMapperTest { +public class PatientMapperTest extends TestInfrastructure { @Resource private PatientMapper patientMapper; diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/QueryChainTest.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/QueryChainTest.java index 2e3f6e46..07dcc0b2 100644 --- a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/QueryChainTest.java +++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/QueryChainTest.java @@ -20,6 +20,7 @@ import com.mybatisflex.core.field.QueryBuilder; import com.mybatisflex.core.query.QueryChain; import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.update.UpdateChain; +import com.mybatisflex.test.TestInfrastructure; import com.mybatisflex.test.model.Gender; import com.mybatisflex.test.model.User; import org.junit.jupiter.api.Assertions; @@ -36,7 +37,7 @@ import static com.mybatisflex.test.model.table.UserTableDef.USER; * @since 2023-08-08 */ @SpringBootTest -class QueryChainTest { +class QueryChainTest extends TestInfrastructure { @Autowired UserMapper userMapper; diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/UserMapperTest.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/UserMapperTest.java index 04a233f2..077f49d5 100644 --- a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/UserMapperTest.java +++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/UserMapperTest.java @@ -18,6 +18,7 @@ package com.mybatisflex.test.mapper; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; +import com.mybatisflex.test.TestInfrastructure; import com.mybatisflex.test.model.*; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -42,7 +43,7 @@ import static com.mybatisflex.test.model.table.UserTableDef.USER; */ @SpringBootTest @SuppressWarnings("all") -class UserMapperTest { +class UserMapperTest extends TestInfrastructure { @Autowired private UserMapper userMapper; diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/service/ArticleServiceTest.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/service/ArticleServiceTest.java index 7062152e..989f545a 100644 --- a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/service/ArticleServiceTest.java +++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/service/ArticleServiceTest.java @@ -17,6 +17,7 @@ package com.mybatisflex.test.service; import com.mybatisflex.core.query.QueryWrapper; +import com.mybatisflex.test.TestInfrastructure; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -28,7 +29,7 @@ import static com.mybatisflex.test.model.table.ArticleTableDef.ARTICLE; * @since 2023-07-22 */ @SpringBootTest -class ArticleServiceTest { +class ArticleServiceTest extends TestInfrastructure { @Autowired ArticleService articleService; diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/service/FieldMappingTest.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/service/FieldMappingTest.java index 0ce0887e..539082b7 100644 --- a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/service/FieldMappingTest.java +++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/service/FieldMappingTest.java @@ -2,6 +2,7 @@ package com.mybatisflex.test.service; import com.mybatisflex.test.mapper.FieldMappingInnerMapper; import com.mybatisflex.test.mapper.FieldMappingMapper; +import com.mybatisflex.test.TestInfrastructure; import com.mybatisflex.test.model.FieldMapping; import com.mybatisflex.test.model.FieldMappingInner; import org.junit.jupiter.api.Test; @@ -11,11 +12,12 @@ import org.springframework.boot.test.context.SpringBootTest; import java.util.Date; @SpringBootTest -public class FieldMappingTest { +class FieldMappingTest extends TestInfrastructure { @Autowired FieldMappingMapper fieldMappingMapper; @Autowired FieldMappingInnerMapper fieldMappingInnerMapper; + @Test void testFieldMapping() { String fieldId = FieldMapping.create().saveOpt().get().getId(); diff --git a/mybatis-flex-test/mybatis-flex-spring-cloud-test/pom.xml b/mybatis-flex-test/mybatis-flex-spring-cloud-test/pom.xml index fe713334..01b7618a 100644 --- a/mybatis-flex-test/mybatis-flex-spring-cloud-test/pom.xml +++ b/mybatis-flex-test/mybatis-flex-spring-cloud-test/pom.xml @@ -4,7 +4,7 @@ mybatis-flex-test com.mybatis-flex - 1.7.6 + 1.7.7 4.0.0 diff --git a/mybatis-flex-test/mybatis-flex-spring-test/pom.xml b/mybatis-flex-test/mybatis-flex-spring-test/pom.xml index 6467bf97..bae84b63 100644 --- a/mybatis-flex-test/mybatis-flex-spring-test/pom.xml +++ b/mybatis-flex-test/mybatis-flex-spring-test/pom.xml @@ -5,7 +5,7 @@ mybatis-flex-test com.mybatis-flex - 1.7.6 + 1.7.7 4.0.0 diff --git a/mybatis-flex-test/pom.xml b/mybatis-flex-test/pom.xml index 9b5af1ee..38eac0b5 100644 --- a/mybatis-flex-test/pom.xml +++ b/mybatis-flex-test/pom.xml @@ -5,7 +5,7 @@ parent com.mybatis-flex - 1.7.6 + 1.7.7 4.0.0 diff --git a/pom.xml b/pom.xml index f1f9cf4b..fdc56735 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ com.mybatis-flex parent pom - 1.7.6 + 1.7.7 mybatis-flex https://mybatis-flex.com @@ -45,6 +45,7 @@ mybatis-flex-core mybatis-flex-spring mybatis-flex-spring-boot-starter + mybatis-flex-spring-boot3-starter mybatis-flex-solon-plugin mybatis-flex-test mybatis-flex-processor @@ -55,9 +56,9 @@ 8 8 - 1.7.6 + 1.7.7 - 3.5.14 + 3.5.15 2.1.2 1.2.4 2.1.2 @@ -71,6 +72,7 @@ 2.5.3 4.13.2 + 1.19.3 1.5.0 @@ -188,6 +190,14 @@ true + + org.testcontainers + testcontainers-bom + ${testcontainers.version} + pom + import + +