['mw.sn', 'mw.real_name', 'mw.account', 'mw.password', 'mw.mobile', 'mw.sex', 'mw.channel', 'mw.is_disable', 'mw.is_new_user', 'mw.create_time', 'mw.update_time'], ]; } public function queryWhere(){ $where = []; // 用户昵称 if (isset($this->params['nickname']) && !empty($this->params['nickname'])) { $where[] = ['mw.nickname|mw.worker_number', 'like','%' .$this->params['nickname'] . '%']; } if (isset($this->params['worker_number']) && !empty($this->params['worker_number'])) { $where[] = ['mw.worker_number', 'like','%' .$this->params['worker_number'] . '%']; } if (isset($this->params['worker_exp_type']) && !empty($this->params['worker_exp_type'])) { $where[] = ['mwr.maintain_exp_type', '=', $this->params['worker_exp_type']]; } if(isset($this->params['min_work_number']) && is_numeric($this->params['min_work_number'])){ $where[] =[ 'work_total','>=',$this->params['min_work_number']]; } if(isset($this->params['max_work_number']) && is_numeric($this->params['max_work_number'])){ $where[] =[ 'work_total','work_total <= ',$this->params['max_work_number']]; } return $where; } /** * @notes 获取列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/07/10 18:17 */ public function lists(): array { return MasterWorker::alias('mw') ->join('master_worker_register mwr', 'mwr.worker_id = mw.id') ->where($this->searchWhere) ->where($this->queryWhere()) ->field([ 'mw.*', 'mwr.maintain_exp_type', 'mwr.other_exp_type', ]) ->limit($this->limitOffset, $this->limitLength) ->order(['mw.id' => 'desc']) ->select() ->toArray(); } /** * @notes 获取数量 * @return int * @author likeadmin * @date 2024/07/10 18:17 */ public function count(): int { return MasterWorker::alias('mw') ->join('master_worker_register mwr', 'mwr.worker_id = mw.id') ->field([ 'mw.*']) ->where($this->searchWhere)->where($this->queryWhere()) ->count(); } }