dbms_init...1

This commit is contained in:
최준흠 2025-05-22 18:59:10 +09:00
parent 4f0e8869ce
commit 125516a4ef
16 changed files with 126 additions and 45 deletions

View File

@ -4,9 +4,10 @@ namespace App\Controllers\Admin\Equipment;
use App\Controllers\Admin\AdminController; use App\Controllers\Admin\AdminController;
use App\Services\Customer\ClientService; use App\Services\Customer\ClientService;
use App\Services\Customer\ServiceService;
use App\Services\Equipment\LineService; use App\Services\Equipment\LineService;
use App\Services\Equipment\ServerService;
use App\Services\Equipment\ServerService;
use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
@ -16,6 +17,7 @@ abstract class EquipmentController extends AdminController
private ?ClientService $_clientService = null; private ?ClientService $_clientService = null;
private ?LineService $_lineService = null; private ?LineService $_lineService = null;
private ?ServerService $_serverService = null; private ?ServerService $_serverService = null;
private ?ServiceService $_serviceService = 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);
@ -29,6 +31,14 @@ abstract class EquipmentController extends AdminController
} }
return $this->_clientService; return $this->_clientService;
} }
final public function getServiceService(): ServiceService
{
if (!$this->_serviceService) {
$this->_serviceService = new ServiceService($this->request);
}
return $this->_serviceService;
}
final public function getLineService(): LineService final public function getLineService(): LineService
{ {
if (!$this->_lineService) { if (!$this->_lineService) {
@ -47,6 +57,14 @@ abstract class EquipmentController extends AdminController
protected function getFormFieldOption(string $field, array $options): array protected function getFormFieldOption(string $field, array $options): array
{ {
switch ($field) { switch ($field) {
case 'serviceinfo_uid':
$temps = [];
foreach ($this->getServiceService()->getEntities() as $entity) {
$temps[$entity->getPK()] = $entity->getTitle();
}
$options[$field] = $temps;
// dd($options);
break;
case 'clientinfo_uid': case 'clientinfo_uid':
$temps = []; $temps = [];
foreach ($this->getClientService()->getEntities() as $entity) { foreach ($this->getClientService()->getEntities() as $entity) {

View File

@ -2,15 +2,17 @@
namespace App\Controllers\Admin\Equipment\Link; namespace App\Controllers\Admin\Equipment\Link;
use App\Helpers\Equipment\Link\CpuHelper;
use App\Services\Equipment\Link\CpuService;
use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use App\Helpers\Equipment\Link\CpuHelper;
use App\Services\Equipment\Link\CpuService;
use App\Services\Equipment\Part\CpuService as PartService;
class CpuController extends LinkController class CpuController extends LinkController
{ {
protected ?PartService $_partService = 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);
@ -33,12 +35,19 @@ class CpuController extends LinkController
} }
return $this->_helper; return $this->_helper;
} }
public function getPartService(): PartService
{
if (!$this->_partService) {
$this->_partService = new PartService($this->request);
}
return $this->_partService;
}
//Index,FieldForm관련 //Index,FieldForm관련
protected function index_process(): array protected function index_process(): array
{ {
$fields = [ $fields = [
'fields' => ['billing_type', 'serviceinfo_uid', 'serverinfo_uid', 'cpuinfo_uid', 'amount'], 'fields' => ['serverinfo_uid', 'cpuinfo_uid'],
]; ];
$this->init('index', $fields); $this->init('index', $fields);
$this->modal_type = 'modal_iframe'; $this->modal_type = 'modal_iframe';

View File

@ -2,15 +2,17 @@
namespace App\Controllers\Admin\Equipment\Link; namespace App\Controllers\Admin\Equipment\Link;
use App\Helpers\Equipment\Link\DiskHelper;
use App\Services\Equipment\Link\DiskService;
use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use App\Helpers\Equipment\Link\DiskHelper;
use App\Services\Equipment\Link\DiskService;
use App\Services\Equipment\Part\DiskService as PartService;
class DiskController extends LinkController class DiskController extends LinkController
{ {
protected ?PartService $_partService = 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);
@ -33,11 +35,18 @@ class DiskController extends LinkController
} }
return $this->_helper; return $this->_helper;
} }
public function getPartService(): PartService
{
if (!$this->_partService) {
$this->_partService = new PartService($this->request);
}
return $this->_partService;
}
//Index,FieldForm관련 //Index,FieldForm관련
protected function index_process(): array protected function index_process(): array
{ {
$fields = [ $fields = [
'fields' => ['billing_type', 'serviceinfo_uid', 'serverinfo_uid', 'diskinfo_uid', 'amount'], 'fields' => ['serverinfo_uid', 'diskinfo_uid'],
]; ];
$this->init('index', $fields); $this->init('index', $fields);
$this->modal_type = 'modal_iframe'; $this->modal_type = 'modal_iframe';

View File

@ -17,6 +17,7 @@ abstract class LinkController extends EquipmentController
$this->uri_path .= 'part/'; $this->uri_path .= 'part/';
// $this->view_path .= "part" . DIRECTORY_SEPARATOR; // $this->view_path .= "part" . DIRECTORY_SEPARATOR;
} }
abstract public function getPartService(): mixed;
protected function setOrderByForList() protected function setOrderByForList()
{ {
@ -39,4 +40,32 @@ abstract class LinkController extends EquipmentController
} }
return $result; return $result;
} }
protected function getFormFieldOption(string $field, array $options): array
{
switch ($field) {
case 'serverinfo_uid':
$temps = [];
foreach ($this->getServerService()->getEntities() as $entity) {
$temps[$entity->getPK()] = $entity->getTitle();
}
$options[$field] = $temps;
// dd($options);
break;
case 'cpuinfo_uid':
case 'raminfo_uid':
case 'diskinfo_uid':
$temps = [];
foreach ($this->getPartService()->getEntities() as $entity) {
$temps[$entity->getPK()] = $entity->getTitle();
}
$options[$field] = $temps;
// dd($options);
break;
default:
$options = parent::getFormFieldOption($field, $options);
break;
}
return $options;
}
} }

View File

@ -2,15 +2,17 @@
namespace App\Controllers\Admin\Equipment\Link; namespace App\Controllers\Admin\Equipment\Link;
use App\Helpers\Equipment\Link\RamHelper;
use App\Services\Equipment\Link\RamService;
use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use App\Helpers\Equipment\Link\RamHelper;
use App\Services\Equipment\Link\RamService;
use App\Services\Equipment\Part\RamService as PartService;
class RamController extends LinkController class RamController extends LinkController
{ {
protected ?PartService $_partService = 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);
@ -33,11 +35,18 @@ class RamController extends LinkController
} }
return $this->_helper; return $this->_helper;
} }
public function getPartService(): PartService
{
if (!$this->_partService) {
$this->_partService = new PartService($this->request);
}
return $this->_partService;
}
//Index,FieldForm관련 //Index,FieldForm관련
protected function index_process(): array protected function index_process(): array
{ {
$fields = [ $fields = [
'fields' => ['billing_type', 'serviceinfo_uid', 'serverinfo_uid', 'raminfo_uid', 'amount'], 'fields' => ['serverinfo_uid', 'raminfo_uid'],
]; ];
$this->init('index', $fields); $this->init('index', $fields);
$this->modal_type = 'modal_iframe'; $this->modal_type = 'modal_iframe';

View File

@ -10,4 +10,8 @@ return [
'updated_at' => "수정일", 'updated_at' => "수정일",
'created_at' => "작성일", 'created_at' => "작성일",
], ],
"BILLING_TYPE" => [
"month" => "월별",
"onetime" => "일회성",
],
]; ];

