MP的子列表查询怎么实现的?没看见老师给例子
场景
订单表,订单详情表
Controller 查询订单,订单信息里包含购买商品信息
@Data
public class OrderMaster {
@TableId(type = IdType.AUTO)
private Integer orderId;
private String buyerName;
private String buyerPhone;
private String buyerAddress;
private String buyerOpenid;
private BigDecimal orderAmount;
private Integer orderStatus = OrderStatusEnum.NEW.getCode();
private Integer payStatus = PayStatusEnum.WAIT.getCode();
@TableField( fill = FieldFill.INSERT)// 新增执行
private Date createTime;
@TableField(fill = FieldFill.INSERT_UPDATE) // 新增和更新执行
private Date updateTime;
private transient List<OrderDetail> orderDetailList;
}@Data
public class OrderDetail {
@TableId(type = IdType.AUTO)
private Integer detailId;
private Integer orderId;
private Integer productId;
private String productName;
private BigDecimal productPrice;
private Integer productQuantity;
private String productIcon;
@TableField( fill = FieldFill.INSERT)// 新增执行
private Date createTime;
@TableField(fill = FieldFill.INSERT_UPDATE) // 新增和更新执行
private Date updateTime;
}查询的时候MP 不能自动处理么?
百度搜到的都是mybatis的处理方法,不知道MP有没有更优雅的方式?