개발자 문서
계층·패키지 규칙
Controller에서 Mapper까지 한 가지 흐름과 금지 목록을 익힙니다.
한 가지 흐름
Controller
→ {기능}CommandService · {기능}QueryService (interface)
→ …ServiceImpl (extends EgovAbstractServiceImpl)
→ 도메인
→ 저장소 interface
→ Mybatis…Repository (extends EgovAbstractMapper) + Mapper XML계층
| 계층 | 패키지 | 책임 |
|---|---|---|
| 진입 | presentation | 화면·API 요청과 응답 |
| 계약 | application.service | Command·Query interface |
| 구현 | application.service의 …ServiceImpl | 업무 규칙, 트랜잭션 |
| 도메인 | wcms.domain.{bc} | 값·규칙·예외 |
| 저장소 계약(쓰기) | wcms-core/src/main/java/wcms/domain/{bc}/{기능}/repository/ | {도메인}Repository interface |
| 저장소 계약(읽기) | application.repository | {대상}QueryRepository interface |
| 저장소 구현 | infrastructure.persistence | MyBatis Mapper, *Row |
| 응답 | application.dto | *Response, Command |
금지
presentation에서 저장소·Row·…Impl을 직접 참조하지 않습니다.wcms-user와wcms-admin이 서로 참조하지 않습니다.- 프레임워크 독립 집합(
wcms-core등)에서 Spring·eGov·MyBatis·Servlet을 import하지 않습니다. - Mapper XML은
infrastructure.persistence의*Row에만 매핑합니다. 화면·API는*Response로 내보냅니다. - 테이블 쓰기는 그 테이블을 소유한 BC만 합니다.
- Enum과 공통코드를 섞지 않습니다.
검사
| 검사 | 도구 |
|---|---|
| ImportControl | wcms-build-config/src/main/resources/wcms/import-control.xml |
| 계층 경계·이름·위치 | scripts/check_architecture.py, scripts/check_structure.py |
| 검사 약화 방지 | scripts/check_layer_probes.py |
| DB 이름 표준 | scripts/check_data_standard.py |
| Mapper 문장 짝 | scripts/check_mybatis_statements.py |
| 프레임워크 독립 컴파일 | scripts/check_core_compile.py |
./gradlew check의 checkstyleMain이 ImportControl을 적용합니다.