|
|
@@ -1,5 +1,44 @@
|
|
|
-package com.bcn.login_mybatis_demo.controller;/**
|
|
|
+package com.bcn.login_mybatis_demo.controller;
|
|
|
+
|
|
|
+import com.bcn.login_mybatis_demo.pojo.User;
|
|
|
+import com.bcn.login_mybatis_demo.service.serviceImpl.UserServiceImpl;
|
|
|
+import com.bcn.login_mybatis_demo.util.Result;
|
|
|
+import com.bcn.login_mybatis_demo.util.ResultUtil;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+/**
|
|
|
* @author 大白菜
|
|
|
* @date Created in 2022/9/26 14:56
|
|
|
- */public class UserController {
|
|
|
+ */
|
|
|
+@SuppressWarnings({"all"})
|
|
|
+@RestController
|
|
|
+@RequestMapping("/user")
|
|
|
+public class UserController {
|
|
|
+ @Autowired
|
|
|
+ UserServiceImpl userServiceImpl;
|
|
|
+
|
|
|
+ @RequestMapping("/login")
|
|
|
+ public Result login(@RequestParam String uact, @RequestParam String upwd) {
|
|
|
+ String msg = userServiceImpl.loginService(uact,upwd);
|
|
|
+ if(("SUCCESS").equals(msg)){
|
|
|
+ return ResultUtil.success("登录成功");
|
|
|
+ }else{
|
|
|
+ return ResultUtil.error(msg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/register")
|
|
|
+ public Result login(@RequestBody User user) {
|
|
|
+ String msg = userServiceImpl.registerService(user);
|
|
|
+ if(("SUCCESS").equals(msg)){
|
|
|
+ return ResultUtil.success("注册成功");
|
|
|
+ }else{
|
|
|
+ return ResultUtil.error(msg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|