View File

@ -10,4 +10,8 @@ return [
'updated_at' => "수정일", 'updated_at' => "수정일",
'created_at' => "작성일", 'created_at' => "작성일",
], ],
"BILLING_TYPE" => [
"month" => "월별",
"onetime" => "일회성",
],
]; ];

View File

@ -10,4 +10,8 @@ return [
'updated_at' => "수정일", 'updated_at' => "수정일",
'created_at' => "작성일", 'created_at' => "작성일",
], ],
"BILLING_TYPE" => [
"month" => "월별",
"onetime" => "일회성",
],
]; ];

View File

@ -13,11 +13,8 @@ class CpuModel extends LinkModel
protected $primaryKey = self::PK; protected $primaryKey = self::PK;
protected $returnType = CpuEntity::class; protected $returnType = CpuEntity::class;
protected $allowedFields = [ protected $allowedFields = [
"serviceinfo_uid",
"serverinfo_uid", "serverinfo_uid",
"cpuinfo_uid", "cpuinfo_uid",
"billing_type",
"amount",
"updated_at", "updated_at",
]; ];
public function __construct() public function __construct()

View File

@ -13,11 +13,8 @@ class DiskModel extends LinkModel
protected $primaryKey = self::PK; protected $primaryKey = self::PK;
protected $returnType = DiskEntity::class; protected $returnType = DiskEntity::class;
protected $allowedFields = [ protected $allowedFields = [
"serviceinfo_uid",
"serverinfo_uid", "serverinfo_uid",
"diskinfo_uid", "diskinfo_uid",
"billing_type",
"amount",
"updated_at", "updated_at",
]; ];
public function __construct() public function __construct()

