AuthController.java
1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.template.controller;
import com.template.common.utils.ResponseData;
import com.template.dto.UserDTO;
import com.template.service.UserService;
import com.template.vo.ResponseVO;
import org.springframework.beans.factory.annotation.Autowired;
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: 用户
* @author DengMin
* @date 2025/5/11 16:32
* @version 1.0
*/
@RestController
@RequestMapping("/openApi")
public class AuthController {
@Autowired
private UserService userService;
@PostMapping(value = "/login")
public ResponseVO login(@RequestBody UserDTO userDTO) {
return ResponseData.generateCreatedResponse(0, userService.login(userDTO));
}
@PostMapping(value = "/loginOut")
public ResponseVO loginOut() {
userService.loginOut();
return ResponseData.generateCreatedResponse(0);
}
}