后端 + 前端:尝试引入 lombok ,解决和 mapstruct 集成的问题

This commit is contained in:
YunaiV
2019-04-06 01:41:53 +08:00
parent 5c8828c2ec
commit 394faf12de
12 changed files with 122 additions and 243 deletions

View File

@@ -11,6 +11,11 @@
<artifactId>promotion-service-api</artifactId>
<properties>
<org.mapstruct.version>1.3.0.Final</org.mapstruct.version>
<org.projectlombok.version>1.16.14</org.projectlombok.version>
</properties>
<dependencies>
<dependency>
<groupId>javax.validation</groupId>
@@ -22,6 +27,51 @@
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId> <!-- use mapstruct-jdk8 for Java 8 or higher -->
<version>${org.mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId>
<version>${org.mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${org.projectlombok.version}</version>
</dependency>
</dependencies>
</project>
<build>
<plugins>
<!-- 提供给 mapstruct 使用 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source> <!-- or higher, depending on your project -->
<target>1.8</target> <!-- or higher, depending on your project -->
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${org.projectlombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,10 +1,15 @@
package cn.iocoder.mall.promotion.api.bo;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* Banner BO
*/
@Data
@Accessors(chain = true)
public class BannerBO {
/**
@@ -40,75 +45,4 @@ public class BannerBO {
*/
private Date createTime;
public Integer getId() {
return id;
}
public BannerBO setId(Integer id) {
this.id = id;
return this;
}
public String getTitle() {
return title;
}
public BannerBO setTitle(String title) {
this.title = title;
return this;
}
public String getUrl() {
return url;
}
public BannerBO setUrl(String url) {
this.url = url;
return this;
}
public Integer getSort() {
return sort;
}
public BannerBO setSort(Integer sort) {
this.sort = sort;
return this;
}
public Integer getStatus() {
return status;
}
public BannerBO setStatus(Integer status) {
this.status = status;
return this;
}
public String getMemo() {
return memo;
}
public BannerBO setMemo(String memo) {
this.memo = memo;
return this;
}
public Date getCreateTime() {
return createTime;
}
public BannerBO setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public String getPicUrl() {
return picUrl;
}
public BannerBO setPicUrl(String picUrl) {
this.picUrl = picUrl;
return this;
}
}
}