$list = Db::name(‘shop_collection‘)
->alias(‘a‘)
->where($where)
->leftjoin(‘bojie_shop_goods b‘, ‘a.goods_id = b.id‘)
->leftjoin(‘bojie_shop_goods_class c‘, ‘a.class_id = c.id‘)
->leftjoin(‘bojie_shop_goods_order_pay d‘, ‘a.goods_id = d.goods_id‘)
->leftjoin(‘bojie_shop_list e‘, ‘b.shop_id = e.id‘)
->field(‘a.url, b.title, b.img, b.price, c.class_name, count(d.id) count, e.shop_name‘)
->group(‘a.id‘)//有group时被分组,没有时只能查询一条数据
->page($page[‘pageNum‘],$page[‘numPerPage‘])
->order(‘a.id‘, ‘desc‘)
->select();