P2-01/02 기본코드 종류 및 세부코드 관리 CRUD 구현
- CodeKindModel + CodeKind 컨트롤러 (목록/등록/수정/삭제) - CodeDetailModel + CodeDetail 컨트롤러 (종류별 세부코드 CRUD) - View: code_kind/(index,create,edit), code_detail/(index,create,edit) - 라우트: /admin/code-kinds/*, /admin/code-details/* - E2E 테스트 7개 전체 통과 - 스크린샷 2개 추가 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
33
app/Models/CodeDetailModel.php
Normal file
33
app/Models/CodeDetailModel.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class CodeDetailModel extends Model
|
||||
{
|
||||
protected $table = 'code_detail';
|
||||
protected $primaryKey = 'cd_idx';
|
||||
protected $returnType = 'object';
|
||||
protected $useTimestamps = false;
|
||||
protected $allowedFields = [
|
||||
'cd_ck_idx',
|
||||
'cd_code',
|
||||
'cd_name',
|
||||
'cd_sort',
|
||||
'cd_state',
|
||||
'cd_regdate',
|
||||
];
|
||||
|
||||
/**
|
||||
* 특정 코드 종류의 세부코드 목록
|
||||
*/
|
||||
public function getByKind(int $ckIdx, bool $activeOnly = false): array
|
||||
{
|
||||
$builder = $this->where('cd_ck_idx', $ckIdx);
|
||||
if ($activeOnly) {
|
||||
$builder->where('cd_state', 1);
|
||||
}
|
||||
return $builder->orderBy('cd_sort', 'ASC')->findAll();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user