dbmsv2 init...1

This commit is contained in:
choi.jh 2025-08-20 17:53:44 +09:00
parent 9fa605e130
commit 66debb0558
9 changed files with 84 additions and 31 deletions

View File

@ -2,12 +2,12 @@
namespace App\Entities\Equipment;
use App\Models\Equipment\IpModel;
use App\Models\Equipment\IPModel;
class IpEntity extends EquipmentEntity
class IPEntity extends EquipmentEntity
{
const PK = IpModel::PK;
const TITLE = IpModel::TITLE;
const PK = IPModel::PK;
const TITLE = IPModel::TITLE;
const STATUS_AVAILABLE = "available";
const STATUS_OCCUPIED = "occupied";
const STATUS_FORBIDDEN = "forbidden";

View File

@ -279,6 +279,9 @@ class CommonHelper
case 'clientinfo_uid':
case 'serviceinfo_uid':
case 'serverinfo_uid':
case 'partinfo_uid':
case 'ipinfo_uid':
case 'csinfo_uid':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$field], $extras);
break;

View File

@ -0,0 +1,14 @@
<?php
namespace App\Helpers\Equipment;
use App\Models\Equipment\IPModel;
class IPHelper extends EquipmentHelper
{
public function __construct()
{
parent::__construct();
$this->setTitleField(field: IPModel::TITLE);
}
}

View File

@ -1,14 +0,0 @@
<?php
namespace App\Helpers\Equipment;
use App\Models\Equipment\IpModel;
class IpHelper extends EquipmentHelper
{
public function __construct()
{
parent::__construct();
$this->setTitleField(field: IpModel::TITLE);
}
}

View File

@ -15,6 +15,9 @@ return [
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
"partinfo_uid" => "부품정보",
"ipinfo_uid" => "IP정보",
"csinfo_uid" => "CS정보",
],
"TYPE" => [
'hp' => "HP",

View File

@ -2,16 +2,16 @@
namespace App\Models\Equipment;
use App\Entities\Equipment\IpEntity;
use App\Entities\Equipment\IPEntity;
class IpModel extends EquipmentModel
class IPModel extends EquipmentModel
{
const TABLE = "ipinfo";
const PK = "uid";
const TITLE = "ip";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = IpEntity::class;
protected $returnType = IPEntity::class;
protected $allowedFields = [
"lineinfo_uid",
"old_clientinfo_uid",

View File

@ -2,19 +2,19 @@
namespace App\Services\Equipment;
use App\Entities\Equipment\IpEntity;
use App\Entities\Equipment\IPEntity;
use App\Entities\Equipment\LineEntity;
use App\Models\Equipment\IpModel;
use App\Models\Equipment\IPModel;
use App\Services\Equipment\EquipmentService;
use App\Services\Equipment\LineService;
class IpService extends EquipmentService
class IPService extends EquipmentService
{
private ?LineService $_lineService = null;
public function __construct()
{
parent::__construct(new IpModel());
$this->addClassName('Ip');
parent::__construct(new IPModel());
$this->addClassName('IP');
}
public function getFormFields(): array
{
@ -62,18 +62,18 @@ class IpService extends EquipmentService
}
return $options;
}
public function createByLineInfo(LineEntity $entity, string $ip): IpEntity
public function createByLineInfo(LineEntity $entity, string $ip): IPEntity
{
$formDatas = [
'lineinfo_uid' => $entity->getPK(),
'ip' => $ip,
'status' => IpEntity::DEFAULT_STATUS,
'status' => IPEntity::DEFAULT_STATUS,
];
return $this->create($formDatas);
}
//상태변경
public function setStatus(int $uid, string $status): IpEntity
public function setStatus(int $uid, string $status): IPEntity
{
//code의 경우 사용가능/사용중으로 설정작업
$entity = $this->getEntity($uid);

View File

@ -2,12 +2,17 @@
namespace App\Services\Equipment;
use App\Entities\Equipment\ServerEntity;
use App\Entities\Equipment\PartEntity;
use App\Entities\Equipment\IPEntity;
use App\Entities\Equipment\CSEntity;
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());
@ -24,11 +29,14 @@ class ServerService extends EquipmentService
"manufactur_at",
"format_at",
"status",
"partinfo_uid",
"ipinfo_uid",
"csinfo_uid",
];
}
public function getFilterFields(): array
{
return ['clientinfo_uid', 'serviceinfo_uid', 'type', 'status'];
return ['clientinfo_uid', 'serviceinfo_uid', 'type', 'status', 'partinfo_uid', 'ipinfo_uid', 'csinfo_uid'];
}
public function getBatchJobFields(): array
{
@ -38,8 +46,47 @@ class ServerService extends EquipmentService
{
return ['clientinfo_uid', 'serviceinfo_uid', "type", 'title', 'price', 'total_price', 'manufactur_at', "format_at", 'status'];
}
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_uid':
$options = $this->getPartService()->getEntities(['status' => PartEntity::STATUS_AVAILABLE]);
break;
case 'ipinfo_uid':
$options = $this->getIPService()->getEntities(['status' => IPEntity::STATUS_AVAILABLE]);
break;
case 'csinfo_uid':
$options = $this->getCSService()->getEntities(['status' => CSEntity::STATUS_AVAILABLE]);
break;
default:
$options = parent::getFormFieldOption($field, $options);
break;
}
return $options;
}
//List 검색용
//OrderBy 처리
public function setOrderBy(mixed $field = null, mixed $value = null): void