sortField; } public function getSortOrder(): string { return in_array(strtolower($this->sortOrder ?? ''), ['asc', 'desc']) ? strtolower($this->sortOrder) : 'desc'; } public function getOrder(): ?string { return $this->order; } /** * 获取排序字符串 (用于数据库查询) */ public function getOrderBy(): string { if (!empty($this->order)) { return $this->order; } if (!empty($this->sortField)) { return $this->sortField . ' ' . $this->getSortOrder(); } return 'id desc'; } }