Skip to content

Commit 173c502

Browse files
김산김산
authored andcommitted
[#7] Feat: create DTOs
1 parent f2fb389 commit 173c502

File tree

5 files changed

+50
-2
lines changed

5 files changed

+50
-2
lines changed

src/main/java/com/example/helper/controller/MealController.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package com.example.helper.controller;
2+
import com.example.helper.dto.DateMealDto;
3+
import com.example.helper.dto.DateReqDto;
24
import com.example.helper.dto.Mealdto;
35
import com.example.helper.entity.Meal;
6+
import com.example.helper.service.DateMealService;
47
import com.example.helper.service.MealService;
58
import com.fasterxml.jackson.core.JsonProcessingException;
69
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -23,6 +26,9 @@ public class MealController {
2326
@Autowired
2427
private MealService mealService;
2528

29+
@Autowired
30+
private DateMealService dateMealService;
31+
2632
@GetMapping("/all")
2733
public String hello() {
2834
return "Hello HELPERs. 초기 세팅 완료.";
@@ -231,7 +237,7 @@ public String readSpecEngMeal() throws JsonProcessingException {
231237
@GetMapping("/date")
232238
public List<DateMealDto> DateMealRead(DateReqDto dateReqDto) {
233239

234-
List<DateMealDto> dateMealDtoList = mealService.getDateMeal(dateReqDto);
240+
List<DateMealDto> dateMealDtoList = dateMealService.getDateMeal(dateReqDto);
235241

236242
return dateMealDtoList;
237243
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.example.helper.dto;
2+
3+
import lombok.Data;
4+
5+
@Data
6+
public class DateMealDto {
7+
private String breakfast;
8+
private String lunch_A;
9+
private String dinner;
10+
private String lunch_B;
11+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.example.helper.dto;
2+
3+
import lombok.Data;
4+
5+
@Data
6+
public class DateReqDto {
7+
private String year;
8+
private String month;
9+
private String date;
10+
private Integer langType;
11+
private Integer bldgType;
12+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.example.helper.service;
2+
3+
import com.example.helper.dto.DateMealDto;
4+
import com.example.helper.dto.DateReqDto;
5+
import java.util.List;
6+
import org.springframework.stereotype.Service;
7+
import org.springframework.transaction.annotation.Transactional;
8+
9+
@Service
10+
@Transactional
11+
public class DateMealService {
12+
// TODO: exception handling(target data is not in DB)
13+
14+
public List<DateMealDto> getDateMeal(DateReqDto dateReqDto) {
15+
return null;
16+
}
17+
}

src/main/java/com/example/helper/service/MealService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package com.example.helper.service;
22

3+
import com.example.helper.dto.DateMealDto;
4+
import com.example.helper.dto.DateReqDto;
35
import com.example.helper.entity.Meal;
46
import com.example.helper.repository.MealRepository;
57
import com.example.helper.repository.SqlMealRepository;
8+
import java.util.List;
69
import org.springframework.beans.factory.annotation.Autowired;
710
import org.springframework.stereotype.Service;
811
import org.springframework.transaction.annotation.Transactional;
@@ -51,5 +54,4 @@ public String getSpecEngMeal() {
5154
//TODO sqlMealRepository.findSpecEngMeal
5255
return "2023-01-27 Breakfast\n\nStudent Union Bldg.2 1st floor\n\nWhite rice*Seasoned rice with seaweed\n";
5356
}
54-
5557
}

0 commit comments

Comments
 (0)