|
|
|
@ -36,6 +36,14 @@ class MaintenanceCategory extends BaseModel |
|
|
|
|
return static::get($categoryId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function catImg(): HasOne |
|
|
|
|
{ |
|
|
|
|
$module = self::getCalledModule(); |
|
|
|
|
return $this->hasOne("app\\{$module}\\model\\UploadFile", 'file_id', 'img_id') |
|
|
|
|
->bind(['img_url' => 'preview_url']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取列表 |
|
|
|
@ -47,7 +55,7 @@ class MaintenanceCategory extends BaseModel |
|
|
|
|
*/ |
|
|
|
|
public function getList(array $where = []): \think\Collection |
|
|
|
|
{ |
|
|
|
|
return $this->where($where) |
|
|
|
|
return $this->where($where)->with(['catImg']) |
|
|
|
|
->order(['sort', $this->getPk()]) |
|
|
|
|
->select(); |
|
|
|
|
} |
|
|
|
|