Skip to content

Commit 3789c74

Browse files
committed
new hashmap
1 parent c5a43fc commit 3789c74

File tree

7 files changed

+36
-0
lines changed

7 files changed

+36
-0
lines changed

admin/src/main/java/info/xiaomo/admin/controller/AdminUserController.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public class AdminUserController extends BaseController {
5454
*/
5555
@RequestMapping(value = "login", method = RequestMethod.POST)
5656
public Map<String, Object> login(@RequestParam String userName, @RequestParam String password) {
57+
result = new HashMap<>();
5758
AdminModel adminModel = service.findAdminUserByUserName(userName);
5859
if (adminModel == null) {
5960
result.put(code, notFound);
@@ -84,6 +85,7 @@ public HashMap<String, Object> add(
8485
@RequestParam String password,
8586
@RequestParam int authLevel
8687
) {
88+
result = new HashMap<>();
8789
AdminModel operatorModel = service.findAdminUserByUserName(operator);
8890
if (operator == null) {
8991
result.put(code, notFound);
@@ -118,6 +120,7 @@ public HashMap<String, Object> add(
118120

119121
@RequestMapping(value = "findById", method = RequestMethod.GET)
120122
public HashMap<String, Object> findUserById(@RequestParam("id") Long id) {
123+
result = new HashMap<>();
121124
AdminModel adminModel = service.findAdminUserById(id);
122125
if (adminModel == null) {
123126
result.put(code, notFound);
@@ -130,6 +133,7 @@ public HashMap<String, Object> findUserById(@RequestParam("id") Long id) {
130133

131134
@RequestMapping(value = "findByName", method = RequestMethod.GET)
132135
public HashMap<String, Object> findByName(@RequestParam("userName") String userName) {
136+
result = new HashMap<>();
133137
AdminModel adminModel = service.findAdminUserByUserName(userName);
134138
if (adminModel == null) {
135139
result.put(code, notFound);
@@ -143,6 +147,7 @@ public HashMap<String, Object> findByName(@RequestParam("userName") String userN
143147

144148
@RequestMapping(value = "findAll", method = RequestMethod.GET)
145149
public HashMap<String, Object> getAll(@RequestParam(value = "start", defaultValue = "1") int start, @RequestParam(value = "pageSize", defaultValue = "10") int page) {
150+
result = new HashMap<>();
146151
Page<AdminModel> pages = service.getAdminUsers(start, page);
147152
result.put(code, success);
148153
result.put(adminUsers, pages);
@@ -151,6 +156,7 @@ public HashMap<String, Object> getAll(@RequestParam(value = "start", defaultValu
151156

152157
@RequestMapping(value = "deleteById", method = RequestMethod.GET)
153158
public HashMap<String, Object> deleteUserById(@RequestParam("id") Long id, @RequestParam String operator) throws UserNotFoundException {
159+
result = new HashMap<>();
154160
AdminModel operatorModel = service.findAdminUserByUserName(operator);
155161
if (operator == null) {
156162
result.put(code, notFound);
@@ -177,6 +183,7 @@ public HashMap<String, Object> update(
177183
@RequestParam("password") String password,
178184
@RequestParam("authLevel") int authLevel
179185
) throws UserNotFoundException {
186+
result = new HashMap<>();
180187
AdminModel operatorModel = service.findAdminUserByUserName(operator);
181188
if (operator == null) {
182189
result.put(code, notFound);
@@ -202,6 +209,7 @@ public HashMap<String, Object> update(
202209

203210
@RequestMapping(value = "forbid", method = RequestMethod.GET)
204211
public HashMap<String, Object> forbid(@RequestParam("id") Long id, @RequestParam("operator") String operator) throws UserNotFoundException {
212+
result = new HashMap<>();
205213
AdminModel operatorModel = service.findAdminUserByUserName(operator);
206214
if (operator == null) {
207215
result.put(code, notFound);

admin/src/main/java/info/xiaomo/admin/controller/BlogController.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public class BlogController extends BaseController {
4242
*/
4343
@RequestMapping("findById")
4444
public HashMap<String, Object> findById(@RequestParam Long id) {
45+
result = new HashMap<>();
4546
BlogModel blogModel = service.findBlogById(id);
4647
if (blogModel == null) {
4748
result.put(code, notFound);
@@ -61,6 +62,7 @@ public HashMap<String, Object> findById(@RequestParam Long id) {
6162
*/
6263
@RequestMapping(value = "findByTitle", method = RequestMethod.GET)
6364
public HashMap<String, Object> findByTitle(@RequestParam String title) {
65+
result = new HashMap<>();
6466
BlogModel model = service.findBlogByTitle(title);
6567
if (model == null) {
6668
result.put(code, notFound);
@@ -82,6 +84,7 @@ public HashMap<String, Object> findByTitle(@RequestParam String title) {
8284
*/
8385
@RequestMapping("findAll")
8486
public HashMap<String, Object> findAll(@RequestParam(value = "start", defaultValue = "1") int start, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
87+
result = new HashMap<>();
8588
Page<BlogModel> all = service.findAll(start, pageSize);
8689
result.put(code, success);
8790
result.put(blogs, all);
@@ -106,6 +109,7 @@ public HashMap<String, Object> add(
106109
@RequestParam int blogType,
107110
@RequestParam Long tagIds[]
108111
) {
112+
result = new HashMap<>();
109113
BlogModel blogModel = service.findBlogByTitle(title);
110114
if (blogModel != null) {
111115
result.put(code, repeat);
@@ -146,6 +150,7 @@ public HashMap<String, Object> update(
146150
@RequestParam int blogType,
147151
@RequestParam Long tagIds[]
148152
) {
153+
result = new HashMap<>();
149154
BlogModel blogModel = service.findBlogByTitle(title);
150155
if (blogModel == null) {
151156
result.put(code, notFound);
@@ -173,6 +178,7 @@ public HashMap<String, Object> update(
173178
*/
174179
@RequestMapping(value = "deleteBlogById", method = RequestMethod.GET)
175180
public HashMap<String, Object> deleteBlogById(@RequestParam Long id) {
181+
result = new HashMap<>();
176182
BlogModel blogModel = service.findBlogById(id);
177183
if (blogModel == null) {
178184
result.put(code, notFound);

admin/src/main/java/info/xiaomo/admin/controller/ChangeLogController.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public class ChangeLogController extends BaseController {
4141
*/
4242
@RequestMapping("findById")
4343
public HashMap<String, Object> findById(@RequestParam Long id) {
44+
result = new HashMap<>();
4445
ChangeLogModel changeLogModel = service.findById(id);
4546
if (changeLogModel == null) {
4647
result.put(code, notFound);
@@ -58,6 +59,7 @@ public HashMap<String, Object> findById(@RequestParam Long id) {
5859
*/
5960
@RequestMapping(value = "findByName", method = RequestMethod.GET)
6061
public HashMap<String, Object> findByName(@RequestParam String name) {
62+
result = new HashMap<>();
6163
ChangeLogModel model = service.findByName(name);
6264
if (model == null) {
6365
result.put(code, notFound);
@@ -77,6 +79,7 @@ public HashMap<String, Object> findByName(@RequestParam String name) {
7779
*/
7880
@RequestMapping("findAll")
7981
public HashMap<String, Object> findAll(@RequestParam(value = "start", defaultValue = "1") int start, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
82+
result = new HashMap<>();
8083
Page<ChangeLogModel> all = service.findAll(start, pageSize);
8184
result.put(code, success);
8285
result.put(changeLogs, all);
@@ -92,6 +95,7 @@ public HashMap<String, Object> findAll(@RequestParam(value = "start", defaultVal
9295
public HashMap<String, Object> add(
9396
@RequestParam String name
9497
) {
98+
result = new HashMap<>();
9599
ChangeLogModel changeLogModel = service.findByName(name);
96100
if (changeLogModel != null) {
97101
result.put(code, repeat);
@@ -115,6 +119,7 @@ public HashMap<String, Object> add(
115119
public HashMap<String, Object> update(
116120
@RequestParam String name
117121
) {
122+
result = new HashMap<>();
118123
ChangeLogModel changeLogModel = service.findByName(name);
119124
if (changeLogModel == null) {
120125
result.put(code, notFound);
@@ -133,6 +138,7 @@ public HashMap<String, Object> update(
133138
*/
134139
@RequestMapping(value = "deleteById", method = RequestMethod.GET)
135140
public HashMap<String, Object> deleteById(@RequestParam Long id) {
141+
result = new HashMap<>();
136142
ChangeLogModel changeLogModel = service.findById(id);
137143
if (changeLogModel == null) {
138144
result.put(code, notFound);

admin/src/main/java/info/xiaomo/admin/controller/LinkController.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public class LinkController extends BaseController {
3434

3535
@RequestMapping("findById")
3636
public HashMap<String, Object> findLinkById(@RequestParam Long id) {
37+
result = new HashMap<>();
3738
LinkModel model = service.findById(id);
3839
if (model == null) {
3940
result.put(code, notFound);
@@ -46,6 +47,7 @@ public HashMap<String, Object> findLinkById(@RequestParam Long id) {
4647

4748
@RequestMapping("findByName")
4849
public HashMap<String, Object> findByName(@RequestParam String name) {
50+
result = new HashMap<>();
4951
LinkModel model = service.findByName(name);
5052
if (model == null) {
5153
result.put(code, notFound);
@@ -59,6 +61,7 @@ public HashMap<String, Object> findByName(@RequestParam String name) {
5961

6062
@RequestMapping("findAll")
6163
public HashMap<String, Object> findAll(@RequestParam(value = "start", defaultValue = "1") int start, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
64+
result = new HashMap<>();
6265
Page<LinkModel> models = service.findAll(start, pageSize);
6366
result.put(code, success);
6467
result.put(links, models);
@@ -68,6 +71,7 @@ public HashMap<String, Object> findAll(@RequestParam(value = "start", defaultVal
6871

6972
@RequestMapping("add")
7073
public HashMap<String, Object> add(@RequestParam String name) {
74+
result = new HashMap<>();
7175
LinkModel linkModel = service.findByName(name);
7276
if (linkModel != null) {
7377
result.put(code, repeat);
@@ -83,6 +87,7 @@ public HashMap<String, Object> add(@RequestParam String name) {
8387

8488
@RequestMapping("update")
8589
public HashMap<String, Object> update(@RequestParam String name) {
90+
result = new HashMap<>();
8691
LinkModel LinkModel = service.findByName(name);
8792
if (LinkModel == null) {
8893
result.put(code, notFound);
@@ -97,6 +102,7 @@ public HashMap<String, Object> update(@RequestParam String name) {
97102

98103
@RequestMapping("delete")
99104
public HashMap<String, Object> delete(@RequestParam Long id) {
105+
result = new HashMap<>();
100106
LinkModel LinkModel = service.findById(id);
101107
if (LinkModel == null) {
102108
result.put(code, notFound);

admin/src/main/java/info/xiaomo/admin/controller/SystemController.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class SystemController extends BaseController {
2828

2929
@RequestMapping("getSystem")
3030
public HashMap<String, Object> getSystem() {
31+
result = new HashMap<>();
3132
Map<String, Object> map = new HashMap<>();
3233
Properties properties = System.getProperties();
3334
map.put("javaVersion", properties.getProperty("java.version"));//运行时环境版本

admin/src/main/java/info/xiaomo/admin/controller/TagController.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public class TagController extends BaseController {
3434

3535
@RequestMapping("findById")
3636
public HashMap<String, Object> findTagById(@RequestParam Long id) {
37+
result = new HashMap<>();
3738
TagModel model = service.findById(id);
3839
if (model == null) {
3940
result.put(code, notFound);
@@ -46,6 +47,7 @@ public HashMap<String, Object> findTagById(@RequestParam Long id) {
4647

4748
@RequestMapping("findByName")
4849
public HashMap<String, Object> findByName(@RequestParam String name) {
50+
result = new HashMap<>();
4951
TagModel model = service.findByName(name);
5052
if (model == null) {
5153
result.put(code, notFound);
@@ -59,6 +61,7 @@ public HashMap<String, Object> findByName(@RequestParam String name) {
5961

6062
@RequestMapping("findAll")
6163
public HashMap<String, Object> findAll(@RequestParam(value = "start", defaultValue = "1") int start, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
64+
result = new HashMap<>();
6265
Page<TagModel> models = service.findAll(start, pageSize);
6366
result.put(code, success);
6467
result.put(tags, models);
@@ -68,6 +71,7 @@ public HashMap<String, Object> findAll(@RequestParam(value = "start", defaultVal
6871

6972
@RequestMapping("add")
7073
public HashMap<String, Object> add(@RequestParam String name) {
74+
result = new HashMap<>();
7175
TagModel tagModel = service.findByName(name);
7276
if (tagModel != null) {
7377
result.put(code, repeat);
@@ -83,6 +87,7 @@ public HashMap<String, Object> add(@RequestParam String name) {
8387

8488
@RequestMapping("update")
8589
public HashMap<String, Object> update(@RequestParam String name) {
90+
result = new HashMap<>();
8691
TagModel tagModel = service.findByName(name);
8792
if (tagModel == null) {
8893
result.put(code, notFound);
@@ -97,6 +102,7 @@ public HashMap<String, Object> update(@RequestParam String name) {
97102

98103
@RequestMapping("delete")
99104
public HashMap<String, Object> delete(@RequestParam Long id) {
105+
result = new HashMap<>();
100106
TagModel tagModel = service.findById(id);
101107
if (tagModel == null) {
102108
result.put(code, notFound);

admin/src/main/java/info/xiaomo/admin/controller/UserController.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public class UserController extends BaseController {
4242
*/
4343
@RequestMapping(value = "findById", method = RequestMethod.GET)
4444
public HashMap<String, Object> findUserById(@RequestParam("id") Long id) {
45+
result = new HashMap<>();
4546
UserModel userModel = service.findUserById(id);
4647
if (userModel == null) {
4748
result.put(code, notFound);
@@ -61,6 +62,7 @@ public HashMap<String, Object> findUserById(@RequestParam("id") Long id) {
6162
*/
6263
@RequestMapping(value = "findAll", method = RequestMethod.GET)
6364
public HashMap<String, Object> getAll(@RequestParam(value = "start", defaultValue = "1") int start, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
65+
result = new HashMap<>();
6466
Page<UserModel> pages = service.findAll(start, pageSize);
6567
result.put(code, success);
6668
result.put(users, pages);
@@ -76,6 +78,7 @@ public HashMap<String, Object> getAll(@RequestParam(value = "start", defaultValu
7678
*/
7779
@RequestMapping(value = "deleteById", method = RequestMethod.GET)
7880
public HashMap<String, Object> deleteUserById(@RequestParam("id") Long id) throws UserNotFoundException {
81+
result = new HashMap<>();
7982
UserModel userModel = service.deleteUserById(id);
8083
if (userModel == null) {
8184
result.put(code, notFound);

0 commit comments

Comments
 (0)