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

2021-01-06  本文已影响0人  Djbfifjd

一、数据转换图例

二、源实体类

@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);
    }
}
上一篇 下一篇

猜你喜欢

热点阅读