64 lines
1.7 KiB
PHP
64 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Model;
|
|
|
|
|
|
|
|
use Hyperf\Database\Model\Collection;
|
|
use Hyperf\Snowflake\Concern\Snowflake;
|
|
|
|
/**
|
|
* @property int $inquiry_time_id 主键id
|
|
* @property int $system_inquiry_config_id 系统配置主键id
|
|
* @property string $start_time 开始时间
|
|
* @property string $end_time 结束时间
|
|
* @property string $time_interval 时段(上午、中午、下午、夜间、全天)
|
|
* @property \Carbon\Carbon $created_at 创建时间
|
|
* @property \Carbon\Carbon $updated_at 修改时间
|
|
*/
|
|
class SystemInquiryTime extends Model
|
|
{
|
|
use Snowflake;
|
|
|
|
/**
|
|
* The table associated with the model.
|
|
*/
|
|
protected ?string $table = 'system_inquiry_time';
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*/
|
|
protected array $fillable = ['inquiry_time_id', 'system_inquiry_config_id', 'start_time', 'end_time', 'time_interval', 'created_at', 'updated_at'];
|
|
|
|
/**
|
|
* The attributes that should be cast to native types.
|
|
*/
|
|
protected array $casts = ['inquiry_time_id' => 'integer', 'system_inquiry_config_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
|
|
|
protected string $primaryKey = "inquiry_time_id";
|
|
|
|
/**
|
|
* 获取信息-单条
|
|
* @param array $params
|
|
* @param array $fields
|
|
* @return object|null
|
|
*/
|
|
public static function getOne(array $params, array $fields = ['*']): object|null
|
|
{
|
|
return self::where($params)->first($fields);
|
|
}
|
|
|
|
/**
|
|
* 获取数据-多
|
|
* @param array $params
|
|
* @param array $fields
|
|
* @return Collection|array
|
|
*/
|
|
public static function getList(array $params = [], array $fields = ['*']): Collection|array
|
|
{
|
|
return self::where($params)->get($fields);
|
|
}
|
|
}
|