hasOne('Company', 'id', 'company_id',[],'LEFT'); } /** * 获取员工列表 * @param $params * @return array|bool|\PDOStatement|string|\think\Collection */ public static function getStaffList($params=[]) { $companyId = isset($params['company_id']) ? $params['company_id'] : 0; $type = isset($params['type']) ? $params['type'] : 0; $company = []; if (!empty($companyId)) { $field = 'id,truename,mobile'; !empty($type) && $where['type'] = $type; $where['company_id'] = $companyId; $company = self::field($field)->where($where)->select(); } return $company; } }