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.
80 lines
2.1 KiB
80 lines
2.1 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\model\service_logs;
|
|
|
|
use core\base\BaseModel;
|
|
use think\model\concern\SoftDelete;
|
|
use think\model\relation\HasMany;
|
|
use think\model\relation\HasOne;
|
|
|
|
use app\model\service\Service;
|
|
use app\model\personnel\Personnel;
|
|
|
|
/**
|
|
* 服务记录模型
|
|
* Class ServiceLogs
|
|
* @package app\model\service_logs
|
|
*/
|
|
class ServiceLogs extends BaseModel
|
|
{
|
|
|
|
/**
|
|
* 数据表主键
|
|
* @var string
|
|
*/
|
|
protected $pk = 'id';
|
|
|
|
/**
|
|
* 模型名称
|
|
* @var string
|
|
*/
|
|
protected $name = 'service_logs';
|
|
|
|
/**
|
|
* 搜索器:服务记录员工ID
|
|
* @param $value
|
|
* @param $data
|
|
*/
|
|
public function searchStaffIdAttr($query, $value, $data)
|
|
{
|
|
if ($value) {
|
|
$query->where("staff_id", $value);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 搜索器:服务记录状态
|
|
* @param $value
|
|
* @param $data
|
|
*/
|
|
public function searchStatusAttr($query, $value, $data)
|
|
{
|
|
if ($value) {
|
|
$query->where("status", $value);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 关联服务表
|
|
*/
|
|
public function service(){
|
|
return $this->hasOne(Service::class, 'id', 'service_id')->joinType('left')->withField('service_name,preview_image_url,description,service_type')->bind(['service_name'=>'service_name', 'preview_image_url'=>'preview_image_url', 'description'=>'description', 'service_type'=>'service_type']);
|
|
}
|
|
|
|
/**
|
|
* 关联员工表
|
|
*/
|
|
public function staff(){
|
|
return $this->hasOne(Personnel::class, 'id', 'staff_id')->joinType('left')->withField('name,id')->bind(['staff_name'=>'name']);
|
|
}
|
|
|
|
}
|
|
|