diff --git a/app/adminapi/lists/dept/OrgsLists.php b/app/adminapi/lists/dept/OrgsLists.php index aef7d4565..fac0a9cd8 100644 --- a/app/adminapi/lists/dept/OrgsLists.php +++ b/app/adminapi/lists/dept/OrgsLists.php @@ -11,68 +11,70 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\lists\dept; - - -use app\adminapi\lists\BaseAdminDataLists; -use app\common\model\dept\Orgs; -use app\common\lists\ListsSearchInterface; - - -/** - * Orgs列表 - * Class OrgsLists - * @package app\adminapi\lists - */ -class OrgsLists extends BaseAdminDataLists implements ListsSearchInterface -{ - - - /** - * @notes 设置搜索条件 - * @return \string[][] - * @author likeadmin - * @date 2023/12/09 10:55 - */ - public function setSearch(): array - { - return [ - '=' => ['status'], - '%like%' => ['name', 'master'], - ]; - } - - - /** - * @notes 获取列表 - * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - * @author likeadmin - * @date 2023/12/09 10:55 - */ - public function lists(): array - { - return Orgs::where($this->searchWhere) - ->field(['id', 'name', 'master', 'status','create_time']) - ->limit($this->limitOffset, $this->limitLength) - ->order(['id' => 'desc']) - ->select() - ->toArray(); - } - - - /** - * @notes 获取数量 - * @return int - * @author likeadmin - * @date 2023/12/09 10:55 - */ - public function count(): int - { - return Orgs::where($this->searchWhere)->count(); - } - -} \ No newline at end of file + + namespace app\adminapi\lists\dept; + + + use app\adminapi\lists\BaseAdminDataLists; + use app\common\lists\ListsSearchInterface; + use app\common\model\dept\Orgs; + + + /** + * Orgs列表 + * Class OrgsLists + * @package app\adminapi\lists + */ + class OrgsLists extends BaseAdminDataLists implements ListsSearchInterface + { + + + /** + * @notes 设置搜索条件 + * @return \string[][] + * @author likeadmin + * @date 2023/12/09 10:55 + */ + public function setSearch(): array + { + return [ + '=' => ['status'], + '%like%' => ['name', 'master'], + ]; + } + + + /** + * @notes 获取列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author likeadmin + * @date 2023/12/09 10:55 + */ + public function lists(): array + { + return Orgs::where($this->searchWhere) + ->field(['id', 'name', 'master', 'status', 'create_time']) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select()->each(function ($data) { + $data['status_text'] = $data->status_text; + }) + ->toArray(); + } + + + /** + * @notes 获取数量 + * @return int + * @author likeadmin + * @date 2023/12/09 10:55 + */ + public function count(): int + { + return Orgs::where($this->searchWhere)->count(); + } + + } \ No newline at end of file