dbmsv2 init...1

This commit is contained in:
choi.jh 2025-08-19 18:53:53 +09:00
parent cb92efa856
commit 860cce5dbc
7 changed files with 61 additions and 38 deletions

View File

@ -4,8 +4,8 @@
"settings": { "settings": {
"width": 3000, "width": 3000,
"height": 3000, "height": 3000,
"scrollTop": 0, "scrollTop": -1180,
"scrollLeft": -690, "scrollLeft": -205,
"zoomLevel": 1, "zoomLevel": 1,
"show": 511, "show": 511,
"database": 4, "database": 4,
@ -147,9 +147,9 @@
"n61V7aSxLmcIeQqsYgAEE", "n61V7aSxLmcIeQqsYgAEE",
"5hP5ZiQGWDGf4HJrOiFb6", "5hP5ZiQGWDGf4HJrOiFb6",
"XPpipgVUsGKsXCW5YNg1X", "XPpipgVUsGKsXCW5YNg1X",
"eg4YJaXvxIwKhydn4tKEC",
"fMx3gLKi1fsfp7g26-QA9", "fMx3gLKi1fsfp7g26-QA9",
"xEoc72X0ErdGKU7rMzenm", "xEoc72X0ErdGKU7rMzenm",
"eg4YJaXvxIwKhydn4tKEC",
"zFbEbi2-nyWp4zEvOHsUG", "zFbEbi2-nyWp4zEvOHsUG",
"02r_3OPPiD_vAgD7rmZK4", "02r_3OPPiD_vAgD7rmZK4",
"Vb_CyMe0qvi7oxda4dUVW", "Vb_CyMe0qvi7oxda4dUVW",
@ -172,7 +172,7 @@
"color": "" "color": ""
}, },
"meta": { "meta": {
"updateAt": 1755592426935, "updateAt": 1755596145096,
"createAt": 1745819764137 "createAt": 1745819764137
} }
}, },

View File

