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;