File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
spring-boot-restful-api/src
main/java/com/example/service/impl Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ public SysUser queryUserById(String userId) {
60
60
e .printStackTrace ();
61
61
}
62
62
63
- return userMapper .selectByPrimaryKey (userId );
63
+ return userMapper .selectByPrimaryKey (Integer . parseInt ( userId ) );
64
64
}
65
65
66
66
@ Override
Original file line number Diff line number Diff line change 1
1
package com .example ;
2
2
3
+ import com .alibaba .fastjson .JSON ;
3
4
import com .example .dao .SysRoleMapper ;
5
+ import com .example .dao .SysUserMapper ;
4
6
import com .example .entity .SysRole ;
7
+ import com .example .entity .SysUser ;
5
8
import lombok .extern .slf4j .Slf4j ;
6
9
import org .junit .Test ;
7
10
import org .junit .runner .RunWith ;
@@ -18,6 +21,8 @@ public class SpringBootRestfulApiApplicationTests {
18
21
19
22
@ Resource
20
23
private SysRoleMapper sysRoleMapper ;
24
+ @ Resource
25
+ private SysUserMapper sysUserMapper ;
21
26
22
27
@ Test
23
28
public void contextLoads () {
@@ -36,4 +41,10 @@ public void testSendMail(){
36
41
log .error ("错误" , e );
37
42
}
38
43
44
+ @ Test
45
+ public void testGetOne (){
46
+ SysUser sysUser = sysUserMapper .selectByPrimaryKey (1 );
47
+ System .out .println (JSON .toJSONString (sysUser ));
48
+ }
49
+
39
50
}
You can’t perform that action at this time.
0 commit comments