mirror of
https://gitee.com/easii/mapstruct-plus.git
synced 2025-12-06 09:08:54 +08:00
release 1.5.0
This commit is contained in:
parent
793da1b8d1
commit
6cd149ec04
@ -192,7 +192,7 @@ public class User {
|
||||
|
||||
```xml
|
||||
<properties>
|
||||
<mapstruct-plus.version>1.4.8</mapstruct-plus.version>
|
||||
<mapstruct-plus.version>1.5.0</mapstruct-plus.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@ -61,18 +61,28 @@ footer:
|
||||
<dependency>
|
||||
<groupId>io.github.linpeilie</groupId>
|
||||
<artifactId>mapstruct-plus-spring-boot-starter</artifactId>
|
||||
<version>1.4.8</version>
|
||||
<version>1.5.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
- gradle
|
||||
|
||||
```groovy
|
||||
implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-starter', version: '1.4.8'
|
||||
implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-starter', version: '1.5.0'
|
||||
```
|
||||
|
||||
## 更新日志
|
||||
|
||||
### 1.5.0
|
||||
|
||||
- 升级 MapStruct 版本为 1.6.3
|
||||
- 升级注意事项:MapStruct 1.6 增加了一个 Breaking Changes,升级后可能会导致有不兼容,详情可见 MapStruct [升级日志](https://github.com/mapstruct/mapstruct/releases)
|
||||
> 在 MapStruct 1.6 中,增加了对源参数(source parameters)进行存在性检查的支持。
|
||||
这意味着,即使你只想直接将一个源参数映射到某个目标属性,也需要使用新的注解 `@SourceParameterCondition` 或 `@Condition(appliesTo = ConditionStrategy.SOURCE_PARAMETERS)` 来定义存在性检查方法。
|
||||
- Converter 支持 Consumer 函数接口
|
||||
- [pr133](https://github.com/linpeilie/mapstruct-plus/pull/133) : AutoMapper、AutoMapping、ReverseAutoMapping 支持重复配置
|
||||
- [pr141](https://github.com/linpeilie/mapstruct-plus/pull/141) : MapperConfig 添加 uses 属性以配置全局共享的自定义转换类
|
||||
|
||||
### 1.4.8
|
||||
|
||||
- 修复在 Vscode 软件中,默认使用 Eclipse jdt.core 环境下,生成的转换实现类冲突的问题;
|
||||
@ -85,13 +95,6 @@ implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-s
|
||||
- fix [#108](https://github.com/linpeilie/mapstruct-plus/issues/108) : SpringContextUtils#getBeanFactory 方法改为静态;
|
||||
- [pr](https://github.com/linpeilie/mapstruct-plus/pull/114) : 增加注解批量增加 `AutoMapping`、`AutoMappings`、`ReverseAutoMapping`、`ReverseAutoMappings` 特性;
|
||||
|
||||
### 1.4.5
|
||||
|
||||
- fix: 修复 `ReverseAutoMappings` 配置不生效的问题
|
||||
|
||||
### 1.4.4
|
||||
|
||||
- fix: 修复部分Spring版本下找不到类的问题
|
||||
|
||||
……
|
||||
|
||||
|
||||
@ -58,18 +58,25 @@ fotter:
|
||||
<dependency>
|
||||
<groupId>io.github.linpeilie</groupId>
|
||||
<artifactId>mapstruct-plus-spring-boot-starter</artifactId>
|
||||
<version>1.4.8</version>
|
||||
<version>1.5.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
- gradle
|
||||
|
||||
```groovy
|
||||
implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-starter', version: '1.4.8'
|
||||
implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-starter', version: '1.5.0'
|
||||
```
|
||||
|
||||
## Change Log
|
||||
|
||||
- Upgrade MapStruct version to 1.6.3
|
||||
- Upgrade Notice: MapStruct 1.6 introduced breaking changes. Upgrading may cause compatibility issues. Refer to the MapStruct [Release Notes for details.] (https://github.com/mapstruct/mapstruct/releases)
|
||||
> In MapStruct 1.6, support for presence checks on source parameters was added. This means that even if you want to map a source parameter directly to a target property, you must now define the presence check method using the new `@SourceParameterCondition` annotation or `@Condition(appliesTo = ConditionStrategy.SOURCE_PARAMETERS)`.
|
||||
- Converter now supports the Consumer functional interface
|
||||
- [pr133](https://github.com/linpeilie/mapstruct-plus/pull/133) : AutoMapper, AutoMapping, and ReverseAutoMapping now support repeated configurations.
|
||||
- [pr141](https://github.com/linpeilie/mapstruct-plus/pull/141) : Added the uses property to MapperConfig for configuring globally shared custom converter classes.
|
||||
|
||||
### 1.4.8
|
||||
|
||||
- Fixed the issue where the generated conversion implementation class conflicted when using the default `Eclipse jdt.core` environment in Vscode;
|
||||
@ -82,21 +89,6 @@ implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-s
|
||||
- fix [#108](https://github.com/linpeilie/mapstruct-plus/issues/108) : SpringContextUtils#getBeanFactory method changes to static;
|
||||
- [PR](https://github.com/linpeilie/mapstruct-plus/pull/114) : increase annotation batch `AutoMapping`、`AutoMappings`、`ReverseAutoMapping`、`ReverseAutoMappings` features.
|
||||
|
||||
|
||||
### 1.4.5
|
||||
|
||||
- fix: fiexed an issue where the `ReverseAutoMapping` configuration did not take effect.
|
||||
|
||||
### 1.4.4
|
||||
|
||||
- fix: fixed a problem with missing classes in some Spring release version.
|
||||
|
||||
### 1.4.3
|
||||
|
||||
- **feat**: Added `spring-lazy` option to `ComponentModel` for lazy loading Spring Beans, resolving mutual dependency issues, and set this option as the default configuration.
|
||||
- **fix**: Fixed the issue where the default configuration for `unmappedTargetPolicy` was not effective.
|
||||
- **enhance**: Optimized IDEA local development build efficiency, reducing build time and metaspace usage to some extent.[Issue #89](https://github.com/linpeilie/mapstruct-plus/issues/89)
|
||||
|
||||
……
|
||||
|
||||
## Code Warehouse
|
||||
|
||||
@ -6,6 +6,13 @@ category:
|
||||
description: MapStructPlus release log
|
||||
---
|
||||
|
||||
- Upgrade MapStruct version to 1.6.3
|
||||
- Upgrade Notice: MapStruct 1.6 introduced breaking changes. Upgrading may cause compatibility issues. Refer to the MapStruct [Release Notes for details.] (https://github.com/mapstruct/mapstruct/releases)
|
||||
> In MapStruct 1.6, support for presence checks on source parameters was added. This means that even if you want to map a source parameter directly to a target property, you must now define the presence check method using the new `@SourceParameterCondition` annotation or `@Condition(appliesTo = ConditionStrategy.SOURCE_PARAMETERS)`.
|
||||
- Converter now supports the Consumer functional interface
|
||||
- [pr133](https://github.com/linpeilie/mapstruct-plus/pull/133) : AutoMapper, AutoMapping, and ReverseAutoMapping now support repeated configurations.
|
||||
- [pr141](https://github.com/linpeilie/mapstruct-plus/pull/141) : Added the uses property to MapperConfig for configuring globally shared custom converter classes.
|
||||
|
||||
### 1.4.8
|
||||
|
||||
- Fixed the issue where the generated conversion implementation class conflicted when using the default `Eclipse jdt.core` environment in Vscode;
|
||||
|
||||
@ -6,6 +6,17 @@ category:
|
||||
description: MapStructPlus release log
|
||||
---
|
||||
|
||||
|
||||
### 1.5.0
|
||||
|
||||
- 升级 MapStruct 版本为 1.6.3
|
||||
- 升级注意事项:MapStruct 1.6 增加了一个 Breaking Changes,升级后可能会导致有不兼容,详情可见 MapStruct [升级日志](https://github.com/mapstruct/mapstruct/releases)
|
||||
> 在 MapStruct 1.6 中,增加了对源参数(source parameters)进行存在性检查的支持。
|
||||
这意味着,即使你只想直接将一个源参数映射到某个目标属性,也需要使用新的注解 `@SourceParameterCondition` 或 `@Condition(appliesTo = ConditionStrategy.SOURCE_PARAMETERS)` 来定义存在性检查方法。
|
||||
- Converter 支持 Consumer 函数接口
|
||||
- [pr133](https://github.com/linpeilie/mapstruct-plus/pull/133) : AutoMapper、AutoMapping、ReverseAutoMapping 支持重复配置
|
||||
- [pr141](https://github.com/linpeilie/mapstruct-plus/pull/141) : MapperConfig 添加 uses 属性以配置全局共享的自定义转换类
|
||||
|
||||
### 1.4.8
|
||||
|
||||
- 修复在 Vscode 软件中,默认使用 Eclipse jdt.core 环境下,生成的转换实现类冲突的问题;
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<mapstruct.version>1.5.1.Final</mapstruct.version>
|
||||
<mapstruct-plus.version>1.4.8</mapstruct-plus.version>
|
||||
<mapstruct.version>1.6.3</mapstruct.version>
|
||||
<mapstruct-plus.version>1.5.0</mapstruct-plus.version>
|
||||
<lombok.version>1.18.22</lombok.version>
|
||||
<hutool.version>5.8.26</hutool.version>
|
||||
<guava.version>32.1.3-jre</guava.version>
|
||||
|
||||
@ -10,6 +10,7 @@ import org.mapstruct.Condition;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Named;
|
||||
import org.mapstruct.SourceParameterCondition;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -19,13 +20,13 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
public class ConditionalMethodWithSourceToTargetMapper {
|
||||
|
||||
@Condition
|
||||
@SourceParameterCondition
|
||||
@Named("mapCustomerFromOrder")
|
||||
public boolean mapCustomerFromOrder(OrderDTO orderDTO) {
|
||||
return orderDTO != null && (orderDTO.getCustomerName() != null || mapAddressFromOrder(orderDTO));
|
||||
}
|
||||
|
||||
@Condition
|
||||
@SourceParameterCondition
|
||||
@Named("mapAddressFromOrder")
|
||||
public boolean mapAddressFromOrder(OrderDTO orderDTO) {
|
||||
return orderDTO != null && (orderDTO.getLine1() != null || orderDTO.getLine2() != null);
|
||||
|
||||
@ -70,7 +70,7 @@ public class Converter {
|
||||
if (ObjectUtils.isNull(targetType)) {
|
||||
throw new ConvertException("targetType cannot be null");
|
||||
}
|
||||
Class<?> sourceType = sourceList.getFirst().getClass();
|
||||
Class<?> sourceType = sourceList.get(0).getClass();
|
||||
BaseMapper<S, T> mapper = (BaseMapper<S, T>) converterFactory.getMapper(sourceType, targetType);
|
||||
if (ObjectUtils.isNull(mapper)) {
|
||||
throw new ConvertException("cannot find converter from " + sourceType.getSimpleName() + " to " + targetType.getSimpleName());
|
||||
@ -116,7 +116,7 @@ public class Converter {
|
||||
if (ObjectUtils.isNull(targetType)) {
|
||||
throw new ConvertException("targetType cannot be null");
|
||||
}
|
||||
Class<?> sourceType = sourceList.getFirst().getClass();
|
||||
Class<?> sourceType = sourceList.get(0).getClass();
|
||||
BaseCycleAvoidingMapper<S, T> mapper = (BaseCycleAvoidingMapper<S, T>) converterFactory.getCycleAvoidingMapper(sourceType, targetType);
|
||||
if (ObjectUtils.isNull(mapper)) {
|
||||
throw new ConvertException("cannot find converter from " + sourceType.getSimpleName() + " to " + targetType.getSimpleName());
|
||||
|
||||
4
pom.xml
4
pom.xml
@ -18,11 +18,11 @@
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<mapstruct-plus.version>1.4.8</mapstruct-plus.version>
|
||||
<mapstruct-plus.version>1.5.0</mapstruct-plus.version>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<mapstruct.version>1.5.5.Final</mapstruct.version>
|
||||
<mapstruct.version>1.6.3</mapstruct.version>
|
||||
<gem.version>1.0.0.Alpha3</gem.version>
|
||||
<hutool.version>5.8.26</hutool.version>
|
||||
<projectUrl>https://github.com/linpeilie/mapstruct-plus.git</projectUrl>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user