
mapStruct中实体中包含list的集合实体,怎么进行转换,实体里边的list转换为空,外层属性转换都是ok的

关注直接在 @Mapper 接口上加一个 list 存储对象类型的转换方法就可以了,示例代码如下。
@Mapper
public interface TrafficEventConverter{
TrafficEventDtoConverter INSTANCE= Mappers.getMapper(TrafficEventDtoConverter.class);
TrafficEventVo convert(TrafficEventDto dto);
// 新增一个转换 list 存储对象类型的方法
EventInfoObjectInfoVo convert(EventInfoObjectInfoDto dto);
}
如果有帮助,请采纳。