java - mapStruct使用
//引入依赖
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>1.2.0.Final</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.2.0.Final</version>
</dependency>
//编写接口类
@Mapper
public interface Publish2PublishVO {
Publish2PublishVO INSTANCE = Mappers.getMapper(Publish2PublishVO.class);
CenterProductDataPublishVO toCenterProductDataPublishVO(CenterProductDataPublish centerProductDataPublish);
}
//调用使用
CenterProductDataPublishVO centerProductDataPublishVO = Publish2PublishVO.INSTANCE.toCenterProductDataPublishVO(centerProductDataPublish);
版权声明
本文仅代表作者观点,不代表博信信息网立场。