File tree 2 files changed +21
-2
lines changed
src/main/java/com/example/demo
2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -29,13 +29,13 @@ public boolean insert(User user) {
29
29
// 1件検索用メソッド
30
30
@ Override
31
31
public User selectOne (String userId ) {
32
- return null ;
32
+ return dao . selectOne ( userId ) ;
33
33
}
34
34
35
35
// 全件検索用メソッド
36
36
@ Override
37
37
public List <User > selectMany () {
38
- return null ;
38
+ return dao . selectMany () ;
39
39
}
40
40
41
41
// 1件更新用メソッド
Original file line number Diff line number Diff line change 1
1
package com .example .demo .login .controller ;
2
2
3
+ import java .util .List ;
4
+
3
5
import org .springframework .beans .factory .annotation .Autowired ;
6
+ import org .springframework .web .bind .annotation .GetMapping ;
7
+ import org .springframework .web .bind .annotation .PathVariable ;
4
8
import org .springframework .web .bind .annotation .RestController ;
5
9
10
+ import com .example .demo .domain .model .User ;
6
11
import com .example .demo .domain .service .RestService ;
7
12
8
13
9
14
@ RestController
10
15
public class UserRestController {
11
16
@ Autowired
12
17
RestService service ;
18
+
19
+ // ユーザー全件取得
20
+ @ GetMapping ("/rest/get" )
21
+ public List <User > getUserMany () {
22
+ // ユーザー全件取得
23
+ return service .selectMany ();
24
+ }
25
+
26
+ // ユーザー1件取得
27
+ @ GetMapping ("/rest/get/{id:.+}" )
28
+ public User getUserOne (@ PathVariable ("id" ) String userId ) {
29
+ // ユーザー1件取得
30
+ return service .selectOne (userId );
31
+ }
13
32
}
You can’t perform that action at this time.
0 commit comments