|
@@ -1,11 +1,15 @@
|
|
package com.project.zcustom.controller.system;
|
|
package com.project.zcustom.controller.system;
|
|
|
|
|
|
|
|
+import cn.dev33.satoken.stp.StpUtil;
|
|
import com.project.zcustom.controller.core.AjaxResult;
|
|
import com.project.zcustom.controller.core.AjaxResult;
|
|
import com.project.zcustom.domain.system.LoginBody;
|
|
import com.project.zcustom.domain.system.LoginBody;
|
|
import com.project.zcustom.service.system.ISysUserService;
|
|
import com.project.zcustom.service.system.ISysUserService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description
|
|
* @Description
|
|
@@ -14,7 +18,7 @@ import org.springframework.web.bind.annotation.*;
|
|
* @Version 1.0
|
|
* @Version 1.0
|
|
*/
|
|
*/
|
|
@RestController
|
|
@RestController
|
|
-@RequestMapping("/user")
|
|
|
|
|
|
+@RequestMapping
|
|
public class LoginController {
|
|
public class LoginController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -25,4 +29,10 @@ public class LoginController {
|
|
String token = sysUserService.login(loginBody.getUsername(), loginBody.getPassword());
|
|
String token = sysUserService.login(loginBody.getUsername(), loginBody.getPassword());
|
|
return AjaxResult.success("操作成功",token);
|
|
return AjaxResult.success("操作成功",token);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @PostMapping("/logout")
|
|
|
|
+ public AjaxResult logout(){
|
|
|
|
+ StpUtil.logout();
|
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
|
+ }
|
|
}
|
|
}
|