From 8fc64e02d23e0588a549d4b9cecbd368a09faa9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A9=E1=86=BC?= =?UTF-8?q?=E1=84=8B=E1=85=AF=E1=86=AB=20Jongwon?= Date: Wed, 16 Aug 2023 13:27:43 +0900 Subject: [PATCH] =?UTF-8?q?[BUG=20FIX]=20#273:=20=EB=A9=94=EC=9D=B8=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../autoever2/cartag/domain/model/ModelShortMappedDto.java | 2 +- .../java/autoever2/cartag/repository/ModelRepository.java | 2 +- .../autoever2/cartag/controller/OptionControllerTest.java | 4 ++-- .../test/java/autoever2/cartag/service/ModelServiceTest.java | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/autoever2/cartag/domain/model/ModelShortMappedDto.java b/backend/src/main/java/autoever2/cartag/domain/model/ModelShortMappedDto.java index e6c0cbd..bdd482f 100644 --- a/backend/src/main/java/autoever2/cartag/domain/model/ModelShortMappedDto.java +++ b/backend/src/main/java/autoever2/cartag/domain/model/ModelShortMappedDto.java @@ -37,7 +37,7 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ModelShortMappedDto that = (ModelShortMappedDto) o; - return modelId == that.modelId && isDefaultModel == that.isDefaultModel && modelTypeId == that.modelTypeId && Objects.equals(modelName, that.modelName) && Objects.equals(modelTypeName, that.modelTypeName) && Objects.equals(modelPrice, that.modelPrice) && Objects.equals(modelBoughtCount, that.modelBoughtCount); + return modelId == that.modelId && isDefaultModel == that.isDefaultModel && modelTypeId == that.modelTypeId && Objects.equals(modelName, that.modelName) && Objects.equals(modelTypeName, that.modelTypeName) && Objects.equals(modelPrice, that.modelPrice) && Objects.equals(modelBoughtCount, that.modelBoughtCount) && Objects.equals(maxPs, that.maxPs) && Objects.equals(maxKgfm, that.maxKgfm); } public void setIsDefaultModel(int isDefaultModel) { diff --git a/backend/src/main/java/autoever2/cartag/repository/ModelRepository.java b/backend/src/main/java/autoever2/cartag/repository/ModelRepository.java index 5e84b21..601626e 100644 --- a/backend/src/main/java/autoever2/cartag/repository/ModelRepository.java +++ b/backend/src/main/java/autoever2/cartag/repository/ModelRepository.java @@ -26,7 +26,7 @@ public ModelRepository(DataSource dataSource) { } public List findAllModelTypeData(int carId) { - String sql = "select m.model_id, m.model_name, t.model_type_id, t.model_type_name, m.model_price, mm.model_bought_count, mm.is_default_model " + + String sql = "select m.model_id, m.model_name, t.model_type_id, t.model_type_name, m.model_price, mm.model_bought_count, mm.is_default_model, pd.max_ps, pd.max_kgfm " + "from ModelCarMapper mm " + "inner join Model m " + "on mm.model_id = m.model_id " + diff --git a/backend/src/test/java/autoever2/cartag/controller/OptionControllerTest.java b/backend/src/test/java/autoever2/cartag/controller/OptionControllerTest.java index bff5ed7..43ad7c8 100644 --- a/backend/src/test/java/autoever2/cartag/controller/OptionControllerTest.java +++ b/backend/src/test/java/autoever2/cartag/controller/OptionControllerTest.java @@ -157,8 +157,8 @@ void getOptionDetail() throws Exception { given(optionService.getOptionDetailData(carId, optionWithHmg, false)).willReturn(expected1); given(optionService.getOptionDetailData(carId, optionPackage, false)).willReturn(expected2); - ResultActions singleOption = mockMvc.perform(MockMvcRequestBuilders.get("/api/options/optiondetail").param("carid", String.valueOf(carId)).param("optionid", String.valueOf(optionWithHmg))); - ResultActions packageOption = mockMvc.perform(MockMvcRequestBuilders.get("/api/options/optiondetail").param("carid", String.valueOf(carId)).param("optionid", String.valueOf(optionPackage))); + ResultActions singleOption = mockMvc.perform(MockMvcRequestBuilders.get("/api/options/sub/detail").param("carid", String.valueOf(carId)).param("optionid", String.valueOf(optionWithHmg))); + ResultActions packageOption = mockMvc.perform(MockMvcRequestBuilders.get("/api/options/sub/detail").param("carid", String.valueOf(carId)).param("optionid", String.valueOf(optionPackage))); singleOption.andExpect(status().isOk()) .andExpect(jsonPath("$.categoryName").value("휠")) diff --git a/backend/src/test/java/autoever2/cartag/service/ModelServiceTest.java b/backend/src/test/java/autoever2/cartag/service/ModelServiceTest.java index b7e16db..c68731c 100644 --- a/backend/src/test/java/autoever2/cartag/service/ModelServiceTest.java +++ b/backend/src/test/java/autoever2/cartag/service/ModelServiceTest.java @@ -112,6 +112,7 @@ void getModelTypeData() { .modelBoughtCount(200L) .build()); + int carId = 1; Long boughtCount = 2000L; when(modelRepository.findAllModelTypeData(carId)).thenReturn(trimModelList); @@ -127,6 +128,7 @@ void getModelTypeData() { assertEquals("바디타입", result.get(2).getModelTypeName()); assertEquals(130000L, result.get(3).getModelPrice()); assertEquals(10, result.get(5).getPercentage()); + softAssertions.assertThat(result.get(0).getHmgData()).isNotNull(); } @Test