質問編集履歴

1

ためしのソースを追加した。

2017/10/11 07:29

投稿

soso_sho
soso_sho

スコア11

test CHANGED
File without changes
test CHANGED
@@ -146,6 +146,54 @@
146
146
 
147
147
 
148
148
 
149
+
150
+
149
151
  ###補足情報(言語/FW/ツール等のバージョンなど)
150
152
 
151
153
  他の学生の情報を見れるのは良くないから、APIのみ処理したいのであれば、どうすればよいのでしょうか。
154
+
155
+
156
+
157
+ 追加:
158
+
159
+ ```java
160
+
161
+ /** 学生を検索します。 low: 先生権限のみ利用可能に */
162
+
163
+ @GetMapping
164
+
165
+ public List<StudentInfo> findStudent() {
166
+
167
+
168
+
169
+ studentInfoList = null;
170
+
171
+ List<StudentInfo> StudentAll = service.findStudent().stream()
172
+
173
+ .map(StudentInfo::of)
174
+
175
+ .collect(Collectors.toList());
176
+
177
+
178
+
179
+ for (StudentInfo studentInfo : StudentAll) {
180
+
181
+
182
+
183
+ if (studentInfo.equals(teacherId)) {
184
+
185
+ studentInfoList.add(studentInfo);
186
+
187
+ }
188
+
189
+ }
190
+
191
+ return studentInfoList;
192
+
193
+ }
194
+
195
+ ```
196
+
197
+ 上記のように、StudentController.javaファイルにループforとif文を使ってみましたが、うまくいかない。
198
+
199
+ もしかしたら、どこかに書き間違えていますか。