“一对一对一”转换为“一对多对多”

一、数据转换图例

二、源实体类

@Data
public class SourceDO implements Serializable {
    private String firTitle;
    private Long secTitle;
    private String thiTitle;
}

三、目标实体类父类

@Data
public class TargetDTO implements Serializable {
    private String firTitle;
    private List<TargetSonDTO> secTitleList;
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TargetDTO tcdto = (TargetDTO) o;
        return Objects.equals(firTitle, tcdto.firTitle);
    }
}
还有 85% 的精彩内容
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
支付 ¥200.00 继续阅读

推荐阅读更多精彩内容