yulichang 2025-06-26 23:23:34 +08:00
parent 9463cb6437
commit 1b72884fcb
4 changed files with 13 additions and 14 deletions

View File

@ -12,9 +12,6 @@
<a href="https://central.sonatype.com/artifact/com.github.yulichang/mybatis-plus-join-boot-starter"> <a href="https://central.sonatype.com/artifact/com.github.yulichang/mybatis-plus-join-boot-starter">
<img alt="Maven central" src="https://img.shields.io/maven-central/v/com.github.yulichang/mybatis-plus-join-boot-starter.svg?style=flat-square"> <img alt="Maven central" src="https://img.shields.io/maven-central/v/com.github.yulichang/mybatis-plus-join-boot-starter.svg?style=flat-square">
</a> </a>
<a href="https://oss.sonatype.org/content/repositories/snapshots/com/github/yulichang/mybatis-plus-join-boot-starter/">
<img alt="Sonatype Nexus (Snapshots)" src="https://img.shields.io/nexus/s/https/oss.sonatype.org/com.github.yulichang/mybatis-plus-join-boot-starter.svg">
</a>
<a href="https://www.apache.org/licenses/LICENSE-2.0"> <a href="https://www.apache.org/licenses/LICENSE-2.0">
<img alt="code style" src="https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?style=flat-square"> <img alt="code style" src="https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?style=flat-square">
</a> </a>
@ -49,12 +46,12 @@
<dependency> <dependency>
<groupId>com.github.yulichang</groupId> <groupId>com.github.yulichang</groupId>
<artifactId>mybatis-plus-join-boot-starter</artifactId> <artifactId>mybatis-plus-join-boot-starter</artifactId>
<version>1.5.3</version> <version>1.5.4</version>
</dependency> </dependency>
``` ```
- Gradle - Gradle
``` ```
implementation 'com.github.yulichang:mybatis-plus-join-boot-starter:1.5.3' implementation 'com.github.yulichang:mybatis-plus-join-boot-starter:1.5.4'
``` ```
或者clone代码到本地执行 `mvn install`, 再引入以上依赖 或者clone代码到本地执行 `mvn install`, 再引入以上依赖
<br> <br>

View File

@ -12,9 +12,6 @@
<a href="https://central.sonatype.com/artifact/com.github.yulichang/mybatis-plus-join-boot-starter"> <a href="https://central.sonatype.com/artifact/com.github.yulichang/mybatis-plus-join-boot-starter">
<img alt="Maven central" src="https://img.shields.io/maven-central/v/com.github.yulichang/mybatis-plus-join-boot-starter.svg?style=flat-square"> <img alt="Maven central" src="https://img.shields.io/maven-central/v/com.github.yulichang/mybatis-plus-join-boot-starter.svg?style=flat-square">
</a> </a>
<a href="https://oss.sonatype.org/content/repositories/snapshots/com/github/yulichang/mybatis-plus-join-boot-starter/">
<img alt="Sonatype Nexus (Snapshots)" src="https://img.shields.io/nexus/s/https/oss.sonatype.org/com.github.yulichang/mybatis-plus-join-boot-starter.svg">
</a>
<a href="https://www.apache.org/licenses/LICENSE-2.0"> <a href="https://www.apache.org/licenses/LICENSE-2.0">
<img alt="code style" src="https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?style=flat-square"> <img alt="code style" src="https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?style=flat-square">
</a> </a>
@ -49,12 +46,12 @@
<dependency> <dependency>
<groupId>com.github.yulichang</groupId> <groupId>com.github.yulichang</groupId>
<artifactId>mybatis-plus-join-boot-starter</artifactId> <artifactId>mybatis-plus-join-boot-starter</artifactId>
<version>1.5.3</version> <version>1.5.4</version>
</dependency> </dependency>
``` ```
- Gradle - Gradle
``` ```
implementation 'com.github.yulichang:mybatis-plus-join-boot-starter:1.5.3' implementation 'com.github.yulichang:mybatis-plus-join-boot-starter:1.5.4'
``` ```
或者clone代码到本地执行 `mvn install`, 再引入以上依赖 或者clone代码到本地执行 `mvn install`, 再引入以上依赖
<br> <br>

View File

@ -17,6 +17,7 @@ import java.net.URLEncoder;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Optional;
import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.joining;
@ -127,9 +128,10 @@ public interface MPJBaseMethod extends Constants {
if (fieldStrategy == FieldStrategy.NEVER) { if (fieldStrategy == FieldStrategy.NEVER) {
return null; return null;
} }
FieldStrategy strategy = Optional.ofNullable(fieldStrategy).orElse(FieldStrategy.DEFAULT);
if (AdapterHelper.getAdapter().mpjIsPrimitive(tableFieldInfo) if (AdapterHelper.getAdapter().mpjIsPrimitive(tableFieldInfo)
|| fieldStrategy.name().equalsIgnoreCase("ALWAYS") || strategy.name().equalsIgnoreCase("ALWAYS")
|| fieldStrategy.name().equalsIgnoreCase("IGNORED")) { || strategy.name().equalsIgnoreCase("IGNORED")) {
return sqlScript; return sqlScript;
} }
if (fieldStrategy == FieldStrategy.NOT_EMPTY && tableFieldInfo.isCharSequence()) { if (fieldStrategy == FieldStrategy.NOT_EMPTY && tableFieldInfo.isCharSequence()) {

View File

@ -8,6 +8,8 @@ import com.github.yulichang.adapter.AdapterHelper;
import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.SqlSource; import org.apache.ibatis.mapping.SqlSource;
import java.util.Optional;
/** /**
* copy {@link com.baomidou.mybatisplus.core.injector.methods.Update} * copy {@link com.baomidou.mybatisplus.core.injector.methods.Update}
* *
@ -65,9 +67,10 @@ public class UpdateJoin extends MPJAbstractMethod {
if (fieldStrategy == FieldStrategy.NEVER) { if (fieldStrategy == FieldStrategy.NEVER) {
return null; return null;
} }
FieldStrategy strategy = Optional.ofNullable(fieldStrategy).orElse(FieldStrategy.DEFAULT);
if (AdapterHelper.getAdapter().mpjIsPrimitive(tableFieldInfo) if (AdapterHelper.getAdapter().mpjIsPrimitive(tableFieldInfo)
|| fieldStrategy.name().equalsIgnoreCase("ALWAYS") || strategy.name().equalsIgnoreCase("ALWAYS")
|| fieldStrategy.name().equalsIgnoreCase("IGNORED")) { || strategy.name().equalsIgnoreCase("IGNORED")) {
return sqlScript; return sqlScript;
} }
if (fieldStrategy == FieldStrategy.NOT_EMPTY && tableFieldInfo.isCharSequence()) { if (fieldStrategy == FieldStrategy.NOT_EMPTY && tableFieldInfo.isCharSequence()) {