jpa querydsl 连表一对多查询

Map sm = jpaQuery.from(qOrder)
        .leftJoin(qProduct)
        .on(qOrder.productId.eq(qProduct.id))
        .select(Projections.bean(OrderViewModel.class,
                  qOrder.code1
                ))
        .transform(GroupBy.groupBy(qOrder.code1).as(Projections.bean(OrderViewModel.class,
                qOrder.code1,
                GroupBy.list(Projections.bean(ProductViewModel.class,
                        qProduct.name
                )).as("productViewModels")
        )));

你可能感兴趣的:(jpa querydsl 连表一对多查询)