diff --git a/extdbms/lib/Controllers/DBMS/NavigatorController.php b/extdbms/lib/Controllers/DBMS/NavigatorController.php index 385c7d0..378fe94 100644 --- a/extdbms/lib/Controllers/DBMS/NavigatorController.php +++ b/extdbms/lib/Controllers/DBMS/NavigatorController.php @@ -31,7 +31,13 @@ class NavigatorController extends BaseController $clients = []; $ip = $this->getRequest('ip'); //IP형식이 ipv4인지 확인 후 값가져오기 - $services = $ip && $this->helper->isIPAddress($ip) ? $this->getServiceervice()->getEntitysByIP($ip) : $this->getServiceervice()->getEntitys(); + $services = []; + if ($ip && $this->helper->isIPAddress($ip)) { + $services = $this->getServiceervice()->getEntitysByIP($ip); + } else { + $this->getServiceervice()->getModel()->like($ip); + $this->getServiceervice()->getEntitys(); + } foreach ($services as $service) { $clients[$service->getPK()] = $this->getClientService()->getEntityByCode($service->getClientCode()); } diff --git a/extdbms/lib/Core/Model.php b/extdbms/lib/Core/Model.php index c14ef70..91f2784 100644 --- a/extdbms/lib/Core/Model.php +++ b/extdbms/lib/Core/Model.php @@ -149,6 +149,21 @@ abstract class Model { $this->_querys["JOIN"] = " {$type} JOIN {$table} ON {$match}"; } + final public function like(string $column, string $value, string $option = "both"): void + { + switch ($option) { + case 'before': + $value = "%{$value}"; + break; + case 'after': + $value = "{$value}%"; + break; + default: + $value = "%{$value}%"; + break; + } + $this->_querys["LIKE"] = "{$column} LIKE '{$$value}'"; + } final public function orderBy(string $column, string $direction = "DESC"): void { $this->_querys["ORDERBY"] = " ORDER BY {$column} {$direction}";