mybatis一对多查询返回

mybatis一对多查询返回

  • 定义实体类
  • Mapper.xml文件
  • Mapper.java文件

定义实体类

InventoryVO 和InventoryDetailVO是一对多的关系。

@Data
public class InventoryVO {
    /**收发 1: 收 0:发**/
    private String inOrOut;
    /**发生日期**/
    private String occTime;
    private Long storeId;
    private Long customerId;
    private String customerName;

    /**仓库名称**/
    private String warehouseName;
    /**业务类型**/
    private String accountTypeName;
    /**业务类型**/
    private int accountType;
    /** wms单号**/
    private String wmsBillNo;
    /**货主单号**/
    private String cusBillNo;

    private List listDetails;
}
@Data
public class InventoryDetailVO {
    /** 行号**/
    private Integer lineNo;
    /** 货物编码**/
    private String itemSkuCode;
    /** 货物名称**/
    private String itemName;
    /** 包装数量**/
    private Integer packageCount;
    /** 单位名称**/
    private String unitName;
    private Long skuId;
    private String categoryName;
}

Mapper.xml文件

定义一个resullMap,返回类型是type:InventoryVO


        
        
        
        
        
        
        
        
            
            
            
            
            
            
        
    


Mapper.java文件

List statisticsDetails(WarehouseInventoryLogDTO warehouseInventoryLogDTO);
@Data
public class WarehouseInventoryLogDTO  extends Pager {
    private Long customerId;
    private String skuName;
    private String startTime;
    private String endTime;
    private List skuIdList;
    private Long storeId;
    private Integer type;
}

你可能感兴趣的:(mybatis一对多查询返回)