//导入依赖项和lt;& lt; groupId> org.mapstruct< / groupId>& lt; artifactId> mapstruct< / artifactId>& lt; version> 1.2.0.Final< / version>& lt; / dependency>& lt; dependency>& lt; groupId> org.mapstruct< / groupId>& lt; artifactId> mapstruct-processor< / artifactId>& lt; version> 1.2.0.Final< / version>& lt; / dependency>//编写接口类@Mapper公共接口Publish2PublishVO {Publish2PublishVO INSTANCE = mapper . getmapper (Publish2PublishVO.class);centerproductdatpublishvo to centerproductdatpublishvo (centerproductdatpublishvo);} //调用使用centerproductdatappublishvo centerproductdatappublishvo = publish2publishvo . instance . tocenterproductdatappublishvo (centerproductdatpublishvo);
// import dependencies
<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>
//Write the interface class
@Mapper
public interface Publish2PublishVO {
Publish2PublishVO INSTANCE = Mappers.getMapper(Publish2PublishVO.class);
CenterProductDataPublishVO toCenterProductDataPublishVO(CenterProductDataPublish centerProductDataPublish);
}
// call to use
CenterProductDataPublishVO centerProductDataPublishVO = Publish2PublishVO.INSTANCE.toCenterProductDataPublishVO(centerProductDataPublish);