View File

@ -16,14 +16,10 @@ abstract class LinkModel extends EquipmentModel
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true)); throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
} }
switch ($field) { switch ($field) {
case "serviceinfo_uid":
case "serverinfo_uid": case "serverinfo_uid":
case "cpuinfo_uid": case "cpuinfo_uid":
case "raminfo_uid": case "raminfo_uid":
case "diskinfo_uid": case "diskinfo_uid":
$rule = "required|trim|string";
break;
case "amount":
$rule = "required|numeric"; $rule = "required|numeric";
break; break;
default: default:

View File

@ -13,11 +13,8 @@ class RamModel extends LinkModel
protected $primaryKey = self::PK; protected $primaryKey = self::PK;
protected $returnType = RamEntity::class; protected $returnType = RamEntity::class;
protected $allowedFields = [ protected $allowedFields = [
"serviceinfo_uid",
"serverinfo_uid", "serverinfo_uid",
"raminfo_uid", "raminfo_uid",
"billing_type",
"amount",
"updated_at", "updated_at",
]; ];
public function __construct() public function __construct()

View File

@ -25,15 +25,20 @@ class CpuService extends LinkService
{ {
return new CpuEntity(); return new CpuEntity();
} }
public function getFields(): array public function getFields(): array
{ {
return [ return [
"billing_type",
"serviceinfo_uid",
"serverinfo_uid", "serverinfo_uid",
"cpuinfo_uid", "cpuinfo_uid",
"amount",
]; ];
} }
public function getFilterFields(): array
{
return ["serverinfo_uid", "cpuinfo_uid"];
}
public function getBatchJobFields(): array
{
return [];
}
} }

View File

@ -29,11 +29,17 @@ class DiskService extends LinkService
public function getFields(): array public function getFields(): array
{ {
return [ return [
"billing_type",
"serviceinfo_uid",
"serverinfo_uid", "serverinfo_uid",
"diskinfo_uid", "diskinfo_uid",
"amount",
]; ];
} }
public function getFilterFields(): array
{
return ["serverinfo_uid", "diskinfo_uid"];
}
public function getBatchJobFields(): array
{
return [];
}
} }

View File

@ -16,13 +16,4 @@ abstract class LinkService extends EquipmentService
{ {
return parent::getClassName() . DIRECTORY_SEPARATOR . "Link"; return parent::getClassName() . DIRECTORY_SEPARATOR . "Link";
} }
public function getFilterFields(): array
{
return [];
}
public function getBatchJobFields(): array
{
return [];
}
} }

View File

@ -29,11 +29,17 @@ class RamService extends LinkService
public function getFields(): array public function getFields(): array
{ {
return [ return [
"billing_type",
"serviceinfo_uid",
"serverinfo_uid", "serverinfo_uid",
"raminfo_uid", "raminfo_uid",
"amount",
]; ];
} }
public function getFilterFields(): array
{
return ["serverinfo_uid", "raminfo_uid"];
}
public function getBatchJobFields(): array
{
return [];
}
} }