dbmsv2 init...1
This commit is contained in:
parent
9fa605e130
commit
66debb0558
@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
namespace App\Entities\Equipment;
|
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 PK = IPModel::PK;
|
||||||
const TITLE = IpModel::TITLE;
|
const TITLE = IPModel::TITLE;
|
||||||
const STATUS_AVAILABLE = "available";
|
const STATUS_AVAILABLE = "available";
|
||||||
const STATUS_OCCUPIED = "occupied";
|
const STATUS_OCCUPIED = "occupied";
|
||||||
const STATUS_FORBIDDEN = "forbidden";
|
const STATUS_FORBIDDEN = "forbidden";
|
||||||
@ -279,6 +279,9 @@ class CommonHelper
|
|||||||
case 'clientinfo_uid':
|
case 'clientinfo_uid':
|
||||||
case 'serviceinfo_uid':
|
case 'serviceinfo_uid':
|
||||||
case 'serverinfo_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';
|
$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);
|
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$field], $extras);
|
||||||
break;
|
break;
|
||||||
|
|||||||
14
app/Helpers/Equipment/IPHelper.php
Normal file
14
app/Helpers/Equipment/IPHelper.php
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -15,6 +15,9 @@ return [
|
|||||||
'updated_at' => "수정일",
|
'updated_at' => "수정일",
|
||||||
'created_at' => "작성일",
|
'created_at' => "작성일",
|
||||||
'deleted_at' => "삭제일",
|
'deleted_at' => "삭제일",
|
||||||
|
"partinfo_uid" => "부품정보",
|
||||||
|
"ipinfo_uid" => "IP정보",
|
||||||
|
"csinfo_uid" => "CS정보",
|
||||||
],
|
],
|
||||||
"TYPE" => [
|
"TYPE" => [
|
||||||
'hp' => "HP",
|
'hp' => "HP",
|
||||||
|
|||||||
@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
namespace App\Models\Equipment;
|
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 TABLE = "ipinfo";
|
||||||
const PK = "uid";
|
const PK = "uid";
|
||||||
const TITLE = "ip";
|
const TITLE = "ip";
|
||||||
protected $table = self::TABLE;
|
protected $table = self::TABLE;
|
||||||
protected $primaryKey = self::PK;
|
protected $primaryKey = self::PK;
|
||||||
protected $returnType = IpEntity::class;
|
protected $returnType = IPEntity::class;
|
||||||
protected $allowedFields = [
|
protected $allowedFields = [
|
||||||
"lineinfo_uid",
|
"lineinfo_uid",
|
||||||
"old_clientinfo_uid",
|
"old_clientinfo_uid",
|
||||||
@ -2,19 +2,19 @@
|
|||||||
|
|
||||||
namespace App\Services\Equipment;
|
namespace App\Services\Equipment;
|
||||||
|
|
||||||
use App\Entities\Equipment\IpEntity;
|
use App\Entities\Equipment\IPEntity;
|
||||||
use App\Entities\Equipment\LineEntity;
|
use App\Entities\Equipment\LineEntity;
|
||||||
use App\Models\Equipment\IpModel;
|
use App\Models\Equipment\IPModel;
|
||||||
use App\Services\Equipment\EquipmentService;
|
use App\Services\Equipment\EquipmentService;
|
||||||
use App\Services\Equipment\LineService;
|
use App\Services\Equipment\LineService;
|
||||||
|
|
||||||
class IpService extends EquipmentService
|
class IPService extends EquipmentService
|
||||||
{
|
{
|
||||||
private ?LineService $_lineService = null;
|
private ?LineService $_lineService = null;
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct(new IpModel());
|
parent::__construct(new IPModel());
|
||||||
$this->addClassName('Ip');
|
$this->addClassName('IP');
|
||||||
}
|
}
|
||||||
public function getFormFields(): array
|
public function getFormFields(): array
|
||||||
{
|
{
|
||||||
@ -62,18 +62,18 @@ class IpService extends EquipmentService
|
|||||||
}
|
}
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
public function createByLineInfo(LineEntity $entity, string $ip): IpEntity
|
public function createByLineInfo(LineEntity $entity, string $ip): IPEntity
|
||||||
{
|
{
|
||||||
$formDatas = [
|
$formDatas = [
|
||||||
'lineinfo_uid' => $entity->getPK(),
|
'lineinfo_uid' => $entity->getPK(),
|
||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'status' => IpEntity::DEFAULT_STATUS,
|
'status' => IPEntity::DEFAULT_STATUS,
|
||||||
];
|
];
|
||||||
return $this->create($formDatas);
|
return $this->create($formDatas);
|
||||||
}
|
}
|
||||||
|
|
||||||
//상태변경
|
//상태변경
|
||||||
public function setStatus(int $uid, string $status): IpEntity
|
public function setStatus(int $uid, string $status): IPEntity
|
||||||
{
|
{
|
||||||
//code의 경우 사용가능/사용중으로 설정작업
|
//code의 경우 사용가능/사용중으로 설정작업
|
||||||
$entity = $this->getEntity($uid);
|
$entity = $this->getEntity($uid);
|
||||||
@ -2,12 +2,17 @@
|
|||||||
|
|
||||||
namespace App\Services\Equipment;
|
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\Models\Equipment\ServerModel;
|
||||||
use App\Services\Equipment\EquipmentService;
|
use App\Services\Equipment\EquipmentService;
|
||||||
|
|
||||||
class ServerService extends EquipmentService
|
class ServerService extends EquipmentService
|
||||||
{
|
{
|
||||||
|
private ?PartService $_partService = null;
|
||||||
|
private ?IPService $_ipService = null;
|
||||||
|
private ?CSService $_csService = null;
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct(new ServerModel());
|
parent::__construct(new ServerModel());
|
||||||
@ -24,11 +29,14 @@ class ServerService extends EquipmentService
|
|||||||
"manufactur_at",
|
"manufactur_at",
|
||||||
"format_at",
|
"format_at",
|
||||||
"status",
|
"status",
|
||||||
|
"partinfo_uid",
|
||||||
|
"ipinfo_uid",
|
||||||
|
"csinfo_uid",
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
public function getFilterFields(): array
|
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
|
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'];
|
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관련용
|
//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 검색용
|
//List 검색용
|
||||||
//OrderBy 처리
|
//OrderBy 처리
|
||||||
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user