feat:dish depot

This commit is contained in:
LAPTOP-7SGDREK0\shiweijun
2025-01-14 17:04:48 +08:00
parent 99b95b76e9
commit 6b38a6b732
11 changed files with 523 additions and 0 deletions

59
app/Model/Depot.php Normal file
View File

@@ -0,0 +1,59 @@
<?php
declare(strict_types=1);
namespace App\Model;
use App\Constants\Admin\DepotCode;
use Hyperf\Database\Model\Builder;
use Hyperf\DbConnection\Model\Model;
/**
* @property int $id
* @property string $name
* @property int $city_id
* @property int $kitchen_id
* @property int $is_del
* @property string $create_time
* @property string $update_time
*/
class Depot extends Model
{
/**
* The table associated with the model.
*/
protected ?string $table = 'depot';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = [];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['id' => 'integer', 'city_id' => 'integer', 'kitchen_id' => 'integer', 'is_del' => 'integer'];
const CREATED_AT = 'create_time';
const UPDATED_AT = 'update_time';
/**
* @param int $id
* @return \Hyperf\Database\Model\Model|Builder|null
*/
public function getInfoById(int $id): \Hyperf\Database\Model\Model|Builder|null
{
return $this->where('id',$id)->where('is_del',DepotCode::IS_NO_DEL)->first();
}
/**
* @param string $name
* @param int $kitchen_id
* @return \Hyperf\Database\Model\Model|Builder|null
*/
public function getInfoByName(string $name,int $kitchen_id): \Hyperf\Database\Model\Model|Builder|null
{
return $this->where('name', $name)->where('kitchen_id',$kitchen_id)->where('is_del',DepotCode::IS_NO_DEL)->first();
}
}