feat: SaToken

This commit is contained in:
landaiqing committed 2024-03-05 19:17:23 +08:00
1 parent 4551fe660c
commit 36f4750705
6 files changed
+41 -44

No files matched your search

@@ -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);
}
@@ -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;
}