diff --git a/src/main/java/com/sixteam/irs/controller/UserController.java b/src/main/java/com/sixteam/irs/controller/UserController.java index f61ef57634a634d18ac9dc719d16756d6a58205d..da35807a9525be7d356f876a1d53a456ad7f59ee 100644 --- a/src/main/java/com/sixteam/irs/controller/UserController.java +++ b/src/main/java/com/sixteam/irs/controller/UserController.java @@ -95,18 +95,15 @@ public class UserController { } @RequestMapping("/addUser") - public String addUser(HttpServletRequest request,User user,String rid){ + public String addUser(User user){ //获取前台传来的用户 - int row = userService.addUser(user); - - System.out.println(rid); - //将用户添加 - if (row >0){ - return "redirect:/userList"; - }else { - request.setAttribute("data","增不了程序出错"); + int user1 = userService.addUser(user); + if (user1>0){ return "redirect:/userList"; + }else{ + return "/test/bb/message"; } + //将用户添加 } @@ -116,7 +113,7 @@ public class UserController { public String toUpdateUser(String id,HttpServletRequest request){ //获取前台传来的用户id,查询此用户 User user = userService.findById(id); - request.setAttribute("user",user); + request.setAttribute("user",user.getuName()); System.out.println(user); //将数据传到修改页面 return "/test/user/修改用户.html"; @@ -137,30 +134,38 @@ public class UserController { } //用户登录 - @RequestMapping("/loginUser") + @RequestMapping("loginUser") public String loginUser(User user,HttpServletRequest request){ User u = userService.loginUser(user); if (u!=null) { request.setAttribute("admin", user.getuName()); - return "bb:/loginUser1"; + return "/test/bb/loginUser1"; }else { request.setAttribute("msg","登陆失败"); - return "bb:/message"; + return "/test/bb/message"; } } //用户注册 - @RequestMapping("/registerUser") + @RequestMapping("registerUser") public String registerUser(User user,HttpServletRequest request){ int u =userService.addUser(user); if (u>0){ request.setAttribute("msg","添加成功"); - return "bb:/message"; + return "/test/bb/message"; }else{ request.setAttribute("msg","添加失败"); - return "bb:/message"; + return "/test/bb/message"; } } + @RequestMapping("tologinUser") + public String tologinUser(HttpServletRequest request){ + return "/test/bb/indexuser"; + } + @RequestMapping("toRegisterUser") + public String toRegisterUser(HttpServletRequest request){ + return "/test/bb/registerUser"; + } @RequestMapping("/touxiang") public String touxiang(){ return "/test/头像.html"; diff --git a/src/main/resources/com/sixteam/irs/mapper/UserMapper.xml b/src/main/resources/com/sixteam/irs/mapper/UserMapper.xml index c3abc964a3f88778fa8eabc45c5a00c0fc37da41..3d4b27a151cc33a72edbf2138254d7e12e1387fa 100644 --- a/src/main/resources/com/sixteam/irs/mapper/UserMapper.xml +++ b/src/main/resources/com/sixteam/irs/mapper/UserMapper.xml @@ -67,7 +67,7 @@ where u_id = #{uId} - + select * from irs_user where (u_email = #{uEmail} or u_phone = #{uPhone}) and u_password = #{uPassword} \ No newline at end of file diff --git a/src/main/resources/templates/test/bb/indexuser.html b/src/main/resources/templates/test/bb/indexuser.html index 334fe881fe477d3264fd4a59c9377b1b5869be64..5cce7a5c0c3a312be65ae91aa18cc3ff1a18e615 100644 --- a/src/main/resources/templates/test/bb/indexuser.html +++ b/src/main/resources/templates/test/bb/indexuser.html @@ -1,14 +1,197 @@ + - Title + + Document + + -
- 电话/邮箱:
- 密码:
- +
+

login

+ +
电话/邮箱 + +
+
密码 + + +
+ + + + + + +
- \ No newline at end of file + diff --git a/src/main/resources/templates/test/bb/loginUser1.html b/src/main/resources/templates/test/bb/loginUser1.html index c20659f15c15ac6e3309aa966bc3e22c1f66d5ad..3f14110eb4e10a0a4199c41f1558b9fd274b9b4e 100644 --- a/src/main/resources/templates/test/bb/loginUser1.html +++ b/src/main/resources/templates/test/bb/loginUser1.html @@ -3,8 +3,9 @@ Title + -{{admin}}欢迎您 +去用户页面 - \ No newline at end of file + diff --git a/src/main/resources/templates/test/bb/message.html b/src/main/resources/templates/test/bb/message.html index 96c246df3c9fb6cb67c109785267626ed74e8995..fdfb107ca4b4c9f388e520b3f696075a6275d462 100644 --- a/src/main/resources/templates/test/bb/message.html +++ b/src/main/resources/templates/test/bb/message.html @@ -3,8 +3,9 @@ Title + -{{msg}} +方法执行成功 \ No newline at end of file diff --git a/src/main/resources/templates/test/bb/updateUser.html b/src/main/resources/templates/test/bb/registerUser.html similarity index 91% rename from src/main/resources/templates/test/bb/updateUser.html rename to src/main/resources/templates/test/bb/registerUser.html index e2d3eba0ec3a403ae37b2d8b47bc45459e1645e9..562032e9aeb3e7e34d7e30dc6991d76d2c970218 100644 --- a/src/main/resources/templates/test/bb/updateUser.html +++ b/src/main/resources/templates/test/bb/registerUser.html @@ -5,7 +5,7 @@ Title -
+ 用户姓名:
用户邮箱:
用户电话:
diff --git a/src/main/resources/templates/test/img/2.png b/src/main/resources/templates/test/img/2.png new file mode 100644 index 0000000000000000000000000000000000000000..3861fbbd258533c1b48ed3b98abeabf22afeea1c Binary files /dev/null and b/src/main/resources/templates/test/img/2.png differ diff --git a/src/main/resources/templates/test/index.html b/src/main/resources/templates/test/index.html index 6cb03ac359068432d8b09a74af2f072e2085723b..ec837323544d7d1656faa69b68b62e38e5eb0e84 100644 --- a/src/main/resources/templates/test/index.html +++ b/src/main/resources/templates/test/index.html @@ -9,8 +9,8 @@ 职场百科列表 企业列表 权限列表 - 去管理员页面 - 去用户页面 - 头像 +去管理员页面 +去用户页面 +登录 \ No newline at end of file