This commit is contained in:
farukonfly 2024-01-10 00:47:27 +08:00
commit ab5a21a450
60 changed files with 435 additions and 188 deletions

View File

@ -7,7 +7,7 @@ body:
attributes: attributes:
label: 这个 Bug 是否已经存在: label: 这个 Bug 是否已经存在:
options: 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 required: true
- type: textarea - type: textarea
attributes: attributes:

View File

@ -13,7 +13,7 @@ body:
attributes: attributes:
label: 这个问题是否已经存在: label: 这个问题是否已经存在:
options: 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 required: true
- type: textarea - type: textarea
id: question-description id: question-description

View File

@ -2,6 +2,22 @@
查看 [全部代码贡献者](/zh/intro/what-is-mybatisflex.html#贡献者)。 查看 [全部代码贡献者](/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: ## v1.7.6 20231223:
- 新增Db.selectFirstAndSecondColumnsAsMap 方法:查询结果的第一列作为 key第二列作为 value感谢 @617054137 - 新增Db.selectFirstAndSecondColumnsAsMap 方法:查询结果的第一列作为 key第二列作为 value感谢 @617054137
- 新增:方言添加添加权限处理统一入口 prepareAuth感谢 @bf109f - 新增:方言添加添加权限处理统一入口 prepareAuth感谢 @bf109f

View File

@ -78,8 +78,8 @@ const {Layout} = DefaultTheme
<!--docs: https://vitepress.dev/guide/extending-default-theme#layout-slots--> <!--docs: https://vitepress.dev/guide/extending-default-theme#layout-slots-->
<template #doc-before> <template #doc-before>
<div style="margin-bottom: 30px"> <div style="margin-bottom: 30px">
<a href="https://aieditor.dev" target="_blank"> <a href="https://mp.weixin.qq.com/s/V34VkARgBCBKdytSlKhosg" target="_blank">
<img src="/assets/images/ad/doc-banner.jpg"> <img src="/assets/images/ad/admin-banner.jpg">
</a> </a>
</div> </div>
</template> </template>

View File

@ -1,12 +1,8 @@
:root { :root {
--vp-c-brand: #F06C33; --vp-c-brand-1:#F06C33;
--vp-c-brand-light: #FFCC00; --vp-home-hero-name-color:#F06C33;
--vp-c-brand-lighter: #FFCC99; --vp-button-brand-bg:#F06C33;
--vp-c-brand-dark: #FF9933; --vp-button-brand-hover-bg:#ff986b;
--vp-c-brand-darker: #CC6600;
--vp-custom-block-tip-border: #FFCC99;
--vp-custom-block-tip-text: #F06C33;
} }
.vp-doc .custom-block p { .vp-doc .custom-block p {

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -1,11 +1,11 @@
{ {
"type": "module", "type": "module",
"scripts": { "scripts": {
"docs:dev": "vitepress dev", "docs:dev": "vitepress dev",
"docs:build": "vitepress build", "docs:build": "vitepress build",
"docs:preview": "vitepress preview" "docs:preview": "vitepress preview"
}, },
"devDependencies": { "devDependencies": {
"vitepress": "^1.0.0-beta.3 " "vitepress": "^1.0.0-rc.32"
} }
} }

View File

@ -9,10 +9,10 @@ MyBatis-Flex 展示的机会。
在本站对应的位置放置您的 LOGO 及跳转链接。 在本站对应的位置放置您的 LOGO 及跳转链接。
| 位置 | 素材 | 宽高 | 赞助费 | 名额 | | 位置 | 素材 | 宽高 | 赞助费 | 名额 |
| ---------------- | ---------------- | ------------- | ---------- |------------ | | ---------------- | ---------------- |----------| ---------- |----|
| 全站右侧边栏 1 | 图片+链接 | 105*50px | ¥200/月 | 8 | | 全站右侧边栏 1 | 图片+链接 | 105*50px | ¥200/月 | 8 |
| 全站右侧边栏 2 | 图片+链接 | 122*50px | ¥400/月 |1 | | 全站右侧边栏 2 | 图片+链接 | 222*50px | ¥400/月 | 1 |
您可以联系微信 `fuh99888` 就展示位的详细事宜。 您可以联系微信 `fuh99888` 就展示位的详细事宜。

View File

@ -2,6 +2,22 @@
查看 [全部代码贡献者](/zh/intro/what-is-mybatisflex.html#贡献者)。 查看 [全部代码贡献者](/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: ## v1.7.6 20231223:
- 新增Db.selectFirstAndSecondColumnsAsMap 方法:查询结果的第一列作为 key第二列作为 value感谢 @617054137 - 新增Db.selectFirstAndSecondColumnsAsMap 方法:查询结果的第一列作为 key第二列作为 value感谢 @617054137
- 新增:方言添加添加权限处理统一入口 prepareAuth感谢 @bf109f - 新增:方言添加添加权限处理统一入口 prepareAuth感谢 @bf109f

View File

@ -119,7 +119,7 @@ public class AuthDialectImpl extends CommonsDialectImpl {
`QueryWrapper`的表做筛选可参考 **方式1** `QueryWrapper`的表做筛选可参考 **方式1**
在项目启动时通过 `DialectFactory` 注册 `AuthDialectImpl`以spring boot项目为例 在项目启动时通过 `DialectFactory` 注册 `AuthDialectImpl`以spring boot项目为例
``` ```java
@Configuration @Configuration
public class MybatisFlexConfig implements MyBatisFlexCustomizer { public class MybatisFlexConfig implements MyBatisFlexCustomizer {

View File

@ -10,7 +10,7 @@
## MyBatis-Flex 逻辑删除示例 ## MyBatis-Flex 逻辑删除示例
假设在 tb_account 表中,存在一个为 is_deleted 的字段,用来标识该数据的逻辑删除,那么 tb_account 表 假设在 tb_account 表中,存在一个为 is_delete 的字段,用来标识该数据的逻辑删除,那么 tb_account 表
对应的 "Account.java" 实体类应该配置如下: 对应的 "Account.java" 实体类应该配置如下:
```java ```java

View File

@ -57,12 +57,11 @@ VALUES (1, '张三', 18, '2020-01-11'),
需要添加的 Maven 主要依赖示例: 需要添加的 Maven 主要依赖示例:
```xml ```xml
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-spring-boot-starter</artifactId> <artifactId>mybatis-flex-spring-boot-starter</artifactId>
<version>1.7.6</version> <version>1.7.7</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.mysql</groupId> <groupId>com.mysql</groupId>
@ -82,6 +81,35 @@ VALUES (1, '张三', 18, '2020-01-11'),
</dependencies> </dependencies>
``` ```
**注意** 如果您当前使用的是 SpringBoot v3.x 版本,需要把依赖 `mybatis-flex-spring-boot-starter` 修改为:`mybatis-flex-spring-boot3-starter`,
如下代码所示:
```xml 4
<dependencies>
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-spring-boot3-starter</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
<!-- for test only -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
```
**第 3 步:对 Spring Boot 项目进行配置** **第 3 步:对 Spring Boot 项目进行配置**
在 application.yml 中配置数据源: 在 application.yml 中配置数据源:

View File

@ -10,7 +10,7 @@
```kotlin ```kotlin
dependencies { 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 ```groovy
dependencies { 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 ```kotlin
dependencies { 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 ```groovy
dependencies { 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 ```kotlin
dependencies { 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 ```groovy
dependencies { 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 ```kotlin
dependencies { 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 ```groovy
dependencies { dependencies {
annotationProcessor 'com.mybatis-flex:mybatis-flex-processor:1.7.6' annotationProcessor 'com.mybatis-flex:mybatis-flex-processor:1.7.7'
} }
``` ```

View File

@ -12,12 +12,12 @@
<dependency> <dependency>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-core</artifactId> <artifactId>mybatis-flex-core</artifactId>
<version>1.7.6</version> <version>1.7.7</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-processor</artifactId> <artifactId>mybatis-flex-processor</artifactId>
<version>1.7.6</version> <version>1.7.7</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
``` ```
@ -28,33 +28,49 @@
<dependency> <dependency>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-spring</artifactId> <artifactId>mybatis-flex-spring</artifactId>
<version>1.7.6</version> <version>1.7.7</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-processor</artifactId> <artifactId>mybatis-flex-processor</artifactId>
<version>1.7.6</version> <version>1.7.7</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
`````` ``````
3、用到了 Spring Boot 的场景 3、用到了 SpringBoot v2.x 的场景
```xml ```xml 3
<dependency> <dependency>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-spring-boot-starter</artifactId> <artifactId>mybatis-flex-spring-boot-starter</artifactId>
<version>1.7.6</version> <version>1.7.7</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-processor</artifactId> <artifactId>mybatis-flex-processor</artifactId>
<version>1.7.6</version> <version>1.7.7</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
``` ```
4、配置 annotationProcessor 4、用到了 SpringBoot v3.x 的场景
```xml 3
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-spring-boot3-starter</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-processor</artifactId>
<version>1.7.7</version>
<scope>provided</scope>
</dependency>
```
5、配置 annotationProcessor
`mybatis-flex-processor`提供APT服务可以配置到annotationProcessorPaths配置后无需在依赖中声明`mybatis-flex-processor`依赖。 `mybatis-flex-processor`提供APT服务可以配置到annotationProcessorPaths配置后无需在依赖中声明`mybatis-flex-processor`依赖。
@ -72,14 +88,14 @@
<path> <path>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-processor</artifactId> <artifactId>mybatis-flex-processor</artifactId>
<version>1.7.6</version> <version>1.7.7</version>
</path> </path>
</annotationProcessorPaths> </annotationProcessorPaths>
</configuration> </configuration>
</plugin> </plugin>
``` ```
5、配置依赖管理 6、配置依赖管理
MyBatis-Flex 提供了 `mybatis-flex-dependencies` 模块进行依赖管理,只需要在 `<dependencyManagement>` 标签下进行配置就可以了。 MyBatis-Flex 提供了 `mybatis-flex-dependencies` 模块进行依赖管理,只需要在 `<dependencyManagement>` 标签下进行配置就可以了。

View File

@ -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://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|
|![](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| |snyk-bot|lhzsdnu|![](https://foruda.gitee.com/avatar/1683858335519306352/15535_noear_admin_1683858335.png!avatar30)西东|tangxin|Font_C|
|![](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=笨小孩)笨小孩| |pengpeng|庄佳彬|Ice-samll|guanmengyuan|![](https://foruda.gitee.com/avatar/1697612161781835336/7870258_wchopper_1697612161.png!avatar30)王超|
|![](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=草语)草语| |笨小孩|bf109f|chenjh3|CloudPlayer|Jerry|
|![](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| |snow|草语|farukonfly|![](https://foruda.gitee.com/avatar/1694759381586775676/568596_qq925966998_1694759381.png!avatar30)李楠|菜鸟3853|
|![](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=沈君锋)沈君锋| |mofan|Jerry_Zheng|wujl|Martin7-1|![](https://foruda.gitee.com/avatar/1676895504036051867/8807_piggsoft_1578914592.jpg!avatar30)piggsoft|
|![](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://foruda.gitee.com/avatar/1674286432514482953/4807650_fandai_fandaidzsw_1674286432.png!avatar30)赤兮丷|黄沐鸿|loong0306|沈君锋|![](https://foruda.gitee.com/avatar/1691034002435340221/1920167_qimincow_1691034002.png!avatar30)英雄路|
|![](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| |natsufumij|BQ60ziOxlFI0R0|tan90|aqnghu|张继续|
|![](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| |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|
|![](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| |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|
|![](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)锁力| |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://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/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/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://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)阿志同学|
|![](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| |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)豌豆粉|涛声依旧|
|![](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| |matthew|gongzhongqiang|luy|凌尘|Alex|
|![](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| |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|
|![](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| |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)数据小王子|
|![](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)老吉丶| |XiaoLin|丿风轻灬云淡|![](https://foruda.gitee.com/avatar/1703832348210958955/7966959_zhang-bo-bo_1703832348.png!avatar30)张博|Freeman Liu|大周|
|![](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| |欢乐码农|2han9wen71an|shark771|庄佳彬|_FLOW__|
|![](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/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)时间淡忘一切|

View File

@ -19,68 +19,70 @@
- 快速构建启动通过DSL重载运算符快速配置 MybatisFlexBootstrap 实例并启动: - 快速构建启动通过DSL重载运算符快速配置 MybatisFlexBootstrap 实例并启动:
```kotlin ```kotlin
buildBootstrap { runFlex {
// 配置数据源 相当于 setDataSource(dataSource) // 配置数据源 相当于 setDataSource(dataSource)
+dataSource +dataSource
// 配置Mapper 相当于 addMapper(AccountMapper::class.java) // 配置Mapper 相当于 addMapper(AccountMapper::class.java)
+AccountMapper::class +AccountMapper::class
// 配置日志输出 相当于 setLogImpl(StdOutImpl::class.java) // 配置日志输出 相当于 setLogImpl(StdOutImpl::class.java)
logImpl = StdOutImpl::class logImpl = StdOutImpl::class
}.start() }
``` ```
- 快速查询数据通过DSL泛型快速编写查询语句并查询: (快速查询提供三个函数all, filter 和 query ) - 快速查询数据通过DSL泛型快速编写查询语句并查询: (快速查询提供三个函数all, filter 和 query )
>- `all<实体类>()` 查泛型对应的表的所有数据 >- `all<实体类>()` 查泛型对应的表的所有数据
>- `filter<实体类>(vararg KProperty<*>, ()->QueryCondition)` 按条件查泛型对应的表的数据 >- `filter<实体类>(vararg KProperty<*>, ()->QueryCondition)` 按条件查泛型对应的表的数据
>- `query<实体类>(QueryScope.()->Unit)` 较复杂查泛型对应的表的数据 (如: 分组,排序等) >- `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<AccountMapper>().selectListByQuery(queryWrapper)
```
* **扩展后** * **【对比原生】**
```kotlin * **原生**
query<Account> { ```kotlin
select(Account::id, Account::userName) val queryWrapper = QueryWrapper.create()
where(Account::age.isNotNull) and { Account::age ge 17 } orderBy -Account::id .select(QueryColumn("id"), QueryColumn("user_name"))
} .where(QueryColumn("age").isNotNull()).and(QueryColumn("age").ge(17))
``` .orderBy(QueryColumn("id").desc())
执行的SQL: mapper<AccountMapper>().selectListByQuery(queryWrapper)
```sql ```
SELECT `id`, `user_name` FROM `tb_account` WHERE `age` IS NOT NULL AND `age` >= 17 ORDER BY `id` DESC
```
* **【条件优化】** * **扩展后**
- 例如: 查询属性是否在一个连续的区间时,会自动将 IN 转为 BETWEEN 调用 ```kotlin
```kotlin // 无需注册Mapper与APT/KSP即可查询操作
filter<Account> { Account::age `in` (17..19) } val accountList: List<Account> = query {
``` select(Account::id, Account::userName)
where(Account::age.isNotNull) and { Account::age ge 17 } orderBy -Account::id
}
```
执行的SQL: 执行的SQL:
```sql ```sql
SELECT * FROM `tb_account` WHERE `age` BETWEEN 17 AND 19 SELECT `id`, `user_name` FROM `tb_account` WHERE `age` IS NOT NULL AND `age` >= 17 ORDER BY `id` DESC
```
- 例如: 构建多属性组合 IN (最多支持三个属性)
```kotlin
filter<Account> {
(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)
``` ```
* **【条件优化】**
- 例如: 查询属性是否在一个连续的区间时,会自动将 IN 转为 BETWEEN 调用
```kotlin
filter<Account> { Account::age `in` (17..19) }
```
执行的SQL:
```sql
SELECT * FROM `tb_account` WHERE `age` BETWEEN 17 AND 19
```
- 例如: 构建多属性组合 IN (最多支持三个属性)
```kotlin
filter<Account> {
(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: 使用扩展方法摆脱对 APT(注解处理器) 的使用,直接使用属性引用让代码更加灵活优雅:
> 使用APT: `ACCOUNT.ID eq 1` ,使用属性引用: `Account::id eq 1` > 使用APT: `ACCOUNT.ID eq 1` ,使用属性引用: `Account::id eq 1`
> >

View File

@ -220,7 +220,7 @@ pom.xml 添加 `annotationProcessorPaths` 配置,
``` ```
dependencies { dependencies {
... ...
annotationProcessor 'com.mybatis-flex:mybatis-flex-processor:1.7.6' annotationProcessor 'com.mybatis-flex:mybatis-flex-processor:1.7.7'
} }
``` ```

View File

@ -10,7 +10,7 @@
<dependency> <dependency>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-codegen</artifactId> <artifactId>mybatis-flex-codegen</artifactId>
<version>1.7.6</version> <version>1.7.7</version>
</dependency> </dependency>
``` ```

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>parent</artifactId> <artifactId>parent</artifactId>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<version>1.7.6</version> <version>1.7.7</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -26,7 +26,7 @@ public interface SetListener extends Listener {
* @param entity 实体类 * @param entity 实体类
* @param property 属性名 * @param property 属性名
* @param value 属性值 * @param value 属性值
* @return 实体类 * @return 属性值
*/ */
Object onSet(Object entity, String property, Object value); Object onSet(Object entity, String property, Object value);

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>parent</artifactId> <artifactId>parent</artifactId>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<version>1.7.6</version> <version>1.7.7</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -23,7 +23,7 @@
<dependency> <dependency>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-core</artifactId> <artifactId>mybatis-flex-core</artifactId>
<version>1.7.6</version> <version>1.7.7</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>

View File

@ -4,7 +4,7 @@ import com.mybatisflex.solon.service.impl.ServiceImpl;
import #(packageConfig.entityPackage).#(table.buildEntityClassName()); import #(packageConfig.entityPackage).#(table.buildEntityClassName());
import #(packageConfig.mapperPackage).#(table.buildMapperClassName()); import #(packageConfig.mapperPackage).#(table.buildMapperClassName());
import #(packageConfig.servicePackage).#(table.buildServiceClassName()); import #(packageConfig.servicePackage).#(table.buildServiceClassName());
import org.noear.solon.annotation.ProxyComponent; import org.noear.solon.annotation.Component;
/** /**
* #(table.getComment()) 服务层实现。 * #(table.getComment()) 服务层实现。
@ -12,7 +12,7 @@ import org.noear.solon.annotation.ProxyComponent;
* @author #(javadocConfig.getAuthor()) * @author #(javadocConfig.getAuthor())
* @since #(javadocConfig.getSince()) * @since #(javadocConfig.getSince())
*/ */
@ProxyComponent @Component
public class #(table.buildServiceImplClassName()) extends ServiceImpl<#(table.buildMapperClassName()), #(table.buildEntityClassName())> implements #(table.buildServiceClassName()) { public class #(table.buildServiceImplClassName()) extends ServiceImpl<#(table.buildMapperClassName()), #(table.buildEntityClassName())> implements #(table.buildServiceClassName()) {
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>parent</artifactId> <artifactId>parent</artifactId>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<version>1.7.6</version> <version>1.7.7</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -101,7 +101,7 @@
<dependency> <dependency>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-annotation</artifactId> <artifactId>mybatis-flex-annotation</artifactId>
<version>1.7.6</version> <version>1.7.7</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>

View File

@ -27,7 +27,7 @@ public class FlexConsts {
} }
public static final String NAME = "MyBatis-Flex"; 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"; public static final String SQL = "$$sql";

View File

@ -127,6 +127,7 @@ public class DialectFactory {
case DORIS: case DORIS:
return new CommonsDialectImpl(KeywordWrap.BACK_QUOTE, LimitOffsetProcessor.MYSQL); return new CommonsDialectImpl(KeywordWrap.BACK_QUOTE, LimitOffsetProcessor.MYSQL);
case CLICK_HOUSE: case CLICK_HOUSE:
case GBASE_8S:
return new CommonsDialectImpl(KeywordWrap.NONE, LimitOffsetProcessor.MYSQL); return new CommonsDialectImpl(KeywordWrap.NONE, LimitOffsetProcessor.MYSQL);
case DM: case DM:
return new DmDialect(); return new DmDialect();

View File

@ -479,7 +479,7 @@ public class FlexDefaultResultSetHandler extends DefaultResultSetHandler {
private boolean applyPropertyMappings(ResultSetWrapper rsw, ResultMap resultMap, MetaObject metaObject, private boolean applyPropertyMappings(ResultSetWrapper rsw, ResultMap resultMap, MetaObject metaObject,
ResultLoaderMap lazyLoader, String columnPrefix) throws SQLException { ResultLoaderMap lazyLoader, String columnPrefix) throws SQLException {
final List<String> mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix); final Collection<String> mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix);
boolean foundValues = false; boolean foundValues = false;
final List<ResultMapping> propertyMappings = resultMap.getPropertyResultMappings(); final List<ResultMapping> propertyMappings = resultMap.getPropertyResultMappings();
for (ResultMapping propertyMapping : propertyMappings) { for (ResultMapping propertyMapping : propertyMappings) {
@ -1178,7 +1178,7 @@ public class FlexDefaultResultSetHandler extends DefaultResultSetHandler {
if (resultMapping.isSimple()) { if (resultMapping.isSimple()) {
final String column = prependPrefix(resultMapping.getColumn(), columnPrefix); final String column = prependPrefix(resultMapping.getColumn(), columnPrefix);
final TypeHandler<?> th = resultMapping.getTypeHandler(); final TypeHandler<?> th = resultMapping.getTypeHandler();
List<String> mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix); Collection<String> mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix);
// Issue #114 // Issue #114
if (column != null && mappedColumnNames.contains(column.toUpperCase(Locale.ENGLISH))) { if (column != null && mappedColumnNames.contains(column.toUpperCase(Locale.ENGLISH))) {
final Object value = th.getResult(rsw.getResultSet(), column); final Object value = th.getResult(rsw.getResultSet(), column);

View File

@ -30,6 +30,7 @@ import org.apache.ibatis.type.TypeHandler;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -84,7 +85,7 @@ public class FlexResultSetHandler extends FlexDefaultResultSetHandler {
String columnName = prependPrefix(mapping.getColumn(), columnPrefix); String columnName = prependPrefix(mapping.getColumn(), columnPrefix);
TypeHandler<?> typeHandler = mapping.getTypeHandler(); TypeHandler<?> typeHandler = mapping.getTypeHandler();
List<String> mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix); Collection<String> mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix);
if (columnName != null && mappedColumnNames.contains(columnName.toUpperCase(Locale.ENGLISH))) { if (columnName != null && mappedColumnNames.contains(columnName.toUpperCase(Locale.ENGLISH))) {
return typeHandler.getResult(rsw.getResultSet(), columnName); return typeHandler.getResult(rsw.getResultSet(), columnName);
} }

View File

@ -247,8 +247,8 @@ public class RowSqlProvider {
FlexAssert.notNull(entity, "entity can not be null"); FlexAssert.notNull(entity, "entity can not be null");
// Mapper 是通用 Mapper 无法通过 ProviderContext 获取直接使用 TableInfoFactory // Mapper 是通用 Mapper 无法通过 ProviderContext 获取直接使用 TableInfoFactory
TableInfo tableInfo = TableInfoFactory.ofEntityClass(ClassUtil.getUsefulClass(entity.getClass()));
TableInfo tableInfo = TableInfoFactory.ofEntityClass(ClassUtil.getUsefulClass(entity.getClass()));
// 执行 onUpdate 监听器 // 执行 onUpdate 监听器
tableInfo.invokeOnUpdateListener(entity); tableInfo.invokeOnUpdateListener(entity);

View File

@ -22,6 +22,7 @@ import com.mybatisflex.core.util.LambdaGetter;
import com.mybatisflex.core.util.LambdaUtil; import com.mybatisflex.core.util.LambdaUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import static com.mybatisflex.core.constant.FuncName.*; import static com.mybatisflex.core.constant.FuncName.*;
@ -2346,6 +2347,12 @@ public class QueryMethods {
return new DistinctQueryColumn(columns); return new DistinctQueryColumn(columns);
} }
@SafeVarargs
public static <T> DistinctQueryColumn distinct(LambdaGetter<T>... columns) {
return new DistinctQueryColumn(Arrays.stream(columns)
.map(LambdaUtil::getQueryColumn).toArray(QueryColumn[]::new));
}
// === CASE THEN ELSE === // === CASE THEN ELSE ===
/** /**
@ -2564,6 +2571,13 @@ public class QueryMethods {
return new OperatorQueryCondition("NOT ", childCondition); return new OperatorQueryCondition("NOT ", childCondition);
} }
/**
* {@code NOT (column)} {@code NOT column}
*/
public static <N> QueryColumn not(LambdaGetter<N> column) {
return new FunctionQueryColumn("NOT", LambdaUtil.getQueryColumn(column));
}
/** /**
* 空条件 * 空条件
*/ */

View File

@ -376,7 +376,7 @@ public interface IService<T> {
* @return 查询结果数据 * @return 查询结果数据
*/ */
default T getOne(QueryCondition condition) { default T getOne(QueryCondition condition) {
return getOne(query().where(condition)); return getOne(query().where(condition).limit(1));
} }
/** /**

View File

@ -149,7 +149,9 @@ public class ColumnInfo {
if (configuration == null) { if (configuration == null) {
configuration = FlexGlobalConfig.getDefaultConfig().getConfiguration(); configuration = FlexGlobalConfig.getDefaultConfig().getConfiguration();
} }
buildTypeHandler = configuration.getTypeHandlerRegistry().getTypeHandler(propertyType); if (configuration != null) {
buildTypeHandler = configuration.getTypeHandlerRegistry().getTypeHandler(propertyType);
}
} }
return buildTypeHandler; return buildTypeHandler;

View File

@ -70,14 +70,15 @@ public class ClassUtil {
} }
public static <T> Class<T> getUsefulClass(Class<T> clazz) { public static <T> Class<T> getUsefulClass(Class<T> clazz) {
if (ProxyObject.class.isAssignableFrom(clazz)) {
return (Class<T>) clazz.getSuperclass();
}
if (isProxy(clazz)) { if (isProxy(clazz)) {
return getJdkProxySuperClass(clazz); return getJdkProxySuperClass(clazz);
} }
// if (ProxyObject.class.isAssignableFrom(clazz)){
// return (Class<T>) clazz.getSuperclass();
// }
//ControllerTest$ServiceTest$$EnhancerByGuice$$40471411#hello -------> Guice //ControllerTest$ServiceTest$$EnhancerByGuice$$40471411#hello -------> Guice
//com.demo.blog.Blog$$EnhancerByCGLIB$$69a17158 ----> CGLIB //com.demo.blog.Blog$$EnhancerByCGLIB$$69a17158 ----> CGLIB
//io.jboot.test.app.TestAppListener_$$_jvstb9f_0 ------> javassist //io.jboot.test.app.TestAppListener_$$_jvstb9f_0 ------> javassist

View File

@ -58,13 +58,9 @@ public class FieldWrapper {
String setterName = "set" + StringUtil.firstCharToUpperCase(fieldName); String setterName = "set" + StringUtil.firstCharToUpperCase(fieldName);
Method setter = ClassUtil.getFirstMethod(clazz, method -> Method setter = ClassUtil.getFirstMethod(clazz, method ->
method.getParameterCount() == 1 method.getParameterCount() == 1
&& Modifier.isPublic(method.getModifiers()) && Modifier.isPublic(method.getModifiers())
&& method.getName().equals(setterName)); && method.getName().equals(setterName));
if (setter == null) {
throw new IllegalStateException("Can not find method \"set" + StringUtil.firstCharToUpperCase(fieldName) + "\" in class: " + clazz);
}
fieldWrapper = new FieldWrapper(); fieldWrapper = new FieldWrapper();
fieldWrapper.field = findField; fieldWrapper.field = findField;
@ -80,8 +76,8 @@ public class FieldWrapper {
String[] getterNames = new String[]{"get" + StringUtil.firstCharToUpperCase(fieldName), "is" + StringUtil.firstCharToUpperCase(fieldName)}; String[] getterNames = new String[]{"get" + StringUtil.firstCharToUpperCase(fieldName), "is" + StringUtil.firstCharToUpperCase(fieldName)};
fieldWrapper.getterMethod = ClassUtil.getFirstMethod(clazz, method -> method.getParameterCount() == 0 fieldWrapper.getterMethod = ClassUtil.getFirstMethod(clazz, method -> method.getParameterCount() == 0
&& Modifier.isPublic(method.getModifiers()) && Modifier.isPublic(method.getModifiers())
&& ArrayUtil.contains(getterNames, method.getName())); && ArrayUtil.contains(getterNames, method.getName()));
wrapperMap.put(fieldName, fieldWrapper); wrapperMap.put(fieldName, fieldWrapper);
} }
@ -120,6 +116,9 @@ public class FieldWrapper {
public void set(Object value, Object to) { public void set(Object value, Object to) {
try { try {
if (setterMethod == null) {
throw new IllegalStateException("Can not find method \"set" + StringUtil.firstCharToUpperCase(field.getName()) + "\" in class: " + to.getClass());
}
setterMethod.invoke(to, value); setterMethod.invoke(to, value);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@ -128,6 +127,9 @@ public class FieldWrapper {
public Object get(Object target) { public Object get(Object target) {
try { 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); return getterMethod.invoke(target);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@ -153,4 +155,4 @@ public class FieldWrapper {
public boolean isIgnore() { public boolean isIgnore() {
return isIgnore; return isIgnore;
} }
} }

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<artifactId>parent</artifactId> <artifactId>parent</artifactId>
<version>1.7.6</version> <version>1.7.7</version>
</parent> </parent>
<artifactId>mybatis-flex-dependencies</artifactId> <artifactId>mybatis-flex-dependencies</artifactId>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>parent</artifactId> <artifactId>parent</artifactId>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<version>1.7.6</version> <version>1.7.7</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -22,7 +22,7 @@
<dependency> <dependency>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-annotation</artifactId> <artifactId>mybatis-flex-annotation</artifactId>
<version>1.7.6</version> <version>1.7.7</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>parent</artifactId> <artifactId>parent</artifactId>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<version>1.7.6</version> <version>1.7.7</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>parent</artifactId> <artifactId>parent</artifactId>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<version>1.7.6</version> <version>1.7.7</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -23,7 +23,7 @@
<dependency> <dependency>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-spring</artifactId> <artifactId>mybatis-flex-spring</artifactId>
<version>1.7.6</version> <version>1.7.7</version>
</dependency> </dependency>
<dependency> <dependency>
@ -104,7 +104,7 @@
<dependency> <dependency>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-core</artifactId> <artifactId>mybatis-flex-core</artifactId>
<version>1.7.6</version> <version>1.7.7</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mybatis-flex</groupId>
<artifactId>parent</artifactId>
<version>1.7.7</version>
</parent>
<artifactId>mybatis-flex-spring-boot3-starter</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-spring-boot-starter</artifactId>
<version>1.7.7</version>
<exclusions>
<exclusion>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>3.0.3</version>
</dependency>
</dependencies>
</project>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>parent</artifactId> <artifactId>parent</artifactId>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<version>1.7.6</version> <version>1.7.7</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -22,7 +22,7 @@
<dependency> <dependency>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-core</artifactId> <artifactId>mybatis-flex-core</artifactId>
<version>1.7.6</version> <version>1.7.7</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>mybatis-flex-test</artifactId> <artifactId>mybatis-flex-test</artifactId>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<version>1.7.6</version> <version>1.7.7</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -30,6 +30,7 @@ public class ContributorsDocGen {
List<String> urls = Arrays.asList( List<String> urls = Arrays.asList(
"https://gitee.com/mybatis-flex/mybatis-flex/contributors?ref=main" "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=2&ref=main"
, "https://gitee.com/mybatis-flex/mybatis-flex/contributors?page=3&ref=main"
); );
StringBuilder markdown = new StringBuilder(); StringBuilder markdown = new StringBuilder();
markdown.append("| | | | | |\n" + markdown.append("| | | | | |\n" +
@ -73,12 +74,16 @@ public class ContributorsDocGen {
if (userName.contains("@")) { if (userName.contains("@")) {
userName = userName.substring(0, userName.indexOf("@")); userName = userName.substring(0, userName.indexOf("@"));
} }
if (StringUtil.isBlank(src)) { // if (StringUtil.isBlank(src)) {
src = "https://api.dicebear.com/7.x/initials/svg?seed=" + userName; // src = "https://api.dicebear.com/7.x/initials/svg?seed=" + userName;
} // }
markdown.append("|"); markdown.append("|");
markdown.append("![](" + src + ")");
if (StringUtil.isNotBlank(src)) {
markdown.append("![](" + src + ")");
}
markdown.append(userName); markdown.append(userName);
startIndex++; startIndex++;

View File

@ -82,19 +82,28 @@ public class DbTest {
Map map2 = Db.selectFirstAndSecondColumnsAsMap("select * from tb_account"); Map map2 = Db.selectFirstAndSecondColumnsAsMap("select * from tb_account");
System.out.println(map); System.out.println(map);
System.out.println(map2); System.out.println(map2);
assert map.equals(map2);
} }
@Test @Test
public void test03() { public void test03() {
Account account = UpdateEntity.of(Account.class,1); try {
account.setAge(1); Account account = UpdateEntity.of(Account.class, 1);
List<Account> accounts = new ArrayList<>(); account.setAge(1);
accounts.add(account); List<Account> accounts = new ArrayList<>();
Account account2 = UpdateEntity.of(Account.class,2); accounts.add(account);
account2.setAge(2); Account account2 = UpdateEntity.of(Account.class, 2);
UpdateWrapper updateWrapper = UpdateWrapper.of(account2); account2.setAge(2);
updateWrapper.setRaw("age","age+1"); UpdateWrapper updateWrapper = UpdateWrapper.of(account2);
accounts.add(account2); updateWrapper.setRaw("age", "age+1");
Db.updateEntitiesBatch(accounts); accounts.add(account2);
Account account3 = new Account();
account3.setId(3L);
account3.setAge(4);
accounts.add(account3);
Db.updateEntitiesBatch(accounts);
}catch (Exception e){
assert false;
}
} }
} }

View File

@ -4,7 +4,7 @@
<parent> <parent>
<artifactId>mybatis-flex-test</artifactId> <artifactId>mybatis-flex-test</artifactId>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<version>1.7.6</version> <version>1.7.7</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>mybatis-flex-test</artifactId> <artifactId>mybatis-flex-test</artifactId>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<version>1.7.6</version> <version>1.7.7</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -83,6 +83,24 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mysql</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -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();
}
}

View File

@ -19,6 +19,11 @@ package com.mybatisflex.test.common;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONReader; import com.alibaba.fastjson2.JSONReader;
import com.alibaba.fastjson2.JSONWriter; 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.*; import java.io.*;
@ -71,4 +76,26 @@ public class SerialUtil {
return parseObject(toJSONString(obj), tClass); 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;
}
} }

View File

@ -19,18 +19,16 @@ package com.mybatisflex.test.mapper;
import com.mybatisflex.core.logicdelete.LogicDeleteManager; import com.mybatisflex.core.logicdelete.LogicDeleteManager;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.row.Db; 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.Account;
import com.mybatisflex.test.model.AccountVO; import com.mybatisflex.test.model.AccountVO;
import com.mybatisflex.test.model.AccountVO2; import com.mybatisflex.test.model.AccountVO2;
import lombok.val;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import java.util.Date; import java.util.Date;
import java.util.List;
import static com.mybatisflex.core.query.QueryMethods.*; import static com.mybatisflex.core.query.QueryMethods.*;
import static com.mybatisflex.test.model.table.AccountTableDef.ACCOUNT; import static com.mybatisflex.test.model.table.AccountTableDef.ACCOUNT;
@ -44,7 +42,7 @@ import static com.mybatisflex.test.model.table.UserTableDef.USER;
*/ */
@SpringBootTest @SpringBootTest
@SuppressWarnings("all") @SuppressWarnings("all")
class AccountMapperTest { class AccountMapperTest extends TestInfrastructure {
@Autowired @Autowired
private AccountMapper accountMapper; private AccountMapper accountMapper;

View File

@ -18,6 +18,7 @@ package com.mybatisflex.test.mapper;
import com.mybatisflex.core.mybatis.Mappers; import com.mybatisflex.core.mybatis.Mappers;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.test.TestInfrastructure;
import com.mybatisflex.test.model.Good; import com.mybatisflex.test.model.Good;
import com.mybatisflex.test.model.User; import com.mybatisflex.test.model.User;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
@ -34,7 +35,7 @@ import static com.mybatisflex.test.model.table.UserTableDef.USER;
* @since 2023-07-23 * @since 2023-07-23
*/ */
@SpringBootTest @SpringBootTest
class ActiveRecordTest { class ActiveRecordTest extends TestInfrastructure {
@Test @Test
void testMapper() { void testMapper() {

View File

@ -17,6 +17,7 @@
package com.mybatisflex.test.mapper; package com.mybatisflex.test.mapper;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.test.TestInfrastructure;
import com.mybatisflex.test.model.Account; import com.mybatisflex.test.model.Account;
import com.mybatisflex.test.model.Article; import com.mybatisflex.test.model.Article;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -26,7 +27,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import java.util.List; import java.util.List;
@SpringBootTest @SpringBootTest
public class CombinedMapperTest { public class CombinedMapperTest extends TestInfrastructure {
@Autowired @Autowired
private AccountMapper accountMapper; private AccountMapper accountMapper;

View File

@ -16,6 +16,7 @@
package com.mybatisflex.test.mapper; package com.mybatisflex.test.mapper;
import com.mybatisflex.test.TestInfrastructure;
import com.mybatisflex.test.model.Account; import com.mybatisflex.test.model.Account;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; 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 * @since 2023/4/24 19:37
*/ */
@SpringBootTest @SpringBootTest
class MyAccountMapperTest { class MyAccountMapperTest extends TestInfrastructure {
@Autowired @Autowired
private MyAccountMapper mapper; private MyAccountMapper mapper;

View File

@ -17,7 +17,7 @@
package com.mybatisflex.test.mapper; package com.mybatisflex.test.mapper;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.test.entity.Inner; import com.mybatisflex.test.TestInfrastructure;
import com.mybatisflex.test.entity.Outer; import com.mybatisflex.test.entity.Outer;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -32,7 +32,7 @@ import static com.mybatisflex.test.entity.table.OuterTableDef.OUTER;
* @since 2023-07-01 * @since 2023-07-01
*/ */
@SpringBootTest @SpringBootTest
class OuterMapperTest { class OuterMapperTest extends TestInfrastructure {
@Autowired @Autowired
private OuterMapper outerMapper; private OuterMapper outerMapper;

View File

@ -1,5 +1,6 @@
package com.mybatisflex.test.mapper; package com.mybatisflex.test.mapper;
import com.mybatisflex.test.TestInfrastructure;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
@ -13,7 +14,7 @@ import javax.annotation.Resource;
*/ */
@SpringBootTest @SpringBootTest
@SuppressWarnings("all") @SuppressWarnings("all")
public class PatientMapperTest { public class PatientMapperTest extends TestInfrastructure {
@Resource @Resource
private PatientMapper patientMapper; private PatientMapper patientMapper;

View File

@ -20,6 +20,7 @@ import com.mybatisflex.core.field.QueryBuilder;
import com.mybatisflex.core.query.QueryChain; import com.mybatisflex.core.query.QueryChain;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.update.UpdateChain; import com.mybatisflex.core.update.UpdateChain;
import com.mybatisflex.test.TestInfrastructure;
import com.mybatisflex.test.model.Gender; import com.mybatisflex.test.model.Gender;
import com.mybatisflex.test.model.User; import com.mybatisflex.test.model.User;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
@ -36,7 +37,7 @@ import static com.mybatisflex.test.model.table.UserTableDef.USER;
* @since 2023-08-08 * @since 2023-08-08
*/ */
@SpringBootTest @SpringBootTest
class QueryChainTest { class QueryChainTest extends TestInfrastructure {
@Autowired @Autowired
UserMapper userMapper; UserMapper userMapper;

View File

@ -18,6 +18,7 @@ package com.mybatisflex.test.mapper;
import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.test.TestInfrastructure;
import com.mybatisflex.test.model.*; import com.mybatisflex.test.model.*;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -42,7 +43,7 @@ import static com.mybatisflex.test.model.table.UserTableDef.USER;
*/ */
@SpringBootTest @SpringBootTest
@SuppressWarnings("all") @SuppressWarnings("all")
class UserMapperTest { class UserMapperTest extends TestInfrastructure {
@Autowired @Autowired
private UserMapper userMapper; private UserMapper userMapper;

View File

@ -17,6 +17,7 @@
package com.mybatisflex.test.service; package com.mybatisflex.test.service;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.test.TestInfrastructure;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
@ -28,7 +29,7 @@ import static com.mybatisflex.test.model.table.ArticleTableDef.ARTICLE;
* @since 2023-07-22 * @since 2023-07-22
*/ */
@SpringBootTest @SpringBootTest
class ArticleServiceTest { class ArticleServiceTest extends TestInfrastructure {
@Autowired @Autowired
ArticleService articleService; ArticleService articleService;

View File

@ -2,6 +2,7 @@ package com.mybatisflex.test.service;
import com.mybatisflex.test.mapper.FieldMappingInnerMapper; import com.mybatisflex.test.mapper.FieldMappingInnerMapper;
import com.mybatisflex.test.mapper.FieldMappingMapper; import com.mybatisflex.test.mapper.FieldMappingMapper;
import com.mybatisflex.test.TestInfrastructure;
import com.mybatisflex.test.model.FieldMapping; import com.mybatisflex.test.model.FieldMapping;
import com.mybatisflex.test.model.FieldMappingInner; import com.mybatisflex.test.model.FieldMappingInner;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -11,11 +12,12 @@ import org.springframework.boot.test.context.SpringBootTest;
import java.util.Date; import java.util.Date;
@SpringBootTest @SpringBootTest
public class FieldMappingTest { class FieldMappingTest extends TestInfrastructure {
@Autowired @Autowired
FieldMappingMapper fieldMappingMapper; FieldMappingMapper fieldMappingMapper;
@Autowired @Autowired
FieldMappingInnerMapper fieldMappingInnerMapper; FieldMappingInnerMapper fieldMappingInnerMapper;
@Test @Test
void testFieldMapping() { void testFieldMapping() {
String fieldId = FieldMapping.create().saveOpt().get().getId(); String fieldId = FieldMapping.create().saveOpt().get().getId();

View File

@ -4,7 +4,7 @@
<parent> <parent>
<artifactId>mybatis-flex-test</artifactId> <artifactId>mybatis-flex-test</artifactId>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<version>1.7.6</version> <version>1.7.7</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>mybatis-flex-test</artifactId> <artifactId>mybatis-flex-test</artifactId>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<version>1.7.6</version> <version>1.7.7</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>parent</artifactId> <artifactId>parent</artifactId>
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<version>1.7.6</version> <version>1.7.7</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

16
pom.xml
View File

@ -7,7 +7,7 @@
<groupId>com.mybatis-flex</groupId> <groupId>com.mybatis-flex</groupId>
<artifactId>parent</artifactId> <artifactId>parent</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>1.7.6</version> <version>1.7.7</version>
<name>mybatis-flex</name> <name>mybatis-flex</name>
<url>https://mybatis-flex.com</url> <url>https://mybatis-flex.com</url>
@ -45,6 +45,7 @@
<module>mybatis-flex-core</module> <module>mybatis-flex-core</module>
<module>mybatis-flex-spring</module> <module>mybatis-flex-spring</module>
<module>mybatis-flex-spring-boot-starter</module> <module>mybatis-flex-spring-boot-starter</module>
<module>mybatis-flex-spring-boot3-starter</module>
<module>mybatis-flex-solon-plugin</module> <module>mybatis-flex-solon-plugin</module>
<module>mybatis-flex-test</module> <module>mybatis-flex-test</module>
<module>mybatis-flex-processor</module> <module>mybatis-flex-processor</module>
@ -55,9 +56,9 @@
<maven.compiler.source>8</maven.compiler.source> <maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target> <maven.compiler.target>8</maven.compiler.target>
<mybatis-flex.version>1.7.6</mybatis-flex.version> <mybatis-flex.version>1.7.7</mybatis-flex.version>
<mybatis.version>3.5.14</mybatis.version> <mybatis.version>3.5.15</mybatis.version>
<mybatis-spring.version>2.1.2</mybatis-spring.version> <mybatis-spring.version>2.1.2</mybatis-spring.version>
<mybatis-freemarker.version>1.2.4</mybatis-freemarker.version> <mybatis-freemarker.version>1.2.4</mybatis-freemarker.version>
<mybatis-velocity.version>2.1.2</mybatis-velocity.version> <mybatis-velocity.version>2.1.2</mybatis-velocity.version>
@ -71,6 +72,7 @@
<solon.version>2.5.3</solon.version> <solon.version>2.5.3</solon.version>
<junit.version>4.13.2</junit.version> <junit.version>4.13.2</junit.version>
<testcontainers.version>1.19.3</testcontainers.version>
<maven-flatten.version>1.5.0</maven-flatten.version> <maven-flatten.version>1.5.0</maven-flatten.version>
</properties> </properties>
@ -188,6 +190,14 @@
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-bom</artifactId>
<version>${testcontainers.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>