关联查询一对多,可以一个实体有多个对多的属性,sql记录会随着关联增多,但是用了mybatis集合会自动合并


关联查询一对多,可以一个实体有多个对多的属性,sql记录会随着关联增多,但是用了mybatis集合会自动合并

left join是线性扩张还是星型扩张看,表之间的join关系,上述一个实体包含多个对多的属性实体,需用星型关连(后续关联项是一对一即可线性)


   
   
   
   
   
   
   
   
 

 
   
   
   
 

 
   
   
 

 


@Data
@ApiModel(description = "菜单信息根据类别")
@Accessors(chain = true)
public class MenuForNewVO {

    @ApiModelProperty(value = "商品id", required = true, example = "", position = 0)
    private Long id;

    @ApiModelProperty(value = "商品编码", required = true, example = "", position = 0)
    private String productCode;
    @ApiModelProperty(value = "菜单商品显示名称中文", required = true, notes = "如:麦麦脆汁鸡2块", position = 1)
    private String productNameCn;
    @ApiModelProperty(value = "菜单商品显示名称英文", notes = "如:McCrispy Chicken-2pcs", position = 2)
    private String productNameEn;
    @ApiModelProperty(value = "价格组redis存储key", required = true, notes = "redis存储key", example = "", position = 3)
    private String priceGroupInfo;

    @ApiModelProperty(value = "商品图片相对路径redis存储key", required = true, notes = "只有图片名称,图片路径需要前台配置redis存储key", example = "", position = 4)
    private String productImage;

    @ApiModelProperty(value = "菜品类别", required = true, notes = "1:单品 2:套餐 3:产品组", position = 11,allowableValues = "1,2,3")
    private String productType;
    @ApiModelProperty(value = "售卖标识", required = true, notes = "1:可卖,0:不可买,2:隐藏", position = 12,allowableValues = "0,1,2")
    private String saleFlag;
    @ApiModelProperty(value = "商品组的前端交互方式", required = true, notes = "1:单品到详情页;2:产品组到详情页", position = 13,allowableValues = "1,2")
    private String  uiType;
    @ApiModelProperty(value = "商品组对象", required = true, notes = "如果单品中存在特制属性,也需要在产品组对象中有值", example = "", position = 14)
    private List productGroupList;
    private List productTagList;

    private List productPeriodList;

    @JsonIgnore
    private String daypart;
    @JsonIgnore
    private String salesPeriod;
    @JsonIgnore
    private String salesTime;
}

 

关联查询一对多,可以一个实体有多个对多的属性,sql记录会随着关联增多,但是用了mybatis集合会自动合并_第1张图片

 

 

参考:

https://blog.csdn.net/qq87034246/article/details/79878850    

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(关联查询一对多,可以一个实体有多个对多的属性,sql记录会随着关联增多,但是用了mybatis集合会自动合并)