1.模型中创建关联关系app
public function goods()
{
return $this->belongsTo('app\common\model\goods\Goods', 'goods_id', 'id', [], 'LEFT')->setEagerlyType(0); // 一对一 //多对多hasmoney
}
2.查询的时候能够直接先查出当前表的数据
$collectModel = new Collectgoods();
$check = $collectModel
->where($arr)
->page($page,20)
->select();
//#####重点######