From 5d89fc763925b54ee5f8524d310029d318d9a079 Mon Sep 17 00:00:00 2001 From: "choi.jh" Date: Mon, 13 Oct 2025 15:36:04 +0900 Subject: [PATCH] dbmsv3 init...1 --- app/Controllers/Admin/SearchController.php | 12 ++++-------- app/Services/CommonService.php | 13 ++++++------- app/Services/Equipment/ServerService.php | 3 --- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/app/Controllers/Admin/SearchController.php b/app/Controllers/Admin/SearchController.php index 0f7051f..c0f813e 100644 --- a/app/Controllers/Admin/SearchController.php +++ b/app/Controllers/Admin/SearchController.php @@ -56,8 +56,7 @@ class SearchController extends AdminController } return $result; } - - protected function getChildServers(ServiceEntity $entity): array + private function getChildServers(ServiceEntity $entity): array { $servers = []; foreach ($this->getServerService()->getEntities(['serviceinfo_uid' => $entity->getPK()]) as $serverEntity) { @@ -70,8 +69,6 @@ class SearchController extends AdminController } return $servers; } - // - protected function index_process(array $entities = []): array { $keyword = $this->request->getGet('keyword'); // 검색어 @@ -104,14 +101,13 @@ class SearchController extends AdminController // echo $builder->getCompiledSelect(); // exit; $results = $builder->get()->getResultArray(); - // dd($results); + if (!count($results)) { + return []; + } $uids = []; foreach ($results as $result) { $uids[] = "'{$result['serviceinfo_uid']}'"; } - if (!count($uids)) { - return []; - } //서비스별 미납 Count $childServers = []; foreach ($this->getService()->getEntities("uid IN (" . implode(",", $uids) . ")") as $entity) { diff --git a/app/Services/CommonService.php b/app/Services/CommonService.php index 21694c9..97d9658 100644 --- a/app/Services/CommonService.php +++ b/app/Services/CommonService.php @@ -134,6 +134,10 @@ abstract class CommonService $this->setControlDatas('field_optons', $options); } //Entity별로 작업처리시 + final public function getLastQuery(): string + { + return $this->getModel()->getLastQuery(); + } protected function getEntity_process(mixed $entity): mixed { return $entity; @@ -153,7 +157,7 @@ abstract class CommonService $message = sprintf( "\n------%s SQL오류-----
\n%s\n%s\n------------------------------\n", __FUNCTION__, - $this->getModel()->getLastQuery(), + $this->getLastQuery(), $e->getMessage() ); throw new \Exception($message); @@ -176,12 +180,7 @@ abstract class CommonService final public function getEntities(mixed $where = null, array $columns = ['*']): array { try { - $entities = $this->getEntities_process($where, $columns); - $debug = sprintf("debug.%s.%s", str_replace("\\", ".", get_class($this)), __FUNCTION__); - if (env($debug, false)) { - echo $this->getModel()->getLastQuery(); - } - return $entities; + return $this->getEntities_process($where, $columns); } catch (\Exception $e) { $message = sprintf( "\n------%s SQL오류-----
\n%s\n%s\n------------------------------\n", diff --git a/app/Services/Equipment/ServerService.php b/app/Services/Equipment/ServerService.php index bbbb048..3daed01 100644 --- a/app/Services/Equipment/ServerService.php +++ b/app/Services/Equipment/ServerService.php @@ -186,9 +186,6 @@ class ServerService extends EquipmentService implements ServiceInterface case 'serviceinfo_uid': $options = $this->getServiceService()->getEntities(); break; - // case 'ip': - // $options = $this->getIPService()->getEntities(); - // break; default: $options = parent::getFormOption($field, $options); break;