-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #234 from KJBig/feature/S2D-18
Feature/s2 d 18
- Loading branch information
Showing
9 changed files
with
144 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/main/java/com/sluv/server/domain/brand/mapper/BrandMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.sluv.server.domain.brand.mapper; | ||
|
||
import com.sluv.server.domain.brand.dto.BrandSearchResDto; | ||
import com.sluv.server.domain.brand.entity.Brand; | ||
import org.mapstruct.Mapper; | ||
|
||
@Mapper(componentModel = "spring") | ||
public interface BrandMapper { | ||
|
||
BrandSearchResDto toBrandSearchResDto(Brand brand); | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/sluv/server/domain/brand/mapper/NewBrandMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.sluv.server.domain.brand.mapper; | ||
|
||
import com.sluv.server.domain.brand.dto.NewBrandPostReqDto; | ||
import com.sluv.server.domain.brand.dto.NewBrandPostResDto; | ||
import com.sluv.server.domain.brand.entity.NewBrand; | ||
import com.sluv.server.domain.brand.enums.NewBrandStatus; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
|
||
@Mapper(componentModel = "spring") | ||
public interface NewBrandMapper { | ||
|
||
@Mapping(target = "id", ignore = true) | ||
@Mapping(target = "brandName", source = "newBrandPostReqDto.newBrandName") | ||
@Mapping(target = "newBrandStatus", source = "newBrandStatus", defaultValue = "ACTIVE") | ||
NewBrand toEntity(NewBrandPostReqDto newBrandPostReqDto, NewBrandStatus newBrandStatus); | ||
|
||
@Mapping(target = "newBrandId", source = "newBrand.id") | ||
@Mapping(target = "newBrandName", source = "newBrand.brandName") | ||
NewBrandPostResDto toNewBrandPostResDto(NewBrand newBrand); | ||
|
||
} |
68 changes: 68 additions & 0 deletions
68
src/main/java/com/sluv/server/domain/brand/mapper/RecentSelectBrandMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package com.sluv.server.domain.brand.mapper; | ||
|
||
import com.sluv.server.domain.brand.dto.RecentSelectBrandResDto; | ||
import com.sluv.server.domain.brand.entity.Brand; | ||
import com.sluv.server.domain.brand.entity.NewBrand; | ||
import com.sluv.server.domain.brand.entity.RecentSelectBrand; | ||
import com.sluv.server.domain.user.entity.User; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
import org.mapstruct.Named; | ||
|
||
@Mapper(componentModel = "spring") | ||
public interface RecentSelectBrandMapper { | ||
|
||
@Mapping(target = "id", ignore = true) | ||
@Mapping(target = "brand", source = "brand") | ||
@Mapping(target = "newBrand", source = "newBrand") | ||
@Mapping(target = "user", source = "user") | ||
RecentSelectBrand toEntity(Brand brand, NewBrand newBrand, User user); | ||
|
||
@Mapping(target = "id", source = "recentSelectBrand", qualifiedByName = "mapId") | ||
@Mapping(target = "brandName", source = "recentSelectBrand", qualifiedByName = "mapBrandName") | ||
@Mapping(target = "brandImgUrl", source = "recentSelectBrand", qualifiedByName = "mapBrandUrl") | ||
@Mapping(target = "flag", source = "recentSelectBrand", qualifiedByName = "mapFlag") | ||
RecentSelectBrandResDto toRecentSelectBrandResDto(RecentSelectBrand recentSelectBrand); | ||
|
||
@Named("mapId") | ||
default Long mapId(RecentSelectBrand recentSelectBrand) { | ||
Long brandId; | ||
String flag = recentSelectBrand.getBrand() != null ? "Y" :"N"; | ||
if(flag.equals("Y")){ | ||
brandId = recentSelectBrand.getBrand().getId(); | ||
}else{ | ||
brandId = recentSelectBrand.getNewBrand().getId(); | ||
} | ||
return brandId; | ||
} | ||
|
||
@Named("mapBrandName") | ||
static String mapBrandName(RecentSelectBrand recentSelectBrand) { | ||
String brandName; | ||
String flag = recentSelectBrand.getBrand() != null ? "Y" :"N"; | ||
if(flag.equals("Y")){ | ||
brandName = recentSelectBrand.getBrand().getBrandKr(); | ||
}else{ | ||
brandName = recentSelectBrand.getNewBrand().getBrandName(); | ||
} | ||
return brandName; | ||
} | ||
|
||
@Named("mapBrandUrl") | ||
static String mapBrandUrl(RecentSelectBrand recentSelectBrand) { | ||
String brandImgUrl; | ||
String flag = recentSelectBrand.getBrand() != null ? "Y" :"N"; | ||
if(flag.equals("Y")){ | ||
brandImgUrl = recentSelectBrand.getBrand().getBrandImgUrl(); | ||
}else{ | ||
brandImgUrl = null; | ||
} | ||
return brandImgUrl; | ||
} | ||
|
||
@Named("mapFlag") | ||
static String mapFlag(RecentSelectBrand recentSelectBrand) { | ||
String flag = recentSelectBrand.getBrand() != null ? "Y" :"N"; | ||
return flag; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters