This commit is contained in:
@ -40,6 +40,21 @@ class FirstCompanyController extends AbstractController
|
||||
|
||||
$this->firstCompanyRepository->addCompany($data);
|
||||
|
||||
$this->opLogs('[添加公司]' . $data['full_name'] ?? '');
|
||||
|
||||
return $this->apiResponse->success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 公司列表.
|
||||
* @return Response
|
||||
* @throws Exception
|
||||
*/
|
||||
public function companyList(): Response
|
||||
{
|
||||
[$page, $pageSize] = $this->getPage();
|
||||
$params = $this->request->all();
|
||||
$data = $this->firstCompanyRepository->getList($page, $pageSize, $params);
|
||||
return $this->apiResponse->success($data);
|
||||
}
|
||||
}
|
@ -127,4 +127,21 @@ class FirstCompanyRepository extends AbstractRepository
|
||||
}
|
||||
return $company ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取公司列表.
|
||||
* @param int|string $page
|
||||
* @param int|string $pageSize
|
||||
* @param array $params
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getList(int|string $page, int|string $pageSize, array $params = []): array
|
||||
{
|
||||
$fields = $this->dao->getFields();
|
||||
$query = $this->dao->builder()->select($fields);
|
||||
// 构建查询条件
|
||||
$this->dao->buildWhere($query, $params);
|
||||
return $this->dao->paginate($query, compact('page', 'pageSize'));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user