@@ -33,17 +33,50 @@ public class InstrumentQueryService {
33
33
34
34
private final InstrumentRepository instrumentRepository ;
35
35
36
+ /**
37
+ * Id로 악기를 조회한다.
38
+ *
39
+ * @param id 조회하고자 하는 Instrument entity의 id
40
+ * @return 조회된 Instrument entity
41
+ */
42
+ public Instrument getInstrumentById (Long id ) {
43
+ return instrumentRepository .findById (id )
44
+ .orElseThrow (() -> new InstrumentNotFoundByIdException (id ));
45
+ }
46
+
47
+ /**
48
+ * Id로 악기를 조회한다.
49
+ *
50
+ * @param id 조회하고자 하는 악기의 id
51
+ * @return 조회된 Instrument dto
52
+ */
36
53
public InstrumentDto getInstrumentDtoById (Long id ) {
37
54
Instrument instrument = getInstrumentById (id );
38
55
return InstrumentMapper .toDto (instrument );
39
56
}
40
57
58
+ /**
59
+ * 악기 목록을 조회한다.
60
+ *
61
+ * @param page 페이지 번호
62
+ * @param pageSize 페이지 크기
63
+ * @param sort 정렬 기준
64
+ * @return 조회된 악기 dto 목록
65
+ */
41
66
public Page <InstrumentDto > findInstrumentDtos (int page , int pageSize , InstrumentSortOption sort ) {
42
67
return instrumentRepository
43
68
.findAll (PageRequest .of (page , pageSize , sort .toSort ()))
44
69
.map (InstrumentMapper ::toDto );
45
70
}
46
71
72
+ /**
73
+ * 일렉 기타 목록을 조회한다.
74
+ *
75
+ * @param page 페이지 번호
76
+ * @param pageSize 페이지 크기
77
+ * @param sort 정렬 기준
78
+ * @return 조회된 일렉 기타 dto 목록
79
+ */
47
80
public Page <ElectricGuitarDto > findElectricGuitarDtos (
48
81
int page ,
49
82
int pageSize ,
@@ -55,6 +88,14 @@ public Page<ElectricGuitarDto> findElectricGuitarDtos(
55
88
.map (InstrumentMapper ::toElectricGuitarDto );
56
89
}
57
90
91
+ /**
92
+ * 베이스 기타 목록을 조회한다.
93
+ *
94
+ * @param page 페이지 번호
95
+ * @param pageSize 페이지 크기
96
+ * @param sort 정렬 기준
97
+ * @return 조회된 베이스 기타 dto 목록
98
+ */
58
99
public Page <BassGuitarDto > findBassGuitarDtos (
59
100
int page ,
60
101
int pageSize ,
@@ -66,6 +107,14 @@ public Page<BassGuitarDto> findBassGuitarDtos(
66
107
.map (InstrumentMapper ::toBassGuitarDto );
67
108
}
68
109
110
+ /**
111
+ * 어쿠스틱&클래식 기타 목록을 조회한다.
112
+ *
113
+ * @param page 페이지 번호
114
+ * @param pageSize 페이지 크기
115
+ * @param sort 정렬 기준
116
+ * @return 조회된 어쿠스틱&클래식 기타 dto 목록
117
+ */
69
118
public Page <AcousticAndClassicGuitarDto > findAcousticAndClassicGuitarDtos (
70
119
int page ,
71
120
int pageSize ,
@@ -77,6 +126,14 @@ public Page<AcousticAndClassicGuitarDto> findAcousticAndClassicGuitarDtos(
77
126
.map (InstrumentMapper ::toAcousticAndClassicGuitarDto );
78
127
}
79
128
129
+ /**
130
+ * 이펙터 목록을 조회한다.
131
+ *
132
+ * @param page 페이지 번호
133
+ * @param pageSize 페이지 크기
134
+ * @param sort 정렬 기준
135
+ * @return 조회된 이펙터 dto 목록
136
+ */
80
137
public Page <EffectorDto > findEffectorDtos (
81
138
int page ,
82
139
int pageSize ,
@@ -88,6 +145,14 @@ public Page<EffectorDto> findEffectorDtos(
88
145
.map (InstrumentMapper ::toEffectorDto );
89
146
}
90
147
148
+ /**
149
+ * 앰프 목록을 조회한다.
150
+ *
151
+ * @param page 페이지 번호
152
+ * @param pageSize 페이지 크기
153
+ * @param sort 정렬 기준
154
+ * @return 조회된 앰프 dto 목록
155
+ */
91
156
public Page <AmplifierDto > findAmplifierDtos (
92
157
int page ,
93
158
int pageSize ,
@@ -99,6 +164,14 @@ public Page<AmplifierDto> findAmplifierDtos(
99
164
.map (InstrumentMapper ::toAmplifierDto );
100
165
}
101
166
167
+ /**
168
+ * 음향 장비 목록을 조회한다.
169
+ *
170
+ * @param page 페이지 번호
171
+ * @param pageSize 페이지 크기
172
+ * @param sort 정렬 기준
173
+ * @return 조회된 음향 장비 dto 목록
174
+ */
102
175
public Page <AudioEquipmentDto > findAudioEquipmentDtos (
103
176
int page ,
104
177
int pageSize ,
@@ -109,9 +182,4 @@ public Page<AudioEquipmentDto> findAudioEquipmentDtos(
109
182
.findAudioEquipments (page , pageSize , sort , filterConditions )
110
183
.map (InstrumentMapper ::toAmplifierDto );
111
184
}
112
-
113
- private Instrument getInstrumentById (Long id ) {
114
- return instrumentRepository .findById (id )
115
- .orElseThrow (() -> new InstrumentNotFoundByIdException (id ));
116
- }
117
185
}
0 commit comments