From 495ab4cedab5604cc6f5fb2cae7129836562f654 Mon Sep 17 00:00:00 2001 From: HyunJunSon Date: Thu, 7 Mar 2024 16:31:31 +0900 Subject: [PATCH 1/4] =?UTF-8?q?feature::=20admin=20=EB=A9=A4=EB=B2=84?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=20=EC=A0=84=EC=B2=B4=EB=A9=A4=EB=B2=84=20api?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/code/MemberBusinessCode.java | 30 ++++++++++ .../member/code/MemberErrorCode.java | 31 ++++++++++ .../member/controller/MemberController.java | 26 ++++++++ .../com/kernel360/member/dto/MemberDto.java | 48 +++++++++++++++ .../kernel360/member/dto/MemberResponse.java | 38 ++++++++++++ .../kernel360/member/dto/MemberSearchDto.java | 19 ++++++ .../com/kernel360/member/enumset/Age.java | 16 +++++ .../com/kernel360/member/enumset/Gender.java | 13 ++++ .../com/kernel360/member/enumset/Sort.java | 23 ++++++++ .../member/repository/MemberRepository.java | 5 ++ .../repository/MemberRepositoryDsl.java | 10 ++++ .../repository/MemberRepositoryImpl.java | 59 +++++++++++++++++++ .../member/service/MemberService.java | 23 ++++++++ .../review/repository/ReviewRepository.java | 4 ++ .../ReviewRepositoryDsl.java | 2 +- .../ReviewRepositoryImpl.java | 3 +- .../review/respository/ReviewRepository.java | 6 -- .../review/service/ReviewServiceImpl.java | 2 +- .../com/kernel360/carinfo/entity/CarInfo.java | 8 ++- .../member/repository/AdminRepository.java | 7 +++ ...pository.java => MemberRepositoryJpa.java} | 2 +- .../SafetyStatusConverter.java | 2 +- .../kernel360/washinfo/entity/WashInfo.java | 5 +- 23 files changed, 367 insertions(+), 15 deletions(-) create mode 100644 module-admin/src/main/java/com/kernel360/member/code/MemberBusinessCode.java create mode 100644 module-admin/src/main/java/com/kernel360/member/code/MemberErrorCode.java create mode 100644 module-admin/src/main/java/com/kernel360/member/controller/MemberController.java create mode 100644 module-admin/src/main/java/com/kernel360/member/dto/MemberDto.java create mode 100644 module-admin/src/main/java/com/kernel360/member/dto/MemberResponse.java create mode 100644 module-admin/src/main/java/com/kernel360/member/dto/MemberSearchDto.java create mode 100644 module-admin/src/main/java/com/kernel360/member/enumset/Age.java create mode 100644 module-admin/src/main/java/com/kernel360/member/enumset/Gender.java create mode 100644 module-admin/src/main/java/com/kernel360/member/enumset/Sort.java create mode 100644 module-admin/src/main/java/com/kernel360/member/repository/MemberRepository.java create mode 100644 module-admin/src/main/java/com/kernel360/member/repository/MemberRepositoryDsl.java create mode 100644 module-admin/src/main/java/com/kernel360/member/repository/MemberRepositoryImpl.java create mode 100644 module-admin/src/main/java/com/kernel360/member/service/MemberService.java create mode 100644 module-admin/src/main/java/com/kernel360/review/repository/ReviewRepository.java rename module-admin/src/main/java/com/kernel360/review/{respository => repository}/ReviewRepositoryDsl.java (89%) rename module-admin/src/main/java/com/kernel360/review/{respository => repository}/ReviewRepositoryImpl.java (97%) delete mode 100644 module-admin/src/main/java/com/kernel360/review/respository/ReviewRepository.java create mode 100644 module-domain/src/main/java/com/kernel360/member/repository/AdminRepository.java rename module-domain/src/main/java/com/kernel360/member/repository/{MemberRepository.java => MemberRepositoryJpa.java} (91%) rename module-domain/src/main/java/com/kernel360/product/{entity => converter}/SafetyStatusConverter.java (95%) diff --git a/module-admin/src/main/java/com/kernel360/member/code/MemberBusinessCode.java b/module-admin/src/main/java/com/kernel360/member/code/MemberBusinessCode.java new file mode 100644 index 00000000..10cf42c2 --- /dev/null +++ b/module-admin/src/main/java/com/kernel360/member/code/MemberBusinessCode.java @@ -0,0 +1,30 @@ +package com.kernel360.member.code; + +import com.kernel360.code.BusinessCode; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@RequiredArgsConstructor +public enum MemberBusinessCode implements BusinessCode { + + SUCCESS_REQUEST_ALL_MEMBER_LIST(HttpStatus.OK.value(), "BMC001", "전체회원목록 조회 성공"); + + private final int status; + private final String code; + private final String message; + + @Override + public int getStatus() { + return status; + } + + @Override + public String getCode() { + return code; + } + + @Override + public String getMessage() { + return message; + } +} diff --git a/module-admin/src/main/java/com/kernel360/member/code/MemberErrorCode.java b/module-admin/src/main/java/com/kernel360/member/code/MemberErrorCode.java new file mode 100644 index 00000000..cdf33ec6 --- /dev/null +++ b/module-admin/src/main/java/com/kernel360/member/code/MemberErrorCode.java @@ -0,0 +1,31 @@ +package com.kernel360.member.code; + +import com.kernel360.code.ErrorCode; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@RequiredArgsConstructor +public enum MemberErrorCode implements ErrorCode { + + FAILED_NOT_MAPPING_ORDINAL_TO_NAME(HttpStatus.INTERNAL_SERVER_ERROR.value(), "EMC001", ""); + + + private final int status; + private final String code; + private final String message; + + @Override + public int getStatus() { + return status; + } + + @Override + public String getCode() { + return code; + } + + @Override + public String getMessage() { + return message; + } +} diff --git a/module-admin/src/main/java/com/kernel360/member/controller/MemberController.java b/module-admin/src/main/java/com/kernel360/member/controller/MemberController.java new file mode 100644 index 00000000..63b837de --- /dev/null +++ b/module-admin/src/main/java/com/kernel360/member/controller/MemberController.java @@ -0,0 +1,26 @@ +package com.kernel360.member.controller; + +import com.kernel360.member.code.MemberBusinessCode; +import com.kernel360.member.dto.MemberResponse; +import com.kernel360.member.service.MemberService; +import com.kernel360.response.ApiResponse; +import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/admin") +public class MemberController { + + private final MemberService memberService; + + @GetMapping("members") + public ResponseEntity>> getMemberList(Pageable pageable) { + Page members = memberService.getAllMembers(pageable); + + return ApiResponse.toResponseEntity(MemberBusinessCode.SUCCESS_REQUEST_ALL_MEMBER_LIST, members); + } +} diff --git a/module-admin/src/main/java/com/kernel360/member/dto/MemberDto.java b/module-admin/src/main/java/com/kernel360/member/dto/MemberDto.java new file mode 100644 index 00000000..44024790 --- /dev/null +++ b/module-admin/src/main/java/com/kernel360/member/dto/MemberDto.java @@ -0,0 +1,48 @@ +package com.kernel360.member.dto; + + +import java.time.LocalDate; + +/** + * DTO for {@link com.kernel360.member.entity.Member} + */ +public record MemberDto(Long memberNo, + String id, + String email, + String password, + String gender, + String age, + LocalDate createdAt, + String createdBy, + LocalDate modifiedAt, + String modifiedBy +) { + + public static MemberDto of( + Long memberNo, + String id, + String email, + String password, + String gender, + String age, + LocalDate createdAt, + String createdBy, + LocalDate modifiedAt, + String modifiedBy + ) { + return new MemberDto( + memberNo, + id, + email, + password, + gender, + age, + createdAt, + createdBy, + modifiedAt, + modifiedBy + ); + } + + +} \ No newline at end of file diff --git a/module-admin/src/main/java/com/kernel360/member/dto/MemberResponse.java b/module-admin/src/main/java/com/kernel360/member/dto/MemberResponse.java new file mode 100644 index 00000000..0cb77532 --- /dev/null +++ b/module-admin/src/main/java/com/kernel360/member/dto/MemberResponse.java @@ -0,0 +1,38 @@ +package com.kernel360.member.dto; + + +import com.kernel360.carinfo.entity.CarInfo; +import com.kernel360.washinfo.entity.WashInfo; +import com.querydsl.core.annotations.QueryProjection; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; + +@Getter +@NoArgsConstructor +public class MemberResponse { + private Long memberNo; + private String id; + private String email; + private int gender; + private int age; + private LocalDate registerDate; + private String accountType; + private WashInfo washInfo; + private CarInfo carInfo; + @QueryProjection + public MemberResponse(Long memberNo, String id, String email, int gender, int age, LocalDate registerDate, + String accountType, WashInfo washInfo, CarInfo carInfo) { + this.memberNo = memberNo; + this.id = id; + this.email = email; + this.gender = gender; + this.age = age; + this.registerDate = registerDate; + this.accountType = accountType; + this.washInfo = washInfo; + this.carInfo = carInfo; + } + +} diff --git a/module-admin/src/main/java/com/kernel360/member/dto/MemberSearchDto.java b/module-admin/src/main/java/com/kernel360/member/dto/MemberSearchDto.java new file mode 100644 index 00000000..ace6014a --- /dev/null +++ b/module-admin/src/main/java/com/kernel360/member/dto/MemberSearchDto.java @@ -0,0 +1,19 @@ +package com.kernel360.member.dto; + +import com.kernel360.carinfo.entity.CarInfo; +import com.kernel360.washinfo.entity.WashInfo; +import lombok.Builder; + +import java.time.LocalDate; + +@Builder +public record MemberSearchDto( + String id, + String name, + String email, + String age, + LocalDate registerDate, + WashInfo washInfo, + CarInfo carInfo +) { +} diff --git a/module-admin/src/main/java/com/kernel360/member/enumset/Age.java b/module-admin/src/main/java/com/kernel360/member/enumset/Age.java new file mode 100644 index 00000000..8fc70e47 --- /dev/null +++ b/module-admin/src/main/java/com/kernel360/member/enumset/Age.java @@ -0,0 +1,16 @@ +package com.kernel360.member.enumset; + +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public enum Age { + AGE_20(20), + AGE_30(30), + AGE_40(40), + AGE_50(50), + AGE_60(60), + AGE_99(99); + + private final int value; + +} diff --git a/module-admin/src/main/java/com/kernel360/member/enumset/Gender.java b/module-admin/src/main/java/com/kernel360/member/enumset/Gender.java new file mode 100644 index 00000000..050ffa4e --- /dev/null +++ b/module-admin/src/main/java/com/kernel360/member/enumset/Gender.java @@ -0,0 +1,13 @@ +package com.kernel360.member.enumset; + +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public enum Gender { + MALE(0), + FEMALE(1), + OTHERS(99); + + private final int value; + +} diff --git a/module-admin/src/main/java/com/kernel360/member/enumset/Sort.java b/module-admin/src/main/java/com/kernel360/member/enumset/Sort.java new file mode 100644 index 00000000..7538f52f --- /dev/null +++ b/module-admin/src/main/java/com/kernel360/member/enumset/Sort.java @@ -0,0 +1,23 @@ +package com.kernel360.member.enumset; + +public enum Sort { + ID_ORDER("id-order"), + GENDER_ORDER("gender-order"), + AGE_ORDER("age-order"), + REGISTER_ORDER("register-order"), + RECENT_PRODUCT_ORDER("recent-order"); + + + private final String orderType; + + Sort(String orderType) { + this.orderType = orderType; + } + + public String getOrderType() { + return orderType; + } +} + + + diff --git a/module-admin/src/main/java/com/kernel360/member/repository/MemberRepository.java b/module-admin/src/main/java/com/kernel360/member/repository/MemberRepository.java new file mode 100644 index 00000000..b6b56a89 --- /dev/null +++ b/module-admin/src/main/java/com/kernel360/member/repository/MemberRepository.java @@ -0,0 +1,5 @@ +package com.kernel360.member.repository; + + +public interface MemberRepository extends MemberRepositoryJpa, MemberRepositoryDsl { +} diff --git a/module-admin/src/main/java/com/kernel360/member/repository/MemberRepositoryDsl.java b/module-admin/src/main/java/com/kernel360/member/repository/MemberRepositoryDsl.java new file mode 100644 index 00000000..b0bdb1e3 --- /dev/null +++ b/module-admin/src/main/java/com/kernel360/member/repository/MemberRepositoryDsl.java @@ -0,0 +1,10 @@ +package com.kernel360.member.repository; + +import com.kernel360.member.dto.MemberResponse; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +public interface MemberRepositoryDsl { + Page findAllMember(Pageable pageable); + +} diff --git a/module-admin/src/main/java/com/kernel360/member/repository/MemberRepositoryImpl.java b/module-admin/src/main/java/com/kernel360/member/repository/MemberRepositoryImpl.java new file mode 100644 index 00000000..b67f817f --- /dev/null +++ b/module-admin/src/main/java/com/kernel360/member/repository/MemberRepositoryImpl.java @@ -0,0 +1,59 @@ +package com.kernel360.member.repository; + + +import com.kernel360.member.dto.MemberResponse; +import com.kernel360.member.dto.QMemberResponse; + +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.support.PageableExecutionUtils; + +import java.util.List; + +import static com.kernel360.carinfo.entity.QCarInfo.*; +import static com.kernel360.member.entity.QMember.*; +import static com.kernel360.washinfo.entity.QWashInfo.*; + + +@RequiredArgsConstructor +public class MemberRepositoryImpl implements MemberRepositoryDsl { + + private final JPAQueryFactory query; + + @Override + public Page findAllMember(Pageable pageable) { + List members = query.select(new QMemberResponse( + member.memberNo, + member.id, + member.email, + member.gender, + member.age, + member.createdAt, + member.accountType, + washInfo, + carInfo + )) + .from(member) + .leftJoin(member.washInfo, washInfo).on(IsWashInfoNotNull()) + .leftJoin(member.carInfo, carInfo).on(IsCarInfoNotNull()) + .offset(pageable.getOffset()) + .limit(pageable.getPageSize()) + .orderBy(member.memberNo.desc()) + .fetch(); + + return PageableExecutionUtils.getPage(members, pageable, members::size); + } + + private static BooleanExpression IsCarInfoNotNull() { + return member.carInfo.carNo.isNotNull(); + } + + private static BooleanExpression IsWashInfoNotNull() { + return member.washInfo.washNo.isNotNull(); + } + + +} diff --git a/module-admin/src/main/java/com/kernel360/member/service/MemberService.java b/module-admin/src/main/java/com/kernel360/member/service/MemberService.java new file mode 100644 index 00000000..74d872a5 --- /dev/null +++ b/module-admin/src/main/java/com/kernel360/member/service/MemberService.java @@ -0,0 +1,23 @@ +package com.kernel360.member.service; + +import com.kernel360.member.dto.MemberResponse; +import com.kernel360.member.repository.MemberRepository; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; + + +@Slf4j +@Service +@RequiredArgsConstructor +public class MemberService { + + private final MemberRepository memberRepository; + + public Page getAllMembers(Pageable pageable) { + + return memberRepository.findAllMember(pageable); + } +} diff --git a/module-admin/src/main/java/com/kernel360/review/repository/ReviewRepository.java b/module-admin/src/main/java/com/kernel360/review/repository/ReviewRepository.java new file mode 100644 index 00000000..619f004f --- /dev/null +++ b/module-admin/src/main/java/com/kernel360/review/repository/ReviewRepository.java @@ -0,0 +1,4 @@ +package com.kernel360.review.repository; + +public interface ReviewRepository extends ReviewRepositoryJpa, ReviewRepositoryDsl{ +} diff --git a/module-admin/src/main/java/com/kernel360/review/respository/ReviewRepositoryDsl.java b/module-admin/src/main/java/com/kernel360/review/repository/ReviewRepositoryDsl.java similarity index 89% rename from module-admin/src/main/java/com/kernel360/review/respository/ReviewRepositoryDsl.java rename to module-admin/src/main/java/com/kernel360/review/repository/ReviewRepositoryDsl.java index 55c9e501..6480742b 100644 --- a/module-admin/src/main/java/com/kernel360/review/respository/ReviewRepositoryDsl.java +++ b/module-admin/src/main/java/com/kernel360/review/repository/ReviewRepositoryDsl.java @@ -1,4 +1,4 @@ -package com.kernel360.review.respository; +package com.kernel360.review.repository; import com.kernel360.review.dto.ReviewSearchDto; import com.kernel360.review.entity.Review; diff --git a/module-admin/src/main/java/com/kernel360/review/respository/ReviewRepositoryImpl.java b/module-admin/src/main/java/com/kernel360/review/repository/ReviewRepositoryImpl.java similarity index 97% rename from module-admin/src/main/java/com/kernel360/review/respository/ReviewRepositoryImpl.java rename to module-admin/src/main/java/com/kernel360/review/repository/ReviewRepositoryImpl.java index 6885b68c..5aee21d1 100644 --- a/module-admin/src/main/java/com/kernel360/review/respository/ReviewRepositoryImpl.java +++ b/module-admin/src/main/java/com/kernel360/review/repository/ReviewRepositoryImpl.java @@ -1,4 +1,4 @@ -package com.kernel360.review.respository; +package com.kernel360.review.repository; import static com.kernel360.review.entity.QReview.review; @@ -9,7 +9,6 @@ import com.querydsl.jpa.impl.JPAQuery; import com.querydsl.jpa.impl.JPAQueryFactory; import java.util.List; -import java.util.function.LongSupplier; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.data.domain.Page; diff --git a/module-admin/src/main/java/com/kernel360/review/respository/ReviewRepository.java b/module-admin/src/main/java/com/kernel360/review/respository/ReviewRepository.java deleted file mode 100644 index e7edbc87..00000000 --- a/module-admin/src/main/java/com/kernel360/review/respository/ReviewRepository.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.kernel360.review.respository; - -import com.kernel360.review.repository.ReviewRepositoryJpa; - -public interface ReviewRepository extends ReviewRepositoryJpa, ReviewRepositoryDsl{ -} diff --git a/module-admin/src/main/java/com/kernel360/review/service/ReviewServiceImpl.java b/module-admin/src/main/java/com/kernel360/review/service/ReviewServiceImpl.java index 09fe8732..447c2bba 100644 --- a/module-admin/src/main/java/com/kernel360/review/service/ReviewServiceImpl.java +++ b/module-admin/src/main/java/com/kernel360/review/service/ReviewServiceImpl.java @@ -4,7 +4,7 @@ import com.kernel360.review.code.ReviewErrorCode; import com.kernel360.review.dto.AdminReviewDto; import com.kernel360.review.dto.ReviewSearchDto; -import com.kernel360.review.respository.ReviewRepository; +import com.kernel360.review.repository.ReviewRepository; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.data.domain.Page; diff --git a/module-domain/src/main/java/com/kernel360/carinfo/entity/CarInfo.java b/module-domain/src/main/java/com/kernel360/carinfo/entity/CarInfo.java index 48a27ede..ad106037 100644 --- a/module-domain/src/main/java/com/kernel360/carinfo/entity/CarInfo.java +++ b/module-domain/src/main/java/com/kernel360/carinfo/entity/CarInfo.java @@ -23,17 +23,21 @@ public class CarInfo extends BaseEntity { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "car_info_id_gen") @SequenceGenerator(name = "car_info_id_gen", sequenceName = "car_info_car_no_seq") - @Column(nullable = false) + @Column(name = "car_no", nullable = false) private Long carNo; @OneToOne @JoinColumn(name = "member_no") private Member member; - + @Column(name = "car_type") private Integer carType; + @Column(name = "car_size") private Integer carSize; + @Column(name = "car_color") private Integer carColor; + @Column(name = "driving_env") private Integer drivingEnv; + @Column(name = "parking_env") private Integer parkingEnv; public CarInfo(Integer carType, Integer carSize, Integer carColor, Integer drivingEnv, Integer parkingEnv) { diff --git a/module-domain/src/main/java/com/kernel360/member/repository/AdminRepository.java b/module-domain/src/main/java/com/kernel360/member/repository/AdminRepository.java new file mode 100644 index 00000000..f4f15520 --- /dev/null +++ b/module-domain/src/main/java/com/kernel360/member/repository/AdminRepository.java @@ -0,0 +1,7 @@ +package com.kernel360.member.repository; + +import com.kernel360.member.entity.Admin; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface AdminRepository extends JpaRepository { +} diff --git a/module-domain/src/main/java/com/kernel360/member/repository/MemberRepository.java b/module-domain/src/main/java/com/kernel360/member/repository/MemberRepositoryJpa.java similarity index 91% rename from module-domain/src/main/java/com/kernel360/member/repository/MemberRepository.java rename to module-domain/src/main/java/com/kernel360/member/repository/MemberRepositoryJpa.java index bf021316..4c3e7b98 100644 --- a/module-domain/src/main/java/com/kernel360/member/repository/MemberRepository.java +++ b/module-domain/src/main/java/com/kernel360/member/repository/MemberRepositoryJpa.java @@ -7,7 +7,7 @@ import org.springframework.data.repository.query.Param; -public interface MemberRepository extends JpaRepository { +public interface MemberRepositoryJpa extends JpaRepository { Member findOneByIdAndPassword(String id, String password); diff --git a/module-domain/src/main/java/com/kernel360/product/entity/SafetyStatusConverter.java b/module-domain/src/main/java/com/kernel360/product/converter/SafetyStatusConverter.java similarity index 95% rename from module-domain/src/main/java/com/kernel360/product/entity/SafetyStatusConverter.java rename to module-domain/src/main/java/com/kernel360/product/converter/SafetyStatusConverter.java index 61b91c3e..1e919ec6 100644 --- a/module-domain/src/main/java/com/kernel360/product/entity/SafetyStatusConverter.java +++ b/module-domain/src/main/java/com/kernel360/product/converter/SafetyStatusConverter.java @@ -1,4 +1,4 @@ -package com.kernel360.product.entity; +package com.kernel360.product.converter; import com.kernel360.product.enumset.SafetyStatus; import jakarta.persistence.AttributeConverter; diff --git a/module-domain/src/main/java/com/kernel360/washinfo/entity/WashInfo.java b/module-domain/src/main/java/com/kernel360/washinfo/entity/WashInfo.java index a3ff4503..6754f459 100644 --- a/module-domain/src/main/java/com/kernel360/washinfo/entity/WashInfo.java +++ b/module-domain/src/main/java/com/kernel360/washinfo/entity/WashInfo.java @@ -24,15 +24,18 @@ public class WashInfo extends BaseEntity { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "wash_info_id_gen") @SequenceGenerator(name = "wash_info_id_gen", sequenceName = "wash_info_wash_no_seq", allocationSize = 50) - @Column(nullable = false) + @Column(name = "wash_no", nullable = false) private Integer washNo; @OneToOne(fetch = FetchType.LAZY) @JoinColumn(name = "member_no", nullable = false) private Member member; + @Column(name= "wash_count") private Integer washCount; + @Column(name = "monthly_expense") private Integer monthlyExpense; + @Column(name = "interest") private Integer interest; private WashInfo(Integer washCount, Integer monthlyExpense, Integer interest) { From 85ddd4b0aebdab74696b7a6d48e083c9e643ee15 Mon Sep 17 00:00:00 2001 From: HyunJunSon Date: Thu, 14 Mar 2024 11:43:42 +0900 Subject: [PATCH 2/4] =?UTF-8?q?feature::=20=EB=A6=AC=EB=B7=B0=EB=B0=98?= =?UTF-8?q?=EC=98=81=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/code/MemberErrorCode.java | 31 ------------------- .../com/kernel360/member/dto/MemberDto.java | 14 ++++----- .../kernel360/member/dto/MemberResponse.java | 6 ++-- .../kernel360/member/dto/MemberSearchDto.java | 4 +-- .../repository/MemberRepositoryImpl.java | 8 ++--- 5 files changed, 15 insertions(+), 48 deletions(-) delete mode 100644 module-admin/src/main/java/com/kernel360/member/code/MemberErrorCode.java diff --git a/module-admin/src/main/java/com/kernel360/member/code/MemberErrorCode.java b/module-admin/src/main/java/com/kernel360/member/code/MemberErrorCode.java deleted file mode 100644 index cdf33ec6..00000000 --- a/module-admin/src/main/java/com/kernel360/member/code/MemberErrorCode.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.kernel360.member.code; - -import com.kernel360.code.ErrorCode; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatus; - -@RequiredArgsConstructor -public enum MemberErrorCode implements ErrorCode { - - FAILED_NOT_MAPPING_ORDINAL_TO_NAME(HttpStatus.INTERNAL_SERVER_ERROR.value(), "EMC001", ""); - - - private final int status; - private final String code; - private final String message; - - @Override - public int getStatus() { - return status; - } - - @Override - public String getCode() { - return code; - } - - @Override - public String getMessage() { - return message; - } -} diff --git a/module-admin/src/main/java/com/kernel360/member/dto/MemberDto.java b/module-admin/src/main/java/com/kernel360/member/dto/MemberDto.java index 44024790..f003ca58 100644 --- a/module-admin/src/main/java/com/kernel360/member/dto/MemberDto.java +++ b/module-admin/src/main/java/com/kernel360/member/dto/MemberDto.java @@ -1,20 +1,18 @@ package com.kernel360.member.dto; -import java.time.LocalDate; +import java.time.LocalDateTime; + -/** - * DTO for {@link com.kernel360.member.entity.Member} - */ public record MemberDto(Long memberNo, String id, String email, String password, String gender, String age, - LocalDate createdAt, + LocalDateTime createdAt, String createdBy, - LocalDate modifiedAt, + LocalDateTime modifiedAt, String modifiedBy ) { @@ -25,9 +23,9 @@ public static MemberDto of( String password, String gender, String age, - LocalDate createdAt, + LocalDateTime createdAt, String createdBy, - LocalDate modifiedAt, + LocalDateTime modifiedAt, String modifiedBy ) { return new MemberDto( diff --git a/module-admin/src/main/java/com/kernel360/member/dto/MemberResponse.java b/module-admin/src/main/java/com/kernel360/member/dto/MemberResponse.java index 0cb77532..3eba9363 100644 --- a/module-admin/src/main/java/com/kernel360/member/dto/MemberResponse.java +++ b/module-admin/src/main/java/com/kernel360/member/dto/MemberResponse.java @@ -7,7 +7,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -import java.time.LocalDate; +import java.time.LocalDateTime; @Getter @NoArgsConstructor @@ -17,12 +17,12 @@ public class MemberResponse { private String email; private int gender; private int age; - private LocalDate registerDate; + private LocalDateTime registerDate; private String accountType; private WashInfo washInfo; private CarInfo carInfo; @QueryProjection - public MemberResponse(Long memberNo, String id, String email, int gender, int age, LocalDate registerDate, + public MemberResponse(Long memberNo, String id, String email, int gender, int age, LocalDateTime registerDate, String accountType, WashInfo washInfo, CarInfo carInfo) { this.memberNo = memberNo; this.id = id; diff --git a/module-admin/src/main/java/com/kernel360/member/dto/MemberSearchDto.java b/module-admin/src/main/java/com/kernel360/member/dto/MemberSearchDto.java index ace6014a..5c3c78d5 100644 --- a/module-admin/src/main/java/com/kernel360/member/dto/MemberSearchDto.java +++ b/module-admin/src/main/java/com/kernel360/member/dto/MemberSearchDto.java @@ -4,7 +4,7 @@ import com.kernel360.washinfo.entity.WashInfo; import lombok.Builder; -import java.time.LocalDate; +import java.time.LocalDateTime; @Builder public record MemberSearchDto( @@ -12,7 +12,7 @@ public record MemberSearchDto( String name, String email, String age, - LocalDate registerDate, + LocalDateTime registerDate, WashInfo washInfo, CarInfo carInfo ) { diff --git a/module-admin/src/main/java/com/kernel360/member/repository/MemberRepositoryImpl.java b/module-admin/src/main/java/com/kernel360/member/repository/MemberRepositoryImpl.java index b67f817f..3618b67d 100644 --- a/module-admin/src/main/java/com/kernel360/member/repository/MemberRepositoryImpl.java +++ b/module-admin/src/main/java/com/kernel360/member/repository/MemberRepositoryImpl.java @@ -37,8 +37,8 @@ public Page findAllMember(Pageable pageable) { carInfo )) .from(member) - .leftJoin(member.washInfo, washInfo).on(IsWashInfoNotNull()) - .leftJoin(member.carInfo, carInfo).on(IsCarInfoNotNull()) + .leftJoin(member.washInfo, washInfo).on(isWashInfoNotNull()) + .leftJoin(member.carInfo, carInfo).on(isCarInfoNotNull()) .offset(pageable.getOffset()) .limit(pageable.getPageSize()) .orderBy(member.memberNo.desc()) @@ -47,11 +47,11 @@ public Page findAllMember(Pageable pageable) { return PageableExecutionUtils.getPage(members, pageable, members::size); } - private static BooleanExpression IsCarInfoNotNull() { + private static BooleanExpression isCarInfoNotNull() { return member.carInfo.carNo.isNotNull(); } - private static BooleanExpression IsWashInfoNotNull() { + private static BooleanExpression isWashInfoNotNull() { return member.washInfo.washNo.isNotNull(); } From dda5a873d808c0f90ecc9eecf9e1ac196f80ce55 Mon Sep 17 00:00:00 2001 From: HyunJunSon Date: Thu, 14 Mar 2024 11:52:26 +0900 Subject: [PATCH 3/4] =?UTF-8?q?feature::=20=EB=A6=AC=EB=B7=B0=EB=B0=98?= =?UTF-8?q?=EC=98=81#2=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/kernel360/{member/entity => admin}/Admin.java | 2 +- .../java/com/kernel360/member/repository/AdminRepository.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename module-domain/src/main/java/com/kernel360/{member/entity => admin}/Admin.java (97%) diff --git a/module-domain/src/main/java/com/kernel360/member/entity/Admin.java b/module-domain/src/main/java/com/kernel360/admin/Admin.java similarity index 97% rename from module-domain/src/main/java/com/kernel360/member/entity/Admin.java rename to module-domain/src/main/java/com/kernel360/admin/Admin.java index 42d0865b..93baab71 100644 --- a/module-domain/src/main/java/com/kernel360/member/entity/Admin.java +++ b/module-domain/src/main/java/com/kernel360/admin/Admin.java @@ -1,4 +1,4 @@ -package com.kernel360.member.entity; +package com.kernel360.admin; import com.kernel360.base.BaseEntity; diff --git a/module-domain/src/main/java/com/kernel360/member/repository/AdminRepository.java b/module-domain/src/main/java/com/kernel360/member/repository/AdminRepository.java index f4f15520..38a24267 100644 --- a/module-domain/src/main/java/com/kernel360/member/repository/AdminRepository.java +++ b/module-domain/src/main/java/com/kernel360/member/repository/AdminRepository.java @@ -1,6 +1,6 @@ package com.kernel360.member.repository; -import com.kernel360.member.entity.Admin; +import com.kernel360.admin.Admin; import org.springframework.data.jpa.repository.JpaRepository; public interface AdminRepository extends JpaRepository { From 6989428ac4e0531f6800b470957272c0124fafb9 Mon Sep 17 00:00:00 2001 From: HyunJunSon Date: Thu, 14 Mar 2024 11:58:03 +0900 Subject: [PATCH 4/4] =?UTF-8?q?feature::=20=EB=A6=AC=EB=B7=B0=EB=B0=98?= =?UTF-8?q?=EC=98=813=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/kernel360/admin/{ => entity}/Admin.java | 2 +- .../{member => admin}/repository/AdminRepository.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename module-domain/src/main/java/com/kernel360/admin/{ => entity}/Admin.java (97%) rename module-domain/src/main/java/com/kernel360/{member => admin}/repository/AdminRepository.java (62%) diff --git a/module-domain/src/main/java/com/kernel360/admin/Admin.java b/module-domain/src/main/java/com/kernel360/admin/entity/Admin.java similarity index 97% rename from module-domain/src/main/java/com/kernel360/admin/Admin.java rename to module-domain/src/main/java/com/kernel360/admin/entity/Admin.java index 93baab71..41f691ee 100644 --- a/module-domain/src/main/java/com/kernel360/admin/Admin.java +++ b/module-domain/src/main/java/com/kernel360/admin/entity/Admin.java @@ -1,4 +1,4 @@ -package com.kernel360.admin; +package com.kernel360.admin.entity; import com.kernel360.base.BaseEntity; diff --git a/module-domain/src/main/java/com/kernel360/member/repository/AdminRepository.java b/module-domain/src/main/java/com/kernel360/admin/repository/AdminRepository.java similarity index 62% rename from module-domain/src/main/java/com/kernel360/member/repository/AdminRepository.java rename to module-domain/src/main/java/com/kernel360/admin/repository/AdminRepository.java index 38a24267..c7bea761 100644 --- a/module-domain/src/main/java/com/kernel360/member/repository/AdminRepository.java +++ b/module-domain/src/main/java/com/kernel360/admin/repository/AdminRepository.java @@ -1,6 +1,6 @@ -package com.kernel360.member.repository; +package com.kernel360.admin.repository; -import com.kernel360.admin.Admin; +import com.kernel360.admin.entity.Admin; import org.springframework.data.jpa.repository.JpaRepository; public interface AdminRepository extends JpaRepository {