【发布时间】:2021-08-18 08:36:47
【问题描述】:
我创建了几个 DTO 和一个 MapStruct 接口来获取用户数据:
public class UserDto {
private Long id;
private CountryDto country;
}
public class CountryDto {
private Long id;
private String name;
private List<TimeZoneDto> timeZones = new ArrayList<TimeZoneDto>();
}
@Mapper
public interface UserMapper {
UserMapper INSTANCE = Mappers.getMapper(UserMapper.class);
// TODO exclude country timezones
UserDto mapToDto(User entity);
}
我想修改 UserMapper 以便排除 CountryDto 时区列表
{
"id":1,
"country": {
"id": 182,
"name":"Australia"
}
}
【问题讨论】:
标签: java spring-boot dto mapstruct