[api] AdminMemberController 이쪽 컨벤션 맞춰 변경

This commit is contained in:
2026-05-21 16:02:45 +09:00
parent 41b3cd5b33
commit 4c30133285
19 changed files with 227 additions and 211 deletions
+18 -5
View File
@@ -14,12 +14,16 @@
- `Vo`는 Mapper 에서 Service, Controller 로 반환하는 값 객체로 정의한다.
- `Vo`는 Mapper 조회 결과를 담을 수 있고, Service 에서 비즈니스 로직 처리 후 필요한 데이터를 가공해서 Controller 로 반환하는 용도로 사용한다.
- `Form`은 Controller 입력 검증과 요청 바인딩 전용으로 두고, `@Valid` 와 Jakarta Validation 어노테이션을 우선 사용한다.
- Form/Dto/Vo 클래스명은 가능한 한 Controller 메서드명을 기준으로 맞춘다. 예: Controller 메서드가 `adminMemberList` 이면 `AdminMemberListForm`, `AdminMemberListDto`, `AdminMemberListVo` 를 사용한다.
- 신규 API 에서는 path 동작명과 다른 표현을 지양한다. 예: 목록은 `Search` 보다 `List`, 상세는 `Detail` 보다 `View`, 수정은 `Update` 보다 `Modify` 를 우선 사용한다.
- 현재 코드처럼 DTO/VO는 Lombok `@Getter`, 필요한 경우에만 `@Setter`를 사용한다.
- Form 안에는 DTO 변환 메서드를 둘 수 있다. 예: `userDto()`, `fileUploadDto()`
- Form 안에는 DTO 변환 메서드를 둘 수 있으며, 짝이 되는 Dto 로 변환하는 메서드는 `toDto()` 를 기본으로 사용한다. 예: `AdminMemberListForm#toDto()` `AdminMemberListDto` 를 반환한다.
- 하나의 Form 이 여러 Dto 로 변환되어야 하는 예외 상황에서만 `toAdminMemberListDto()` 처럼 대상 Dto 이름을 명시한다.
- Form 에서 DTO 로 변환할 때는 검증과 `trim()`, 기본값 치환까지 같이 처리하는 현재 패턴을 우선 따른다.
- DTO 안에 연관된 다른 DTO 변환이 꼭 필요할 때만 최소한의 보조 메서드를 둔다.
- 외부 응답에 노출되면 안 되는 내부 필드는 응답에 사용될 수 있는 객체에서 `@JsonIgnore`로 숨긴다.
- Form 에서 DTO 로 변환할 때는 검증과 `trim()`, 기본값 치환까지 같이 처리하는 현재 패턴을 우선 따른다.
- 목록 조회 API 는 특별한 사유가 없으면 기본적으로 페이징을 적용하고, 검색 Form/Dto 는 `PageRequest`, 목록 응답 Vo 는 `PageResponse` 를 상속한다.
- 등록, 수정, 삭제, 상태 변경처럼 처리 여부만 반환하는 VO 의 boolean 필드는 `processed` 로 통일한다. 예: `private boolean processed;`
- 목록 조회 API 는 특별한 사유가 없으면 기본적으로 페이징을 적용하고, 목록 조회 Form/Dto 는 `PageRequest`, 목록 응답 Vo 는 `PageResponse` 를 상속한다.
## Swagger/OpenAPI 문서화 규칙
- 신규 또는 수정되는 Controller, Form, VO에는 Swagger 테스트 편의성을 위한 설명을 반드시 남긴다.
@@ -39,8 +43,10 @@
- 페이징 응답의 `rowStartNum`처럼 계산 방식이 필요한 값은 프론트 사용 방법까지 `description`에 남긴다.
## Mapper/MyBatis 규칙
- Mapper 메서드명은 SQL 동작이 드러나도록 `select`, `insert`, `update` 접두어를 사용한다.
- 삭제 물리 삭제가 아니라 상태 변경이면 `delete` 대신 목적이 드러나는 `update...Canceled`, `update...DelYn` 같은 이름을 우선한다.
- Service/Mapper 메서드명은 주된 DB 동작이 드러나도록 `select`, `insert`, `update` 접두어를 먼저 붙이고 Controller 메서드명을 이어서 만든다. 예: Controller 메서드가 `adminSsoClientList` 이면 Service/Mapper 조회 메서드는 `selectAdminSsoClientList`.
- 삭제 API도 기본적으로 물리 삭제가 아니라 상태 변경으로 처리하므로 실제 SQL 동작에 맞춰 `update...Delete` 형태를 우선 사용한다. 예: Controller 메서드가 `adminSsoClientDelete` 이면 Service/Mapper 메서드는 `updateAdminSsoClientDelete`.
- 물리 삭제가 정책상 명확히 필요한 예외 상황에서만 `delete` SQL과 `delete...` 메서드명을 사용한다.
- SQL 을 여러 줄로 작성할 때 콤마는 다음 줄 앞에 둔다. 예: `SELECT COL1`, 다음 줄 `, COL2`.
- Mapper XML `namespace`는 인터페이스의 전체 경로와 정확히 일치시킨다.
- XML의 `id`는 Mapper 메서드명과 동일하게 맞춘다.
- 조회 결과 타입은 `resultType`, 저장/수정 파라미터는 DTO 필드명과 매핑되는 프로퍼티명을 그대로 사용한다.
@@ -52,12 +58,17 @@
## Java/Spring 코드 스타일
- Java 코드는 현재 프로젝트 스타일에 맞춰 탭/들여쓰기와 import 정렬을 유지한다.
- 코드는 초급 개발자가 읽어도 흐름을 따라갈 수 있도록 직관적으로 작성한다. 과한 축약, 기교적인 표현, 불필요하게 복잡한 체이닝보다 명확한 변수명과 단계적인 흐름을 우선한다.
- Java 코드에서 메서드 호출, 어노테이션 인자, 생성자 인자 등을 여러 줄로 작성할 때 콤마는 다음 줄 앞에 둔다. 예: `summary = "회원 목록 조회"` 다음 줄 `, description = "..."`
- 기능 수정/추가 시 가능하면 Red-Green-Refactor 흐름을 따른다. 먼저 실패하는 테스트나 재현 가능한 검증 조건을 만들고(Red), 최소 구현으로 통과시키며(Green), 이후 컨벤션과 가독성에 맞게 정리한다(Refactor). 테스트 작성이 어려운 경우에는 최소 실행 검증 절차를 먼저 정하고 결과를 보고한다.
- Lombok은 반복 보일러플레이트 제거에만 절제해서 사용한다.
- 로그는 `Slf4j`를 사용하고 반복문 내부 대량 출력은 지양한다.
- 새로운 기능은 가능하면 역할이 드러나는 패키지로 분리한다.
- 생성자 주입을 기본으로 하고 필드 주입은 추가하지 않는다.
- Service 에서 DB 상태를 바꾸는 메서드는 필요한 범위에서 `@Transactional`을 사용하고, 조회 전용은 `readOnly = true`를 우선 검토한다.
- 문자열 입력값은 현재 코드처럼 필요한 지점에서 `trim()` 처리하고, null 가능성 여부를 먼저 확인한다.
- 지역 변수명은 `result`, `list`, `vo`, `dto` 처럼 범용적인 이름보다 도메인과 객체 종류가 드러나게 작성한다. 예: `List<AdminMemberVo> adminMemberList`, `AdminMemberListVo adminMemberListVo`, `AdminMemberListDto adminMemberListDto`.
- 같은 타입 또는 같은 의미의 변수가 여러 개 필요해도 객체 종류를 유지하고, 구분이 필요한 경우 숫자 suffix 를 제한적으로 사용한다. 예: `AdminMemberVo adminMemberVo1`, `AdminMemberVo adminMemberVo2`.
## Controller/Service 규칙
- Controller 는 요청/응답 조립과 인증 주체 확인에 집중하고, DB 처리나 복잡한 계산은 Service 로 넘긴다.
@@ -65,3 +76,5 @@
- Controller 에서는 `@RequestBody`, `@PathVariable`, `@RequestHeader`, `@CookieValue` 를 명시적으로 선언해 요청 출처를 드러낸다.
- 인증 사용자 확인은 모듈 구현에 따라 `HttpSession` 또는 `SecurityContextHolder` 를 사용하므로 기존 방식을 먼저 맞춘다.
- 목록 조회는 Controller 에서 `@ModelAttribute` 검색 Form 을 받고, Service 에서 `totalCount` 와 목록을 조회한 뒤 `PageResponse#setPaging(...)` 으로 페이징 정보를 채운다.
- 신규 API path 의 동작명은 CRUD 성격에 맞춰 통일한다. 목록은 `list`, 상세 조회는 `view`, 등록은 `add`, 수정은 `modify`, 삭제는 `delete` 를 사용한다.
- Controller 메서드명은 가능한 한 path 조합을 기준으로 만든다. 클래스 레벨 path 와 메서드 레벨 path 를 이어 붙인 의미가 드러나게 작성한다. 예: 클래스 path 가 `/admin/member`, 메서드 path 가 `/list` 이면 `adminMemberList`, 클래스 path 가 `/admin/sso/client`, 메서드 path 가 `/view` 이면 `adminSsoClientView`.
@@ -24,104 +24,104 @@ public class AdminMemberController {
}
@Operation(
summary = "회원 목록 조회",
description = "관리자가 회원 목록을 검색 조건과 페이징으로 조회합니다."
summary = "회원 목록 조회"
, description = "관리자가 회원 목록을 검색 조건과 페이징으로 조회합니다."
)
@GetMapping("/list")
public ResponseEntity<ApiResponse<AdminMemberListVo>> adminMemberList(
@ModelAttribute AdminMemberSearchForm adminMemberSearchForm
@ModelAttribute AdminMemberListForm adminMemberListForm
) {
AdminMemberListVo result = adminMemberService.selectAdminMemberList(adminMemberSearchForm.toAdminMemberSearchDto());
AdminMemberListVo adminMemberListVo = adminMemberService.selectAdminMemberList(adminMemberListForm.toDto());
if (result.getMemberList() == null || result.getMemberList().isEmpty()) {
return ApiResponse.entity(result, ApiResponseCode.CODE_2003);
if (adminMemberListVo.getMemberList() == null || adminMemberListVo.getMemberList().isEmpty()) {
return ApiResponse.entity(adminMemberListVo, ApiResponseCode.CODE_2003);
}
return ApiResponse.entity(result, ApiResponseCode.CODE_2001, "회원");
return ApiResponse.entity(adminMemberListVo, ApiResponseCode.CODE_2001, "회원");
}
@Operation(
summary = "회원 상세 조회",
description = "관리자가 회원 PK 기준으로 회원 상세 정보를 조회합니다."
summary = "회원 상세 조회"
, description = "관리자가 회원 PK 기준으로 회원 상세 정보를 조회합니다."
)
@GetMapping("/detail")
public ResponseEntity<ApiResponse<AdminMemberDetailVo>> adminMemberDetail(
@GetMapping("/view")
public ResponseEntity<ApiResponse<AdminMemberViewVo>> adminMemberView(
@RequestParam Integer userIdx
) {
AdminMemberDetailVo result = adminMemberService.selectAdminMemberDetail(userIdx);
AdminMemberViewVo adminMemberViewVo = adminMemberService.selectAdminMemberView(userIdx);
if (result == null) {
return ApiResponse.entity((AdminMemberDetailVo) null, ApiResponseCode.CODE_2003);
if (adminMemberViewVo == null) {
return ApiResponse.entity((AdminMemberViewVo) null, ApiResponseCode.CODE_2003);
}
return ApiResponse.entity(result, ApiResponseCode.CODE_2001, "회원");
return ApiResponse.entity(adminMemberViewVo, ApiResponseCode.CODE_2001, "회원");
}
@Operation(
summary = "회원 정보 수정",
description = "관리자가 회원 PK 기준으로 회원 기본 정보와 권한 정보를 수정합니다."
summary = "회원 정보 수정"
, description = "관리자가 회원 PK 기준으로 회원 기본 정보와 권한 정보를 수정합니다."
)
@PutMapping("/update")
public ResponseEntity<ApiResponse<AdminMemberUpdateVo>> adminMemberUpdate(
@Valid @RequestBody AdminMemberUpdateForm adminMemberUpdateForm
@PutMapping("/modify")
public ResponseEntity<ApiResponse<AdminMemberModifyVo>> adminMemberModify(
@Valid @RequestBody AdminMemberModifyForm adminMemberModifyForm
) {
AdminMemberUpdateVo result = adminMemberService.updateAdminMember(adminMemberUpdateForm.toAdminMemberUpdateDto());
AdminMemberModifyVo adminMemberModifyVo = adminMemberService.updateAdminMemberModify(adminMemberModifyForm.toDto());
if (!result.isMemberUpdated()) {
return ApiResponse.entity(result, ApiResponseCode.CODE_2003);
if (!adminMemberModifyVo.isProcessed()) {
return ApiResponse.entity(adminMemberModifyVo, ApiResponseCode.CODE_2003);
}
return ApiResponse.entity(result, ApiResponseCode.CODE_2005, "회원 수정");
return ApiResponse.entity(adminMemberModifyVo, ApiResponseCode.CODE_2005, "회원 수정");
}
@Operation(
summary = "회원 휴면 상태 변경",
description = "관리자가 회원 PK 기준으로 휴면 상태를 변경합니다. Y: 휴면, N: 정상"
)
@PatchMapping("/dormant")
public ResponseEntity<ApiResponse<AdminMemberDormantStatusVo>> updateAdminMemberDormantStatus(
@Valid @RequestBody AdminMemberDormantStatusForm adminMemberDormantStatusForm
) {
AdminMemberDormantStatusVo result = adminMemberService.updateAdminMemberDormantStatus(adminMemberDormantStatusForm.toAdminMemberDormantStatusUpdateDto());
if (!result.isDormantStatusUpdated()) {
return ApiResponse.entity(result, ApiResponseCode.CODE_2003);
}
return ApiResponse.entity(result, ApiResponseCode.CODE_2005, "회원 휴면 상태 변경");
}
@Operation(
summary = "회원 탈퇴 상태 변경",
description = "관리자가 회원 PK 기준으로 탈퇴 상태를 변경합니다. N: 정상, P: 탈퇴대기, Y: 탈퇴완료"
)
@PatchMapping("/withdraw")
public ResponseEntity<ApiResponse<AdminMemberWithdrawStatusVo>> updateAdminMemberWithdrawStatus(
@Valid @RequestBody AdminMemberWithdrawStatusForm adminMemberWithdrawStatusForm
) {
AdminMemberWithdrawStatusVo result = adminMemberService.updateAdminMemberWithdrawStatus(adminMemberWithdrawStatusForm.toAdminMemberWithdrawStatusUpdateDto());
if (!result.isWithdrawStatusUpdated()) {
return ApiResponse.entity(result, ApiResponseCode.CODE_2003);
}
return ApiResponse.entity(result, ApiResponseCode.CODE_2005, "회원 탈퇴 상태 변경");
}
@Operation(
summary = "회원 계정 삭제",
description = "관리자가 회원 PK 기준으로 계정을 삭제 처리합니다. 실제 삭제가 아닌 del_yn 변경 방식입니다."
summary = "회원 계정 삭제"
, description = "관리자가 회원 PK 기준으로 계정을 삭제 처리합니다. 실제 삭제가 아닌 del_yn 변경 방식입니다."
)
@PatchMapping("/delete")
public ResponseEntity<ApiResponse<AdminMemberDeleteVo>> deleteAdminMember(
public ResponseEntity<ApiResponse<AdminMemberDeleteVo>> adminMemberDelete(
@Valid @RequestBody AdminMemberDeleteForm adminMemberDeleteForm
) {
AdminMemberDeleteVo result = adminMemberService.deleteAdminMember(adminMemberDeleteForm.toAdminMemberDeleteDto());
AdminMemberDeleteVo adminMemberDeleteVo = adminMemberService.updateAdminMemberDelete(adminMemberDeleteForm.toDto());
if (!result.isMemberDeleted()) {
return ApiResponse.entity(result, ApiResponseCode.CODE_2003);
if (!adminMemberDeleteVo.isProcessed()) {
return ApiResponse.entity(adminMemberDeleteVo, ApiResponseCode.CODE_2003);
}
return ApiResponse.entity(result, ApiResponseCode.CODE_2005, "회원 계정 삭제");
return ApiResponse.entity(adminMemberDeleteVo, ApiResponseCode.CODE_2005, "회원 계정 삭제");
}
@Operation(
summary = "회원 휴면 상태 변경"
, description = "관리자가 회원 PK 기준으로 휴면 상태를 변경합니다. Y: 휴면, N: 정상"
)
@PatchMapping("/dormant/modify")
public ResponseEntity<ApiResponse<AdminMemberDormantModifyVo>> adminMemberDormantModify(
@Valid @RequestBody AdminMemberDormantModifyForm adminMemberDormantModifyForm
) {
AdminMemberDormantModifyVo adminMemberDormantModifyVo = adminMemberService.updateAdminMemberDormantModify(adminMemberDormantModifyForm.toDto());
if (!adminMemberDormantModifyVo.isProcessed()) {
return ApiResponse.entity(adminMemberDormantModifyVo, ApiResponseCode.CODE_2003);
}
return ApiResponse.entity(adminMemberDormantModifyVo, ApiResponseCode.CODE_2005, "회원 휴면 상태 변경");
}
@Operation(
summary = "회원 탈퇴 상태 변경"
, description = "관리자가 회원 PK 기준으로 탈퇴 상태를 변경합니다. N: 정상, P: 탈퇴대기, Y: 탈퇴완료"
)
@PatchMapping("/withdraw/modify")
public ResponseEntity<ApiResponse<AdminMemberWithdrawModifyVo>> adminMemberWithdrawModify(
@Valid @RequestBody AdminMemberWithdrawModifyForm adminMemberWithdrawModifyForm
) {
AdminMemberWithdrawModifyVo adminMemberWithdrawModifyVo = adminMemberService.updateAdminMemberWithdrawModify(adminMemberWithdrawModifyForm.toDto());
if (!adminMemberWithdrawModifyVo.isProcessed()) {
return ApiResponse.entity(adminMemberWithdrawModifyVo, ApiResponseCode.CODE_2003);
}
return ApiResponse.entity(adminMemberWithdrawModifyVo, ApiResponseCode.CODE_2005, "회원 탈퇴 상태 변경");
}
}
@@ -5,7 +5,7 @@ import lombok.Setter;
@Getter
@Setter
public class AdminMemberDormantStatusDto {
public class AdminMemberDormantModifyDto {
private Integer userIdx;
private String dormantYn;
}
@@ -6,7 +6,7 @@ import lombok.Setter;
@Getter
@Setter
public class AdminMemberSearchDto extends PageRequest {
public class AdminMemberListDto extends PageRequest {
private String keyword;
private String userRole;
private String userType;
@@ -5,7 +5,7 @@ import lombok.Setter;
@Getter
@Setter
public class AdminMemberUpdateDto {
public class AdminMemberModifyDto {
private Integer userIdx;
private String email;
private String hp;
@@ -5,7 +5,7 @@ import lombok.Setter;
@Getter
@Setter
public class AdminMemberWithdrawStatusDto {
public class AdminMemberWithdrawModifyDto {
private Integer userIdx;
private String withdrawStatus;
}
@@ -14,7 +14,7 @@ public class AdminMemberDeleteForm {
@NotNull(message = "회원 PK는 필수입니다.")
private Integer userIdx;
public AdminMemberDeleteDto toAdminMemberDeleteDto() {
public AdminMemberDeleteDto toDto() {
AdminMemberDeleteDto adminMemberDeleteDto = new AdminMemberDeleteDto();
adminMemberDeleteDto.setUserIdx(userIdx);
return adminMemberDeleteDto;
@@ -1,6 +1,6 @@
package com.alist.api.modules.admin.member.form;
import com.alist.api.modules.admin.member.dto.AdminMemberDormantStatusDto;
import com.alist.api.modules.admin.member.dto.AdminMemberDormantModifyDto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
@@ -11,7 +11,7 @@ import lombok.Setter;
@Schema(description = "관리자 회원 휴면 상태 변경 요청 폼")
@Getter
@Setter
public class AdminMemberDormantStatusForm {
public class AdminMemberDormantModifyForm {
@Schema(description = "회원 PK", example = "15", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "회원 PK는 필수입니다.")
private Integer userIdx;
@@ -21,10 +21,10 @@ public class AdminMemberDormantStatusForm {
@Pattern(regexp = "^[YN]$", message = "휴면 여부는 Y 또는 N만 가능합니다.")
private String dormantYn;
public AdminMemberDormantStatusDto toAdminMemberDormantStatusUpdateDto() {
AdminMemberDormantStatusDto adminMemberDormantStatusDto = new AdminMemberDormantStatusDto();
adminMemberDormantStatusDto.setUserIdx(userIdx);
adminMemberDormantStatusDto.setDormantYn(dormantYn);
return adminMemberDormantStatusDto;
public AdminMemberDormantModifyDto toDto() {
AdminMemberDormantModifyDto adminMemberDormantModifyDto = new AdminMemberDormantModifyDto();
adminMemberDormantModifyDto.setUserIdx(userIdx);
adminMemberDormantModifyDto.setDormantYn(dormantYn);
return adminMemberDormantModifyDto;
}
}
@@ -1,7 +1,7 @@
package com.alist.api.modules.admin.member.form;
import com.alist.api.common.paging.PageRequest;
import com.alist.api.modules.admin.member.dto.AdminMemberSearchDto;
import com.alist.api.modules.admin.member.dto.AdminMemberListDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@@ -9,7 +9,7 @@ import lombok.Setter;
@Schema(description = "관리자 회원 목록 검색 조건")
@Getter
@Setter
public class AdminMemberSearchForm extends PageRequest {
public class AdminMemberListForm extends PageRequest {
@Schema(description = "검색어. 아이디, 이메일, 휴대폰 번호를 대상으로 검색합니다.", example = "admin")
private String keyword;
@@ -25,15 +25,15 @@ public class AdminMemberSearchForm extends PageRequest {
@Schema(description = "탈퇴 상태. N: 정상, P: 탈퇴대기, Y: 탈퇴완료", example = "N")
private String withdrawStatus;
public AdminMemberSearchDto toAdminMemberSearchDto() {
AdminMemberSearchDto adminMemberSearchDto = new AdminMemberSearchDto();
adminMemberSearchDto.setPage(getPage());
adminMemberSearchDto.setSize(getSize());
adminMemberSearchDto.setKeyword(keyword);
adminMemberSearchDto.setUserRole(userRole);
adminMemberSearchDto.setUserType(userType);
adminMemberSearchDto.setDormantYn(dormantYn);
adminMemberSearchDto.setWithdrawStatus(withdrawStatus);
return adminMemberSearchDto;
public AdminMemberListDto toDto() {
AdminMemberListDto adminMemberListDto = new AdminMemberListDto();
adminMemberListDto.setPage(getPage());
adminMemberListDto.setSize(getSize());
adminMemberListDto.setKeyword(keyword);
adminMemberListDto.setUserRole(userRole);
adminMemberListDto.setUserType(userType);
adminMemberListDto.setDormantYn(dormantYn);
adminMemberListDto.setWithdrawStatus(withdrawStatus);
return adminMemberListDto;
}
}
@@ -1,6 +1,6 @@
package com.alist.api.modules.admin.member.form;
import com.alist.api.modules.admin.member.dto.AdminMemberUpdateDto;
import com.alist.api.modules.admin.member.dto.AdminMemberModifyDto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotNull;
@@ -10,7 +10,7 @@ import lombok.Setter;
@Schema(description = "관리자 회원 수정 요청 폼")
@Getter
@Setter
public class AdminMemberUpdateForm {
public class AdminMemberModifyForm {
@Schema(description = "회원 PK", example = "15", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "회원 PK는 필수입니다.")
private Integer userIdx;
@@ -28,13 +28,13 @@ public class AdminMemberUpdateForm {
@Schema(description = "회원 유형 코드. A: 관리자, T: 교사, S: 학생", example = "T")
private String userType;
public AdminMemberUpdateDto toAdminMemberUpdateDto() {
AdminMemberUpdateDto adminMemberUpdateDto = new AdminMemberUpdateDto();
adminMemberUpdateDto.setUserIdx(userIdx);
adminMemberUpdateDto.setEmail(email);
adminMemberUpdateDto.setHp(hp);
adminMemberUpdateDto.setUserRole(userRole);
adminMemberUpdateDto.setUserType(userType);
return adminMemberUpdateDto;
public AdminMemberModifyDto toDto() {
AdminMemberModifyDto adminMemberModifyDto = new AdminMemberModifyDto();
adminMemberModifyDto.setUserIdx(userIdx);
adminMemberModifyDto.setEmail(email);
adminMemberModifyDto.setHp(hp);
adminMemberModifyDto.setUserRole(userRole);
adminMemberModifyDto.setUserType(userType);
return adminMemberModifyDto;
}
}
@@ -1,6 +1,6 @@
package com.alist.api.modules.admin.member.form;
import com.alist.api.modules.admin.member.dto.AdminMemberWithdrawStatusDto;
import com.alist.api.modules.admin.member.dto.AdminMemberWithdrawModifyDto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
@@ -11,7 +11,7 @@ import lombok.Setter;
@Schema(description = "관리자 회원 탈퇴 상태 변경 요청 폼")
@Getter
@Setter
public class AdminMemberWithdrawStatusForm {
public class AdminMemberWithdrawModifyForm {
@Schema(description = "회원 PK", example = "15", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "회원 PK는 필수입니다.")
private Integer userIdx;
@@ -21,10 +21,10 @@ public class AdminMemberWithdrawStatusForm {
@Pattern(regexp = "^[NPY]$", message = "탈퇴 상태는 N, P, Y만 가능합니다.")
private String withdrawStatus;
public AdminMemberWithdrawStatusDto toAdminMemberWithdrawStatusUpdateDto() {
AdminMemberWithdrawStatusDto adminMemberWithdrawStatusDto = new AdminMemberWithdrawStatusDto();
adminMemberWithdrawStatusDto.setUserIdx(userIdx);
adminMemberWithdrawStatusDto.setWithdrawStatus(withdrawStatus);
return adminMemberWithdrawStatusDto;
public AdminMemberWithdrawModifyDto toDto() {
AdminMemberWithdrawModifyDto adminMemberWithdrawModifyDto = new AdminMemberWithdrawModifyDto();
adminMemberWithdrawModifyDto.setUserIdx(userIdx);
adminMemberWithdrawModifyDto.setWithdrawStatus(withdrawStatus);
return adminMemberWithdrawModifyDto;
}
}
@@ -1,7 +1,7 @@
package com.alist.api.modules.admin.member.mapper;
import com.alist.api.modules.admin.member.dto.*;
import com.alist.api.modules.admin.member.vo.AdminMemberDetailVo;
import com.alist.api.modules.admin.member.vo.AdminMemberViewVo;
import com.alist.api.modules.admin.member.vo.AdminMemberVo;
import org.apache.ibatis.annotations.Mapper;
@@ -9,17 +9,17 @@ import java.util.List;
@Mapper
public interface AdminMemberMapper {
int selectAdminMemberCount(AdminMemberSearchDto adminMemberSearchDto);
int selectAdminMemberCount(AdminMemberListDto adminMemberListDto);
List<AdminMemberVo> selectAdminMemberList(AdminMemberSearchDto adminMemberSearchDto);
List<AdminMemberVo> selectAdminMemberList(AdminMemberListDto adminMemberListDto);
AdminMemberDetailVo selectAdminMemberDetail(Integer userIdx);
AdminMemberViewVo selectAdminMemberView(Integer userIdx);
int updateAdminMember(AdminMemberUpdateDto adminMemberUpdateDto);
int updateAdminMemberModify(AdminMemberModifyDto adminMemberModifyDto);
int updateAdminMemberDormantStatus(AdminMemberDormantStatusDto adminMemberDormantStatusDto);
int updateAdminMemberDormantModify(AdminMemberDormantModifyDto adminMemberDormantModifyDto);
int updateAdminMemberWithdrawStatus(AdminMemberWithdrawStatusDto adminMemberWithdrawStatusDto);
int updateAdminMemberWithdrawModify(AdminMemberWithdrawModifyDto adminMemberWithdrawModifyDto);
int deleteAdminMember(AdminMemberDeleteDto adminMemberDeleteDto);
int updateAdminMemberDelete(AdminMemberDeleteDto adminMemberDeleteDto);
}
@@ -17,55 +17,55 @@ public class AdminMemberService {
}
@Transactional(readOnly = true)
public AdminMemberListVo selectAdminMemberList(AdminMemberSearchDto adminMemberSearchDto) {
int totalCount = adminMemberMapper.selectAdminMemberCount(adminMemberSearchDto);
List<AdminMemberVo> memberList = adminMemberMapper.selectAdminMemberList(adminMemberSearchDto);
public AdminMemberListVo selectAdminMemberList(AdminMemberListDto adminMemberListDto) {
int totalCount = adminMemberMapper.selectAdminMemberCount(adminMemberListDto);
List<AdminMemberVo> adminMemberList = adminMemberMapper.selectAdminMemberList(adminMemberListDto);
AdminMemberListVo result = new AdminMemberListVo();
result.setMemberList(memberList);
result.setPaging(adminMemberSearchDto, totalCount);
AdminMemberListVo adminMemberListVo = new AdminMemberListVo();
adminMemberListVo.setMemberList(adminMemberList);
adminMemberListVo.setPaging(adminMemberListDto, totalCount);
return result;
return adminMemberListVo;
}
@Transactional(readOnly = true)
public AdminMemberDetailVo selectAdminMemberDetail(Integer userIdx) {
return adminMemberMapper.selectAdminMemberDetail(userIdx);
public AdminMemberViewVo selectAdminMemberView(Integer userIdx) {
return adminMemberMapper.selectAdminMemberView(userIdx);
}
@Transactional
public AdminMemberUpdateVo updateAdminMember(AdminMemberUpdateDto adminMemberUpdateDto) {
int updateCount = adminMemberMapper.updateAdminMember(adminMemberUpdateDto);
public AdminMemberModifyVo updateAdminMemberModify(AdminMemberModifyDto adminMemberModifyDto) {
int updateCount = adminMemberMapper.updateAdminMemberModify(adminMemberModifyDto);
AdminMemberUpdateVo result = new AdminMemberUpdateVo();
result.setMemberUpdated(updateCount > 0);
return result;
AdminMemberModifyVo adminMemberModifyVo = new AdminMemberModifyVo();
adminMemberModifyVo.setProcessed(updateCount > 0);
return adminMemberModifyVo;
}
@Transactional
public AdminMemberDormantStatusVo updateAdminMemberDormantStatus(AdminMemberDormantStatusDto adminMemberDormantStatusDto) {
int updateCount = adminMemberMapper.updateAdminMemberDormantStatus(adminMemberDormantStatusDto);
public AdminMemberDormantModifyVo updateAdminMemberDormantModify(AdminMemberDormantModifyDto adminMemberDormantModifyDto) {
int updateCount = adminMemberMapper.updateAdminMemberDormantModify(adminMemberDormantModifyDto);
AdminMemberDormantStatusVo result = new AdminMemberDormantStatusVo();
result.setDormantStatusUpdated(updateCount > 0);
return result;
AdminMemberDormantModifyVo adminMemberDormantModifyVo = new AdminMemberDormantModifyVo();
adminMemberDormantModifyVo.setProcessed(updateCount > 0);
return adminMemberDormantModifyVo;
}
@Transactional
public AdminMemberWithdrawStatusVo updateAdminMemberWithdrawStatus(AdminMemberWithdrawStatusDto adminMemberWithdrawStatusDto) {
int updateCount = adminMemberMapper.updateAdminMemberWithdrawStatus(adminMemberWithdrawStatusDto);
public AdminMemberWithdrawModifyVo updateAdminMemberWithdrawModify(AdminMemberWithdrawModifyDto adminMemberWithdrawModifyDto) {
int updateCount = adminMemberMapper.updateAdminMemberWithdrawModify(adminMemberWithdrawModifyDto);
AdminMemberWithdrawStatusVo result = new AdminMemberWithdrawStatusVo();
result.setWithdrawStatusUpdated(updateCount > 0);
return result;
AdminMemberWithdrawModifyVo adminMemberWithdrawModifyVo = new AdminMemberWithdrawModifyVo();
adminMemberWithdrawModifyVo.setProcessed(updateCount > 0);
return adminMemberWithdrawModifyVo;
}
@Transactional
public AdminMemberDeleteVo deleteAdminMember(AdminMemberDeleteDto adminMemberDeleteDto) {
int updateCount = adminMemberMapper.deleteAdminMember(adminMemberDeleteDto);
public AdminMemberDeleteVo updateAdminMemberDelete(AdminMemberDeleteDto adminMemberDeleteDto) {
int updateCount = adminMemberMapper.updateAdminMemberDelete(adminMemberDeleteDto);
AdminMemberDeleteVo result = new AdminMemberDeleteVo();
result.setMemberDeleted(updateCount > 0);
return result;
AdminMemberDeleteVo adminMemberDeleteVo = new AdminMemberDeleteVo();
adminMemberDeleteVo.setProcessed(updateCount > 0);
return adminMemberDeleteVo;
}
}
@@ -9,5 +9,5 @@ import lombok.Setter;
@Setter
public class AdminMemberDeleteVo {
@Schema(description = "회원 계정 삭제 여부", example = "true")
private boolean memberDeleted;
private boolean processed;
}
@@ -7,7 +7,7 @@ import lombok.Setter;
@Schema(description = "관리자 회원 휴면 상태 변경 응답")
@Getter
@Setter
public class AdminMemberDormantStatusVo {
public class AdminMemberDormantModifyVo {
@Schema(description = "휴면 상태 변경 여부", example = "true")
private boolean dormantStatusUpdated;
private boolean processed;
}
@@ -7,7 +7,7 @@ import lombok.Setter;
@Schema(description = "관리자 회원 수정 응답")
@Getter
@Setter
public class AdminMemberUpdateVo {
public class AdminMemberModifyVo {
@Schema(description = "회원 수정 여부", example = "true")
private boolean memberUpdated;
private boolean processed;
}
@@ -9,7 +9,7 @@ import java.time.LocalDateTime;
@Schema(description = "관리자 회원 상세 조회 응답")
@Getter
@Setter
public class AdminMemberDetailVo {
public class AdminMemberViewVo {
@Schema(description = "회원 PK", example = "15")
private Integer userIdx;
@@ -7,7 +7,7 @@ import lombok.Setter;
@Schema(description = "관리자 회원 탈퇴 상태 변경 응답")
@Getter
@Setter
public class AdminMemberWithdrawStatusVo {
public class AdminMemberWithdrawModifyVo {
@Schema(description = "탈퇴 상태 변경 여부", example = "true")
private boolean withdrawStatusUpdated;
private boolean processed;
}
@@ -26,8 +26,57 @@
AND ATU.withdraw_status = #{withdrawStatus}
</if>
</sql>
<update id="updateAdminMember">
/*AdminMemberMapper.updateAdminMember*/
<select id="selectAdminMemberCount" resultType="int">
/*AdminMemberMapper.selectAdminMemberCount*/
SELECT COUNT(*)
<include refid="adminMemberWhere"/>
</select>
<select id="selectAdminMemberList" resultType="com.alist.api.modules.admin.member.vo.AdminMemberVo">
/*AdminMemberMapper.selectAdminMemberList*/
SELECT ATU.user_idx
, ATUT.user_token_idx
, ATU.id
, ATU.email
, ATU.hp
, ATUT.user_role
, ATUT.user_type
, ATU.dormant_yn
, ATU.dormant_at
, ATU.withdraw_status
, ATU.withdraw_at
, ATU.create_at
, ATU.update_at
<include refid="adminMemberWhere"/>
ORDER BY ATU.user_idx DESC
LIMIT #{limit}
OFFSET #{offset}
</select>
<select id="selectAdminMemberView" resultType="com.alist.api.modules.admin.member.vo.AdminMemberViewVo">
/*AdminMemberMapper.selectAdminMemberView*/
SELECT ATU.user_idx
, ATUT.user_token_idx
, ATU.id
, ATU.email
, ATU.hp
, ATUT.user_role
, ATUT.user_type
, ATU.dormant_yn
, ATU.dormant_at
, ATU.withdraw_status
, ATU.withdraw_at
, ATU.create_at
, ATU.update_at
FROM ALISTLMS.test_user ATU
INNER JOIN ALISTLMS.test_user_token ATUT ON ATUT.user_idx = ATU.user_idx
WHERE ATU.del_yn = 1
AND ATU.user_idx = #{userIdx}
</select>
<update id="updateAdminMemberModify">
/*AdminMemberMapper.updateAdminMemberModify*/
UPDATE ALISTLMS.test_user ATU
INNER JOIN ALISTLMS.test_user_token ATUT ON ATUT.user_idx = ATU.user_idx
SET ATU.update_at = now()
@@ -48,8 +97,8 @@
AND ATU.del_yn = 1
</update>
<update id="updateAdminMemberDormantStatus">
/*AdminMemberMapper.updateAdminMemberDormantStatus*/
<update id="updateAdminMemberDormantModify">
/*AdminMemberMapper.updateAdminMemberDormantModify*/
UPDATE ALISTLMS.test_user
SET dormant_yn = #{dormantYn}
, dormant_at =
@@ -63,8 +112,8 @@
AND del_yn = 1
</update>
<update id="updateAdminMemberWithdrawStatus">
/*AdminMemberMapper.updateAdminMemberWithdrawStatus*/
<update id="updateAdminMemberWithdrawModify">
/*AdminMemberMapper.updateAdminMemberWithdrawModify*/
UPDATE ALISTLMS.test_user
SET withdraw_status = #{withdrawStatus}
, withdraw_at =
@@ -77,59 +126,13 @@
WHERE user_idx = #{userIdx}
AND del_yn = 1
</update>
<update id="deleteAdminMember">
/*AdminMemberMapper.deleteAdminMember*/
<update id="updateAdminMemberDelete">
/*AdminMemberMapper.updateAdminMemberDelete*/
UPDATE ALISTLMS.test_user
SET del_yn = 0
, update_at = now()
WHERE user_idx = #{userIdx}
AND del_yn = 1
</update>
<select id="selectAdminMemberCount" resultType="int">
/*AdminMemberMapper.selectAdminMemberCount*/
SELECT COUNT(*)
<include refid="adminMemberWhere"/>
</select>
<select id="selectAdminMemberList" resultType="com.alist.api.modules.admin.member.vo.AdminMemberVo">
/*AdminMemberMapper.selectAdminMemberList*/
SELECT ATU.user_idx
, ATUT.user_token_idx
, ATU.id
, ATU.email
, ATU.hp
, ATUT.user_role
, ATUT.user_type
, ATU.dormant_yn
, ATU.dormant_at
, ATU.withdraw_status
, ATU.withdraw_at
, ATU.create_at
, ATU.update_at
<include refid="adminMemberWhere"/>
ORDER BY ATU.user_idx DESC
LIMIT #{limit}
OFFSET #{offset}
</select>
<select id="selectAdminMemberDetail" resultType="com.alist.api.modules.admin.member.vo.AdminMemberDetailVo">
/*AdminMemberMapper.selectAdminMemberDetail*/
SELECT ATU.user_idx
, ATUT.user_token_idx
, ATU.id
, ATU.email
, ATU.hp
, ATUT.user_role
, ATUT.user_type
, ATU.dormant_yn
, ATU.dormant_at
, ATU.withdraw_status
, ATU.withdraw_at
, ATU.create_at
, ATU.update_at
FROM ALISTLMS.test_user ATU
INNER JOIN ALISTLMS.test_user_token ATUT ON ATUT.user_idx = ATU.user_idx
WHERE ATU.del_yn = 1
AND ATU.user_idx = #{userIdx}
</select>
</mapper>