dbms_init...1
This commit is contained in:
parent
5d53fb1a6e
commit
b07ea18f34
@ -65,19 +65,4 @@ class ClientController extends CustomerController
|
|||||||
return $validation;
|
return $validation;
|
||||||
}
|
}
|
||||||
//Index,FieldForm관련.
|
//Index,FieldForm관련.
|
||||||
protected function setFilterConditionForList(): void
|
|
||||||
{
|
|
||||||
foreach ($this->getFilterFields() as $field) {
|
|
||||||
$this->$field = $this->request->getVar($field);
|
|
||||||
if ($this->$field !== null && $this->$field !== '') {
|
|
||||||
if ($field === 'role') {
|
|
||||||
$where = "FIND_IN_SET(" . $this->getService()->getModel()->escape($this->$field) . ", {$this->getService()->getModel()->getTable()}.{$field}) > 0";
|
|
||||||
//FIND_IN_SET()은 MySQL 함수이므로 CodeIgniter가 이를 일반 컬럼명으로 착각하고 escape하게 되면 오류가 발생합니다. 따라서 ->where($sql, null, false)로 명시하여 escape를 꺼줘야 정상 작동
|
|
||||||
$this->getService()->getModel()->where($where, null, false);
|
|
||||||
} else {
|
|
||||||
$this->getService()->getModel()->where("{$this->getService()->getModel()->getTable()}.{$field}", $this->$field);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,12 +101,6 @@ class ServicePaymentController extends CustomerController
|
|||||||
parent::view_process($entity);
|
parent::view_process($entity);
|
||||||
}
|
}
|
||||||
//List 관련
|
//List 관련
|
||||||
protected function setOrderByForList(): void
|
|
||||||
{
|
|
||||||
//OrderBy 처리
|
|
||||||
$this->getService()->getModel()->orderBy('billing_at', 'ASC', false);
|
|
||||||
parent::setOrderByForList();
|
|
||||||
}
|
|
||||||
protected function index_process(): void
|
protected function index_process(): void
|
||||||
{
|
{
|
||||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||||
|
|||||||
@ -35,10 +35,4 @@ class CodeController extends EquipmentController
|
|||||||
return $this->_helper;
|
return $this->_helper;
|
||||||
}
|
}
|
||||||
//Index,FieldForm관련
|
//Index,FieldForm관련
|
||||||
protected function setOrderByForList(): void
|
|
||||||
{
|
|
||||||
//OrderBy 처리
|
|
||||||
$this->getService()->getModel()->orderBy('code', 'ASC', false);
|
|
||||||
parent::setOrderByForList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,10 +35,4 @@ class CpuController extends PartController
|
|||||||
return $this->_helper;
|
return $this->_helper;
|
||||||
}
|
}
|
||||||
//Index,FieldForm관련
|
//Index,FieldForm관련
|
||||||
protected function setOrderByForList(): void
|
|
||||||
{
|
|
||||||
//OrderBy 처리
|
|
||||||
$this->getService()->getModel()->orderBy('model', 'ASC', false);
|
|
||||||
parent::setOrderByForList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,11 +35,4 @@ class DefenceController extends PartController
|
|||||||
return $this->_helper;
|
return $this->_helper;
|
||||||
}
|
}
|
||||||
//Index,FieldForm관련
|
//Index,FieldForm관련
|
||||||
|
|
||||||
protected function setOrderByForList(): void
|
|
||||||
{
|
|
||||||
//OrderBy 처리
|
|
||||||
$this->getService()->getModel()->orderBy('INET_ATON(ip)', 'ASC', false);
|
|
||||||
parent::setOrderByForList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,10 +90,4 @@ class DomainController extends PartController
|
|||||||
->setBody(json_encode(['exists' => false, 'message' => $e->getMessage()]));
|
->setBody(json_encode(['exists' => false, 'message' => $e->getMessage()]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected function setOrderByForList(): void
|
|
||||||
{
|
|
||||||
//OrderBy 처리
|
|
||||||
$this->getService()->getModel()->orderBy('domain', 'ASC', false);
|
|
||||||
parent::setOrderByForList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,10 +45,4 @@ class IpController extends PartController
|
|||||||
return $this->_lineService;
|
return $this->_lineService;
|
||||||
}
|
}
|
||||||
//Index,FieldForm관련
|
//Index,FieldForm관련
|
||||||
protected function setOrderByForList(): void
|
|
||||||
{
|
|
||||||
//OrderBy 처리
|
|
||||||
$this->getService()->getModel()->orderBy('INET_ATON(ip)', 'ASC', false);
|
|
||||||
parent::setOrderByForList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,10 +35,4 @@ class RamController extends PartController
|
|||||||
return $this->_helper;
|
return $this->_helper;
|
||||||
}
|
}
|
||||||
//Index,FieldForm관련
|
//Index,FieldForm관련
|
||||||
protected function setOrderByForList(): void
|
|
||||||
{
|
|
||||||
//OrderBy 처리
|
|
||||||
$this->getService()->getModel()->orderBy('model', 'ASC', false);
|
|
||||||
parent::setOrderByForList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,10 +36,4 @@ class SoftwareController extends PartController
|
|||||||
return $this->_helper;
|
return $this->_helper;
|
||||||
}
|
}
|
||||||
//Index,FieldForm관련
|
//Index,FieldForm관련
|
||||||
protected function setOrderByForList(): void
|
|
||||||
{
|
|
||||||
//OrderBy 처리
|
|
||||||
$this->getService()->getModel()->orderBy('model', 'ASC', false);
|
|
||||||
parent::setOrderByForList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,11 +47,4 @@ class ServerController extends EquipmentController
|
|||||||
//부모처리
|
//부모처리
|
||||||
parent::view_process($entity);
|
parent::view_process($entity);
|
||||||
}
|
}
|
||||||
//List부분
|
|
||||||
protected function setOrderByForList(): void
|
|
||||||
{
|
|
||||||
//OrderBy 처리
|
|
||||||
$this->getService()->getModel()->orderBy('model', 'ASC', false);
|
|
||||||
parent::setOrderByForList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,11 +34,5 @@ class SwitchController extends EquipmentController
|
|||||||
}
|
}
|
||||||
return $this->_helper;
|
return $this->_helper;
|
||||||
}
|
}
|
||||||
//Index,FieldForm관련
|
//Index,FieldForm관
|
||||||
protected function setOrderByForList(): void
|
|
||||||
{
|
|
||||||
//OrderBy 처리
|
|
||||||
$this->getService()->getModel()->orderBy('code', 'ASC', false);
|
|
||||||
parent::setOrderByForList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,19 +148,4 @@ class UserController extends AdminController
|
|||||||
return $this->getResultFail($e->getMessage());
|
return $this->getResultFail($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected function setFilterConditionForList(): void
|
|
||||||
{
|
|
||||||
foreach ($this->getFilterFields() as $field) {
|
|
||||||
$this->$field = $this->request->getVar($field);
|
|
||||||
if ($this->$field !== null && $this->$field !== '') {
|
|
||||||
if ($field === 'role') {
|
|
||||||
$where = "FIND_IN_SET(" . $this->getService()->getModel()->escape($this->$field) . ", {$this->getService()->getModel()->getTable()}.{$field}) > 0";
|
|
||||||
//FIND_IN_SET()은 MySQL 함수이므로 CodeIgniter가 이를 일반 컬럼명으로 착각하고 escape하게 되면 오류가 발생합니다. 따라서 ->where($sql, null, false)로 명시하여 escape를 꺼줘야 정상 작동
|
|
||||||
$this->getService()->getModel()->where($where, null, false);
|
|
||||||
} else {
|
|
||||||
$this->getService()->getModel()->where("{$this->getService()->getModel()->getTable()}.{$field}", $this->$field);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -162,9 +162,19 @@ abstract class CommonController extends BaseController
|
|||||||
}
|
}
|
||||||
final protected function setFilterValues(): void
|
final protected function setFilterValues(): void
|
||||||
{
|
{
|
||||||
foreach ($this->getFilterFields() as $field) {
|
if (!array_key_exists('filter_values', $this->_control)) {
|
||||||
$this->_control[$field] = $this->request->getVar($field);
|
$this->_control['filter_values'] = [];
|
||||||
}
|
}
|
||||||
|
foreach ($this->getFilterFields() as $field) {
|
||||||
|
$this->_control['filter_values'][$field] = $this->request->getVar($field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final protected function getFilterValues(?string $field = null): mixed
|
||||||
|
{
|
||||||
|
if ($field === null) {
|
||||||
|
return $this->_control['filter_values'] ?? [];
|
||||||
|
}
|
||||||
|
return array_key_exists($field, $this->_control['filter_values']) ? $this->_control['filter_values'][$field] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function initAction(string $action, $fields = []): void
|
protected function initAction(string $action, $fields = []): void
|
||||||
@ -561,57 +571,31 @@ abstract class CommonController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
//리스트
|
//리스트
|
||||||
//Filter 조건절 처리
|
//조건절 처리
|
||||||
protected function setFilterConditionForList(): void
|
final protected function setConditionForList(): void
|
||||||
{
|
{
|
||||||
//filter_fields에 해당하는 값이 있을 경우 정의
|
|
||||||
$this->setFilterValues();
|
$this->setFilterValues();
|
||||||
|
//Filter 조건절 처리
|
||||||
foreach ($this->getFilterFields() as $field) {
|
foreach ($this->getFilterFields() as $field) {
|
||||||
if ($this->_control[$field] !== null && $this->_control[$field] !== '') {
|
$filter_value = $this->getFilterValues($field);
|
||||||
$this->getService()->getModel()->where("{$this->getService()->getModel()->getTable()}.{$field}", $this->_control[$field]);
|
if ($filter_value !== null && $filter_value !== '') {
|
||||||
|
$this->getService()->getModel()->setList_FormFilter($field, $filter_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
//검색어조건절 처리
|
||||||
//검색어 조건절 처리
|
|
||||||
protected function setWordConditionForList(): void
|
|
||||||
{
|
|
||||||
$this->word = $this->request->getVar('word');
|
$this->word = $this->request->getVar('word');
|
||||||
if ($this->word !== null && $this->word !== '') {
|
if ($this->word !== null && $this->word !== '') {
|
||||||
$this->getService()->getModel()->setList_WordFilter($this->word);
|
$this->getService()->getModel()->setList_WordFilter($this->word);
|
||||||
}
|
}
|
||||||
}
|
//날자검색
|
||||||
//검색일 조건절 처리
|
|
||||||
protected function setDateConditionForList(): void
|
|
||||||
{
|
|
||||||
$this->start = $this->request->getVar('start');
|
$this->start = $this->request->getVar('start');
|
||||||
if ($this->start !== null && $this->start !== '') {
|
|
||||||
$this->getService()->getModel()->where(sprintf("%s.created_at >= '%s 00:00:00'", $this->getService()->getModel()->getTable(), $this->start));
|
|
||||||
}
|
|
||||||
$this->end = $this->request->getVar('end');
|
$this->end = $this->request->getVar('end');
|
||||||
if ($this->end !== null && $this->end !== '') {
|
if ($this->start !== null && $this->start !== '' && $this->end !== null && $this->end !== '') {
|
||||||
$this->getService()->getModel()->where(sprintf("%s.created_at <= '%s 23:59:59'", $this->getService()->getModel()->getTable(), $this->end));
|
$this->getService()->getModel()->setList_DateFilter($this->start, $this->end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//OrderBy 처리
|
|
||||||
protected function setOrderByForList(): void
|
|
||||||
{
|
|
||||||
$this->order_field = $this->request->getVar('order_field');
|
|
||||||
$this->order_value = $this->request->getVar('order_value');
|
|
||||||
if ($this->order_field !== null && $this->order_field !== '') {
|
|
||||||
$this->getService()->getModel()->orderBy(sprintf("%s.%s %s", $this->getService()->getModel()->getTable(), $this->order_field, $this->order_value ?: "DESC"));
|
|
||||||
} else {
|
|
||||||
$this->getService()->getModel()->orderBy(sprintf("%s.%s %s", $this->getService()->getModel()->getTable(), $this->getService()->getModel()->getPKField(), "DESC"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//조건절 처리
|
|
||||||
protected function setConditionForList(): void
|
|
||||||
{
|
|
||||||
$this->setFilterConditionForList();
|
|
||||||
$this->setWordConditionForList();
|
|
||||||
$this->setDateConditionForList();
|
|
||||||
}
|
|
||||||
//PageNation 처리
|
//PageNation 처리
|
||||||
protected function getPageOptiosForList(): array
|
final protected function getPageOptiosForList(): array
|
||||||
{
|
{
|
||||||
$page_options = ["" => "줄수선택"];
|
$page_options = ["" => "줄수선택"];
|
||||||
for ($i = $this->per_page; $i <= $this->total_count; $i += $this->per_page) {
|
for ($i = $this->per_page; $i <= $this->total_count; $i += $this->per_page) {
|
||||||
@ -620,7 +604,7 @@ abstract class CommonController extends BaseController
|
|||||||
$page_options[$this->total_count] = $this->total_count;
|
$page_options[$this->total_count] = $this->total_count;
|
||||||
return $page_options;
|
return $page_options;
|
||||||
}
|
}
|
||||||
protected function getPaginationForList($pager_group = 'default', int $segment = 0, $template = 'bootstrap_full')
|
final protected function getPaginationForList($pager_group = 'default', int $segment = 0, $template = 'bootstrap_full')
|
||||||
{
|
{
|
||||||
//Page, Per_page필요부분
|
//Page, Per_page필요부분
|
||||||
$this->page = (int) $this->request->getVar('page') ?: 1;
|
$this->page = (int) $this->request->getVar('page') ?: 1;
|
||||||
@ -637,17 +621,13 @@ abstract class CommonController extends BaseController
|
|||||||
}
|
}
|
||||||
protected function index_process(): void
|
protected function index_process(): void
|
||||||
{
|
{
|
||||||
//조건절 처리
|
|
||||||
$this->setConditionForList();
|
|
||||||
//TotalCount (SoftDelete적용이 되려면 countAllResults를 사용해야함)
|
|
||||||
$this->total_count = $this->getService()->getModel()->selectCount('*', 'cnt')->countAllResults();
|
|
||||||
//Pagination 처리
|
|
||||||
$this->pagination = $this->getPaginationForList();
|
|
||||||
//줄수 처리용
|
|
||||||
$this->page_options = $this->getPageOptiosForList();
|
|
||||||
//조건절 , OrcerBy , Limit 처리
|
//조건절 , OrcerBy , Limit 처리
|
||||||
$this->setConditionForList();
|
$this->setConditionForList();
|
||||||
$this->setOrderByForList();
|
$this->order_field = $this->request->getVar('order_field');
|
||||||
|
$this->order_value = $this->request->getVar('order_value');
|
||||||
|
if ($this->order_field !== null && $this->order_field !== '') {
|
||||||
|
$this->getService()->getModel()->setOrderBy($this->order_field, $this->order_value);
|
||||||
|
}
|
||||||
$this->getService()->getModel()->limit($this->per_page);
|
$this->getService()->getModel()->limit($this->per_page);
|
||||||
$this->getService()->getModel()->offset(($this->page - 1) * $this->per_page);
|
$this->getService()->getModel()->offset(($this->page - 1) * $this->per_page);
|
||||||
$this->entities = $this->getService()->getEntities();
|
$this->entities = $this->getService()->getEntities();
|
||||||
@ -665,6 +645,14 @@ abstract class CommonController extends BaseController
|
|||||||
}
|
}
|
||||||
// 현재 URL을 스택에 저장
|
// 현재 URL을 스택에 저장
|
||||||
helper(['form']);
|
helper(['form']);
|
||||||
|
//조건절 처리
|
||||||
|
$this->setConditionForList();
|
||||||
|
//TotalCount (SoftDelete적용이 되려면 countAllResults를 사용해야함)
|
||||||
|
$this->total_count = $this->getService()->getModel()->selectCount('*', 'cnt')->countAllResults();
|
||||||
|
//Pagination 처리
|
||||||
|
$this->pagination = $this->getPaginationForList();
|
||||||
|
//줄수 처리용
|
||||||
|
$this->page_options = $this->getPageOptiosForList();
|
||||||
$this->index_process();
|
$this->index_process();
|
||||||
return $this->getResultSuccess();
|
return $this->getResultSuccess();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|||||||
@ -212,8 +212,30 @@ abstract class CommonModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
//List 검색용
|
//List 검색용
|
||||||
|
//FormFilter 조건절 처리
|
||||||
|
public function setList_FormFilter(string $field, mixed $filter_value): void
|
||||||
|
{
|
||||||
|
switch ($field) {
|
||||||
|
default:
|
||||||
|
//일반검색
|
||||||
|
$this->where("{$this->getTable()}.{$field}", $filter_value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//검색어조건절처리
|
||||||
public function setList_WordFilter(string $word): void
|
public function setList_WordFilter(string $word): void
|
||||||
{
|
{
|
||||||
$this->orLike($this->getTable() . "." . $this->getTitleField(), $word, 'both');
|
$this->orLike($this->getTable() . "." . $this->getTitleField(), $word, 'both');
|
||||||
}
|
}
|
||||||
|
//날자검색
|
||||||
|
public function setList_DateFilter(string $start, string $end): void
|
||||||
|
{
|
||||||
|
$this->where(sprintf("%s.created_at >= '%s 00:00:00'", $this->getTable(), $start));
|
||||||
|
$this->where(sprintf("%s.created_at <= '%s 23:59:59'", $this->getTable(), $end));
|
||||||
|
}
|
||||||
|
//OrderBy 처리
|
||||||
|
public function setOrderBy(string $field, $value): void
|
||||||
|
{
|
||||||
|
$this->orderBy(sprintf("%s.%s %s", $this->getTable(), $field, $value ?: "DESC"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,13 +59,21 @@ class ClientModel extends CustomerModel
|
|||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
//Create용
|
//Create용
|
||||||
protected function create_process(array $formDatas): ClientEntity
|
//FormFilter 조건절 처리
|
||||||
|
public function setList_FormFilter(string $field, mixed $filter_value): void
|
||||||
{
|
{
|
||||||
$entity = parent::create_process($formDatas);
|
switch ($field) {
|
||||||
//고객코드 Code 자동 생성 후 수정
|
case 'role':
|
||||||
$code = 'C' . str_pad($entity->getPK(), 4, '0', STR_PAD_LEFT);
|
$where = "FIND_IN_SET(" . $this->escape($filter_value) . ", {$this->getTable()}.{$field}) > 0";
|
||||||
return $this->modify($entity, ['code' => $code]);
|
//FIND_IN_SET()은 MySQL 함수이므로 CodeIgniter가 이를 일반 컬럼명으로 착각하고 escape하게 되면 오류가 발생합니다. 따라서 ->where($sql, null, false)로 명시하여 escape를 꺼줘야 정상 작동
|
||||||
|
$this->where($where, null, false);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
parent::setList_FormFilter($field, $filter_value);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
//검색어조건절처리
|
||||||
//List 검색용
|
//List 검색용
|
||||||
public function setList_WordFilter(string $word): void
|
public function setList_WordFilter(string $word): void
|
||||||
{
|
{
|
||||||
|
|||||||
@ -62,4 +62,11 @@ class ServicePaymentModel extends CustomerModel
|
|||||||
}
|
}
|
||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
|
//List 검색용
|
||||||
|
//OrderBy 처리
|
||||||
|
public function setOrderBy(string $field, $value): void
|
||||||
|
{
|
||||||
|
$this->orderBy('billing_at', 'ASC', false);
|
||||||
|
parent::setOrderBy($field, $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,4 +40,11 @@ class CodeModel extends EquipmentModel
|
|||||||
}
|
}
|
||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
|
//List 검색용
|
||||||
|
//OrderBy 처리
|
||||||
|
public function setOrderBy(string $field, $value): void
|
||||||
|
{
|
||||||
|
$this->getModel()->orderBy('code', 'ASC', false);
|
||||||
|
parent::setOrderBy($field, $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,4 +40,11 @@ class CpuModel extends PartModel
|
|||||||
}
|
}
|
||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
|
//List 검색용
|
||||||
|
//OrderBy 처리
|
||||||
|
public function setOrderBy(string $field, $value): void
|
||||||
|
{
|
||||||
|
$this->orderBy('model', 'ASC', false);
|
||||||
|
parent::setOrderBy($field, $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,4 +51,11 @@ class DefenceModel extends PartModel
|
|||||||
}
|
}
|
||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
|
//List 검색용
|
||||||
|
//OrderBy 처리
|
||||||
|
public function setOrderBy(string $field, $value): void
|
||||||
|
{
|
||||||
|
$this->orderBy('INET_ATON(ip)', 'ASC', false);
|
||||||
|
parent::setOrderBy($field, $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,4 +40,11 @@ class DomainModel extends PartModel
|
|||||||
}
|
}
|
||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
|
//List 검색용
|
||||||
|
//OrderBy 처리
|
||||||
|
public function setOrderBy(string $field, $value): void
|
||||||
|
{
|
||||||
|
$this->orderBy('domain', 'ASC', false);
|
||||||
|
parent::setOrderBy($field, $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,4 +44,11 @@ class IpModel extends PartModel
|
|||||||
}
|
}
|
||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
|
//List 검색용
|
||||||
|
//OrderBy 처리
|
||||||
|
public function setOrderBy(string $field, $value): void
|
||||||
|
{
|
||||||
|
$this->orderBy('INET_ATON(ip)', 'ASC', false);
|
||||||
|
parent::setOrderBy($field, $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,4 +41,11 @@ class RamModel extends PartModel
|
|||||||
}
|
}
|
||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
|
//List 검색용
|
||||||
|
//OrderBy 처리
|
||||||
|
public function setOrderBy(string $field, $value): void
|
||||||
|
{
|
||||||
|
$this->getModel()->orderBy('model', 'ASC', false);
|
||||||
|
parent::setOrderBy($field, $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,4 +45,11 @@ class SoftwareModel extends PartModel
|
|||||||
}
|
}
|
||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
|
//List 검색용
|
||||||
|
//OrderBy 처리
|
||||||
|
public function setOrderBy(string $field, $value): void
|
||||||
|
{
|
||||||
|
$this->getModel()->orderBy('model', 'ASC', false);
|
||||||
|
parent::setOrderBy($field, $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,4 +41,11 @@ class ServerModel extends EquipmentModel
|
|||||||
}
|
}
|
||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
|
//List 검색용
|
||||||
|
//OrderBy 처리
|
||||||
|
public function setOrderBy(string $field, $value): void
|
||||||
|
{
|
||||||
|
$this->getModel()->orderBy('model', 'ASC', false);
|
||||||
|
parent::setOrderBy($field, $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,4 +41,11 @@ class SwitchModel extends EquipmentModel
|
|||||||
}
|
}
|
||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
|
//List 검색용
|
||||||
|
//OrderBy 처리
|
||||||
|
public function setOrderBy(string $field, $value): void
|
||||||
|
{
|
||||||
|
$this->getModel()->orderBy('code', 'ASC', false);
|
||||||
|
parent::setOrderBy($field, $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,6 +71,21 @@ class UserModel extends CommonModel
|
|||||||
return $convertedData;
|
return $convertedData;
|
||||||
}
|
}
|
||||||
//List 검색용
|
//List 검색용
|
||||||
|
//FormFilter 조건절 처리
|
||||||
|
public function setList_FormFilter(string $field, mixed $filter_value): void
|
||||||
|
{
|
||||||
|
switch ($field) {
|
||||||
|
case 'role':
|
||||||
|
$where = "FIND_IN_SET(" . $this->escape($filter_value) . ", {$this->getTable()}.{$field}) > 0";
|
||||||
|
//FIND_IN_SET()은 MySQL 함수이므로 CodeIgniter가 이를 일반 컬럼명으로 착각하고 escape하게 되면 오류가 발생합니다. 따라서 ->where($sql, null, false)로 명시하여 escape를 꺼줘야 정상 작동
|
||||||
|
$this->where($where, null, false);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
parent::setList_FormFilter($field, $filter_value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//검색어조건절처리
|
||||||
public function setList_WordFilter(string $word): void
|
public function setList_WordFilter(string $word): void
|
||||||
{
|
{
|
||||||
$this->orLike(self::TABLE . '.id', $word, 'both');
|
$this->orLike(self::TABLE . '.id', $word, 'both');
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||||
<td nowrap class="text-start">
|
<td nowrap class="text-start">
|
||||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['control'][$field] ?? null), $viewDatas) ?>
|
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['control']['filter_value'][$field] ?? null), $viewDatas) ?>
|
||||||
<span><?= validation_show_error($field); ?></span>
|
<span><?= validation_show_error($field); ?></span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||||
<td nowrap class="text-start">
|
<td nowrap class="text-start">
|
||||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['control'][$field] ?? null), $viewDatas) ?>
|
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['control']['filter_value'][$field] ?? null), $viewDatas) ?>
|
||||||
<span><?= validation_show_error($field); ?></span>
|
<span><?= validation_show_error($field); ?></span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
<nav class="condition nav">
|
<nav class="condition nav">
|
||||||
조건:
|
조건:
|
||||||
<?php foreach ($viewDatas['control']['filter_fields'] as $field): ?>
|
<?php foreach ($viewDatas['control']['filter_fields'] as $field): ?>
|
||||||
<?= $viewDatas['helper']->getFieldForm($field, $viewDatas['control'][$field] ?? old($field), $viewDatas, ['id' => $field, 'index_content_top_filter' => 'true']) ?>
|
<?= $viewDatas['helper']->getFieldForm($field, $viewDatas['control']['filter_value'][$field] ?? old($field), $viewDatas, ['id' => $field, 'index_content_top_filter' => 'true']) ?>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</nav>
|
</nav>
|
||||||
<nav class="search nav justify-content-center">
|
<nav class="search nav justify-content-center">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user