我在底部添加了数据库结构
我正在为招聘机构制定排名系统。我在不同的表格中捕获所有申请人的详细信息,并通过比较候选人的数据对他们进行排名(如果它们符合某个招聘广告的需求/要求)在数据库中到 job_advert 表中的作业。然后显示 10 名最佳排名(合格)候选人的列表,他们将收到一份通知,表明他们有资格获得该职位。
我从数据库中获取候选人数据,如下所示:
class ranking_model extends CI_Model {
function __construct() {
parent::__construct();
}
function age() {
$sql = "SELECT * FROM membership";
$query = $this->db->query($sql)->result();
foreach ($query as $row) {
$id = $row->id_number;
$dobs = substr($id, 0, 6);
$dob = str_split($dobs, 2);
$day = date('d', mktime(0, 0, 0, 0, $dob[2], 0));
$month = date('m', mktime(0, 0, 0, $dob[1] + 1, 0, 0));
$year = date('o', mktime(0, 0, 0, 0, 0, $dob[0] + 1));
$date = "$day/$month/$year";
//explode the date to get month, day and year
$date = explode("/", $date);
//get age from date or birthdate
$age = (date("md", date("U", mktime(0, 0, 0, $date[0], $date[1], $date[2]))) > date("md") ? ((date("Y") - $date[2]) - 1) : (date("Y") - $date[2]));
}
return $age;
}
function job_experience() {
$sql = "SELECT * FROM job_list
JOIN job_history
ON job_list.job_history_id = job_history.job_history_id";
$query = $this->db->query($sql)->result();
foreach ($query as $row) {
$start = $row->start_date;
$end = $row->end_date;
// //explode the date to get month, day and year
$start = explode("-", $start);
$end = explode("-", $end);
// //get age from date or birthdate
$exp_in_years = (date("md", date("U", mktime(0, 0, 0, $start[2], $start[1], $start[0]))) > date("md", mktime(0, 0, 0, $end[2], $end[1], 0)) ? ((date("Y", mktime(0, 0, 0, 0, 0, $end[0])) - $start[0])) : (date("Y", mktime(0, 0, 0, 0, 0, $end[0])) - $start[0]));
}
return $exp_in_years;
}
function location() {
$sql = "SELECT * FROM personal";
$query = $this->db->query($sql)->result();
foreach ($query as $row) {
$city = $row->city;
}
return $city;
}
function relocate() {
$sql = "SELECT * FROM personal";
$query = $this->db->query($sql)->result();
foreach ($query as $row) {
$relocate = $row->relocate; //are you willing to relocate yes/no
}
return $relocate;
}
function get_personal() {
$this->db->select('*');
$this->db->from('membership');
$this->db->join('personal', 'membership.id_number = personal.id_number');
$query = $this->db->get()->result();
foreach ($query as $row) {
$row->id_number;
$row->firstname;
}
return $query;
}
和这样的广告细节:
function get_advert() {
$sql = "SELECT * FROM job_advert";
$query = $this->db->query($sql)->result();
foreach ($query as $row) {
$job_id = $row->job_id;
$job_title = $row->job_title;
$salary_offered = $row->salary_offered;
$is_negotiable = $row->negotiable;
$company_location = $row->company_location;
$experience = $row->required_experience;
$age = $row->age;
}
}
}
现在我不知道如何将候选人数据与我从 job_adverts 表中获得的数据进行比较。我真的不知道。任何形式的帮助将不胜感激。
数据库结构
粗体PK斜体是FK。
会员资格(id_number
,名字,姓氏,用户名,电子邮件,电话,密码,角色,Reg_time,已激活);
个人(person_id
,地址,城市,执照,,id_number
性别,搬迁,minimum_salary,prefered_salary,contract_type);
job_list( job_list_id
, job_history_id
, start_date, end_date, 收入, company_name, industry_type, reason_for_leaving, job_title);
工作历史(job_history_id
,id_number
);
job_advert(advert_id
,job_title,job_description,start_date,end_date,salary_offered,可协商,福利,company_location,required_experience,年龄);
我在数据库中有更多表,但这些是我用于排名的表。