From a724b4c79fa60639e16393bcfbdd0e001bf4fe5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Wed, 21 May 2025 19:32:53 +0900 Subject: [PATCH] dbms_init...1 --- .../Admin/Equipment/ServerController.php | 48 +++--- app/Database/erp2.vuerd.json | 144 ++++++++++++++---- app/Entities/Equipment/Link/CpuEntity.php | 11 ++ app/Entities/Equipment/Link/DiskEntity.php | 11 ++ app/Entities/Equipment/Link/LinkEntity.php | 22 +++ app/Entities/Equipment/Link/RamEntity.php | 11 ++ app/Entities/Equipment/ServerEntity.php | 4 +- app/Models/Equipment/Link/CpuModel.php | 17 +++ app/Models/Equipment/Link/DiskModel.php | 17 +++ .../LinkModel.php} | 23 +-- app/Models/Equipment/Link/RamModel.php | 17 +++ app/Models/Equipment/Part/DiskModel.php | 2 +- app/Models/Equipment/Part/RamModel.php | 2 +- app/Services/Equipment/Link/CpuService.php | 28 ++++ app/Services/Equipment/Link/DiskService.php | 28 ++++ app/Services/Equipment/Link/LinkService.php | 36 +++++ app/Services/Equipment/Link/RamService.php | 28 ++++ app/Services/Equipment/Part/CpuService.php | 5 + app/Services/Equipment/Part/DiskService.php | 5 + app/Services/Equipment/Part/PartService.php | 12 ++ app/Services/Equipment/Part/RamService.php | 5 + app/Services/Equipment/ServerPartService.php | 46 ------ 22 files changed, 405 insertions(+), 117 deletions(-) create mode 100644 app/Entities/Equipment/Link/CpuEntity.php create mode 100644 app/Entities/Equipment/Link/DiskEntity.php create mode 100644 app/Entities/Equipment/Link/LinkEntity.php create mode 100644 app/Entities/Equipment/Link/RamEntity.php create mode 100644 app/Models/Equipment/Link/CpuModel.php create mode 100644 app/Models/Equipment/Link/DiskModel.php rename app/Models/Equipment/{ServerPartModel.php => Link/LinkModel.php} (52%) create mode 100644 app/Models/Equipment/Link/RamModel.php create mode 100644 app/Services/Equipment/Link/CpuService.php create mode 100644 app/Services/Equipment/Link/DiskService.php create mode 100644 app/Services/Equipment/Link/LinkService.php create mode 100644 app/Services/Equipment/Link/RamService.php delete mode 100644 app/Services/Equipment/ServerPartService.php diff --git a/app/Controllers/Admin/Equipment/ServerController.php b/app/Controllers/Admin/Equipment/ServerController.php index f430564..f545f67 100644 --- a/app/Controllers/Admin/Equipment/ServerController.php +++ b/app/Controllers/Admin/Equipment/ServerController.php @@ -9,13 +9,15 @@ use Psr\Log\LoggerInterface; use App\Helpers\Equipment\ServerHelper; use App\Services\Equipment\ServerService; -use App\Services\Equipment\PartService; -use App\Services\Equipment\ServerPartService; +use App\Services\Equipment\Part\CpuService; +use App\Services\Equipment\Part\RamService; +use App\Services\Equipment\Part\DiskService; class ServerController extends EquipmentController { - private ?PartService $_partService = null; - private ?ServerPartService $_serverPartService = null; + private ?CpuService $_cpuService = null; + private ?RamService $_ramService = null; + private ?DiskService $_diskService = null; public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { parent::initController($request, $response, $logger); @@ -41,31 +43,28 @@ class ServerController extends EquipmentController } return $this->_helper; } - final public function getPartService(): PartService + final public function getCpuService(): CpuService { - if (!$this->_partService) { - $this->_partService = new PartService($this->request); + if (!$this->_cpuService) { + $this->_cpuService = new CpuService($this->request); } - return $this->_partService; + return $this->_cpuService; } - final public function getServerPartService(): ServerPartService + final public function getRamService(): RamService { - if (!$this->_serverPartService) { - $this->_serverPartService = new ServerPartService($this->request); + if (!$this->_ramService) { + $this->_ramService = new RamService($this->request); } - return $this->_serverPartService; + return $this->_ramService; + } + final public function getDiskService(): DiskService + { + if (!$this->_diskService) { + $this->_diskService = new DiskService($this->request); + } + return $this->_diskService; } //Index,FieldForm관련 - private function setPartEntity(ServerEntity $entity): ServerEntity - { - foreach ($this->getServerPartService()->getEntities(['serverinfo_uid' => $entity->getPK()]) as $serverPartEntity) { - $partEntity = $this->getPartService()->getEntity($serverPartEntity->getPartInfoUID()); - if ($partEntity) { - $entity->addPartEntity($partEntity->getType(), $partEntity); - } - } - return $entity; - } protected function index_process(): array { $fields = [ @@ -75,7 +74,10 @@ class ServerController extends EquipmentController $this->modal_type = 'modal_iframe'; $entities = []; foreach (parent::index_process() as $entity) { - $entities[] = $this->setPartEntity($entity); + $entity->setPartEntities("CPU", $this->getCpuService()->getPartEntities($entity)); + $entity->setPartEntities("RAM", $this->getRamService()->getPartEntities($entity)); + $entity->setPartEntities("DISK", $this->getDiskService()->getPartEntities($entity)); + $entities[] = $entity; } return $entities; } diff --git a/app/Database/erp2.vuerd.json b/app/Database/erp2.vuerd.json index 637ccc6..89f777d 100644 --- a/app/Database/erp2.vuerd.json +++ b/app/Database/erp2.vuerd.json @@ -4,9 +4,9 @@ "settings": { "width": 4000, "height": 4000, - "scrollTop": -2704.6009, - "scrollLeft": -1890.4788, - "zoomLevel": 0.79, + "scrollTop": -2409.9338, + "scrollLeft": -1962.0885, + "zoomLevel": 0.94, "show": 511, "database": 4, "databaseName": "", @@ -98,7 +98,7 @@ "tableEntities": { "Jq5Qkun2FzQhCGKANIVOZ": { "id": "Jq5Qkun2FzQhCGKANIVOZ", - "name": "userinfo", + "name": "user", "comment": "관리자정보", "columnIds": [ "mfHtgzc_Aeocr6xkgwYWh", @@ -133,7 +133,7 @@ "color": "" }, "meta": { - "updateAt": 1747808064456, + "updateAt": 1747816360177, "createAt": 1745819764136 } }, @@ -769,6 +769,7 @@ "columnIds": [ "Jh6e_-9QYe1Tqve0PE3kT", "DC7TvFFpBT7vY0UKKHt-W", + "qcYZvSlfu93cigmIRzU_C", "3nwgqrQd_qDGdg6Fe3kEp", "mwVYv9PaJFpoxYvTRJ223" ], @@ -784,6 +785,7 @@ "dr0UoY8ebsS-TjcPyP4is", "GnoGvT4HaG9kp-BvwZ4FQ", "wx8zTFviA4I8YQnn-MFpW", + "qcYZvSlfu93cigmIRzU_C", "3nwgqrQd_qDGdg6Fe3kEp", "mwVYv9PaJFpoxYvTRJ223" ], @@ -796,7 +798,7 @@ "color": "" }, "meta": { - "updateAt": 1747809657264, + "updateAt": 1747816625765, "createAt": 1746783410914 } }, @@ -889,6 +891,7 @@ "zBz4vBOZSIA8vKmfqXckO", "YqInlreLnga0pOXtaP8GF", "ixoWg1kPLrUYL069d75Kq", + "BvHyGw9Xf_gz7bEkZhLbk", "0STHSEXiceoCa6a7jGXV5", "j2hkudsfMKexNL6P7SM8R", "mDU5e29uBK_pIGHPmO6Nv", @@ -900,6 +903,7 @@ "YqInlreLnga0pOXtaP8GF", "VYbvSvXIEQPQtx6GL-tdv", "ixoWg1kPLrUYL069d75Kq", + "BvHyGw9Xf_gz7bEkZhLbk", "0STHSEXiceoCa6a7jGXV5", "j2hkudsfMKexNL6P7SM8R", "lf3Q5NccF2HWpq4GlYVta", @@ -908,15 +912,15 @@ "pzEFysMFfI2J8uB8YHXxA" ], "ui": { - "x": 2210.4386, - "y": 2830.124, + "x": 2204.1096, + "y": 2852.9084, "zIndex": 796, "widthName": 64, "widthComment": 60, "color": "" }, "meta": { - "updateAt": 1747809667091, + "updateAt": 1747817209215, "createAt": 1747374666215 } }, @@ -1024,26 +1028,28 @@ "columnIds": [ "203b3hUKUQ_Gu5wKShBgZ", "kohhWoNuei3x97SzgQUF4", + "SzD5tmOIoZodU1wBH56I4", "EEerVyCwkEAuiRc-gon8s", "uki_QcviBOFJ57v1IbbPX" ], "seqColumnIds": [ "203b3hUKUQ_Gu5wKShBgZ", "kohhWoNuei3x97SzgQUF4", + "SzD5tmOIoZodU1wBH56I4", "EEerVyCwkEAuiRc-gon8s", "uki_QcviBOFJ57v1IbbPX", "5EZEDNUFxzmElbK6goZPK" ], "ui": { "x": 2199.8478, - "y": 2473.3563, + "y": 2482.2169, "zIndex": 1036, "widthName": 60, "widthComment": 60, "color": "" }, "meta": { - "updateAt": 1747809661233, + "updateAt": 1747816633128, "createAt": 1747808112554 } }, @@ -1164,25 +1170,27 @@ "columnIds": [ "WaCB3uNZYFReAPiBqQ97v", "tn-GhYT445kEh1tzf8Lf1", + "FOr_RCEoaL3a0M7smSYRC", "cMe_lKgwfS-LNTHhHIYrk", "ixmBlLhmVt4et6tZEwLPC" ], "seqColumnIds": [ "WaCB3uNZYFReAPiBqQ97v", "tn-GhYT445kEh1tzf8Lf1", + "FOr_RCEoaL3a0M7smSYRC", "cMe_lKgwfS-LNTHhHIYrk", "ixmBlLhmVt4et6tZEwLPC" ], "ui": { - "x": 2198.6283, - "y": 2646.5269, + "x": 2199.8941, + "y": 2665.5139, "zIndex": 1118, "widthName": 60, "widthComment": 60, "color": "" }, "meta": { - "updateAt": 1747809663796, + "updateAt": 1747816638083, "createAt": 1747808548333 } }, @@ -3490,20 +3498,20 @@ "DGl10GI58QwOHwpTu4Z1Y": { "id": "DGl10GI58QwOHwpTu4Z1Y", "tableId": "gsa0XtQZQgrJ8ZXy8VQVg", - "name": "userinfo_uid", + "name": "user_uid", "comment": "", "dataType": "INT", "default": "", "options": 8, "ui": { "keys": 2, - "widthName": 67, + "widthName": 60, "widthComment": 60, "widthDataType": 60, "widthDefault": 60 }, "meta": { - "updateAt": 1745819764142, + "updateAt": 1747816382451, "createAt": 1745819764142 } }, @@ -5983,7 +5991,7 @@ "widthDefault": 60 }, "meta": { - "updateAt": 1747374993341, + "updateAt": 1747817155134, "createAt": 1747374853724 } }, @@ -7706,6 +7714,86 @@ "updateAt": 1747810040937, "createAt": 1747810029959 } + }, + "qcYZvSlfu93cigmIRzU_C": { + "id": "qcYZvSlfu93cigmIRzU_C", + "tableId": "RMhrLs7bOaopKmKt9YKHQ", + "name": "status", + "comment": "", + "dataType": "VARCHAR(20)", + "default": "'use'", + "options": 8, + "ui": { + "keys": 0, + "widthName": 60, + "widthComment": 60, + "widthDataType": 75, + "widthDefault": 60 + }, + "meta": { + "updateAt": 1747816623992, + "createAt": 1747816623991 + } + }, + "SzD5tmOIoZodU1wBH56I4": { + "id": "SzD5tmOIoZodU1wBH56I4", + "tableId": "lwd2DR7f1FW8fXtJ0lX-r", + "name": "status", + "comment": "", + "dataType": "VARCHAR(20)", + "default": "'use'", + "options": 8, + "ui": { + "keys": 0, + "widthName": 60, + "widthComment": 60, + "widthDataType": 75, + "widthDefault": 60 + }, + "meta": { + "updateAt": 1747816631728, + "createAt": 1747816631727 + } + }, + "FOr_RCEoaL3a0M7smSYRC": { + "id": "FOr_RCEoaL3a0M7smSYRC", + "tableId": "dnFyz1CSdGeS6mCbfCMO0", + "name": "status", + "comment": "", + "dataType": "VARCHAR(20)", + "default": "'use'", + "options": 8, + "ui": { + "keys": 0, + "widthName": 60, + "widthComment": 60, + "widthDataType": 75, + "widthDefault": 60 + }, + "meta": { + "updateAt": 1747816636766, + "createAt": 1747816636766 + } + }, + "BvHyGw9Xf_gz7bEkZhLbk": { + "id": "BvHyGw9Xf_gz7bEkZhLbk", + "tableId": "RTq5rHQupiXXJPXqpN8K5", + "name": "accountid", + "comment": "", + "dataType": "VARCHAR(50)", + "default": "", + "options": 0, + "ui": { + "keys": 0, + "widthName": 60, + "widthComment": 60, + "widthDataType": 75, + "widthDefault": 60 + }, + "meta": { + "updateAt": 1747817197659, + "createAt": 1747817172798 + } } }, "relationshipEntities": { @@ -8054,7 +8142,7 @@ "Jh6e_-9QYe1Tqve0PE3kT" ], "x": 2196.9786, - "y": 2370.1577, + "y": 2382.1577, "direction": 1 }, "end": { @@ -8109,8 +8197,8 @@ "columnIds": [ "zBz4vBOZSIA8vKmfqXckO" ], - "x": 2210.4386, - "y": 2954.124, + "x": 2204.1096, + "y": 2988.9084, "direction": 1 }, "end": { @@ -8390,7 +8478,7 @@ "Jh6e_-9QYe1Tqve0PE3kT" ], "x": 2693.9786, - "y": 2370.1577, + "y": 2382.1577, "direction": 2 }, "end": { @@ -8558,7 +8646,7 @@ "203b3hUKUQ_Gu5wKShBgZ" ], "x": 2199.8478, - "y": 2549.3563, + "y": 2570.2169, "direction": 1 }, "end": { @@ -8586,7 +8674,7 @@ "203b3hUKUQ_Gu5wKShBgZ" ], "x": 2696.8478, - "y": 2549.3563, + "y": 2570.2169, "direction": 2 }, "end": { @@ -8641,8 +8729,8 @@ "columnIds": [ "WaCB3uNZYFReAPiBqQ97v" ], - "x": 2695.6283, - "y": 2722.5269, + "x": 2696.8941, + "y": 2753.5139, "direction": 2 }, "end": { @@ -8697,8 +8785,8 @@ "columnIds": [ "WaCB3uNZYFReAPiBqQ97v" ], - "x": 2198.6283, - "y": 2722.5269, + "x": 2199.8941, + "y": 2753.5139, "direction": 1 }, "end": { diff --git a/app/Entities/Equipment/Link/CpuEntity.php b/app/Entities/Equipment/Link/CpuEntity.php new file mode 100644 index 0000000..43c897e --- /dev/null +++ b/app/Entities/Equipment/Link/CpuEntity.php @@ -0,0 +1,11 @@ +attributes['serverinfo_uid']; + } + public function getPartInfoUID(): string + { + return $this->attributes['cpuinfo_uid']; + } +} diff --git a/app/Entities/Equipment/Link/RamEntity.php b/app/Entities/Equipment/Link/RamEntity.php new file mode 100644 index 0000000..bdf9480 --- /dev/null +++ b/app/Entities/Equipment/Link/RamEntity.php @@ -0,0 +1,11 @@ +attributes[$type] ?? []; } - public function addPartEntity(string $type, PartEntity $partEntity): void + public function setPartEntities(string $type, array $partEntities): void { if (!isset($this->attributes[$type])) { $this->attributes[$type] = []; } - $this->attributes[$type][] = $partEntity; + $this->attributes[$type] = $partEntities; // $this->attributes[$type] = array_unique($this->attributes[$type], SORT_REGULAR); } } diff --git a/app/Models/Equipment/Link/CpuModel.php b/app/Models/Equipment/Link/CpuModel.php new file mode 100644 index 0000000..9c7109d --- /dev/null +++ b/app/Models/Equipment/Link/CpuModel.php @@ -0,0 +1,17 @@ +request); + } } diff --git a/app/Services/Equipment/Part/DiskService.php b/app/Services/Equipment/Part/DiskService.php index 6ed79bb..001d9cb 100644 --- a/app/Services/Equipment/Part/DiskService.php +++ b/app/Services/Equipment/Part/DiskService.php @@ -5,6 +5,7 @@ namespace App\Services\Equipment\Part; use App\Entities\Equipment\Part\DiskEntity; use App\Models\Equipment\Part\DiskModel; use CodeIgniter\HTTP\IncomingRequest; +use App\Services\Equipment\Link\DiskService as LinkService; class DiskService extends PartService { @@ -25,4 +26,8 @@ class DiskService extends PartService { return new DiskEntity(); } + protected function getLinkService(): LinkService + { + return new LinkService($this->request); + } } diff --git a/app/Services/Equipment/Part/PartService.php b/app/Services/Equipment/Part/PartService.php index 78410ae..6ce1a30 100644 --- a/app/Services/Equipment/Part/PartService.php +++ b/app/Services/Equipment/Part/PartService.php @@ -3,6 +3,7 @@ namespace App\Services\Equipment\Part; +use App\Entities\Equipment\ServerEntity; use App\Services\Equipment\EquipmentService; use CodeIgniter\HTTP\IncomingRequest; @@ -12,6 +13,8 @@ abstract class PartService extends EquipmentService { parent::__construct($request); } + + abstract protected function getLinkService(): mixed; public function getClassName(): string { return parent::getClassName() . DIRECTORY_SEPARATOR . "Part"; @@ -32,4 +35,13 @@ abstract class PartService extends EquipmentService { return ['status']; } + + final public function getPartEntities(ServerEntity $entity): array + { + $entities = []; + foreach ($this->getLinkService()->getEntities(['serverinfo_uid' => $entity->getPK()]) as $linkEntity) { + $entities[] = $this->getEntity($linkEntity->getPartInfoUID()); + } + return $entities; + } } diff --git a/app/Services/Equipment/Part/RamService.php b/app/Services/Equipment/Part/RamService.php index 31f7034..3752c59 100644 --- a/app/Services/Equipment/Part/RamService.php +++ b/app/Services/Equipment/Part/RamService.php @@ -5,6 +5,7 @@ namespace App\Services\Equipment\Part; use App\Entities\Equipment\Part\RamEntity; use App\Models\Equipment\Part\RamModel; use CodeIgniter\HTTP\IncomingRequest; +use App\Services\Equipment\Link\RamService as LinkService; class RamService extends PartService { @@ -25,4 +26,8 @@ class RamService extends PartService { return new RamEntity(); } + protected function getLinkService(): LinkService + { + return new LinkService($this->request); + } } diff --git a/app/Services/Equipment/ServerPartService.php b/app/Services/Equipment/ServerPartService.php deleted file mode 100644 index 08be0ff..0000000 --- a/app/Services/Equipment/ServerPartService.php +++ /dev/null @@ -1,46 +0,0 @@ -