155 lines
4.8 KiB
PHP
155 lines
4.8 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Equipment;
|
|
|
|
use App\Entities\Equipment\PartEntity;
|
|
use App\Models\Equipment\ServerModel;
|
|
use App\Services\Equipment\EquipmentService;
|
|
|
|
class ServerService extends EquipmentService
|
|
{
|
|
private ?PartService $_partService = null;
|
|
private ?IPService $_ipService = null;
|
|
private ?CSService $_csService = null;
|
|
public function __construct()
|
|
{
|
|
parent::__construct(new ServerModel());
|
|
$this->addClassName('Server');
|
|
}
|
|
public function getFormFields(): array
|
|
{
|
|
return [
|
|
'fields' => [
|
|
"code",
|
|
"type",
|
|
"title",
|
|
"partinfo_cpu_uid",
|
|
"partinfo_ram_uid",
|
|
"partinfo_disk_uid",
|
|
"partinfo_os_uid",
|
|
"price",
|
|
"manufactur_at",
|
|
"format_at",
|
|
"status",
|
|
],
|
|
'filters' => [
|
|
"clientinfo_uid",
|
|
"serviceinfo_uid",
|
|
"type",
|
|
"title",
|
|
"partinfo_cpu_uid",
|
|
"partinfo_ram_uid",
|
|
"partinfo_disk_uid",
|
|
"partinfo_os_uid",
|
|
"status"
|
|
],
|
|
];
|
|
}
|
|
public function getIndexFields(): array
|
|
{
|
|
return [
|
|
'fields' => [
|
|
'clientinfo_uid',
|
|
'serviceinfo_uid',
|
|
'partinfo_uid',
|
|
"type",
|
|
'title',
|
|
'price',
|
|
'total_price',
|
|
'manufactur_at',
|
|
"format_at",
|
|
'status'
|
|
],
|
|
'filters' => ['clientinfo_uid', 'serviceinfo_uid', 'type', 'partinfo_uid', 'status'],
|
|
'batchjob_fields' => ['clientinfo_uid', 'partinfo_uid', 'status'],
|
|
'batchjob_buttions' => [
|
|
'batchjob' => '일괄 처리',
|
|
'batchjob_delete' => '일괄 삭제',
|
|
]
|
|
];
|
|
}
|
|
final public function getPartService(): PartService
|
|
{
|
|
if (!$this->_partService) {
|
|
$this->_partService = new PartService();
|
|
}
|
|
return $this->_partService;
|
|
}
|
|
final public function getIPService(): IPService
|
|
{
|
|
if (!$this->_ipService) {
|
|
$this->_ipService = new IPService();
|
|
}
|
|
return $this->_ipService;
|
|
}
|
|
final public function getCSService(): CSService
|
|
{
|
|
if (!$this->_csService) {
|
|
$this->_csService = new CSService();
|
|
}
|
|
return $this->_csService;
|
|
}
|
|
//기본 기능부분
|
|
//FieldForm관련용
|
|
public function getFormFieldOption(string $field, array $options = []): array
|
|
{
|
|
switch ($field) {
|
|
case 'partinfo_cpu_uid':
|
|
$options = $this->getPartService()->getEntities([
|
|
'type' => 'CPU'
|
|
]);
|
|
break;
|
|
case 'partinfo_ram_uid':
|
|
$options = $this->getPartService()->getEntities([
|
|
'type' => 'RAM'
|
|
]);
|
|
break;
|
|
case 'partinfo_disk_uid':
|
|
$options = $this->getPartService()->getEntities([
|
|
'type' => 'DISK'
|
|
]);
|
|
break;
|
|
case 'partinfo_os_uid':
|
|
$options = $this->getPartService()->getEntities([
|
|
'type' => 'OS'
|
|
]);
|
|
break;
|
|
case 'partinfo_db_uid':
|
|
$options = $this->getPartService()->getEntities([
|
|
'type' => 'DB'
|
|
]);
|
|
break;
|
|
case 'partinfo_software_uid':
|
|
$options = $this->getPartService()->getEntities([
|
|
'type' => 'SOFTWARE'
|
|
]);
|
|
break;
|
|
case 'partinfo_uid': //수정때문에 전체가 필요
|
|
$options = $this->getPartService()->getEntities();
|
|
break;
|
|
case 'ipinfo_uid': //수정때문에 전체가 필요
|
|
$options = $this->getIPService()->getEntities();
|
|
break;
|
|
case 'csinfo_uid': //수정때문에 전체가 필요
|
|
$options = $this->getCSService()->getEntities();
|
|
break;
|
|
default:
|
|
$options = parent::getFormFieldOption($field, $options);
|
|
break;
|
|
}
|
|
return $options;
|
|
}
|
|
//create용 장비코드 마지막번호 가져오기
|
|
final public function getLastestCode(int $default = 1): string
|
|
{
|
|
return $this->getModel()->getLastestCode($default);
|
|
}
|
|
//List 검색용
|
|
//OrderBy 처리
|
|
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
|
{
|
|
$this->getModel()->orderBy("code ASC,title ASC");
|
|
parent::setOrderBy($field, $value);
|
|
}
|
|
}
|