feat: SaToken
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.landaiqing.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.SaTokenInfo;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.base.Preconditions;
|
||||
@@ -21,7 +22,9 @@ import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Classname StudentController
|
||||
@@ -132,7 +135,7 @@ public class StudentController {
|
||||
* @date: 2024/3/5 17:28
|
||||
*/
|
||||
@RequestMapping("login")
|
||||
public Result<Boolean> login(@RequestBody StudentDTO studentDTO) {
|
||||
public Result<SaTokenInfo> login(@RequestBody StudentDTO studentDTO) {
|
||||
try {
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("StudentController.queryStudentPermission.dto:{}", JSON.toJSONString(studentDTO));
|
||||
@@ -140,11 +143,11 @@ public class StudentController {
|
||||
Preconditions.checkArgument(!StringUtils.isBlank(studentDTO.getUsername()), "用户名不能为空!");
|
||||
Preconditions.checkArgument(!StringUtils.isBlank(studentDTO.getPassword()), "密码不能为空!");
|
||||
StudentBO studentBO = StudentInfoDtoConvert.INSTANCE.convertDtoToBO(studentDTO);
|
||||
Boolean result = studentDomainService.login(studentBO);
|
||||
return Result.ok(result);
|
||||
SaTokenInfo saTokenInfo = studentDomainService.login(studentBO);
|
||||
return Result.ok(saTokenInfo);
|
||||
} catch (Exception e) {
|
||||
log.error("StudentController.queryStudentPermission.error:{}", e.getMessage(), e);
|
||||
return Result.fail("查询失败失败!");
|
||||
log.error("StudentController.login.error:{}", e.getMessage(), e);
|
||||
return Result.fail("登录失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user