|
|
@ -40,12 +40,45 @@ class StudentService extends BaseAdminService |
|
|
* @param array $where |
|
|
* @param array $where |
|
|
* @return array |
|
|
* @return array |
|
|
*/ |
|
|
*/ |
|
|
public function getPage(array $where = []) |
|
|
public function getPage(array $data = []) |
|
|
{ |
|
|
{ |
|
|
$field = 'id,user_id,campus_id,class_id,name,gender,age,birthday,member_label,emergency_contact,contact_phone,note,status,created_at,updated_at,deleted_at'; |
|
|
$field = 'id,user_id,campus_id,class_id,name,gender,age,birthday,member_label,emergency_contact,contact_phone,note,status,created_at,updated_at,deleted_at'; |
|
|
$order = 'id desc'; |
|
|
$order = 'id desc'; |
|
|
|
|
|
|
|
|
$search_model = $this->model->withSearch(["campus_id", "name", "emergency_contact", "contact_phone", "created_at", "member_label","class_id"], $where)->with(['customerResources', 'campus', 'classGrade'])->field($field)->order($order); |
|
|
$where = []; |
|
|
|
|
|
if($data['campus_id']){ |
|
|
|
|
|
$where[] = ['campus_id','=',$data['campus_id']]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if($data['name']){ |
|
|
|
|
|
$where[] = ['name','=',$data['name']]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if($data['emergency_contact']){ |
|
|
|
|
|
$where[] = ['emergency_contact','=',$data['emergency_contact']]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if($data['contact_phone']){ |
|
|
|
|
|
$where[] = ['contact_phone','=',$data['contact_phone']]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if($data['class_id']){ |
|
|
|
|
|
$where[] = ['class_id','=',$data['class_id']]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($data['member_label']) { |
|
|
|
|
|
$where[] = ['a.member_label', 'like', "%" . $data['member_label'] . "%"]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$search_model = $this->model->where($where)->with(['customerResources', 'campus', 'classGrade'])->field($field)->order($order); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($data['created_at'][0]) && isset($data['created_at'][1])) { |
|
|
|
|
|
$search_model->whereBetweenTime('created_at', $data['created_at'][0] . "00:00:00", $data['created_at'][1] . "23:59:59"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $this->pageQuery($search_model, function ($item, $key) { |
|
|
return $this->pageQuery($search_model, function ($item, $key) { |
|
|
$item = $this->makeUp($item); |
|
|
$item = $this->makeUp($item); |
|
|
}); |
|
|
}); |
|
|
|