dbmsv2 init...1

This commit is contained in:
choi.jh 2025-08-27 17:54:08 +09:00
parent eb36d74033
commit 058e3c535e
12 changed files with 411 additions and 276 deletions

View File

@ -365,6 +365,11 @@ define('DEFAULT_LIST_PERPAGE', $_ENV['LIST_PERPAGE'] ?? $_SERVER['LIST_PERPAGE']
//신규서비스 Interval //신규서비스 Interval
define('SERVICE_NEW_INTERVAL', $_ENV['SERVICE_NEW_INTERVAL'] ?? $_SERVER['SERVICE_NEW_INTERVAL'] ?? 7); define('SERVICE_NEW_INTERVAL', $_ENV['SERVICE_NEW_INTERVAL'] ?? $_SERVER['SERVICE_NEW_INTERVAL'] ?? 7);
//서버 PartType
define("SERVER", [
"PARTTYPES" => ['CPU', 'RAM', 'DISK', 'OS']
]);
//결제관련 //결제관련
define("PAYMENT", [ define("PAYMENT", [
'BILLING' => [ 'BILLING' => [

View File

@ -2,20 +2,18 @@
namespace App\Controllers\Admin\Equipment; namespace App\Controllers\Admin\Equipment;
use App\Entities\Equipment\IPEntity;
use App\Entities\Equipment\ServerEntity; use App\Entities\Equipment\ServerEntity;
use App\Entities\Equipment\ServerPartEntity; use App\Entities\Equipment\ServerPartEntity;
use App\Helpers\Equipment\ServerHelper; use App\Helpers\Equipment\ServerHelper;
use App\Services\Equipment\ServerPartService;
use App\Services\Equipment\ServerService; use App\Services\Equipment\ServerService;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
class ServerController extends EquipmentController class ServerController extends EquipmentController
{ {
private ?ServerPartService $_serverPartService = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{ {
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
@ -41,13 +39,6 @@ class ServerController extends EquipmentController
} }
return $this->_helper; return $this->_helper;
} }
final public function getServerPartService(): ServerPartService
{
if (!$this->_serverPartService) {
$this->_serverPartService = new ServerPartService();
}
return $this->_serverPartService;
}
//Index,FieldForm관련 //Index,FieldForm관련
//생성 //생성
protected function create_form_process(): void protected function create_form_process(): void
@ -60,22 +51,39 @@ class ServerController extends EquipmentController
parent::create_form_process(); parent::create_form_process();
} }
//추가 파트정보 생성 //추가 파트정보 생성
private function createServerParts(ServerEntity $entity): array private function getFormDatasForServerPartInfo(ServerEntity $entity, string $partType): array
{ {
$serverPartEntities = []; $formDatas = [
foreach (ServerPartService::BaseParts as $basePart) { "partinfo_uid" => $this->request->getPost(["serverpartinfo_{$partType}_uid"]),
$formDatas = [ "serverinfo_uid" => $entity->getPK(),
"partinfo_uid" => $this->request->getPost(["serverpartinfo_{$basePart}_uid"]), "serviceinfo_uid" => $entity->getServiceInfoUID(),
"serverinfo_uid" => $entity->getPK(), "type" => $partType,
"serviceinfo_uid" => $entity->getServiceInfoUID(), "billing" => ServerPartENtity::DEFAULT_BILLING,
"billing" => ServerPartENtity::DEFAULT_BILLING, "amount" => $this->request->getPost("amount") ?? 0,
"amount" => $this->request->getPost("amount") ?? 0, "cnt" => $this->request->getPost("serverpartinfo_{$partType}_uid_cnt") ?? 1,
"cnt" => $this->request->getPost("serverpartinfo_{$basePart}_uid_cnt") ?? 1, "extra" => $this->request->getPost("serverpartinfo_{$partType}_uid_extra") ?? ""
"extra" => $this->request->getPost("serverpartinfo_{$basePart}_uid_extra") ?? "" ];
]; return $formDatas;
$serverPartEntities[] = $this->getServerPartService()->create($formDatas); }
private function getFormDatasForIPInfo(ServerEntity $entity, string $status): array
{
$formDatas = [
"serverinfo_uid" => $entity->getPK(),
"clientinfo_uid" => $entity->getClientInfoUID(),
"serviceinfo_uid" => $entity->getServiceInfoUID(),
"status" => $status
];
return $formDatas;
}
private function createIpInfo(ServerEntity $entity): IPEntity
{
//기존 Entity 가져오기
$ipinfo_uid = $this->request->getPost("ipinfo_uid");
$ipEntity = $this->getService()->getIPService()->getEntity($ipinfo_uid);
if (!$ipEntity) {
throw new \Exception("{$ipinfo_uid}에 대한 정보를 찾을수 없습니다.");
} }
return $serverPartEntities; return $this->getService()->getIPService()->modify($ipEntity, $this->getFormDatasForIPInfo($entity, $ipEntity::STATUS_OCCUPIED));
} }
protected function create_process(array $formDatas): ServerEntity protected function create_process(array $formDatas): ServerEntity
{ {
@ -91,19 +99,15 @@ class ServerController extends EquipmentController
throw new \Exception("Server코드[{$formDatas['code']}의 형식이 맞지않습니다"); throw new \Exception("Server코드[{$formDatas['code']}의 형식이 맞지않습니다");
} }
$entity = parent::create_process($formDatas); $entity = parent::create_process($formDatas);
//추가 파트정보 생성 후 ServerEntity 에 설정 //ServerPart정보 생성 후 ServerEntity에 설정
$entity->setServerParts($this->createServerParts($entity)); foreach (SERVER['PARTTYPES'] as $partType) {
$serverPartEnty = $this->getService()->getServerPartService()->create(
$this->getFormDatasForServerPartInfo($entity, $partType)
);
$entity->setServerPartEntity($partType, $serverPartEnty);
}
//IP정보 속성 수정후 ServerEntity에 설정
$entity->setIPEntities([$this->createIpInfo($entity)]);
return $entity; return $entity;
} }
protected function index_process(array $entities = []): array
{
foreach (parent::index_process($entities) as $entity) {
//서버 부품정보 정의
$entity->setServerParts($this->getServerPartService()->getEntities(['serverinfo_uid' => $entity->getPK()]));
//서버 IP정보 정의
//서버 CS정보 정의
$entities[] = $entity;
}
return $entities;
}
} }

View File

@ -4,13 +4,13 @@
"settings": { "settings": {
"width": 3000, "width": 3000,
"height": 3000, "height": 3000,
"scrollTop": -1509.3576, "scrollTop": -1726.3031,
"scrollLeft": -365.7916, "scrollLeft": -455.9114,
"zoomLevel": 0.76, "zoomLevel": 0.76,
"show": 511, "show": 511,
"database": 4, "database": 4,
"databaseName": "", "databaseName": "",
"canvasType": "@dineug/erd-editor/builtin-schema-sql", "canvasType": "ERD",
"language": 1, "language": 1,
"tableNameCase": 4, "tableNameCase": 4,
"columnNameCase": 2, "columnNameCase": 2,
@ -113,15 +113,15 @@
"w_EuwbTwtLEPAgYjS1aYq" "w_EuwbTwtLEPAgYjS1aYq"
], ],
"ui": { "ui": {
"x": 1419.5003, "x": 1298.9121,
"y": 297.6737, "y": 227.0855,
"zIndex": 2, "zIndex": 2,
"widthName": 60, "widthName": 60,
"widthComment": 62, "widthComment": 62,
"color": "" "color": ""
}, },
"meta": { "meta": {
"updateAt": 1755653491658, "updateAt": 1756279440813,
"createAt": 1745819764136 "createAt": 1745819764136
} }
}, },
@ -175,15 +175,15 @@
"JEk5AASiK6MpT9QBRWjMX" "JEk5AASiK6MpT9QBRWjMX"
], ],
"ui": { "ui": {
"x": 696.3092, "x": 1250.1794,
"y": 832.1517, "y": 704.2103,
"zIndex": 2, "zIndex": 2,
"widthName": 60, "widthName": 60,
"widthComment": 60, "widthComment": 60,
"color": "" "color": ""
}, },
"meta": { "meta": {
"updateAt": 1755654904923, "updateAt": 1756279482646,
"createAt": 1745819764137 "createAt": 1745819764137
} }
}, },
@ -319,15 +319,15 @@
"aY2pn1J3VHF_qV5XFM_zf" "aY2pn1J3VHF_qV5XFM_zf"
], ],
"ui": { "ui": {
"x": 807.5175, "x": 2264.5612,
"y": 1997.4168, "y": 1964.677,
"zIndex": 2, "zIndex": 2,
"widthName": 60, "widthName": 60,
"widthComment": 60, "widthComment": 60,
"color": "" "color": ""
}, },
"meta": { "meta": {
"updateAt": 1756086075154, "updateAt": 1756279464511,
"createAt": 1745819764137 "createAt": 1745819764137
} }
}, },
@ -365,15 +365,15 @@
"xvHi50lODgZs-Ke-lH95g" "xvHi50lODgZs-Ke-lH95g"
], ],
"ui": { "ui": {
"x": 2303.7942, "x": 66.565,
"y": 1764.818, "y": 2125.8862,
"zIndex": 2, "zIndex": 2,
"widthName": 60, "widthName": 60,
"widthComment": 60, "widthComment": 60,
"color": "" "color": ""
}, },
"meta": { "meta": {
"updateAt": 1755506769168, "updateAt": 1756279418325,
"createAt": 1745819764138 "createAt": 1745819764138
} }
}, },
@ -418,15 +418,15 @@
"ZgRRNC6OFpn87uomKBHbH" "ZgRRNC6OFpn87uomKBHbH"
], ],
"ui": { "ui": {
"x": 2303.2041, "x": 62.9566,
"y": 1392.8748, "y": 1781.5745,
"zIndex": 2, "zIndex": 2,
"widthName": 60, "widthName": 60,
"widthComment": 60, "widthComment": 60,
"color": "" "color": ""
}, },
"meta": { "meta": {
"updateAt": 1755654240788, "updateAt": 1756279413496,
"createAt": 1745819764138 "createAt": 1745819764138
} }
}, },
@ -484,15 +484,15 @@
"CX9ODlVw-gFnxgfMJ1JyV" "CX9ODlVw-gFnxgfMJ1JyV"
], ],
"ui": { "ui": {
"x": 1612.8983, "x": 758.8735,
"y": 1500.839, "y": 1837.6814,
"zIndex": 2, "zIndex": 2,
"widthName": 60, "widthName": 60,
"widthComment": 60, "widthComment": 60,
"color": "" "color": ""
}, },
"meta": { "meta": {
"updateAt": 1756086185204, "updateAt": 1756279479074,
"createAt": 1745819764138 "createAt": 1745819764138
} }
}, },
@ -639,15 +639,15 @@
"n9ZWAQ9754sZ3MM4IxCAA" "n9ZWAQ9754sZ3MM4IxCAA"
], ],
"ui": { "ui": {
"x": 2314.4072, "x": 2195.6764,
"y": 644.0365, "y": 573.0616,
"zIndex": 2278, "zIndex": 2278,
"widthName": 60, "widthName": 60,
"widthComment": 60, "widthComment": 60,
"color": "" "color": ""
}, },
"meta": { "meta": {
"updateAt": 1755653438046, "updateAt": 1756279455895,
"createAt": 1748484896313 "createAt": 1748484896313
} }
}, },
@ -728,15 +728,15 @@
"2fzVlWt1Skh-391N_z9Ci" "2fzVlWt1Skh-391N_z9Ci"
], ],
"ui": { "ui": {
"x": 1526.2804, "x": 2160.5683,
"y": 976.8582, "y": 1265.7898,
"zIndex": 2395, "zIndex": 2395,
"widthName": 60, "widthName": 60,
"widthComment": 62, "widthComment": 62,
"color": "" "color": ""
}, },
"meta": { "meta": {
"updateAt": 1755660518169, "updateAt": 1756279460059,
"createAt": 1748485662214 "createAt": 1748485662214
} }
}, },
@ -777,15 +777,15 @@
"qOLH2re1rmaG-63c08R8x" "qOLH2re1rmaG-63c08R8x"
], ],
"ui": { "ui": {
"x": 74.9689, "x": 46.0215,
"y": 1414.7795, "y": 1046.3584,
"zIndex": 2509, "zIndex": 2509,
"widthName": 60, "widthName": 60,
"widthComment": 62, "widthComment": 62,
"color": "" "color": ""
}, },
"meta": { "meta": {
"updateAt": 1755666709923, "updateAt": 1756279268718,
"createAt": 1750898626895 "createAt": 1750898626895
} }
}, },
@ -832,15 +832,15 @@
"S-_BBM4Qv5LCTvGVKmQQw" "S-_BBM4Qv5LCTvGVKmQQw"
], ],
"ui": { "ui": {
"x": 50.1723, "x": 58.067,
"y": 1816.5969, "y": 1344.2285,
"zIndex": 4045, "zIndex": 4045,
"widthName": 60, "widthName": 60,
"widthComment": 201, "widthComment": 201,
"color": "" "color": ""
}, },
"meta": { "meta": {
"updateAt": 1756086070863, "updateAt": 1756279299856,
"createAt": 1755244574868 "createAt": 1755244574868
} }
}, },
@ -853,6 +853,7 @@
"l2g7xess8DY86_ZOm7Ca1", "l2g7xess8DY86_ZOm7Ca1",
"IbWdZlEEF70bGqUDkU5ub", "IbWdZlEEF70bGqUDkU5ub",
"eu4eV0U7BRaP7Zk-oyBhV", "eu4eV0U7BRaP7Zk-oyBhV",
"czO0QNJkidvlfvj3hL6xs",
"mYEan5gjLS5bBthtFCc6w", "mYEan5gjLS5bBthtFCc6w",
"tmSvn-3Kqlf7oUbiedFDh", "tmSvn-3Kqlf7oUbiedFDh",
"SioEINPlR0iyL87vqa4N-", "SioEINPlR0iyL87vqa4N-",
@ -869,6 +870,7 @@
"l2g7xess8DY86_ZOm7Ca1", "l2g7xess8DY86_ZOm7Ca1",
"IbWdZlEEF70bGqUDkU5ub", "IbWdZlEEF70bGqUDkU5ub",
"eu4eV0U7BRaP7Zk-oyBhV", "eu4eV0U7BRaP7Zk-oyBhV",
"czO0QNJkidvlfvj3hL6xs",
"mYEan5gjLS5bBthtFCc6w", "mYEan5gjLS5bBthtFCc6w",
"tmSvn-3Kqlf7oUbiedFDh", "tmSvn-3Kqlf7oUbiedFDh",
"SioEINPlR0iyL87vqa4N-", "SioEINPlR0iyL87vqa4N-",
@ -880,15 +882,15 @@
"kDyVwSigBBYnp_F9MyRAw" "kDyVwSigBBYnp_F9MyRAw"
], ],
"ui": { "ui": {
"x": 1541.4598, "x": 698.2708,
"y": 1937.3055, "y": 2247.9865,
"zIndex": 4514, "zIndex": 4514,
"widthName": 101, "widthName": 101,
"widthComment": 165, "widthComment": 165,
"color": "" "color": ""
}, },
"meta": { "meta": {
"updateAt": 1756083472477, "updateAt": 1756279409021,
"createAt": 1755476453282 "createAt": 1755476453282
} }
}, },
@ -8193,6 +8195,26 @@
"updateAt": 1756083498528, "updateAt": 1756083498528,
"createAt": 1756083498528 "createAt": 1756083498528
} }
},
"czO0QNJkidvlfvj3hL6xs": {
"id": "czO0QNJkidvlfvj3hL6xs",
"tableId": "8GYAVBvZGaMFeq3QuXk_B",
"name": "type",
"comment": "형식",
"dataType": "VARCHAR(20)",
"default": "",
"options": 8,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 75,
"widthDefault": 60
},
"meta": {
"updateAt": 1756279042574,
"createAt": 1756279042572
}
} }
}, },
"relationshipEntities": { "relationshipEntities": {
@ -8206,18 +8228,18 @@
"columnIds": [ "columnIds": [
"7B0zaLoZnOoMNW8OHZlrQ" "7B0zaLoZnOoMNW8OHZlrQ"
], ],
"x": 2303.2041, "x": 565.9566,
"y": 1540.8748, "y": 1929.5745,
"direction": 1 "direction": 2
}, },
"end": { "end": {
"tableId": "ZLEpY5EjuZV21718zf-Y1", "tableId": "ZLEpY5EjuZV21718zf-Y1",
"columnIds": [ "columnIds": [
"f7_MGvRjkwL1xkCWrAgDR" "f7_MGvRjkwL1xkCWrAgDR"
], ],
"x": 2144.8983, "x": 758.8735,
"y": 1684.839, "y": 2021.6814,
"direction": 2 "direction": 1
}, },
"meta": { "meta": {
"updateAt": 1746595277837, "updateAt": 1746595277837,
@ -8234,17 +8256,17 @@
"columnIds": [ "columnIds": [
"mfHtgzc_Aeocr6xkgwYWh" "mfHtgzc_Aeocr6xkgwYWh"
], ],
"x": 1672.0003, "x": 1803.9121,
"y": 593.6737, "y": 473.7521666666667,
"direction": 8 "direction": 2
}, },
"end": { "end": {
"tableId": "B8haiEbPc1lRBWTv1g25G", "tableId": "B8haiEbPc1lRBWTv1g25G",
"columnIds": [ "columnIds": [
"Vf3bNvvEPfu1zCs4rcHTU" "Vf3bNvvEPfu1zCs4rcHTU"
], ],
"x": 1852.7804, "x": 2323.8183,
"y": 976.8582, "y": 1265.7898,
"direction": 4 "direction": 4
}, },
"meta": { "meta": {
@ -8262,8 +8284,8 @@
"columnIds": [ "columnIds": [
"mfHtgzc_Aeocr6xkgwYWh" "mfHtgzc_Aeocr6xkgwYWh"
], ],
"x": 1924.5003, "x": 1803.9121,
"y": 519.6737, "y": 375.0855,
"direction": 2 "direction": 2
}, },
"end": { "end": {
@ -8271,8 +8293,8 @@
"columnIds": [ "columnIds": [
"s1Az-lXWK0NlVQqFEEK8o" "s1Az-lXWK0NlVQqFEEK8o"
], ],
"x": 2314.4072, "x": 2195.6764,
"y": 705.3698333333333, "y": 665.0616,
"direction": 1 "direction": 1
}, },
"meta": { "meta": {
@ -8290,8 +8312,8 @@
"columnIds": [ "columnIds": [
"mfHtgzc_Aeocr6xkgwYWh" "mfHtgzc_Aeocr6xkgwYWh"
], ],
"x": 1924.5003, "x": 1803.9121,
"y": 371.6737, "y": 276.41883333333334,
"direction": 2 "direction": 2
}, },
"end": { "end": {
@ -8318,17 +8340,17 @@
"columnIds": [ "columnIds": [
"mfHtgzc_Aeocr6xkgwYWh" "mfHtgzc_Aeocr6xkgwYWh"
], ],
"x": 1419.5003, "x": 1551.4121,
"y": 482.6737, "y": 523.0855,
"direction": 1 "direction": 8
}, },
"end": { "end": {
"tableId": "6ajvOCaGuXU9pzV0Y9jEi", "tableId": "6ajvOCaGuXU9pzV0Y9jEi",
"columnIds": [ "columnIds": [
"hrPg0uHAdEjamOj--BVzO" "hrPg0uHAdEjamOj--BVzO"
], ],
"x": 1140.4758666666667, "x": 1516.6794,
"y": 832.1517, "y": 704.2103,
"direction": 4 "direction": 4
}, },
"meta": { "meta": {
@ -8346,8 +8368,8 @@
"columnIds": [ "columnIds": [
"mfHtgzc_Aeocr6xkgwYWh" "mfHtgzc_Aeocr6xkgwYWh"
], ],
"x": 1419.5003, "x": 1298.9121,
"y": 334.6737, "y": 276.41883333333334,
"direction": 1 "direction": 1
}, },
"end": { "end": {
@ -8374,8 +8396,8 @@
"columnIds": [ "columnIds": [
"mfHtgzc_Aeocr6xkgwYWh" "mfHtgzc_Aeocr6xkgwYWh"
], ],
"x": 1419.5003, "x": 1298.9121,
"y": 408.6737, "y": 375.0855,
"direction": 1 "direction": 1
}, },
"end": { "end": {
@ -8402,18 +8424,18 @@
"columnIds": [ "columnIds": [
"2HB01q46-mugMjuOz85YG" "2HB01q46-mugMjuOz85YG"
], ],
"x": 2303.7942, "x": 563.565,
"y": 1888.818, "y": 2249.8862,
"direction": 1 "direction": 2
}, },
"end": { "end": {
"tableId": "8GYAVBvZGaMFeq3QuXk_B", "tableId": "8GYAVBvZGaMFeq3QuXk_B",
"columnIds": [ "columnIds": [
"l2g7xess8DY86_ZOm7Ca1" "l2g7xess8DY86_ZOm7Ca1"
], ],
"x": 2135.4598, "x": 698.2708,
"y": 2085.3055, "y": 2407.9865,
"direction": 2 "direction": 1
}, },
"meta": { "meta": {
"updateAt": 1755486693704, "updateAt": 1755486693704,
@ -8430,8 +8452,8 @@
"columnIds": [ "columnIds": [
"mfHtgzc_Aeocr6xkgwYWh" "mfHtgzc_Aeocr6xkgwYWh"
], ],
"x": 1419.5003, "x": 1298.9121,
"y": 556.6737, "y": 473.7521666666667,
"direction": 1 "direction": 1
}, },
"end": { "end": {
@ -8458,8 +8480,8 @@
"columnIds": [ "columnIds": [
"V6BuLrtFrGgCWaHSUkSLb" "V6BuLrtFrGgCWaHSUkSLb"
], ],
"x": 696.3092, "x": 1250.1794,
"y": 1052.1517, "y": 924.2103,
"direction": 1 "direction": 1
}, },
"end": { "end": {
@ -8486,9 +8508,9 @@
"columnIds": [ "columnIds": [
"V6BuLrtFrGgCWaHSUkSLb" "V6BuLrtFrGgCWaHSUkSLb"
], ],
"x": 962.8091999999999, "x": 1250.1794,
"y": 832.1517, "y": 836.2103,
"direction": 4 "direction": 1
}, },
"end": { "end": {
"tableId": "jO40Ej5EXImXnadoJo9bn", "tableId": "jO40Ej5EXImXnadoJo9bn",
@ -8514,9 +8536,9 @@
"columnIds": [ "columnIds": [
"V6BuLrtFrGgCWaHSUkSLb" "V6BuLrtFrGgCWaHSUkSLb"
], ],
"x": 785.1425333333333, "x": 1250.1794,
"y": 832.1517, "y": 748.2103,
"direction": 4 "direction": 1
}, },
"end": { "end": {
"tableId": "GDEF0_WuOpaYtsZxjn2zM", "tableId": "GDEF0_WuOpaYtsZxjn2zM",
@ -8542,8 +8564,8 @@
"columnIds": [ "columnIds": [
"V6BuLrtFrGgCWaHSUkSLb" "V6BuLrtFrGgCWaHSUkSLb"
], ],
"x": 1229.3092000000001, "x": 1783.1794,
"y": 887.1517, "y": 814.2103,
"direction": 2 "direction": 2
}, },
"end": { "end": {
@ -8551,8 +8573,8 @@
"columnIds": [ "columnIds": [
"8mPFhDdUY8QLPvc8rNw1B" "8mPFhDdUY8QLPvc8rNw1B"
], ],
"x": 2314.4072, "x": 2195.6764,
"y": 828.0364999999999, "y": 849.0616,
"direction": 1 "direction": 1
}, },
"meta": { "meta": {
@ -8570,8 +8592,8 @@
"columnIds": [ "columnIds": [
"V6BuLrtFrGgCWaHSUkSLb" "V6BuLrtFrGgCWaHSUkSLb"
], ],
"x": 1229.3092000000001, "x": 1783.1794,
"y": 997.1517, "y": 1034.2103,
"direction": 2 "direction": 2
}, },
"end": { "end": {
@ -8579,8 +8601,8 @@
"columnIds": [ "columnIds": [
"N-2m8O_JzS6-sDEcL5zTv" "N-2m8O_JzS6-sDEcL5zTv"
], ],
"x": 1526.2804, "x": 2160.5683,
"y": 1031.8582000000001, "y": 1309.7898,
"direction": 1 "direction": 1
}, },
"meta": { "meta": {
@ -8598,18 +8620,18 @@
"columnIds": [ "columnIds": [
"nNWsAWbHfKWqx8EwxvuM1" "nNWsAWbHfKWqx8EwxvuM1"
], ],
"x": 2179.2804, "x": 2650.3183,
"y": 1196.8582000000001, "y": 1265.7898,
"direction": 2 "direction": 4
}, },
"end": { "end": {
"tableId": "QCNA57Pi6A9dJDgybxS5v", "tableId": "QCNA57Pi6A9dJDgybxS5v",
"columnIds": [ "columnIds": [
"vxhl-9RMNJ8zU9oqzEWo8" "vxhl-9RMNJ8zU9oqzEWo8"
], ],
"x": 2314.4072, "x": 2506.1764,
"y": 950.7031666666666, "y": 941.0616,
"direction": 1 "direction": 8
}, },
"meta": { "meta": {
"updateAt": 1755653412891, "updateAt": 1755653412891,
@ -8626,17 +8648,17 @@
"columnIds": [ "columnIds": [
"RITMHZcQAJ7KvtxkTtMv-" "RITMHZcQAJ7KvtxkTtMv-"
], ],
"x": 894.8508333333333, "x": 2264.5612,
"y": 1997.4168, "y": 2082.277,
"direction": 4 "direction": 1
}, },
"end": { "end": {
"tableId": "IsMoJXzvtuoOFFt93qS0w", "tableId": "IsMoJXzvtuoOFFt93qS0w",
"columnIds": [ "columnIds": [
"wi1XbZM3emknh42sOMkYq" "wi1XbZM3emknh42sOMkYq"
], ],
"x": 591.9689, "x": 563.0215000000001,
"y": 1641.446166666667, "y": 1273.0250666666668,
"direction": 2 "direction": 2
}, },
"meta": { "meta": {
@ -8654,8 +8676,8 @@
"columnIds": [ "columnIds": [
"RITMHZcQAJ7KvtxkTtMv-" "RITMHZcQAJ7KvtxkTtMv-"
], ],
"x": 807.5175, "x": 2264.5612,
"y": 2193.4168, "y": 2160.677,
"direction": 1 "direction": 1
}, },
"end": { "end": {
@ -8663,8 +8685,8 @@
"columnIds": [ "columnIds": [
"GtBqjKsmtYWvsd0fckBc0" "GtBqjKsmtYWvsd0fckBc0"
], ],
"x": 588.1723, "x": 596.067,
"y": 2143.263566666667, "y": 1670.895166666667,
"direction": 2 "direction": 2
}, },
"meta": { "meta": {
@ -8682,17 +8704,17 @@
"columnIds": [ "columnIds": [
"nNWsAWbHfKWqx8EwxvuM1" "nNWsAWbHfKWqx8EwxvuM1"
], ],
"x": 1526.2804, "x": 2487.0683,
"y": 1251.8582000000001, "y": 1705.7898,
"direction": 1 "direction": 8
}, },
"end": { "end": {
"tableId": "B4qGh3KZsXHQ3_4EOgwJZ", "tableId": "B4qGh3KZsXHQ3_4EOgwJZ",
"columnIds": [ "columnIds": [
"4iRyOhmW3b7kbiZT8lQyY" "4iRyOhmW3b7kbiZT8lQyY"
], ],
"x": 1244.1841666666667, "x": 2526.5612,
"y": 1997.4168, "y": 1964.677,
"direction": 4 "direction": 4
}, },
"meta": { "meta": {
@ -8710,8 +8732,8 @@
"columnIds": [ "columnIds": [
"V6BuLrtFrGgCWaHSUkSLb" "V6BuLrtFrGgCWaHSUkSLb"
], ],
"x": 1140.4758666666667, "x": 1694.346066666667,
"y": 1272.1517, "y": 1144.2103,
"direction": 8 "direction": 8
}, },
"end": { "end": {
@ -8719,9 +8741,9 @@
"columnIds": [ "columnIds": [
"JRdeV7n53lb1iSmmYnhHX" "JRdeV7n53lb1iSmmYnhHX"
], ],
"x": 1069.5175, "x": 2264.5612,
"y": 1997.4168, "y": 2003.877,
"direction": 4 "direction": 1
}, },
"meta": { "meta": {
"updateAt": 1755653851900, "updateAt": 1755653851900,
@ -8738,18 +8760,18 @@
"columnIds": [ "columnIds": [
"V6BuLrtFrGgCWaHSUkSLb" "V6BuLrtFrGgCWaHSUkSLb"
], ],
"x": 1229.3092000000001, "x": 1339.0127333333335,
"y": 1107.1517, "y": 1144.2103,
"direction": 2 "direction": 8
}, },
"end": { "end": {
"tableId": "ZLEpY5EjuZV21718zf-Y1", "tableId": "ZLEpY5EjuZV21718zf-Y1",
"columnIds": [ "columnIds": [
"60w6M5QqxGAvJa3EEMDbR" "60w6M5QqxGAvJa3EEMDbR"
], ],
"x": 1612.8983, "x": 891.8735,
"y": 1562.1723333333334, "y": 1837.6814,
"direction": 1 "direction": 4
}, },
"meta": { "meta": {
"updateAt": 1755653938445, "updateAt": 1755653938445,
@ -8766,18 +8788,18 @@
"columnIds": [ "columnIds": [
"RITMHZcQAJ7KvtxkTtMv-" "RITMHZcQAJ7KvtxkTtMv-"
], ],
"x": 1331.5175, "x": 2264.5612,
"y": 2095.4168, "y": 2239.077,
"direction": 2 "direction": 1
}, },
"end": { "end": {
"tableId": "ZLEpY5EjuZV21718zf-Y1", "tableId": "ZLEpY5EjuZV21718zf-Y1",
"columnIds": [ "columnIds": [
"QznZ6PY_T3OGj3YD4GdOX" "QznZ6PY_T3OGj3YD4GdOX"
], ],
"x": 1612.8983, "x": 1290.8735000000001,
"y": 1807.505666666667, "y": 2113.6814,
"direction": 1 "direction": 2
}, },
"meta": { "meta": {
"updateAt": 1755653979090, "updateAt": 1755653979090,
@ -8794,18 +8816,18 @@
"columnIds": [ "columnIds": [
"RITMHZcQAJ7KvtxkTtMv-" "RITMHZcQAJ7KvtxkTtMv-"
], ],
"x": 1331.5175, "x": 2264.5612,
"y": 2291.4168, "y": 2317.4770000000003,
"direction": 2 "direction": 1
}, },
"end": { "end": {
"tableId": "8GYAVBvZGaMFeq3QuXk_B", "tableId": "8GYAVBvZGaMFeq3QuXk_B",
"columnIds": [ "columnIds": [
"IbWdZlEEF70bGqUDkU5ub" "IbWdZlEEF70bGqUDkU5ub"
], ],
"x": 1541.4598, "x": 1292.2708,
"y": 2085.3055, "y": 2487.9865,
"direction": 1 "direction": 2
}, },
"meta": { "meta": {
"updateAt": 1755654048878, "updateAt": 1755654048878,
@ -8822,18 +8844,18 @@
"columnIds": [ "columnIds": [
"nNWsAWbHfKWqx8EwxvuM1" "nNWsAWbHfKWqx8EwxvuM1"
], ],
"x": 2016.0304, "x": 2160.5683,
"y": 1416.8582000000001, "y": 1573.7898,
"direction": 8 "direction": 1
}, },
"end": { "end": {
"tableId": "ZLEpY5EjuZV21718zf-Y1", "tableId": "ZLEpY5EjuZV21718zf-Y1",
"columnIds": [ "columnIds": [
"sJfMcwfDgXnsZ89DVVDA2" "sJfMcwfDgXnsZ89DVVDA2"
], ],
"x": 1878.8983, "x": 1290.8735000000001,
"y": 1500.839, "y": 1929.6814,
"direction": 4 "direction": 2
}, },
"meta": { "meta": {
"updateAt": 1755664509604, "updateAt": 1755664509604,
@ -8850,8 +8872,8 @@
"columnIds": [ "columnIds": [
"nNWsAWbHfKWqx8EwxvuM1" "nNWsAWbHfKWqx8EwxvuM1"
], ],
"x": 1526.2804, "x": 2160.5683,
"y": 1141.8582000000001, "y": 1397.7898,
"direction": 1 "direction": 1
}, },
"end": { "end": {
@ -8859,8 +8881,8 @@
"columnIds": [ "columnIds": [
"E30sHnqJytLlBmfL7ueOG" "E30sHnqJytLlBmfL7ueOG"
], ],
"x": 591.9689, "x": 563.0215000000001,
"y": 1460.1128333333336, "y": 1182.3584,
"direction": 2 "direction": 2
}, },
"meta": { "meta": {
@ -8878,8 +8900,8 @@
"columnIds": [ "columnIds": [
"nNWsAWbHfKWqx8EwxvuM1" "nNWsAWbHfKWqx8EwxvuM1"
], ],
"x": 1526.2804, "x": 2160.5683,
"y": 1361.8582000000001, "y": 1485.7898,
"direction": 1 "direction": 1
}, },
"end": { "end": {
@ -8887,8 +8909,8 @@
"columnIds": [ "columnIds": [
"7Tqt0jVOln16nire8AE2K" "7Tqt0jVOln16nire8AE2K"
], ],
"x": 588.1723, "x": 596.067,
"y": 2012.5969000000002, "y": 1540.2285000000002,
"direction": 2 "direction": 2
}, },
"meta": { "meta": {
@ -8906,18 +8928,18 @@
"columnIds": [ "columnIds": [
"nNWsAWbHfKWqx8EwxvuM1" "nNWsAWbHfKWqx8EwxvuM1"
], ],
"x": 1689.5304, "x": 2160.5683,
"y": 1416.8582000000001, "y": 1661.7898,
"direction": 8 "direction": 1
}, },
"end": { "end": {
"tableId": "8GYAVBvZGaMFeq3QuXk_B", "tableId": "8GYAVBvZGaMFeq3QuXk_B",
"columnIds": [ "columnIds": [
"eu4eV0U7BRaP7Zk-oyBhV" "eu4eV0U7BRaP7Zk-oyBhV"
], ],
"x": 1838.4598, "x": 1292.2708,
"y": 1937.3055, "y": 2327.9865,
"direction": 4 "direction": 2
}, },
"meta": { "meta": {
"updateAt": 1755664858263, "updateAt": 1755664858263,
@ -8934,17 +8956,17 @@
"columnIds": [ "columnIds": [
"V6BuLrtFrGgCWaHSUkSLb" "V6BuLrtFrGgCWaHSUkSLb"
], ],
"x": 962.8091999999999, "x": 1250.1794,
"y": 1272.1517, "y": 1012.2103,
"direction": 8 "direction": 1
}, },
"end": { "end": {
"tableId": "IsMoJXzvtuoOFFt93qS0w", "tableId": "IsMoJXzvtuoOFFt93qS0w",
"columnIds": [ "columnIds": [
"9FYinSR3C6jDrEsRsCMpl" "9FYinSR3C6jDrEsRsCMpl"
], ],
"x": 591.9689, "x": 563.0215000000001,
"y": 1550.7795000000003, "y": 1091.6917333333333,
"direction": 2 "direction": 2
}, },
"meta": { "meta": {
@ -8962,17 +8984,17 @@
"columnIds": [ "columnIds": [
"V6BuLrtFrGgCWaHSUkSLb" "V6BuLrtFrGgCWaHSUkSLb"
], ],
"x": 785.1425333333333, "x": 1250.1794,
"y": 1272.1517, "y": 1100.2103,
"direction": 8 "direction": 1
}, },
"end": { "end": {
"tableId": "SEgsi7mbM-56Rsx5-qj8K", "tableId": "SEgsi7mbM-56Rsx5-qj8K",
"columnIds": [ "columnIds": [
"q_IaRBb367b9mgGozh6jB" "q_IaRBb367b9mgGozh6jB"
], ],
"x": 588.1723, "x": 596.067,
"y": 1881.9302333333335, "y": 1409.5618333333334,
"direction": 2 "direction": 2
}, },
"meta": { "meta": {
@ -8990,18 +9012,18 @@
"columnIds": [ "columnIds": [
"V6BuLrtFrGgCWaHSUkSLb" "V6BuLrtFrGgCWaHSUkSLb"
], ],
"x": 1229.3092000000001, "x": 1516.6794000000002,
"y": 1217.1517, "y": 1144.2103,
"direction": 2 "direction": 8
}, },
"end": { "end": {
"tableId": "ZLEpY5EjuZV21718zf-Y1", "tableId": "ZLEpY5EjuZV21718zf-Y1",
"columnIds": [ "columnIds": [
"4sj8hIYAiLSSF89eeNXdQ" "4sj8hIYAiLSSF89eeNXdQ"
], ],
"x": 1612.8983, "x": 1157.8735000000001,
"y": 1684.8390000000002, "y": 1837.6814,
"direction": 1 "direction": 4
}, },
"meta": { "meta": {
"updateAt": 1755666739577, "updateAt": 1755666739577,

View File

@ -406,6 +406,7 @@ CREATE TABLE `serverinfo_partinfo` (
`partinfo_uid` int(11) NOT NULL COMMENT 'PART정보', `partinfo_uid` int(11) NOT NULL COMMENT 'PART정보',
`serverinfo_uid` int(11) NOT NULL COMMENT '서버정보', `serverinfo_uid` int(11) NOT NULL COMMENT '서버정보',
`serviceinfo_uid` int(11) DEFAULT NULL COMMENT '서비스정보', `serviceinfo_uid` int(11) DEFAULT NULL COMMENT '서비스정보',
`type` varchar(20) NOT NULL COMMENT '형식',
`billing` varchar(20) NOT NULL COMMENT '청구방법(month,onetime)', `billing` varchar(20) NOT NULL COMMENT '청구방법(month,onetime)',
`amount` int(11) NOT NULL DEFAULT 0 COMMENT '서비스금액', `amount` int(11) NOT NULL DEFAULT 0 COMMENT '서비스금액',
`cnt` tinyint(4) NOT NULL DEFAULT 1 COMMENT '갯수', `cnt` tinyint(4) NOT NULL DEFAULT 1 COMMENT '갯수',

File diff suppressed because one or more lines are too long

View File

@ -13,13 +13,38 @@ class ServerEntity extends EquipmentEntity
const STATUS_FORBIDDEN = "forbidden"; const STATUS_FORBIDDEN = "forbidden";
const DEFAULT_STATUS = self::STATUS_AVAILABLE; const DEFAULT_STATUS = self::STATUS_AVAILABLE;
public function setServerParts(array $datas): void public function setServerPartEntity(string $partType, ServerPartENtity $entity): void
{ {
$this->attributes['server_parts'] = $datas; if (!array_key_exists('serverPartEntities', $this->attributes)) {
$this->attributes['serverPartEntities'] = [];
}
$this->attributes['serverPartEntities'][$partType] = $entity;
} }
public function getServerParts(): array public function getServerPartEntity(string $partType): ServerPartENtity|null
{ {
return $this->attributes['server_parts'] ?? []; if (!array_key_exists('serverPartEntities', $this->attributes)) {
return null;
}
if (!array_key_exists($partType, $this->attributes['serverPartEntities'])) {
return null;
}
return $this->attributes['serverPartEntities'][$partType];
}
public function setIPEntities(array $entities): void
{
$this->attributes['ipEntities'] = $entities;
}
public function getIPEntities(): array
{
return $this->attributes['ipEntities'] ?? [];
}
public function setCSEntities(array $entities): void
{
$this->attributes['csEntities'] = $entities;
}
public function getCSEntities(): array
{
return $this->attributes['csEntities'] ?? [];
} }
//기본기능용 //기본기능용
public function getCode(): string public function getCode(): string

View File

@ -12,21 +12,25 @@ class ServerPartEntity extends EquipmentEntity
public function setPartEntity(PartEntity $entity): void public function setPartEntity(PartEntity $entity): void
{ {
$this->attributes['part'] = $entity; $this->attributes['partEntity'] = $entity;
}
public function getPartEntity(): PartEntity
{
return $this->attributes['partEntity'];
}
public function getType(): string
{
return $this->getPartEntity()->getType() ?? "";
} }
public function getTitle(): string public function getTitle(): string
{ {
return $this->getPartEntity()->getTitle(); return $this->getPartEntity()->getTitle() ?? "";
} }
public function getPrice(): string public function getPrice(): int
{ {
return $this->getPartEntity()->getPrice(); return $this->getPartEntity()->getPrice() ?? 0;
} }
//기본기능용 //기본기능용
public function getPartEntity(): PartEntity
{
return $this->attributes['part'] ?? [];
}
public function getPartInfoUID(): int public function getPartInfoUID(): int
{ {
return $this->attributes['partinfo_uid']; return $this->attributes['partinfo_uid'];

View File

@ -19,17 +19,18 @@ class ServerHelper extends EquipmentHelper
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender'; $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender';
$form = form_input($field, $value ?? "", $extras); $form = form_input($field, $value ?? "", $extras);
break; break;
case 'serverpartinfo_cpu_uid': case 'CPU':
case 'serverpartinfo_ram_uid': case 'RAM':
case 'serverpartinfo_disk_uid': case 'SOFTWARE':
case 'serverpartinfo_software_uid': case 'OS':
case 'serverpartinfo_os_uid': case 'serverpartinfo_DB_uid':
case 'serverpartinfo_db_uid': $form = $this->form_dropdown_custom($field, old($field) ?? (array_key_exists('entity', $viewDatas) ? $viewDatas['entity']->getServerPartEntity('CPU')->getPK() : null), $viewDatas, $extras);
$form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
$form .= " " . form_dropdown("{$field}_cnt", $viewDatas['serverpartinfo_cnt_range'], old("{$field}_cnt") ?? $viewDatas['entity']->$field ?? 1) . ""; $form .= " " . form_dropdown("{$field}_cnt", $viewDatas['serverpartinfo_cnt_range'], old("{$field}_cnt") ?? $viewDatas['entity']->$field ?? 1) . "";
if ($field === 'serverpartinfo_disk_uid') { break;
$form .= form_dropdown("{$field}_extra", $viewDatas['serverpartinfo_extra_options'], old("{$field}_extra") ?? $viewDatas['entity']->$field ?? 1); case 'DISK':
} $form = $this->form_dropdown_custom($field, old($field) ?? (array_key_exists('entity', $viewDatas) ? $viewDatas['entity']->getPartInfoUID() : null), $viewDatas, $extras);
$form .= " " . form_dropdown("{$field}_cnt", $viewDatas['serverpartinfo_cnt_range'], old("{$field}_cnt") ?? $viewDatas['entity']->$field ?? 1) . "";
$form .= form_dropdown("{$field}_extra", $viewDatas['serverpartinfo_extra_options'], old("{$field}_extra") ?? $viewDatas['entity']->$field ?? 1);
break; break;
case 'ipinfo_uid': case 'ipinfo_uid':
case 'csinfo_uid': case 'csinfo_uid':
@ -50,16 +51,30 @@ class ServerHelper extends EquipmentHelper
$value = $value ? date("Y-m-d", strtotime($value)) : ""; $value = $value ? date("Y-m-d", strtotime($value)) : "";
break; break;
case 'serverpartinfo': case 'serverpartinfo':
// dd($viewDatas['entity']);
$value = ""; $value = "";
foreach ($viewDatas['entity']->getServerParts() as $serverPart) { foreach (SERVER['PARTTYPES'] as $partType) {
$serverPartEntity = $viewDatas['entity']->getServerPartEntity($partType);
$value .= sprintf( $value .= sprintf(
"<div>%s%s %s</div>", "<div>%s : %s%s %s</div>",
$serverPart->getTitle(), $serverPartEntity->getType(),
$serverPart->getCnt() > 1 ? "*" . $serverPart->getCnt() . "" : "", $serverPartEntity->getTitle(),
$serverPart->getExtra() ?? "" $serverPartEntity->getCnt() > 1 ? "*" . $serverPartEntity->getCnt() . "" : "",
$serverPartEntity->getExtra() ?? ""
); );
} }
// dd($value); break;
case 'ipinfo_uid':
$value = "";
foreach ($viewDatas['entity']->getIPEntities() as $ipEntity) {
$value .= sprintf("<div>%s%s %s</div>", $ipEntity->getTitle(), $ipEntity->getAmount());
}
break;
case 'csinfo_uid':
$value = "";
foreach ($viewDatas['entity']->getCSEntities() as $csEntity) {
$value .= sprintf("<div>%s%s %s</div>", $csEntity->getTitle(), $csEntity->getAmount());
}
break; break;
default: default:
$value = parent::getFieldView($field, $value, $viewDatas, $extras); $value = parent::getFieldView($field, $value, $viewDatas, $extras);

View File

@ -18,12 +18,12 @@ return [
"serverpartinfo" => "부품정보", "serverpartinfo" => "부품정보",
"ipinfo_uid" => "IP정보", "ipinfo_uid" => "IP정보",
"csinfo_uid" => "CS정보", "csinfo_uid" => "CS정보",
'serverpartinfo_cpu_uid' => "CPU", 'CPU' => "CPU",
'serverpartinfo_ram_uid' => "RAM", 'RAM' => "RAM",
'serverpartinfo_disk_uid' => "DISK", 'DISK' => "DISK",
'serverpartinfo_os_uid' => "OS", 'OS' => "OS",
'serverpartinfo_db_uid' => "DB", 'serverpartinfo_DB_uid' => "DB",
'serverpartinfo_software_uid' => "기타SW", 'SOFTWARE' => "기타SW",
], ],
"TITLE" => [ "TITLE" => [
'HP DL360 Gen6' => "HP DL360 Gen6", 'HP DL360 Gen6' => "HP DL360 Gen6",

View File

@ -72,6 +72,8 @@ abstract class CommonService
if ($where) { if ($where) {
$this->getModel()->where($where); $this->getModel()->where($where);
} }
//출력순서 정의
$this->setOrderBy();
$entities = []; $entities = [];
foreach ($this->getModel()->select(implode(',', $columns))->findAll() as $entity) { foreach ($this->getModel()->select(implode(',', $columns))->findAll() as $entity) {
$entities[$entity->getPK()] = $this->getEntity_process($entity); $entities[$entity->getPK()] = $this->getEntity_process($entity);

View File

@ -2,12 +2,12 @@
namespace App\Services\Equipment; namespace App\Services\Equipment;
use App\Entities\Equipment\ServerPartEntity;
use App\Models\Equipment\ServerPartModel; use App\Models\Equipment\ServerPartModel;
use App\Services\Equipment\EquipmentService; use App\Services\Equipment\EquipmentService;
class ServerPartService extends EquipmentService class ServerPartService extends EquipmentService
{ {
const BaseParts = ['cpu', 'ram', 'disk', 'os'];
private ?PartService $_partService = null; private ?PartService $_partService = null;
public function __construct() public function __construct()
{ {
@ -48,27 +48,33 @@ class ServerPartService extends EquipmentService
} }
return $this->_partService; return $this->_partService;
} }
//partEntity 정보 추가
protected function getEntity_process(mixed $entity): ServerPartEntity
{
$entity->setPartEntity($this->getPartService()->getEntity($entity->getPartInfoUID()));
return $entity;
}
//기본 기능부분 //기본 기능부분
//FieldForm관련용 //FieldForm관련용
public function getFormFieldOption(string $field, array $options = []): array public function getFormFieldOption(string $field, array $options = []): array
{ {
switch ($field) { switch ($field) {
case 'partinfo_cpu_uid': case 'partinfo_CPU_uid':
$options = $this->getPartService()->getEntities(['type' => 'CPU']); $options = $this->getPartService()->getEntities(['type' => 'CPU']);
break; break;
case 'partinfo_ram_uid': case 'partinfo_RAM_uid':
$options = $this->getPartService()->getEntities(['type' => 'RAM']); $options = $this->getPartService()->getEntities(['type' => 'RAM']);
break; break;
case 'partinfo_disk_uid': case 'partinfo_DISK_uid':
$options = $this->getPartService()->getEntities(['type' => 'DISK']); $options = $this->getPartService()->getEntities(['type' => 'DISK']);
break; break;
case 'partinfo_os_uid': case 'partinfo_OS_uid':
$options = $this->getPartService()->getEntities(['type' => 'OS']); $options = $this->getPartService()->getEntities(['type' => 'OS']);
break; break;
case 'partinfo_db_uid': case 'partinfo_DB_uid':
$options = $this->getPartService()->getEntities(['type' => 'DB']); $options = $this->getPartService()->getEntities(['type' => 'DB']);
break; break;
case 'partinfo_software_uid': case 'partinfo_SOFTWARE_uid':
$options = $this->getPartService()->getEntities(['type' => 'SOFTWARE']); $options = $this->getPartService()->getEntities(['type' => 'SOFTWARE']);
break; break;
case 'partinfo_uid': //수정때문에 전체가 필요 case 'partinfo_uid': //수정때문에 전체가 필요
@ -80,10 +86,4 @@ class ServerPartService extends EquipmentService
} }
return $options; return $options;
} }
//partEntity 정보 추가
protected function getEntity_process(mixed $entity): mixed
{
$entity->setPartEntity($this->getPartService()->getEntity($entity->getPartInfoUID()));
return $entity;
}
} }

View File

@ -22,10 +22,11 @@ class ServerService extends EquipmentService
"code", "code",
"type", "type",
"title", "title",
"serverpartinfo_cpu_uid", "CPU",
"serverpartinfo_ram_uid", "RAM",
"serverpartinfo_disk_uid", "DISK",
"serverpartinfo_os_uid", "OS",
"ipinfo_uid",
"price", "price",
"amount", "amount",
"manufactur_at", "manufactur_at",
@ -37,14 +38,42 @@ class ServerService extends EquipmentService
"serviceinfo_uid", "serviceinfo_uid",
"type", "type",
"title", "title",
"serverpartinfo_cpu_uid", "CPU",
"serverpartinfo_ram_uid", "RAM",
"serverpartinfo_disk_uid", "DISK",
"serverpartinfo_os_uid", "OS",
"ipinfo_uid",
"status" "status"
], ],
]; ];
} }
public function getViewFields(): array
{
return [
'fields' => [
'clientinfo_uid',
'serviceinfo_uid',
"type",
'title',
'price',
'amount',
"serverpartinfo",
"ipinfo_uid",
"csinfo_uid",
'manufactur_at',
"format_at",
'status'
],
'filters' => [
'clientinfo_uid',
'serviceinfo_uid',
'type',
"ipinfo_uid",
"csinfo_uid",
'status'
],
];
}
public function getIndexFields(): array public function getIndexFields(): array
{ {
return [ return [
@ -53,14 +82,23 @@ class ServerService extends EquipmentService
'serviceinfo_uid', 'serviceinfo_uid',
"type", "type",
'title', 'title',
"serverpartinfo",
'price', 'price',
'amount', 'amount',
"serverpartinfo",
"ipinfo_uid",
"csinfo_uid",
'manufactur_at', 'manufactur_at',
"format_at", "format_at",
'status' 'status'
], ],
'filters' => ['clientinfo_uid', 'serviceinfo_uid', 'type', 'status'], 'filters' => [
'clientinfo_uid',
'serviceinfo_uid',
'type',
"ipinfo_uid",
"csinfo_uid",
'status'
],
]; ];
} }
public function getBatchjobFields(): array public function getBatchjobFields(): array
@ -88,27 +126,43 @@ class ServerService extends EquipmentService
} }
return $this->_csService; return $this->_csService;
} }
//partEntity 정보 추가
protected function getEntity_process(mixed $entity): ServerEntity
{
//서버 부품정보 정의
foreach (SERVER['PARTTYPES'] as $partType) {
$serverPartEnty = $this->getServerPartService()->getEntity(['serverinfo_uid' => $entity->getPK(), 'type' => $partType]);
if ($serverPartEnty) {
$entity->setServerPartEntity($partType, $serverPartEnty);
}
}
//서버 IP정보 정의
$entity->setIPEntities($this->getIPService()->getEntities(['serverinfo_uid' => $entity->getPK()]));
//서버 CS정보 정의
$entity->setCSEntities($this->getCSService()->getEntities(['serverinfo_uid' => $entity->getPK()]));
return $entity;
}
//기본 기능부분 //기본 기능부분
public function getFormFieldOption(string $field, array $options = []): array public function getFormFieldOption(string $field, array $options = []): array
{ {
switch ($field) { switch ($field) {
case 'serverpartinfo_cpu_uid': case 'CPU':
$options = $this->getServerPartService()->getFormFieldOption('partinfo_cpu_uid'); $options = $this->getServerPartService()->getFormFieldOption('partinfo_CPU_uid');
break; break;
case 'serverpartinfo_ram_uid': case 'RAM':
$options = $this->getServerPartService()->getFormFieldOption('partinfo_ram_uid'); $options = $this->getServerPartService()->getFormFieldOption('partinfo_RAM_uid');
break; break;
case 'serverpartinfo_disk_uid': case 'DISK':
$options = $this->getServerPartService()->getFormFieldOption('partinfo_disk_uid'); $options = $this->getServerPartService()->getFormFieldOption('partinfo_DISK_uid');
break; break;
case 'serverpartinfo_os_uid': case 'OS':
$options = $this->getServerPartService()->getFormFieldOption('partinfo_os_uid'); $options = $this->getServerPartService()->getFormFieldOption('partinfo_OS_uid');
break; break;
case 'serverpartinfo_db_uid': case 'serverpartinfo_DB_uid':
$options = $this->getServerPartService()->getFormFieldOption('partinfo_db_uid'); $options = $this->getServerPartService()->getFormFieldOption('partinfo_DB_uid');
break; break;
case 'serverpartinfo_software_uid': case 'SOFTWARE':
$options = $this->getServerPartService()->getFormFieldOption('partinfo_software_uid'); $options = $this->getServerPartService()->getFormFieldOption('partinfo_SOFTWARE_uid');
break; break;
case 'ipinfo_uid': //수정때문에 전체가 필요 case 'ipinfo_uid': //수정때문에 전체가 필요
$options = $this->getIPService()->getEntities(); $options = $this->getIPService()->getEntities();