feat(model): 为 StaffUser模型添加 profile 关联

- 在 StaffUser 模型中添加 profile 方法,建立与 XzglProfile 模型的关联
- 使用 hasOne 关系,通过 id 字段进行关联
This commit is contained in:
2025-08-23 15:35:00 +08:00
parent 03a6d01b4c
commit 6e1aff7f09

View File

@@ -6,6 +6,7 @@ use think\admin\Model;
use think\admin\model\SystemUser;
use think\db\Query;
use think\model\relation\HasOne;
use app\xzgl\model\XzglProfile;
class StaffUser extends Model
{
@@ -41,4 +42,9 @@ class StaffUser extends Model
{
return $this->dept ? $this->dept['name'] : '';
}
public function profile(): HasOne
{
return $this->hasOne(XzglProfile::class, 'id', 'id');
}
}