getModel()->where($where)->field($field)->when($page&&$limit,function($query)use($page,$limit){ // $query->page($page,$limit); // })->select(); // } /** * 获取权限菜单列表 * @param array $where * @param array|null $field * @return array|\crmeb\basic\BaseModel[]|\think\Collection * @throws \ReflectionException * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function getMenusRoule(array $where, ?array $field = []) { if (!$field) { $field = ['id', 'title', 'icon', 'pid', 'sort', 'path', 'status']; } return $this->getModel()->where($where)->field($field)->order('sort DESC,id DESC')->failException(false)->select(); } }