hospital-applets-api/app/Model/DiseaseClassDetection.php

81 lines
2.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $id 主键id
* @property int $detection_project_id 检测项目id
* @property string $name 疾病分类名称
* @property int $status 状态1:正常 2:删除)
* @property int $enable 是否启用1:是 2:否)
* @property int $sort 排序值(越小排序越往前)
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class DiseaseClassDetection extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'disease_class_detection';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['id', 'detection_project_id', 'name', 'status', 'enable', 'sort', 'created_at', 'updated_at'];
protected string $primaryKey = "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);
}
/**
* 新增-批量
* @param array $data 新增数据
* @return \Hyperf\Database\Model\Model|DiseaseClassDetection
*/
public static function addDiseaseClassDetection(array $data): \Hyperf\Database\Model\Model|DiseaseClassDetection
{
return self::create($data);
}
/**
* 修改-批量
* @param array $params
* @param array $data
* @return int
*/
public static function editDiseaseClassDetection(array $params = [], array $data = []): int
{
return self::where($params)->update($data);
}
}