-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathUserApi.java
More file actions
executable file
·114 lines (79 loc) · 2.38 KB
/
Copy pathUserApi.java
File metadata and controls
executable file
·114 lines (79 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package example.api;
import example.dto.*;
import example.ApiClient;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
/**
* 用户接口
*/
public class UserApi {
private final ApiClient client;
public UserApi(ApiClient client) {
this.client = client;
}
public static final TypeReference<Long> addResultType = new TypeReference<Long>() {
};
/**
* 添加用户
*
*/
public Long add( User body) {
return client.post("/user/add",body, addResultType);
}
public static final TypeReference<Boolean> deleteResultType = new TypeReference<Boolean>() {
};
/**
* 删除用户
*
*/
public Boolean delete( Long id) {
Map<String,Object> params = new HashMap<String,Object>();
return client.delete(String.format("/user/delete/%s",id),params, deleteResultType);
}
public static final TypeReference<Long> editResultType = new TypeReference<Long>() {
};
/**
* 修改用户
*
*/
public Long edit( Long id, User body) {
return client.put(String.format("/user/edit/%s",id),body, editResultType);
}
public static final TypeReference<User> edit_1ResultType = new TypeReference<User>() {
};
/**
* 查询用户
*
*/
public User edit_1( Long id, String keyword) {
Map<String,Object> params = new HashMap<String,Object>();
params.put("id",id);
params.put("keyword",keyword);
return client.get(String.format("/user/detail/%s",id),params, edit_1ResultType);
}
public static final TypeReference<List<User>> listResultType = new TypeReference<List<User>>() {
};
/**
* 用户列表
*
*/
public List<User> list() {
Map<String,Object> params = new HashMap<String,Object>();
return client.get("/user/list",params, listResultType);
}
public static final TypeReference<PageData<User>> pageResultType = new TypeReference<PageData<User>>() {
};
/**
* 用户分页
*
*/
public PageData<User> page( Integer page, Integer size) {
Map<String,Object> params = new HashMap<String,Object>();
params.put("page",page);
params.put("size",size);
return client.get("/user/page",params, pageResultType);
}
}