61 lines
1.6 KiB
PHP
61 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Model;
|
|
|
|
|
|
|
|
use Hyperf\Snowflake\Concern\Snowflake;
|
|
|
|
/**
|
|
* @property int $expertise_id 主键id
|
|
* @property string $expertise_name 专长名称
|
|
* @property int $expertise_sort 排序(越大排序越靠前)
|
|
* @property \Carbon\Carbon $created_at 创建时间
|
|
* @property \Carbon\Carbon $updated_at 修改时间
|
|
*/
|
|
class DiseaseClassExpertise extends Model
|
|
{
|
|
use Snowflake;
|
|
|
|
/**
|
|
* The table associated with the model.
|
|
*/
|
|
protected ?string $table = 'disease_class_expertise';
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*/
|
|
protected array $fillable = ['expertise_id', 'expertise_name', 'expertise_sort', 'created_at', 'updated_at'];
|
|
|
|
/**
|
|
* The attributes that should be cast to native types.
|
|
*/
|
|
protected array $casts = ['expertise_id' => 'string', 'expertise_sort' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
|
|
|
protected string $primaryKey = "expertise_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 array
|
|
*/
|
|
public static function getOrderList(array $params = [], array $fields = ['*'],): array
|
|
{
|
|
return self::where($params)->orderBy('expertise_sort','desc')->get($fields)->toArray();
|
|
}
|
|
}
|