需求背景:有一个业务对象,数据库里存的是分号隔开的String,在返回给前台时需要转换成List
dao类TNotice中
@ApiModelProperty(value = "附件地址,以分号隔开")
private String attachments;
vo类NoticeVo中
@ApiModelProperty(value = "附件地址列表")
private List attachmentList;
mapStruct类中的写法
@Mapper(componentModel = "spring")
public interface NoticeExchange {
@Mappings({
@Mapping(source = "attachments", target = "attachmentList"),
@Mapping(source = "types", target = "typeList")
})
NoticeVo dao2Vo(TNotice dao);
@Mappings({
@Mapping(source &#