feat:warehouseKeeper

This commit is contained in:
LAPTOP-7SGDREK0\shiweijun
2025-02-11 17:54:00 +08:00
parent 8321940169
commit c96ecc2594
6 changed files with 227 additions and 1 deletions

View File

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