mirror of
https://gitee.com/easii/mapstruct-plus.git
synced 2025-12-06 17:18:43 +08:00
commit
1d49188524
@ -188,7 +188,7 @@ public class User {
|
||||
|
||||
```xml
|
||||
<properties>
|
||||
<mapstruct-plus.version>1.4.4</mapstruct-plus.version>
|
||||
<mapstruct-plus.version>1.4.5</mapstruct-plus.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
export const links = [
|
||||
{ logo: 'https://plus-doc.dromara.org/static/image/logo.png', title: 'RuoYi-Vue-Plus 多租户权限管理系统', desc: '真正面向企业级的应用框架\n组件化 模块化 轻耦合 高扩展 针对企业痛点 业界一流技术栈', link: 'https://plus-doc.dromara.org/#/' },
|
||||
{ logo: 'https://demo.orangeforms.com/img/login_logo2.424461a3.png', title: '橙单 —— 最纯粹的代码生成工具', desc: '80% 代码「免费」生成,全部源码交付,永久免费升级', link: 'https://www.orangeforms.com/' }
|
||||
{ logo: 'https://demo.orangeforms.com/img/login_logo2.424461a3.png', title: '免费代码生成工具', desc: '卓越的代码生成能力,全优的代码生成质量', link: 'https://www.orangeforms.com/' }
|
||||
]
|
||||
@ -61,18 +61,22 @@ footer:
|
||||
<dependency>
|
||||
<groupId>io.github.linpeilie</groupId>
|
||||
<artifactId>mapstruct-plus-spring-boot-starter</artifactId>
|
||||
<version>1.4.4</version>
|
||||
<version>1.4.5</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
- gradle
|
||||
|
||||
```groovy
|
||||
implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-starter', version: '1.4.4'
|
||||
implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-starter', version: '1.4.5'
|
||||
```
|
||||
|
||||
## 更新日志
|
||||
|
||||
### 1.4.5
|
||||
|
||||
- fix: 修复 `ReverseAutoMappings` 配置不生效的问题
|
||||
|
||||
### 1.4.4
|
||||
|
||||
- fix: 修复部分Spring版本下找不到类的问题
|
||||
|
||||
@ -58,18 +58,22 @@ fotter:
|
||||
<dependency>
|
||||
<groupId>io.github.linpeilie</groupId>
|
||||
<artifactId>mapstruct-plus-spring-boot-starter</artifactId>
|
||||
<version>1.4.4</version>
|
||||
<version>1.4.5</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
- gradle
|
||||
|
||||
```groovy
|
||||
implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-starter', version: '1.4.4'
|
||||
implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-starter', version: '1.4.5'
|
||||
```
|
||||
|
||||
## Change Log
|
||||
|
||||
### 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.
|
||||
|
||||
@ -6,6 +6,10 @@ category:
|
||||
description: MapStructPlus release log
|
||||
---
|
||||
|
||||
### 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.
|
||||
|
||||
@ -6,6 +6,10 @@ category:
|
||||
description: MapStructPlus release log
|
||||
---
|
||||
|
||||
### 1.4.5
|
||||
|
||||
- fix: 修复 `ReverseAutoMappings` 配置不生效的问题
|
||||
|
||||
### 1.4.4
|
||||
|
||||
- fix: 修复部分Spring版本下找不到类的问题
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<mapstruct.version>1.5.1.Final</mapstruct.version>
|
||||
<mapstruct-plus.version>1.4.3</mapstruct-plus.version>
|
||||
<mapstruct-plus.version>1.4.5</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>
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
package io.github.linpeilie.me.reverseConvertGenerate;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import io.github.linpeilie.annotations.AutoMapping;
|
||||
import io.github.linpeilie.annotations.ReverseAutoMapping;
|
||||
import io.github.linpeilie.annotations.ReverseAutoMappings;
|
||||
import lombok.Data;
|
||||
|
||||
@AutoMapper(target = PersonVo.class)
|
||||
@Data
|
||||
public class PersonBo {
|
||||
|
||||
@ReverseAutoMappings({
|
||||
@ReverseAutoMapping(source = "name")
|
||||
})
|
||||
private String n;
|
||||
private Integer age;
|
||||
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package io.github.linpeilie.me.reverseConvertGenerate;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PersonVo {
|
||||
|
||||
private String name;
|
||||
private Integer age;
|
||||
|
||||
}
|
||||
@ -919,7 +919,7 @@ public class AutoMapperProcessor extends AbstractProcessor {
|
||||
}
|
||||
ReverseAutoMappingsGem reverseAutoMappingsGem = ReverseAutoMappingsGem.instanceOn(field);
|
||||
if (reverseAutoMappingsGem != null && reverseAutoMappingsGem.isValid()) {
|
||||
reverseAutoMappingsGem.value().get().forEach(a -> buildAutoMappingMetadata(a, field));
|
||||
reverseAutoMappingsGem.value().get().forEach(a -> list.add(buildAutoMappingMetadata(a, field)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -45,11 +45,15 @@ public @interface AutoMapper {
|
||||
|
||||
/**
|
||||
* 生成的 Mapper 接口名称
|
||||
*
|
||||
* @return 生成的 Mapper 接口名称
|
||||
*/
|
||||
String mapperName() default "";
|
||||
|
||||
/**
|
||||
* 生成的 Mapper 接口名称后缀,生成的反向转换接口同时生效
|
||||
*
|
||||
* @return 生成的 Mapper 接口名称后缀
|
||||
*/
|
||||
String mapperNameSuffix() default "";
|
||||
|
||||
|
||||
@ -25,7 +25,9 @@ public @interface AutoMapping {
|
||||
Class<?> targetClass() default DefaultMapping.class;
|
||||
|
||||
/**
|
||||
* 是否生成反向转换的逻辑
|
||||
* 是否生成反向转换的逻辑。
|
||||
*
|
||||
* 该属性只针对复杂转换,且 MapStruct 默认不会自动转换的属性生效,比如多层结构:a.b 转换为当前类的 c
|
||||
*
|
||||
* @return true : 生成反向转换的逻辑 false : 不生成反向转换的逻辑
|
||||
*/
|
||||
@ -46,6 +48,7 @@ public @interface AutoMapping {
|
||||
String numberFormat() default "";
|
||||
|
||||
/**
|
||||
* @return 常量值
|
||||
* @since 1.4.2
|
||||
*/
|
||||
String constant() default "";
|
||||
|
||||
@ -4,8 +4,8 @@ public class ClassUtil {
|
||||
|
||||
/**
|
||||
* 简化类全限定名
|
||||
* @param qualifiedName
|
||||
* @return
|
||||
* @param qualifiedName 类全限定名
|
||||
* @return 类全限定名简化后的名称
|
||||
*/
|
||||
public static String simplifyQualifiedName(String qualifiedName) {
|
||||
String[] arr = qualifiedName.split("\\.");
|
||||
|
||||
2
pom.xml
2
pom.xml
@ -18,7 +18,7 @@
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<mapstruct-plus.version>1.4.4</mapstruct-plus.version>
|
||||
<mapstruct-plus.version>1.4.5</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>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user