@ -8,7 +8,7 @@ return [
'type' => "장비종류", 'type' => "장비종류",
'title' => "장비명", 'title' => "장비명",
'price' => "기본금액", 'price' => "기본금액",
'amount' => "서비스금액", 'total_price' => "최종금액",
'manufactur_at' => "입고일", 'manufactur_at' => "입고일",
'format_at' => "포맷보유", 'format_at' => "포맷보유",
'status' => "상태", 'status' => "상태",

View File

@ -2,6 +2,7 @@
namespace App\Libraries\DBMigration\Process; namespace App\Libraries\DBMigration\Process;
use App\Entities\Equipment\SwitchEntity;
use CodeIgniter\Database\BaseConnection; use CodeIgniter\Database\BaseConnection;
class SwitchCodeProcess implements MigrationProcessInterface class SwitchCodeProcess implements MigrationProcessInterface
@ -13,9 +14,13 @@ class SwitchCodeProcess implements MigrationProcessInterface
} }
public function process(array $row, int $cnt): void public function process(array $row, int $cnt): void
{ {
if (empty($row['service_sw']) || strlen($row['service_sw']) <= 4 || $row['service_sw'] === '1회성 장비') {
echo "{$cnt} -> SKIP SWITCHCODE\n";
return;
}
$temps = []; $temps = [];
$temps['code'] = trim($row['service_sw']); $temps['code'] = trim($row['service_sw']);
$temps['status'] = 'default'; $temps['status'] = SwitchEntity::DEFAULT_STATUS; // Assuming SwitchEntity has a STATUS_DEFAULT constant
if (!$this->db->table('switchinfo')->insert($temps)) { if (!$this->db->table('switchinfo')->insert($temps)) {
throw new \Exception($this->db->error()['message']); throw new \Exception($this->db->error()['message']);
} }

View File

@ -6,14 +6,6 @@ use App\Entities\Customer\ClientEntity;
use App\Services\CommonService; use App\Services\CommonService;
use App\Services\Customer\ClientService; use App\Services\Customer\ClientService;
use App\Services\Equipment\Part\CpuService;
use App\Services\Equipment\Part\DefenceService;
use App\Services\Equipment\Part\DomainService;
use App\Services\Equipment\Part\IpService;
use App\Services\Equipment\Part\LineService;
use App\Services\Equipment\Part\RamService;
use App\Services\Equipment\Part\SoftwareService;
use App\Services\Equipment\Part\StorageService;
use App\Services\Equipment\ServerService; use App\Services\Equipment\ServerService;
use App\Services\UserService; use App\Services\UserService;
use CodeIgniter\Model; use CodeIgniter\Model;
@ -63,14 +55,17 @@ abstract class CustomerService extends CommonService
public function getFormFieldOption(string $field, array $options = []): array public function getFormFieldOption(string $field, array $options = []): array
{ {
switch ($field) { switch ($field) {
case 'user_uid':
$options = $this->getUserService()->getEntities();
break;
case 'clientinfo_code': case 'clientinfo_code':
$options = $this->getClientService()->getEntities(); $options = $this->getClientService()->getEntities();
break; break;
case 'serviceinfo_code': case 'serviceinfo_code':
$options = $this->getServiceService()->getEntities(); $options = $this->getServiceService()->getEntities();
break; break;
case 'user_uid': case 'serverinfo_code':
$options = $this->getUserService()->getEntities(); $options = $this->getServerService()->getEntities();
break; break;
default: default:
$options = parent::getFormFieldOption($field, $options); $options = parent::getFormFieldOption($field, $options);
@ -83,7 +78,7 @@ abstract class CustomerService extends CommonService
{ {
$entity = $this->getClientService()->getEntity($uid); $entity = $this->getClientService()->getEntity($uid);
if (!$entity) { if (!$entity) {
throw new \Exception("{$uid}에 해당하는 고객/관리자 정보가 존재하지 않습니다. uid: {$uid}"); throw new \Exception("{$uid}에 해당하는 고객정보가 존재하지 않습니다. uid: {$uid}");
} }
return $entity; return $entity;
} }

View File

@ -63,24 +63,6 @@ class ServiceService extends CustomerService
// } // }
//기본 기능부분 //기본 기능부분
//FieldForm관련용 //FieldForm관련용
public function getFormFieldOption(string $field, array $options = []): array
{
switch ($field) {
case 'user_uid':
$options = $this->getUserService()->getEntities();
break;
case 'clientinfo_code':
$options = $this->getClientService()->getEntities();
break;
case 'serverinfo_code':
$options = $this->getServerService()->getEntities(['status' => ServerEntity::DEFAULT_STATUS]);
break;
default:
$options = parent::getFormFieldOption($field, $options);
break;
}
return $options;
}
//interval을 기준으로 최근 신규 서비스정보 가져오기 //interval을 기준으로 최근 신규 서비스정보 가져오기
final public function getEntitiesByNewService(int $interval, string $status = ServiceEntity::DEFAULT_STATUS): array final public function getEntitiesByNewService(int $interval, string $status = ServiceEntity::DEFAULT_STATUS): array
{ {

View File

@ -3,20 +3,25 @@
namespace App\Services\Equipment; namespace App\Services\Equipment;
use App\Services\CommonService; use App\Services\CommonService;
use App\Services\Customer\ClientService; use App\Services\Customer\ClientService;
use App\Services\Customer\ServiceService;
use App\Entities\Customer\ClientEntity;
use App\Services\Equipment\ServerService; use App\Services\Equipment\ServerService;
use App\Services\UserService;
use CodeIgniter\Model; use CodeIgniter\Model;
abstract class EquipmentService extends CommonService abstract class EquipmentService extends CommonService
{ {
private ?UserService $_userService = null;
private ?ClientService $_clientService = null; private ?ClientService $_clientService = null;
private ?ServerService $_serverService = null; private ?ServerService $_serverService = null;
private $_equipmentService = [];
protected function __construct(Model $model) protected function __construct(Model $model)
{ {
parent::__construct($model); parent::__construct($model);
$this->addClassName('Equipment'); $this->addClassName('Equipment');
} }
final public function getClientService(): ClientService final public function getClientService(): ClientService
{ {
if (!$this->_clientService) { if (!$this->_clientService) {
@ -24,6 +29,20 @@ abstract class EquipmentService extends CommonService
} }
return $this->_clientService; return $this->_clientService;
} }
final public function getUSerService(): UserService
{
if (!$this->_userService) {
$this->_userService = new UserService();
}
return $this->_userService;
}
final public function getServiceService(): ServiceService
{
if (!$this->_serviceService) {
$this->_serviceService = new ServiceService();
}
return $this->_serviceService;
}
final public function getServerService(): ServerService final public function getServerService(): ServerService
{ {
if (!$this->_serverService) { if (!$this->_serverService) {
@ -31,17 +50,37 @@ abstract class EquipmentService extends CommonService
} }
return $this->_serverService; return $this->_serverService;
} }
//ServiceItemController,ServiceController에서 사용
//기본기능
//FieldForm관련용 //FieldForm관련용
public function getFormFieldOption(string $field, array $options = []): array public function getFormFieldOption(string $field, array $options = []): array
{ {
switch ($field) { switch ($field) {
case 'user_uid':
$options = $this->getUserService()->getEntities();
break;
case 'clientinfo_code': case 'clientinfo_code':
$options = $this->getClientService()->getEntities(); $options = $this->getClientService()->getEntities();
break; break;
case 'serviceinfo_code':
$options = $this->getServiceService()->getEntities();
break;
case 'serverinfo_code':
$options = $this->getServerService()->getEntities();
break;
default: default:
$options = parent::getFormFieldOption($field, $options); $options = parent::getFormFieldOption($field, $options);
break; break;
} }
return $options; return $options;
} }
//ItemType에 따른 FilterOption 설정용
final public function getClient(int $uid): ClientEntity
{
$entity = $this->getClientService()->getEntity($uid);
if (!$entity) {
throw new \Exception("{$uid}에 해당하는 고객정보가 존재하지 않습니다. uid: {$uid}");
}
return $entity;
}
} }

View File

@ -22,7 +22,7 @@ class ServerService extends EquipmentService
"type", "type",
"title", "title",
"price", "price",
"amount", "total_price",
"manufactur_at", "manufactur_at",
"format_at", "format_at",
"status", "status",
@ -38,8 +38,10 @@ class ServerService extends EquipmentService
} }
public function getIndexFields(): array public function getIndexFields(): array
{ {
return ['clientinfo_code', 'serviceinfo_code', "type", 'title', 'price', 'amount', 'manufactur_at', "format_at", 'status']; return ['clientinfo_code', 'serviceinfo_code', "type", 'title', 'price', 'total_price', 'manufactur_at', "format_at", 'status'];
} }
//기본 기능부분
//FieldForm관련용
//List 검색용 //List 검색용
//OrderBy 처리 //OrderBy 처리
public function setOrderBy(mixed $field = null, mixed $value = null): void public function setOrderBy(mixed $field = null, mixed $value = null): void