mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-09-18 17:48:03 +08:00
修复 sa-token-dao-redis-fastjson 插件 session.getModel
无法反序列化实体类的问题。
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
package com.pj.model;
|
||||
|
||||
/**
|
||||
* User 实体类
|
||||
*
|
||||
* @author kong
|
||||
* @since 2022-10-15
|
||||
*/
|
||||
public class SysUser {
|
||||
|
||||
public SysUser() {
|
||||
}
|
||||
|
||||
public SysUser(long id, String name, int age) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private long id;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 用户年龄
|
||||
*/
|
||||
private int age;
|
||||
|
||||
/**
|
||||
* @return id
|
||||
*/
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id 要设置的 id
|
||||
*/
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name 要设置的 name
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return age
|
||||
*/
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param age 要设置的 age
|
||||
*/
|
||||
public void setAge(int age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysUser [id=" + id + ", name=" + name + ", age=" + age + "]";
|
||||
}
|
||||
|
||||
}
|
@@ -1,9 +1,11 @@
|
||||
package com.pj.test;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.pj.util.AjaxJson;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.dev33.satoken.util.SaResult;
|
||||
|
||||
/**
|
||||
* 测试专用Controller
|
||||
@@ -14,17 +16,26 @@ import com.pj.util.AjaxJson;
|
||||
@RequestMapping("/test/")
|
||||
public class TestController {
|
||||
|
||||
// 测试登录 ---- http://localhost:8081/test/login
|
||||
@RequestMapping("login")
|
||||
public SaResult login(@RequestParam(defaultValue = "10001") long id) {
|
||||
StpUtil.login(id);
|
||||
return SaResult.ok("登录成功");
|
||||
}
|
||||
|
||||
|
||||
// 测试 浏览器访问: http://localhost:8081/test/test
|
||||
@RequestMapping("test")
|
||||
public AjaxJson test() {
|
||||
public SaResult test() {
|
||||
System.out.println("------------进来了");
|
||||
return AjaxJson.getSuccess();
|
||||
// 返回
|
||||
return SaResult.data("");
|
||||
}
|
||||
|
||||
// 测试 浏览器访问: http://localhost:8081/test/test2
|
||||
@RequestMapping("test2")
|
||||
public AjaxJson test2() {
|
||||
return AjaxJson.getSuccess();
|
||||
public SaResult test2() {
|
||||
return SaResult.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user