[alibaba/easyexcel]对于POJO对象中有List, 一对多,或者一对多对多的情况的导入导出

2024-05-21 757 views
9

类似BOM,能够自动合并单元格,后面跟上详情信息。大佬们有没有什么办法

回答

3

我想知道你这样导入导出的excel 是啥样子的。这么的变态吗

4

你说“后面跟上详情信息”,请给出信息信息。请以附件的形式上传问题的所有代码和其他相关信息,例如错误提示、屏幕截图、Demo、测试用例、整个项目的代码,等等,以帮助你分析此问题。我的手机号13410280841,我的微信号是liufuchun254796643,你可以拨打我的手机和我讨论,或者加我的微信和我讨论,这样会比较快、比较方便解决这个问题,谢谢!

0

现在采用的办法是用esay-poi的解决方式 例如BOM对象

public class BomExcelDTO{

    @Excel(name = "ID", needMerge = true)
    private Integer id;
    @Excel(name = "BOM代码", needMerge = true)
    private String number;
    @Excel(name = "BOM名字", needMerge = true)
    private String name;

    @ExcelCollection(name = "BOM-Info详情")
    private List<BomInfoExcelDTO>  bomInfoList;

}
@ExcelTarget("BomInfoExcelDTO")
public class BomInfoExcelDTO {
    @Excel(name = "BomInfo-ID")
    private Integer id;
    @Excel(name = "关联的BOM_ID")
    private Integer bomId;

    @Excel(name = "关联的BOM_代码")
    private String bomNumber;

    @Excel(name = "物料ID")
    private Integer materialId;
    @Excel(name = "物料代码")
    private String materialNumber;
    @Excel(name = "物料名称")
    private String materialName;
}

项目需求导入导出的时候List ,现版本的easy-excel对于 一对多的导入导出的支持不太够。 最终的呈现为 image

7

我想知道你这样导入导出的excel 是啥样子的。这么的变态吗

这种是正常需求啊。订单和订单商品那种的结构

0

这个问题我之前也有问到过,作者的回复是暂不支持,后续可能会考虑