添加一个管理员账号,设置打开一个单位表dept,只能查看status=1字段等于1的数据
在对应的controller中,重写index方法,对登录的ID号进行判断,对指定的登录ID,设置查询字段
public function index() { // 如果不是超级管理员和指定的管理员,就进行查询-获取指定显示的数据 if ($this->auth->id != 1 && $this->auth->id != 57) { $this->model->where('status', '=','1'); } return parent::index(); }