dbmsv2/app/Services/Part/SWITCHService.php
2025-09-25 18:31:14 +09:00

90 lines
2.4 KiB
PHP

<?php
namespace App\Services\Part;
use App\Helpers\Part\SWITCHHelper;
use App\Models\Part\SWITCHModel;
use App\Services\Customer\ServiceService;
use App\Services\Equipment\ServerService;
use App\Services\Part\PartService;
class SWITCHService extends PartService
{
private ?ServiceService $_serviceService = null;
private ?ServerService $_serverService = null;
public function __construct()
{
parent::__construct(new SWITCHModel(), new SWITCHHelper());
$this->addClassName('SWITCH');
}
public function getFormFields(): array
{
return [
"code",
"price",
"status",
];
}
public function getFormFilters(): array
{
return [
'clientinfo_uid',
'serviceinfo_uid',
'serverinfo_uid',
'status'
];
}
public function getIndexFields(): array
{
return [
'clientinfo_uid',
'serviceinfo_uid',
'serverinfo_uid',
"price",
'status',
];
}
public function getBatchjobFields(): array
{
return ['clientinfo_uid', 'serverinfo_uid', 'status'];
}
public function getServiceService(): ServiceService
{
if (!$this->_serviceService) {
$this->_serviceService = new ServiceService();
}
return $this->_serviceService;
}
public function getServerService(): ServerService
{
if (!$this->_serverService) {
$this->_serverService = new ServerService();
}
return $this->_serverService;
}
//기본 기능부분
public function getFormOption(string $field, array $options = []): array
{
switch ($field) {
case 'serviceinfo_uid':
$options = $this->getServiceService()->getEntities();
break;
case 'serverinfo_uid':
$options = $this->getServerService()->getEntities();
break;
default:
$options = parent::getFormOption($field, $options);
break;
}
return $options;
}
//FieldForm관련용
//List 검색용
//OrderBy 처리
public function setOrderBy(mixed $field = null, mixed $value = null): void
{
$this->getModel()->orderBy('code', 'ASC');
parent::setOrderBy($field, $value);
}
}