Skip to content

Commit 29fc557

Browse files
committed
添加模块基于netty的rpc调用
1 parent d9bbf5e commit 29fc557

File tree

6 files changed

+98
-59
lines changed

6 files changed

+98
-59
lines changed

demo/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
<artifactId>watermark</artifactId>
2929
<version>1.3</version>
3030
</dependency>
31+
<dependency>
32+
<groupId>junit</groupId>
33+
<artifactId>junit</artifactId>
34+
</dependency>
3135
</dependencies>
3236

3337
</project>

netty/netty-rpc/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@
6565
<artifactId>commons-lang</artifactId>
6666
<version>2.6</version>
6767
</dependency>
68+
<dependency>
69+
<groupId>commons-lang</groupId>
70+
<artifactId>commons-lang</artifactId>
71+
<version>2.6</version>
72+
<scope>compile</scope>
73+
</dependency>
6874

6975
</dependencies>
7076

persist/persist-mybatisplus/src/main/java/com/salk/lib/persist/User.java

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package com.salk.lib.persist;
2+
3+
import com.baomidou.mybatisplus.annotation.TableField;
4+
import com.baomidou.mybatisplus.annotation.TableName;
5+
6+
/**
7+
* 用户
8+
*
9+
* @author salkli
10+
* @date 2022/10/11
11+
* @since 2022/10/11
12+
*/
13+
14+
@TableName(value = "user")
15+
public class UserPo {
16+
private Long id;
17+
private String name;
18+
@TableField(value = "age")
19+
private String age1;
20+
private String email;
21+
22+
public UserPo(Long id, String name, String age1, String email) {
23+
this.id = id;
24+
this.name = name;
25+
this.age1 = age1;
26+
this.email = email;
27+
}
28+
29+
public UserPo() {}
30+
31+
public Long getId() {
32+
return id;
33+
}
34+
35+
public UserPo setId(Long id) {
36+
this.id = id;
37+
return this;
38+
}
39+
40+
public String getName() {
41+
return name;
42+
}
43+
44+
public UserPo setName(String name) {
45+
this.name = name;
46+
return this;
47+
}
48+
49+
public String getAge1() {
50+
return age1;
51+
}
52+
53+
public UserPo setAge1(String age1) {
54+
this.age1 = age1;
55+
return this;
56+
}
57+
58+
public String getEmail() {
59+
return email;
60+
}
61+
62+
public UserPo setEmail(String email) {
63+
this.email = email;
64+
65+
return this;
66+
}
67+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package com.salk.lib.persist.mapper;
22

33
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4-
import com.salk.lib.persist.User;
4+
import com.salk.lib.persist.UserPo;
55

66
/**
77
* 用户映射器
88
*
99
* @author salkli
1010
* @date 2022/10/11
1111
*/
12-
public interface UserMapper extends BaseMapper<User> {
12+
public interface UserMapper extends BaseMapper<UserPo> {
1313

1414
}

persist/persist-mybatisplus/src/test/java/com/salk/lib/persist/UserTest.java

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
import java.util.List;
44

5+
import com.salk.lib.persist.mapper.UserMapper;
56
import org.junit.jupiter.api.Test;
67
import org.springframework.beans.factory.annotation.Autowired;
78
import org.springframework.boot.test.context.SpringBootTest;
89

9-
import com.salk.lib.persist.mapper.UserMapper;
1010

1111

1212
/**
@@ -19,16 +19,30 @@
1919
public class UserTest {
2020

2121
@Autowired
22-
private UserMapper userMapper;
22+
private UserMapper userMapper;
23+
24+
/**
25+
* 测试查询
26+
*/
27+
@Test
28+
public void testSelect(){
29+
List<UserPo> users = userMapper.selectList(null);
30+
System.out.println("姓名"+users.get(0).getName());
31+
32+
}
2333

2434
/**
2535
* 测试插入
2636
*/
2737
@Test
2838
public void testInsert(){
29-
List<User> users = userMapper.selectList(null);
30-
System.out.println(users);
31-
39+
//List<UserPo> users = userMapper.selectList(null);
40+
//System.out.println("记录数1=========="+users.size());
41+
UserPo user = new UserPo(10L, "salk", "20", "[email protected]");
42+
int insert = userMapper.insert(user);
43+
List<UserPo> users2 = userMapper.selectList(null);
44+
System.out.println("记录数=========="+users2.size());
3245
}
3346

47+
3448
}

0 commit comments

Comments
 (0)