关联查询
$where = ['a.module_id' => $module_id, 'b.city_id' => $city_id];
if ($title) {
$where['b.name like ?'] = '%' . $title . '%';
}
$model = GoodsModel::notorm()
->alias('a')
->leftJoin('cate', 'b', 'a.cate_id = b.id')
->where($where);
$count = $model->count('a.id');
$list = $model
->page($page, $page_size)
->select('a.id,b.name')
->order('a.sort DESC,a.id DESC')
->fetchAll();