File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed
src/main/java/com/springboot/demo/sys/controller Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ * .js linguist-language =java
2
+ * .css linguist-language =java
3
+ * .html linguist-language =java
Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ springboot + shiro + mybatis-plus 集成项目, 使用 mybatis-plus 生成 ent
11
11
## 源码
12
12
见本项目
13
13
14
+ ## 项目启动
15
+ 1 . 导入 sql , 修改数据库配置
16
+ 2 . [ Redis Windows版本] ( https://github.com/MicrosoftArchive/redis/releases ) 下载 。直接下载zip版本解压到任意目录即可。
17
+ 下载后,使用cmd命令切换到Redis根目录,然后运行` redis-server.exe redis.windows.conf ` 启动即可。
14
18
15
19
## 收获
16
20
Please feel free to contact us with any questions you may have.
Original file line number Diff line number Diff line change
1
+ package com .springboot .demo .sys .controller ;
2
+
3
+ import com .springboot .demo .common .domain .ResponseBo ;
4
+ import com .springboot .demo .sys .entity .UserOnline ;
5
+ import com .springboot .demo .sys .service .SessionService ;
6
+ import org .springframework .beans .factory .annotation .Autowired ;
7
+ import org .springframework .stereotype .Controller ;
8
+ import org .springframework .web .bind .annotation .RequestMapping ;
9
+ import org .springframework .web .bind .annotation .ResponseBody ;
10
+
11
+ import java .util .List ;
12
+
13
+ @ Controller
14
+ @ RequestMapping ("/online" )
15
+ public class SessionController {
16
+ @ Autowired
17
+ SessionService sessionService ;
18
+
19
+ @ RequestMapping ("index" )
20
+ public String online () {
21
+ return "online" ;
22
+ }
23
+
24
+ @ ResponseBody
25
+ @ RequestMapping ("list" )
26
+ public List <UserOnline > list () {
27
+ return sessionService .list ();
28
+ }
29
+
30
+ @ ResponseBody
31
+ @ RequestMapping ("forceLogout" )
32
+ public ResponseBo forceLogout (String id ) {
33
+ try {
34
+ sessionService .forceLogout (id );
35
+ return ResponseBo .ok ();
36
+ } catch (Exception e ) {
37
+ e .printStackTrace ();
38
+ return ResponseBo .error ("踢出用户失败" );
39
+ }
40
+ }
41
+ }
You can’t perform that action at this time.
0 commit comments