dbmsv3 init...1

This commit is contained in:
choi.jh 2025-10-13 15:36:04 +09:00
parent 7e0b413a6b
commit 5d89fc7639
3 changed files with 10 additions and 18 deletions

View File

@ -56,8 +56,7 @@ class SearchController extends AdminController
} }
return $result; return $result;
} }
private function getChildServers(ServiceEntity $entity): array
protected function getChildServers(ServiceEntity $entity): array
{ {
$servers = []; $servers = [];
foreach ($this->getServerService()->getEntities(['serviceinfo_uid' => $entity->getPK()]) as $serverEntity) { foreach ($this->getServerService()->getEntities(['serviceinfo_uid' => $entity->getPK()]) as $serverEntity) {
@ -70,8 +69,6 @@ class SearchController extends AdminController
} }
return $servers; return $servers;
} }
//
protected function index_process(array $entities = []): array protected function index_process(array $entities = []): array
{ {
$keyword = $this->request->getGet('keyword'); // 검색어 $keyword = $this->request->getGet('keyword'); // 검색어
@ -104,14 +101,13 @@ class SearchController extends AdminController
// echo $builder->getCompiledSelect(); // echo $builder->getCompiledSelect();
// exit; // exit;
$results = $builder->get()->getResultArray(); $results = $builder->get()->getResultArray();
// dd($results); if (!count($results)) {
return [];
}
$uids = []; $uids = [];
foreach ($results as $result) { foreach ($results as $result) {
$uids[] = "'{$result['serviceinfo_uid']}'"; $uids[] = "'{$result['serviceinfo_uid']}'";
} }
if (!count($uids)) {
return [];
}
//서비스별 미납 Count //서비스별 미납 Count
$childServers = []; $childServers = [];
foreach ($this->getService()->getEntities("uid IN (" . implode(",", $uids) . ")") as $entity) { foreach ($this->getService()->getEntities("uid IN (" . implode(",", $uids) . ")") as $entity) {

View File

@ -134,6 +134,10 @@ abstract class CommonService
$this->setControlDatas('field_optons', $options); $this->setControlDatas('field_optons', $options);
} }
//Entity별로 작업처리시 //Entity별로 작업처리시
final public function getLastQuery(): string
{
return $this->getModel()->getLastQuery();
}
protected function getEntity_process(mixed $entity): mixed protected function getEntity_process(mixed $entity): mixed
{ {
return $entity; return $entity;
@ -153,7 +157,7 @@ abstract class CommonService
$message = sprintf( $message = sprintf(
"\n------%s SQL오류-----<BR>\n%s\n%s\n------------------------------\n", "\n------%s SQL오류-----<BR>\n%s\n%s\n------------------------------\n",
__FUNCTION__, __FUNCTION__,
$this->getModel()->getLastQuery(), $this->getLastQuery(),
$e->getMessage() $e->getMessage()
); );
throw new \Exception($message); throw new \Exception($message);
@ -176,12 +180,7 @@ abstract class CommonService
final public function getEntities(mixed $where = null, array $columns = ['*']): array final public function getEntities(mixed $where = null, array $columns = ['*']): array
{ {
try { try {
$entities = $this->getEntities_process($where, $columns); return $this->getEntities_process($where, $columns);
$debug = sprintf("debug.%s.%s", str_replace("\\", ".", get_class($this)), __FUNCTION__);
if (env($debug, false)) {
echo $this->getModel()->getLastQuery();
}
return $entities;
} catch (\Exception $e) { } catch (\Exception $e) {
$message = sprintf( $message = sprintf(
"\n------%s SQL오류-----<BR>\n%s\n%s\n------------------------------\n", "\n------%s SQL오류-----<BR>\n%s\n%s\n------------------------------\n",

View File

@ -186,9 +186,6 @@ class ServerService extends EquipmentService implements ServiceInterface
case 'serviceinfo_uid': case 'serviceinfo_uid':
$options = $this->getServiceService()->getEntities(); $options = $this->getServiceService()->getEntities();
break; break;
// case 'ip':
// $options = $this->getIPService()->getEntities();
// break;
default: default:
$options = parent::getFormOption($field, $options); $options = parent::getFormOption($field, $options);
break; break;