解决转换后,postContentDto.postId没有赋值的问题。 需要增加一个postContentDto的转换方法,mapstruct并回去使用 PostContentMapper中的定义。
This commit is contained in:
parent
baf2e8df7f
commit
bacb030d3a
@ -1,7 +1,9 @@
|
||||
package com.lk.paopao.mapper;
|
||||
|
||||
import com.lk.paopao.dto.PostContentDto;
|
||||
import com.lk.paopao.entity.Post;
|
||||
import com.lk.paopao.dto.PostDto;
|
||||
import com.lk.paopao.entity.PostContent;
|
||||
import org.mapstruct.*;
|
||||
|
||||
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE, componentModel = MappingConstants.ComponentModel.SPRING)
|
||||
@ -13,4 +15,7 @@ public interface PostMapper {
|
||||
|
||||
@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
|
||||
Post partialUpdate(PostDto postDto, @MappingTarget Post post);
|
||||
|
||||
@Mapping(source = "post.id", target = "postId")
|
||||
PostContentDto toContentDto(PostContent postContent);
|
||||
}
|
Loading…
Reference in New Issue
Block a user