From 0c141eb397b231cf14a7432a3ffa2612cd48265c Mon Sep 17 00:00:00 2001 From: sohot8653 Date: Tue, 26 Aug 2025 16:45:54 +0900 Subject: [PATCH] =?UTF-8?q?[=EA=B3=B5=ED=86=B5=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EA=B4=80=EB=A6=AC]=20=EA=B3=B5=ED=86=B5=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=20=EB=B0=8F=20=EA=B7=B8=EB=A3=B9=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EC=97=94=ED=8B=B0=ED=8B=B0,=20DTO,=20?= =?UTF-8?q?=EB=A7=A4=ED=8D=BC,=20=EC=84=9C=EB=B9=84=EC=8A=A4=20=EB=B0=8F?= =?UTF-8?q?=20=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC=20=EC=B6=94=EA=B0=80.?= =?UTF-8?q?=20=EA=B8=B0=EC=A1=B4=20=EB=A7=A4=ED=8D=BC=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=20=EB=B0=8F=20=EC=99=B8=EB=9E=98=20=ED=82=A4=20=EC=A0=9C?= =?UTF-8?q?=EC=95=BD=20=EC=A1=B0=EA=B1=B4=20=EC=A0=9C=EA=B1=B0.=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=EB=B2=A0=EC=9D=B4=EC=8A=A4=20?= =?UTF-8?q?=EC=8A=A4=ED=82=A4=EB=A7=88=20=EC=88=98=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ddl/schema.sql | 10 --- .../CommonCode/mapper/CommonCodeMapper.java | 68 ------------------- .../mapper/CommonGroupCodeMapper.java | 67 ------------------ .../controller/CommonCodeController.java | 10 +-- .../dto/CommonCodeDto.java | 4 +- .../dto/CommonGroupCodeDto.java | 6 +- .../dto/CreateCommonCodeRequestDto.java | 2 +- .../dto/CreateCommonCodeResponseDto.java | 5 +- .../dto/CreateCommonGroupCodeRequestDto.java | 2 +- .../dto/CreateCommonGroupCodeResponseDto.java | 5 +- .../dto/UpdateCommonCodeRequestDto.java | 2 +- .../dto/UpdateCommonGroupCodeRequestDto.java | 2 +- .../entity/CommonCode.java | 14 ++-- .../entity/CommonGroupCode.java | 2 +- .../common_code/mapper/CommonCodeMapper.java | 57 ++++++++++++++++ .../mapper/CommonGroupCodeMapper.java | 55 +++++++++++++++ .../repository/CommonCodeRepository.java | 4 +- .../repository/CommonGroupCodeRepository.java | 4 +- .../service/CommonCodeService.java | 6 +- .../service/CommonCodeServiceImpl.java | 18 ++--- 20 files changed, 150 insertions(+), 193 deletions(-) delete mode 100644 src/main/java/com/bio/bio_backend/domain/admin/CommonCode/mapper/CommonCodeMapper.java delete mode 100644 src/main/java/com/bio/bio_backend/domain/admin/CommonCode/mapper/CommonGroupCodeMapper.java rename src/main/java/com/bio/bio_backend/domain/admin/{CommonCode => common_code}/controller/CommonCodeController.java (97%) rename src/main/java/com/bio/bio_backend/domain/admin/{CommonCode => common_code}/dto/CommonCodeDto.java (86%) rename src/main/java/com/bio/bio_backend/domain/admin/{CommonCode => common_code}/dto/CommonGroupCodeDto.java (76%) rename src/main/java/com/bio/bio_backend/domain/admin/{CommonCode => common_code}/dto/CreateCommonCodeRequestDto.java (96%) rename src/main/java/com/bio/bio_backend/domain/admin/{CommonCode => common_code}/dto/CreateCommonCodeResponseDto.java (82%) rename src/main/java/com/bio/bio_backend/domain/admin/{CommonCode => common_code}/dto/CreateCommonGroupCodeRequestDto.java (96%) rename src/main/java/com/bio/bio_backend/domain/admin/{CommonCode => common_code}/dto/CreateCommonGroupCodeResponseDto.java (81%) rename src/main/java/com/bio/bio_backend/domain/admin/{CommonCode => common_code}/dto/UpdateCommonCodeRequestDto.java (96%) rename src/main/java/com/bio/bio_backend/domain/admin/{CommonCode => common_code}/dto/UpdateCommonGroupCodeRequestDto.java (95%) rename src/main/java/com/bio/bio_backend/domain/admin/{CommonCode => common_code}/entity/CommonCode.java (84%) rename src/main/java/com/bio/bio_backend/domain/admin/{CommonCode => common_code}/entity/CommonGroupCode.java (95%) create mode 100644 src/main/java/com/bio/bio_backend/domain/admin/common_code/mapper/CommonCodeMapper.java create mode 100644 src/main/java/com/bio/bio_backend/domain/admin/common_code/mapper/CommonGroupCodeMapper.java rename src/main/java/com/bio/bio_backend/domain/admin/{CommonCode => common_code}/repository/CommonCodeRepository.java (90%) rename src/main/java/com/bio/bio_backend/domain/admin/{CommonCode => common_code}/repository/CommonGroupCodeRepository.java (84%) rename src/main/java/com/bio/bio_backend/domain/admin/{CommonCode => common_code}/service/CommonCodeService.java (82%) rename src/main/java/com/bio/bio_backend/domain/admin/{CommonCode => common_code}/service/CommonCodeServiceImpl.java (91%) diff --git a/ddl/schema.sql b/ddl/schema.sql index 4c4c75d..13e2bb0 100644 --- a/ddl/schema.sql +++ b/ddl/schema.sql @@ -95,13 +95,3 @@ create index idx_member_user_id on st_member (user_id); - - alter table if exists st_common_code - add constraint FKdk30t67v5e2vo1k7gl5sk1jp9 - foreign key (group_code) - references st_common_group_code (code); - - alter table if exists st_common_code - add constraint FKgcyw9ydft76p31oox94ho93wf - foreign key (parent_code) - references st_common_code (code); diff --git a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/mapper/CommonCodeMapper.java b/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/mapper/CommonCodeMapper.java deleted file mode 100644 index c4dd553..0000000 --- a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/mapper/CommonCodeMapper.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.bio.bio_backend.domain.admin.CommonCode.mapper; - -import com.bio.bio_backend.domain.admin.CommonCode.dto.CommonCodeDto; -import com.bio.bio_backend.domain.admin.CommonCode.dto.CreateCommonCodeRequestDto; -import com.bio.bio_backend.domain.admin.CommonCode.dto.CreateCommonCodeResponseDto; -import com.bio.bio_backend.domain.admin.CommonCode.dto.UpdateCommonCodeRequestDto; -import com.bio.bio_backend.domain.admin.CommonCode.entity.CommonCode; -import com.bio.bio_backend.global.annotation.IgnoreBaseEntityMapping; -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper(componentModel = "spring") -public interface CommonCodeMapper { - - CommonCodeMapper INSTANCE = Mappers.getMapper(CommonCodeMapper.class); - - /** - * CommonCode 엔티티를 CommonCodeDto로 변환 - */ - CommonCodeDto toCommonCodeDto(CommonCode entity); - - /** - * CommonCodeDto를 CommonCode 엔티티로 변환 - */ - @Mapping(target = "commonGroupCode", ignore = true) - @Mapping(target = "parentCodeEntity", ignore = true) - CommonCode toCommonCode(CommonCodeDto dto); - - /** - * CommonCode 엔티티 리스트를 CommonCodeDto 리스트로 변환 - */ - List toCommonCodeDtoList(List entities); - - /** - * CommonCodeDto 리스트를 CommonCode 엔티티 리스트로 변환 - */ - List toCommonCodeList(List dtos); - - /** - * CommonCodeDto를 CreateCommonCodeResponseDto로 변환 - */ - @Mapping(target = "createdAt", ignore = true) - CreateCommonCodeResponseDto toCreateCommonCodeResponseDto(CommonCodeDto dto); - - /** - * CreateCommonCodeRequestDto를 CommonCodeDto로 변환 - */ - @Mapping(target = "oid", ignore = true) - CommonCodeDto toCommonCodeDto(CreateCommonCodeRequestDto requestDto); - - /** - * UpdateCommonCodeRequestDto를 CommonCodeDto로 변환 - */ - @Mapping(target = "code", ignore = true) - @Mapping(target = "oid", ignore = true) - CommonCodeDto toCommonCodeDto(UpdateCommonCodeRequestDto requestDto); - - /** - * CommonCodeDto의 값으로 CommonCode 엔티티를 업데이트 (null 값은 무시) - */ - @IgnoreBaseEntityMapping - @Mapping(target = "commonGroupCode", ignore = true) - @Mapping(target = "parentCodeEntity", ignore = true) - void updateCommonCodeFromDto(CommonCodeDto commonCodeDto, @org.mapstruct.MappingTarget CommonCode commonCode); -} diff --git a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/mapper/CommonGroupCodeMapper.java b/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/mapper/CommonGroupCodeMapper.java deleted file mode 100644 index 038df71..0000000 --- a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/mapper/CommonGroupCodeMapper.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.bio.bio_backend.domain.admin.CommonCode.mapper; - -import com.bio.bio_backend.domain.admin.CommonCode.dto.CommonGroupCodeDto; -import com.bio.bio_backend.domain.admin.CommonCode.dto.CreateCommonGroupCodeRequestDto; -import com.bio.bio_backend.domain.admin.CommonCode.dto.CreateCommonGroupCodeResponseDto; -import com.bio.bio_backend.domain.admin.CommonCode.dto.UpdateCommonGroupCodeRequestDto; -import com.bio.bio_backend.domain.admin.CommonCode.entity.CommonGroupCode; -import com.bio.bio_backend.global.annotation.IgnoreBaseEntityMapping; -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper(componentModel = "spring") -public interface CommonGroupCodeMapper { - - CommonGroupCodeMapper INSTANCE = Mappers.getMapper(CommonGroupCodeMapper.class); - - /** - * CommonGroupCode 엔티티를 CommonGroupCodeDto로 변환 - */ - CommonGroupCodeDto toCommonGroupCodeDto(CommonGroupCode entity); - - /** - * CommonGroupCodeDto를 CommonGroupCode 엔티티로 변환 - */ - CommonGroupCode toCommonGroupCode(CommonGroupCodeDto dto); - - /** - * CommonGroupCode 엔티티 리스트를 CommonGroupCodeDto 리스트로 변환 - */ - List toCommonGroupCodeDtoList(List entities); - - /** - * CommonGroupCodeDto 리스트를 CommonGroupCode 엔티티 리스트로 변환 - */ - List toCommonGroupCodeList(List dtos); - - /** - * CommonGroupCodeDto를 CreateCommonGroupCodeResponseDto로 변환 - */ - CreateCommonGroupCodeResponseDto toCreateCommonGroupCodeResponseDto(CommonGroupCodeDto dto); - - /** - * CreateCommonGroupCodeRequestDto를 CommonGroupCodeDto로 변환 - */ - @Mapping(target = "oid", ignore = true) - @Mapping(target = "createdAt", ignore = true) - @Mapping(target = "updatedAt", ignore = true) - CommonGroupCodeDto toCommonGroupCodeDto(CreateCommonGroupCodeRequestDto requestDto); - - /** - * UpdateCommonGroupCodeRequestDto를 CommonGroupCodeDto로 변환 - */ - @Mapping(target = "oid", ignore = true) - @Mapping(target = "code", ignore = true) - @Mapping(target = "createdAt", ignore = true) - @Mapping(target = "updatedAt", ignore = true) - CommonGroupCodeDto toCommonGroupCodeDto(UpdateCommonGroupCodeRequestDto requestDto); - - /** - * CommonGroupCodeDto의 값으로 CommonGroupCode 엔티티를 업데이트 (null 값은 무시) - */ - @IgnoreBaseEntityMapping - void updateCommonGroupCodeFromDto(CommonGroupCodeDto groupCodeDto, @org.mapstruct.MappingTarget CommonGroupCode groupCode); -} diff --git a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/controller/CommonCodeController.java b/src/main/java/com/bio/bio_backend/domain/admin/common_code/controller/CommonCodeController.java similarity index 97% rename from src/main/java/com/bio/bio_backend/domain/admin/CommonCode/controller/CommonCodeController.java rename to src/main/java/com/bio/bio_backend/domain/admin/common_code/controller/CommonCodeController.java index b2fa801..dc62e7c 100644 --- a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/controller/CommonCodeController.java +++ b/src/main/java/com/bio/bio_backend/domain/admin/common_code/controller/CommonCodeController.java @@ -1,9 +1,9 @@ -package com.bio.bio_backend.domain.admin.CommonCode.controller; +package com.bio.bio_backend.domain.admin.common_code.controller; -import com.bio.bio_backend.domain.admin.CommonCode.dto.*; -import com.bio.bio_backend.domain.admin.CommonCode.service.CommonCodeService; -import com.bio.bio_backend.domain.admin.CommonCode.mapper.CommonCodeMapper; -import com.bio.bio_backend.domain.admin.CommonCode.mapper.CommonGroupCodeMapper; +import com.bio.bio_backend.domain.admin.common_code.dto.*; +import com.bio.bio_backend.domain.admin.common_code.service.CommonCodeService; +import com.bio.bio_backend.domain.admin.common_code.mapper.CommonCodeMapper; +import com.bio.bio_backend.domain.admin.common_code.mapper.CommonGroupCodeMapper; import com.bio.bio_backend.global.dto.ApiResponseDto; import com.bio.bio_backend.global.constants.ApiResponseCode; import com.bio.bio_backend.global.annotation.LogExecution; diff --git a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/CommonCodeDto.java b/src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/CommonCodeDto.java similarity index 86% rename from src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/CommonCodeDto.java rename to src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/CommonCodeDto.java index 4f72c12..902deee 100644 --- a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/CommonCodeDto.java +++ b/src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/CommonCodeDto.java @@ -1,12 +1,10 @@ -package com.bio.bio_backend.domain.admin.CommonCode.dto; +package com.bio.bio_backend.domain.admin.common_code.dto; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import java.time.LocalDateTime; - @Data @Builder @NoArgsConstructor diff --git a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/CommonGroupCodeDto.java b/src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/CommonGroupCodeDto.java similarity index 76% rename from src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/CommonGroupCodeDto.java rename to src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/CommonGroupCodeDto.java index 656bc21..7fbd919 100644 --- a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/CommonGroupCodeDto.java +++ b/src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/CommonGroupCodeDto.java @@ -1,12 +1,10 @@ -package com.bio.bio_backend.domain.admin.CommonCode.dto; +package com.bio.bio_backend.domain.admin.common_code.dto; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import java.time.LocalDateTime; - @Data @Builder @NoArgsConstructor @@ -23,6 +21,4 @@ public class CommonGroupCodeDto { private String characterRef5Title; private Integer sortOrder; private Boolean useFlag; - private LocalDateTime createdAt; - private LocalDateTime updatedAt; } diff --git a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/CreateCommonCodeRequestDto.java b/src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/CreateCommonCodeRequestDto.java similarity index 96% rename from src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/CreateCommonCodeRequestDto.java rename to src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/CreateCommonCodeRequestDto.java index e208395..4983197 100644 --- a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/CreateCommonCodeRequestDto.java +++ b/src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/CreateCommonCodeRequestDto.java @@ -1,4 +1,4 @@ -package com.bio.bio_backend.domain.admin.CommonCode.dto; +package com.bio.bio_backend.domain.admin.common_code.dto; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/CreateCommonCodeResponseDto.java b/src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/CreateCommonCodeResponseDto.java similarity index 82% rename from src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/CreateCommonCodeResponseDto.java rename to src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/CreateCommonCodeResponseDto.java index 4b9f3ff..e7bde3d 100644 --- a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/CreateCommonCodeResponseDto.java +++ b/src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/CreateCommonCodeResponseDto.java @@ -1,12 +1,10 @@ -package com.bio.bio_backend.domain.admin.CommonCode.dto; +package com.bio.bio_backend.domain.admin.common_code.dto; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import java.time.LocalDateTime; - @Data @Builder @NoArgsConstructor @@ -26,5 +24,4 @@ public class CreateCommonCodeResponseDto { private String characterRef5; private Integer sortOrder; private Boolean useFlag; - private LocalDateTime createdAt; } diff --git a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/CreateCommonGroupCodeRequestDto.java b/src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/CreateCommonGroupCodeRequestDto.java similarity index 96% rename from src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/CreateCommonGroupCodeRequestDto.java rename to src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/CreateCommonGroupCodeRequestDto.java index 60df3d6..27126a1 100644 --- a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/CreateCommonGroupCodeRequestDto.java +++ b/src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/CreateCommonGroupCodeRequestDto.java @@ -1,4 +1,4 @@ -package com.bio.bio_backend.domain.admin.CommonCode.dto; +package com.bio.bio_backend.domain.admin.common_code.dto; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/CreateCommonGroupCodeResponseDto.java b/src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/CreateCommonGroupCodeResponseDto.java similarity index 81% rename from src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/CreateCommonGroupCodeResponseDto.java rename to src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/CreateCommonGroupCodeResponseDto.java index fdab153..a764c87 100644 --- a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/CreateCommonGroupCodeResponseDto.java +++ b/src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/CreateCommonGroupCodeResponseDto.java @@ -1,12 +1,10 @@ -package com.bio.bio_backend.domain.admin.CommonCode.dto; +package com.bio.bio_backend.domain.admin.common_code.dto; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import java.time.LocalDateTime; - @Data @Builder @NoArgsConstructor @@ -23,5 +21,4 @@ public class CreateCommonGroupCodeResponseDto { private String characterRef5Title; private Integer sortOrder; private Boolean useFlag; - private LocalDateTime createdAt; } diff --git a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/UpdateCommonCodeRequestDto.java b/src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/UpdateCommonCodeRequestDto.java similarity index 96% rename from src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/UpdateCommonCodeRequestDto.java rename to src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/UpdateCommonCodeRequestDto.java index a4dd497..0d771c8 100644 --- a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/UpdateCommonCodeRequestDto.java +++ b/src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/UpdateCommonCodeRequestDto.java @@ -1,4 +1,4 @@ -package com.bio.bio_backend.domain.admin.CommonCode.dto; +package com.bio.bio_backend.domain.admin.common_code.dto; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/UpdateCommonGroupCodeRequestDto.java b/src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/UpdateCommonGroupCodeRequestDto.java similarity index 95% rename from src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/UpdateCommonGroupCodeRequestDto.java rename to src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/UpdateCommonGroupCodeRequestDto.java index ec2d6ff..aafd626 100644 --- a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/dto/UpdateCommonGroupCodeRequestDto.java +++ b/src/main/java/com/bio/bio_backend/domain/admin/common_code/dto/UpdateCommonGroupCodeRequestDto.java @@ -1,4 +1,4 @@ -package com.bio.bio_backend.domain.admin.CommonCode.dto; +package com.bio.bio_backend.domain.admin.common_code.dto; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/entity/CommonCode.java b/src/main/java/com/bio/bio_backend/domain/admin/common_code/entity/CommonCode.java similarity index 84% rename from src/main/java/com/bio/bio_backend/domain/admin/CommonCode/entity/CommonCode.java rename to src/main/java/com/bio/bio_backend/domain/admin/common_code/entity/CommonCode.java index 4616d6e..8723cc6 100644 --- a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/entity/CommonCode.java +++ b/src/main/java/com/bio/bio_backend/domain/admin/common_code/entity/CommonCode.java @@ -1,4 +1,4 @@ -package com.bio.bio_backend.domain.admin.CommonCode.entity; +package com.bio.bio_backend.domain.admin.common_code.entity; import com.bio.bio_backend.global.constants.AppConstants; import com.bio.bio_backend.global.entity.BaseEntity; @@ -64,10 +64,12 @@ public class CommonCode extends BaseEntity { // 관계 설정 @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "group_code", referencedColumnName = "code", insertable = false, updatable = false) + @JoinColumn( + name = "group_code", + referencedColumnName = "code", + insertable = false, + updatable = false, + foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT) + ) private CommonGroupCode commonGroupCode; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "parent_code", referencedColumnName = "code", insertable = false, updatable = false) - private CommonCode parentCodeEntity; } diff --git a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/entity/CommonGroupCode.java b/src/main/java/com/bio/bio_backend/domain/admin/common_code/entity/CommonGroupCode.java similarity index 95% rename from src/main/java/com/bio/bio_backend/domain/admin/CommonCode/entity/CommonGroupCode.java rename to src/main/java/com/bio/bio_backend/domain/admin/common_code/entity/CommonGroupCode.java index 22ae60c..4cccf73 100644 --- a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/entity/CommonGroupCode.java +++ b/src/main/java/com/bio/bio_backend/domain/admin/common_code/entity/CommonGroupCode.java @@ -1,4 +1,4 @@ -package com.bio.bio_backend.domain.admin.CommonCode.entity; +package com.bio.bio_backend.domain.admin.common_code.entity; import com.bio.bio_backend.global.constants.AppConstants; import com.bio.bio_backend.global.entity.BaseEntity; diff --git a/src/main/java/com/bio/bio_backend/domain/admin/common_code/mapper/CommonCodeMapper.java b/src/main/java/com/bio/bio_backend/domain/admin/common_code/mapper/CommonCodeMapper.java new file mode 100644 index 0000000..373889b --- /dev/null +++ b/src/main/java/com/bio/bio_backend/domain/admin/common_code/mapper/CommonCodeMapper.java @@ -0,0 +1,57 @@ +package com.bio.bio_backend.domain.admin.common_code.mapper; + +import com.bio.bio_backend.domain.admin.common_code.dto.CommonCodeDto; +import com.bio.bio_backend.domain.admin.common_code.dto.CreateCommonCodeRequestDto; +import com.bio.bio_backend.domain.admin.common_code.dto.CreateCommonCodeResponseDto; +import com.bio.bio_backend.domain.admin.common_code.dto.UpdateCommonCodeRequestDto; +import com.bio.bio_backend.domain.admin.common_code.entity.CommonCode; +import com.bio.bio_backend.global.annotation.IgnoreBaseEntityMapping; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; + +import java.util.List; + +@Mapper(componentModel = "spring") +public interface CommonCodeMapper { + + /** + * CommonCode 엔티티를 CommonCodeDto로 변환 + */ + CommonCodeDto toCommonCodeDto(CommonCode commonCode); + + /** + * CommonCodeDto를 CommonCode 엔티티로 변환 + */ + @Mapping(target = "commonGroupCode", ignore = true) + CommonCode toCommonCode(CommonCodeDto commonCodeDto); + + /** + * CommonCode 엔티티 리스트를 CommonCodeDto 리스트로 변환 + */ + List toCommonCodeDtoList(List commonCodes); + + /** + * CommonCodeDto를 CreateCommonCodeResponseDto로 변환 + */ + CreateCommonCodeResponseDto toCreateCommonCodeResponseDto(CommonCodeDto commonCodeDto); + + /** + * CreateCommonCodeRequestDto를 CommonCodeDto로 변환 + */ + @Mapping(target = "oid", ignore = true) + CommonCodeDto toCommonCodeDto(CreateCommonCodeRequestDto createRequestDto); + + /** + * UpdateCommonCodeRequestDto를 CommonCodeDto로 변환 + */ + @Mapping(target = "oid", ignore = true) + @Mapping(target = "code", ignore = true) + CommonCodeDto toCommonCodeDto(UpdateCommonCodeRequestDto updateRequestDto); + + /** + * CommonCodeDto의 값으로 CommonCode 엔티티를 업데이트 + */ + @IgnoreBaseEntityMapping + @Mapping(target = "commonGroupCode", ignore = true) + void updateCommonCodeFromDto(CommonCodeDto commonCodeDto, @org.mapstruct.MappingTarget CommonCode commonCode); +} diff --git a/src/main/java/com/bio/bio_backend/domain/admin/common_code/mapper/CommonGroupCodeMapper.java b/src/main/java/com/bio/bio_backend/domain/admin/common_code/mapper/CommonGroupCodeMapper.java new file mode 100644 index 0000000..e5f7f89 --- /dev/null +++ b/src/main/java/com/bio/bio_backend/domain/admin/common_code/mapper/CommonGroupCodeMapper.java @@ -0,0 +1,55 @@ +package com.bio.bio_backend.domain.admin.common_code.mapper; + +import com.bio.bio_backend.domain.admin.common_code.dto.CommonGroupCodeDto; +import com.bio.bio_backend.domain.admin.common_code.dto.CreateCommonGroupCodeRequestDto; +import com.bio.bio_backend.domain.admin.common_code.dto.CreateCommonGroupCodeResponseDto; +import com.bio.bio_backend.domain.admin.common_code.dto.UpdateCommonGroupCodeRequestDto; +import com.bio.bio_backend.domain.admin.common_code.entity.CommonGroupCode; +import com.bio.bio_backend.global.annotation.IgnoreBaseEntityMapping; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; + +import java.util.List; + +@Mapper(componentModel = "spring") +public interface CommonGroupCodeMapper { + + /** + * CommonGroupCode 엔티티를 CommonGroupCodeDto로 변환 + */ + CommonGroupCodeDto toCommonGroupCodeDto(CommonGroupCode commonGroupCode); + + /** + * CommonGroupCodeDto를 CommonGroupCode 엔티티로 변환 + */ + CommonGroupCode toCommonGroupCode(CommonGroupCodeDto commonGroupCodeDto); + + /** + * CommonGroupCode 엔티티 리스트를 CommonGroupCodeDto 리스트로 변환 + */ + List toCommonGroupCodeDtoList(List commonGroupCodes); + + /** + * CommonGroupCodeDto를 CreateCommonGroupCodeResponseDto로 변환 + */ + CreateCommonGroupCodeResponseDto toCreateCommonGroupCodeResponseDto(CommonGroupCodeDto commonGroupCodeDto); + + /** + * CreateCommonGroupCodeRequestDto를 CommonGroupCodeDto로 변환 + */ + @Mapping(target = "oid", ignore = true) + CommonGroupCodeDto toCommonGroupCodeDto(CreateCommonGroupCodeRequestDto createRequestDto); + + /** + * UpdateCommonGroupCodeRequestDto를 CommonGroupCodeDto로 변환 + */ + @Mapping(target = "oid", ignore = true) + @Mapping(target = "code", ignore = true) + CommonGroupCodeDto toCommonGroupCodeDto(UpdateCommonGroupCodeRequestDto updateRequestDto); + + /** + * CommonGroupCodeDto의 값으로 CommonGroupCode 엔티티를 업데이트 + */ + @IgnoreBaseEntityMapping + void updateCommonGroupCodeFromDto(CommonGroupCodeDto commonGroupCodeDto, @org.mapstruct.MappingTarget CommonGroupCode commonGroupCode); +} diff --git a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/repository/CommonCodeRepository.java b/src/main/java/com/bio/bio_backend/domain/admin/common_code/repository/CommonCodeRepository.java similarity index 90% rename from src/main/java/com/bio/bio_backend/domain/admin/CommonCode/repository/CommonCodeRepository.java rename to src/main/java/com/bio/bio_backend/domain/admin/common_code/repository/CommonCodeRepository.java index 369153d..39445b4 100644 --- a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/repository/CommonCodeRepository.java +++ b/src/main/java/com/bio/bio_backend/domain/admin/common_code/repository/CommonCodeRepository.java @@ -1,6 +1,6 @@ -package com.bio.bio_backend.domain.admin.CommonCode.repository; +package com.bio.bio_backend.domain.admin.common_code.repository; -import com.bio.bio_backend.domain.admin.CommonCode.entity.CommonCode; +import com.bio.bio_backend.domain.admin.common_code.entity.CommonCode; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; diff --git a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/repository/CommonGroupCodeRepository.java b/src/main/java/com/bio/bio_backend/domain/admin/common_code/repository/CommonGroupCodeRepository.java similarity index 84% rename from src/main/java/com/bio/bio_backend/domain/admin/CommonCode/repository/CommonGroupCodeRepository.java rename to src/main/java/com/bio/bio_backend/domain/admin/common_code/repository/CommonGroupCodeRepository.java index 012c852..889d4a2 100644 --- a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/repository/CommonGroupCodeRepository.java +++ b/src/main/java/com/bio/bio_backend/domain/admin/common_code/repository/CommonGroupCodeRepository.java @@ -1,6 +1,6 @@ -package com.bio.bio_backend.domain.admin.CommonCode.repository; +package com.bio.bio_backend.domain.admin.common_code.repository; -import com.bio.bio_backend.domain.admin.CommonCode.entity.CommonGroupCode; +import com.bio.bio_backend.domain.admin.common_code.entity.CommonGroupCode; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; diff --git a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/service/CommonCodeService.java b/src/main/java/com/bio/bio_backend/domain/admin/common_code/service/CommonCodeService.java similarity index 82% rename from src/main/java/com/bio/bio_backend/domain/admin/CommonCode/service/CommonCodeService.java rename to src/main/java/com/bio/bio_backend/domain/admin/common_code/service/CommonCodeService.java index dd9ab88..d84e0ca 100644 --- a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/service/CommonCodeService.java +++ b/src/main/java/com/bio/bio_backend/domain/admin/common_code/service/CommonCodeService.java @@ -1,7 +1,7 @@ -package com.bio.bio_backend.domain.admin.CommonCode.service; +package com.bio.bio_backend.domain.admin.common_code.service; -import com.bio.bio_backend.domain.admin.CommonCode.dto.CommonCodeDto; -import com.bio.bio_backend.domain.admin.CommonCode.dto.CommonGroupCodeDto; +import com.bio.bio_backend.domain.admin.common_code.dto.CommonCodeDto; +import com.bio.bio_backend.domain.admin.common_code.dto.CommonGroupCodeDto; import java.util.List; diff --git a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/service/CommonCodeServiceImpl.java b/src/main/java/com/bio/bio_backend/domain/admin/common_code/service/CommonCodeServiceImpl.java similarity index 91% rename from src/main/java/com/bio/bio_backend/domain/admin/CommonCode/service/CommonCodeServiceImpl.java rename to src/main/java/com/bio/bio_backend/domain/admin/common_code/service/CommonCodeServiceImpl.java index 8490ddc..832504c 100644 --- a/src/main/java/com/bio/bio_backend/domain/admin/CommonCode/service/CommonCodeServiceImpl.java +++ b/src/main/java/com/bio/bio_backend/domain/admin/common_code/service/CommonCodeServiceImpl.java @@ -1,13 +1,13 @@ -package com.bio.bio_backend.domain.admin.CommonCode.service; +package com.bio.bio_backend.domain.admin.common_code.service; -import com.bio.bio_backend.domain.admin.CommonCode.dto.CommonCodeDto; -import com.bio.bio_backend.domain.admin.CommonCode.dto.CommonGroupCodeDto; -import com.bio.bio_backend.domain.admin.CommonCode.entity.CommonCode; -import com.bio.bio_backend.domain.admin.CommonCode.entity.CommonGroupCode; -import com.bio.bio_backend.domain.admin.CommonCode.mapper.CommonCodeMapper; -import com.bio.bio_backend.domain.admin.CommonCode.mapper.CommonGroupCodeMapper; -import com.bio.bio_backend.domain.admin.CommonCode.repository.CommonCodeRepository; -import com.bio.bio_backend.domain.admin.CommonCode.repository.CommonGroupCodeRepository; +import com.bio.bio_backend.domain.admin.common_code.dto.CommonCodeDto; +import com.bio.bio_backend.domain.admin.common_code.dto.CommonGroupCodeDto; +import com.bio.bio_backend.domain.admin.common_code.entity.CommonCode; +import com.bio.bio_backend.domain.admin.common_code.entity.CommonGroupCode; +import com.bio.bio_backend.domain.admin.common_code.mapper.CommonCodeMapper; +import com.bio.bio_backend.domain.admin.common_code.mapper.CommonGroupCodeMapper; +import com.bio.bio_backend.domain.admin.common_code.repository.CommonCodeRepository; +import com.bio.bio_backend.domain.admin.common_code.repository.CommonGroupCodeRepository; import com.bio.bio_backend.global.exception.ApiException; import com.bio.bio_backend.global.constants.ApiResponseCode; import lombok.RequiredArgsConstructor;