You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
2.4 KiB
99 lines
2.4 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\model\physical_test;
|
|
|
|
use core\base\BaseModel;
|
|
use think\model\concern\SoftDelete;
|
|
use think\model\relation\HasMany;
|
|
use think\model\relation\HasOne;
|
|
|
|
use app\model\customer_resources\CustomerResources;
|
|
|
|
use app\model\student\Student;
|
|
|
|
use app\model\personnel\Personnel;
|
|
|
|
/**
|
|
* 体测模型
|
|
* Class PhysicalTest
|
|
* @package app\model\physical_test
|
|
*/
|
|
class PhysicalTest extends BaseModel
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
* 数据表主键
|
|
* @var string
|
|
*/
|
|
protected $pk = 'id';
|
|
|
|
/**
|
|
* 模型名称
|
|
* @var string
|
|
*/
|
|
protected $name = 'physical_test';
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* 搜索器:体测客户姓名
|
|
* @param $value
|
|
* @param $data
|
|
*/
|
|
public function searchResourceIdAttr($query, $value, $data)
|
|
{
|
|
if ($value) {
|
|
$query->where("resource_id", $value);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 搜索器:体测学员姓名
|
|
* @param $value
|
|
* @param $data
|
|
*/
|
|
public function searchStudentIdAttr($query, $value, $data)
|
|
{
|
|
if ($value) {
|
|
$query->where("student_id", $value);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function customerResources(){
|
|
return $this->hasOne(CustomerResources::class, 'id', 'resource_id')->joinType('left')->withField('name,id')->bind(['resource_id_name'=>'name']);
|
|
}
|
|
|
|
//获取学生资源一对一
|
|
public function customerResourcesHasOne(){
|
|
return $this->hasOne(CustomerResources::class, 'id', 'resource_id');
|
|
}
|
|
|
|
|
|
|
|
public function student(){
|
|
return $this->hasOne(Student::class, 'id', 'student_id')->joinType('left')->withField('name,id')->bind(['student_id_name'=>'name']);
|
|
}
|
|
|
|
public function personnel(){
|
|
return $this->hasOne(Personnel::class, 'id', 'coach_id')->joinType('left')->withField('name,id')->bind(['coach_id_name'=>'name']);
|
|
}
|
|
|
|
}
|
|
|