From d155f7318c7c1f127661817585ddfb820ed19d24 Mon Sep 17 00:00:00 2001 From: zmd50 <2531977234@qq.com> Date: Tue, 16 Jun 2020 11:36:13 +0800 Subject: [PATCH] 9 --- .../java/com/book/demo/controller/BookController.java | 4 ++-- .../java/com/book/demo/controller/CartController.java | 4 ++-- .../java/com/book/demo/controller/UserController.java | 8 +++++--- src/main/java/com/book/demo/mapper/UserMapper.java | 4 ++-- src/main/resources/application.properties | 4 ++-- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/book/demo/controller/BookController.java b/src/main/java/com/book/demo/controller/BookController.java index 265b6c1..32ae777 100644 --- a/src/main/java/com/book/demo/controller/BookController.java +++ b/src/main/java/com/book/demo/controller/BookController.java @@ -72,7 +72,7 @@ public class BookController { } return res; } - +/* //添加型图书 图书表结构更改 @ResponseBody @PostMapping("/addbook") @@ -106,5 +106,5 @@ public class BookController { res.data=null; return res; } - +*/ } diff --git a/src/main/java/com/book/demo/controller/CartController.java b/src/main/java/com/book/demo/controller/CartController.java index fc2af41..680ee1e 100644 --- a/src/main/java/com/book/demo/controller/CartController.java +++ b/src/main/java/com/book/demo/controller/CartController.java @@ -15,7 +15,7 @@ public class CartController { @Autowired Result res; - +/* //添加商品进购物车 id为isbn @ResponseBody @GetMapping("/addintocart") @@ -51,5 +51,5 @@ public class CartController { res.data=null; return res; } - +*/ } diff --git a/src/main/java/com/book/demo/controller/UserController.java b/src/main/java/com/book/demo/controller/UserController.java index 2caf22d..2c87312 100644 --- a/src/main/java/com/book/demo/controller/UserController.java +++ b/src/main/java/com/book/demo/controller/UserController.java @@ -46,13 +46,15 @@ public class UserController { res.setCode(-2); res.setMsg("密码错误"); res.data = null; - } else if (user.getUserstatus() == 0) { + } else if (user1.getUserstatus() == 0) { res.setCode(0); res.setMsg("用户登录"); + res.data.clear(); res.data.add(user1); } else { res.setCode(1); res.setMsg("管理员登录"); + res.data.clear(); res.data.add(user1); } return res; @@ -82,7 +84,7 @@ public class UserController { } return res; } - +/* //用户管理>删除用户 注销账号 @ResponseBody @GetMapping("/delete") @@ -123,5 +125,5 @@ public class UserController { return res; } - +*/ } diff --git a/src/main/java/com/book/demo/mapper/UserMapper.java b/src/main/java/com/book/demo/mapper/UserMapper.java index a024e3a..b7176b5 100644 --- a/src/main/java/com/book/demo/mapper/UserMapper.java +++ b/src/main/java/com/book/demo/mapper/UserMapper.java @@ -11,9 +11,9 @@ import org.springframework.stereotype.Repository; public interface UserMapper { //通过username查询用户信息 - @Select("select * from user_list where username=#{username}") + @Select("select * from user where username=#{username}") User queryUserByusername(String username); - @Insert("insert into user_list values(#{username},#{password},#{kind})") + @Insert("insert into user values(#{username},#{password},#{kind})") int InsertUser(User user); } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 63a464c..1e773f9 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,6 +1,6 @@ -server.port=8090 +server.port=8099 -spring.datasource.url=jdbc:mysql://localhost:3306/test02?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8 +spring.datasource.url=jdbc:mysql://localhost:3306/bookstore?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8 spring.datasource.username=root spring.datasource.password=root