diff --git a/src/main/java/com/peteralbus/controller/AdminController.java b/src/main/java/com/peteralbus/controller/AdminController.java index 109c4e6..229f684 100644 --- a/src/main/java/com/peteralbus/controller/AdminController.java +++ b/src/main/java/com/peteralbus/controller/AdminController.java @@ -76,4 +76,14 @@ public class AdminController } return "error"; } + @ResponseBody + @RequestMapping("/setAdmin") + public String setAdmin(Long userId) + { + if(userService.setAdmin(userId)>0) + { + return "success"; + } + return "error"; + } } diff --git a/src/main/java/com/peteralbus/service/UserService.java b/src/main/java/com/peteralbus/service/UserService.java index a120f92..fa2be04 100644 --- a/src/main/java/com/peteralbus/service/UserService.java +++ b/src/main/java/com/peteralbus/service/UserService.java @@ -93,4 +93,11 @@ public class UserService { return userDao.selectById(userId); } + + public int setAdmin(Long userId) + { + User user=userDao.selectById(userId); + user.setUserClass(0); + return userDao.updateById(user); + } } diff --git a/src/main/webapp/jsp/account/register.jsp b/src/main/webapp/jsp/account/register.jsp index 3cd95e6..84bd307 100644 --- a/src/main/webapp/jsp/account/register.jsp +++ b/src/main/webapp/jsp/account/register.jsp @@ -20,11 +20,16 @@
+ +

如果需要创建管理员账号,请先注册一个任意类型的新账号,然后联系网站管理员将您设为管理员

+
- +
diff --git a/src/main/webapp/jsp/admin/users.jsp b/src/main/webapp/jsp/admin/users.jsp index d42c5c1..6237417 100644 --- a/src/main/webapp/jsp/admin/users.jsp +++ b/src/main/webapp/jsp/admin/users.jsp @@ -73,6 +73,14 @@ + + + +