refactor(sample)!: CRUD 반환 계약과 페이징 처리 및 MyBatis 매핑 개선 - #80
Open
LeeBaekHaeng wants to merge 1 commit into
Open
Conversation
등록·수정·삭제 시 매퍼의 처리 건수를 서비스에서 반환하고 컨트롤러에서 결과를 디버그 로그로 기록한다. 목록 조회 결과를 List<SampleVO>로 통일하고 밑줄 컬럼명을 camelCase 속성에 자동 매핑한다. pageUnit과 pageSize를 nullable Integer로 변경하여 요청값이 없을 때만 설정의 기본값을 적용한다. 목록·건수 조회의 검색 SQL을 공통화하고 불필요한 ID 갱신을 제거한다. SQL 기본 제한 시간을 3초, 목록 조회 제한 시간을 30초로 설정한다. 서비스 빈의 명시적 이름을 제거하고 관련 테스트를 변경된 계약에 맞춘다. BREAKING CHANGE: CRUD 반환 타입을 void에서 int로, 목록 요소를 EgovMap에서 SampleVO로 변경한다. pageUnit과 pageSize는 int 기본값 10에서 Integer 기본값 null로 변경되며 서비스 빈 이름은 sampleService에서 egovSampleServiceImpl로 변경된다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
수정 사유 Reason for modification
샘플 CRUD 처리 건수를 호출부에 전달하고 목록 조회 결과 타입을
SampleVO로 통일한다. 요청한 페이징 값을 유지하며 중복 SQL을 정리한다.
수정된 소스 내용 Modified source
컨트롤러에서 처리 건수를 디버그 로그로 기록한다.
SampleVO getter 호출로 변경한다.
SampleVO resultType으로 전환한다.
기존에는 요청값을 설정값으로 덮어썼으나, 이제 null일 때만 기본값을 적용한다.
호환성 영향
SampleVO 기반으로 변경해야 한다.
egovSampleServiceImpl로 변경하거나 타입 기반 주입을 사용해야 한다.
JUnit 테스트 JUnit tests
JDK 17.0.17+10, Maven 3.9.9에서 다음 관련 테스트 5개 클래스를 실행했다.
결과: 14개 테스트 통과, 실패 0, 오류 0, 건너뜀 0 / BUILD SUCCESS
실행 명령:
mvn -B -Dtest=SampleDefaultVOTest,EgovSampleServiceImplTest,EgovSampleControllerTestAddTest,EgovSampleControllerTestDeleteTest,EgovSampleControllerTestUpdateTest test
전체 테스트는 실행하지 않았다.
페이징 요청값 유지와 CRUD 반환 건수에 대한 직접 검증은 추가 보강이 필요하다.
테스트 브라우저 Test Browser
http://localhost:8080/?pageUnit=20
테스트 스크린샷 또는 캡처 영상 Test screenshots or captured video
테스트 후