后端 + 前端:尝试引入 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

@ -13,6 +13,7 @@
<properties>
<org.mapstruct.version>1.3.0.Final</org.mapstruct.version>
<org.projectlombok.version>1.16.14</org.projectlombok.version>
</properties>
<dependencies>
@ -103,6 +104,17 @@
<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>
@ -112,7 +124,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<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 -->
@ -122,6 +134,11 @@
<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>

View File

@ -2,10 +2,14 @@ package cn.iocoder.mall.promotion.application.vo.admins;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
@ApiModel("Banner VO")
@Data
@Accessors(chain = true)
public class AdminsBannerVO {
@ApiModelProperty(value = "Banner 编号", required = true, example = "1")
@ -25,75 +29,4 @@ public class AdminsBannerVO {
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
private Date createTime;
public Integer getId() {
return id;
}
public AdminsBannerVO setId(Integer id) {
this.id = id;
return this;
}
public String getTitle() {
return title;
}
public AdminsBannerVO setTitle(String title) {
this.title = title;
return this;
}
public String getUrl() {
return url;
}
public AdminsBannerVO setUrl(String url) {
this.url = url;
return this;
}
public Integer getSort() {
return sort;
}
public AdminsBannerVO setSort(Integer sort) {
this.sort = sort;
return this;
}
public Integer getStatus() {
return status;
}
public AdminsBannerVO setStatus(Integer status) {
this.status = status;
return this;
}
public String getMemo() {
return memo;
}
public AdminsBannerVO setMemo(String memo) {
this.memo = memo;
return this;
}
public Date getCreateTime() {
return createTime;
}
public AdminsBannerVO setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public String getPicUrl() {
return picUrl;
}
public AdminsBannerVO setPicUrl(String picUrl) {
this.picUrl = picUrl;
return this;
}
}

View File

@ -2,8 +2,12 @@ package cn.iocoder.mall.promotion.application.vo.users;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
@ApiModel("Banner VO")
@Data
@Accessors(chain = true)
public class UsersBannerVO {
@ApiModelProperty(value = "跳转链接", required = true, example = "http://www.baidu.com")
@ -11,22 +15,4 @@ public class UsersBannerVO {
@ApiModelProperty(value = "图片链接", required = true, example = "http://www.iocoder.cn/01.jpg")
private String picUrl;
public String getUrl() {
return url;
}
public UsersBannerVO setUrl(String url) {
this.url = url;
return this;
}
public String getPicUrl() {
return picUrl;
}
public UsersBannerVO setPicUrl(String picUrl) {
this.picUrl = picUrl;
return this;
}
}

View File

@ -12,8 +12,8 @@ import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2019-04-05T22:26:04+0800",
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 11.0.1 (Oracle Corporation)"
date = "2019-04-06T01:40:13+0800",
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
)
public class BannerConvertImpl implements BannerConvert {
@ -28,11 +28,11 @@ public class BannerConvertImpl implements BannerConvert {
adminsBannerVO.setId( bannerBO.getId() );
adminsBannerVO.setTitle( bannerBO.getTitle() );
adminsBannerVO.setUrl( bannerBO.getUrl() );
adminsBannerVO.setPicUrl( bannerBO.getPicUrl() );
adminsBannerVO.setSort( bannerBO.getSort() );
adminsBannerVO.setStatus( bannerBO.getStatus() );
adminsBannerVO.setMemo( bannerBO.getMemo() );
adminsBannerVO.setCreateTime( bannerBO.getCreateTime() );
adminsBannerVO.setPicUrl( bannerBO.getPicUrl() );
return adminsBannerVO;
}

View File

@ -11,8 +11,8 @@ import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2019-04-05T22:26:04+0800",
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 11.0.1 (Oracle Corporation)"
date = "2019-04-06T01:40:13+0800",
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
)
public class CouponTemplateConvertImpl implements CouponTemplateConvert {

View File

@ -13,8 +13,8 @@ import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2019-04-05T22:26:04+0800",
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 11.0.1 (Oracle Corporation)"
date = "2019-04-06T01:40:13+0800",
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
)
public class ProductRecommendConvertImpl implements ProductRecommendConvert {

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>
<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;
}
}

View File

@ -14,6 +14,7 @@
<properties>
<org.mapstruct.version>1.3.0.Final</org.mapstruct.version>
<org.projectlombok.version>1.16.14</org.projectlombok.version>
</properties>
<dependencies>
@ -53,11 +54,23 @@
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<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>
<dependency>
<groupId>com.google.guava</groupId>
@ -103,7 +116,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<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 -->
@ -113,6 +126,11 @@
<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>

View File

@ -1,10 +1,14 @@
package cn.iocoder.mall.promotion.biz.dataobject;
import cn.iocoder.common.framework.dataobject.DeletableDO;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* Banner 广告页
*/
@Data
@Accessors(chain = true)
public class BannerDO extends DeletableDO {
/**
@ -40,67 +44,4 @@ public class BannerDO extends DeletableDO {
// TODO 芋艿 点击次数&& 其他数据相关
public Integer getId() {
return id;
}
public BannerDO setId(Integer id) {
this.id = id;
return this;
}
public String getTitle() {
return title;
}
public BannerDO setTitle(String title) {
this.title = title;
return this;
}
public String getUrl() {
return url;
}
public BannerDO setUrl(String url) {
this.url = url;
return this;
}
public Integer getStatus() {
return status;
}
public BannerDO setStatus(Integer status) {
this.status = status;
return this;
}
public String getMemo() {
return memo;
}
public BannerDO setMemo(String memo) {
this.memo = memo;
return this;
}
public Integer getSort() {
return sort;
}
public BannerDO setSort(Integer sort) {
this.sort = sort;
return this;
}
public String getPicUrl() {
return picUrl;
}
public BannerDO setPicUrl(String picUrl) {
this.picUrl = picUrl;
return this;
}
}

View File

@ -12,8 +12,8 @@ import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2019-04-06T00:20:10+0800",
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 11.0.1 (Oracle Corporation)"
date = "2019-04-06T01:40:11+0800",
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
)
public class CouponTemplateConvertImpl implements CouponTemplateConvert {

View File

@ -10,8 +10,8 @@ import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2019-04-06T00:20:10+0800",
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 11.0.1 (Oracle Corporation)"
date = "2019-04-06T01:40:11+0800",
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
)
public class ProductRecommendConvertImpl implements ProductRecommendConvert {