feat: SaToken

This commit is contained in:
2024-03-05 19:17:23 +08:00
parent 4551fe660c
commit 36f4750705
6 changed files with 41 additions and 44 deletions

View File

@@ -1,5 +1,6 @@
package com.landaiqing.domain.service;
import cn.dev33.satoken.stp.SaTokenInfo;
import com.landaiqing.auth.common.entity.PageResult;
import com.landaiqing.domain.bo.StudentBO;
@@ -11,5 +12,5 @@ public interface StudentDomainService {
PageResult<StudentBO> queryAllStudentByPage(StudentBO studentBO);
Boolean login(StudentBO studentBO);
SaTokenInfo login(StudentBO studentBO);
}

View File

@@ -1,5 +1,7 @@
package com.landaiqing.domain.service.impl;
import cn.dev33.satoken.stp.SaTokenInfo;
import cn.dev33.satoken.stp.StpUtil;
import com.landaiqing.auth.common.entity.PageResult;
import com.landaiqing.auth.common.enums.IsDeletedFlagEnum;
import com.landaiqing.domain.bo.StudentBO;
@@ -58,10 +60,12 @@ public class StudentDomainServiceImpl implements StudentDomainService {
}
@Override
public Boolean login(StudentBO studentBO) {
public SaTokenInfo login(StudentBO studentBO) {
Student student = StudentBOConvert.INSTANCE.convertBOToEntity(studentBO);
Integer count= studentService.login(student);
return count>0;
Integer id= studentService.login(student);
StpUtil.login(id);
SaTokenInfo tokenInfo = StpUtil.getTokenInfo();
return tokenInfo;
}