Skip to content

Commit

Permalink
[STYLE] #434: Dto 클래스명 변경에 따른 코드 수정사항 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
tank3a committed Aug 24, 2023
1 parent ef6fa9b commit 732572c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import autoever2.cartag.cars.dto.CarInfoDto;
import autoever2.cartag.cars.dto.CarTypeDto;
import autoever2.cartag.cars.dto.TrimInfoDto;
import autoever2.cartag.cars.dto.TrimDataDto;
import org.springframework.dao.support.DataAccessUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.RowMapper;
Expand Down Expand Up @@ -53,7 +53,7 @@ public List<CarTypeDto> findAllCarType() {
return template.query(sql, carTypeDtoRowMapper());
}

public Optional<TrimInfoDto> findTrimInfoByCarId(int carId) {
public Optional<TrimDataDto> findTrimInfoByCarId(int carId) {
String sql = "select car_id, trim, car_default_price " +
"from Car " +
"where car_id = :carId";
Expand Down Expand Up @@ -91,8 +91,8 @@ private RowMapper<Integer> intMapper() {
return (rs, rowNum) -> rs.getInt("car_default_price");
}

private RowMapper<TrimInfoDto> trimInfoRowMapper() {
return BeanPropertyRowMapper.newInstance(TrimInfoDto.class);
private RowMapper<TrimDataDto> trimInfoRowMapper() {
return BeanPropertyRowMapper.newInstance(TrimDataDto.class);
}

}
7 changes: 3 additions & 4 deletions backend/src/main/java/autoever2/cartag/cars/CarService.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package autoever2.cartag.cars;

import autoever2.cartag.cars.dto.*;
import autoever2.cartag.domain.color.InnerColorDto;
import autoever2.cartag.domain.color.OuterColorDto;
import autoever2.cartag.domain.color.ColorDto;
import autoever2.cartag.models.dto.ModelDefaultDto;
import autoever2.cartag.exception.EmptyDataException;
import autoever2.cartag.exception.ErrorCode;
Expand Down Expand Up @@ -44,8 +43,8 @@ public List<CarVo> getCarDtoByCarType(int carType) {
}

public CarDefaultDto getCarDefaultDtoByCarId(int carId) {
List<OuterColorDto> outerColorList = colorRepository.findOuterColorCarByCarId(carId);
List<InnerColorDto> innerColorList = colorRepository.findInnerColorCarByCarId(carId);
List<ColorDto> outerColorList = colorRepository.findOuterColorCarByCarId(carId);
List<ColorDto> innerColorList = colorRepository.findInnerColorCarByCarId(carId);
List<ModelDefaultDto> modelList = modelRepository.findDefaultModelListByCarId(carId);
if (outerColorList.isEmpty() || innerColorList.isEmpty() || modelList.isEmpty()) {
throw new EmptyDataException(ErrorCode.DATA_NOT_EXISTS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public InnerColorPercentDto(int colorId, String colorName, String colorImage, Lo
this.colorCarImage = colorCarImage;
}

public static InnerColorPercentDto toPercent(InnerColorDto innerColorDto, int colorBoughtPercent) {
public static InnerColorPercentDto toPercent(ColorDto innerColorDto, int colorBoughtPercent) {
return InnerColorPercentDto.builder()
.colorId(innerColorDto.getColorId())
.colorName(innerColorDto.getColorName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Schema(description = "차량 외부 색상 반환 DTO")
Expand Down Expand Up @@ -32,7 +30,7 @@ public OuterColorPercentDto(int colorId, String colorName, String colorImage, Lo
this.colorCarImage = colorCarImage;
}

public static OuterColorPercentDto toPercent(OuterColorDto outerColorDto, int colorBoughtPercent, String imageUrl) {
public static OuterColorPercentDto toPercent(ColorDto outerColorDto, int colorBoughtPercent, String imageUrl) {
return OuterColorPercentDto.builder()
.colorId(outerColorDto.getColorId())
.colorName(outerColorDto.getColorName())
Expand Down

0 comments on commit 732572c

Please sign in to comment.