-
admin
2024-06-01 a846f28bef985e7671f0b469fb73541cbfb08a93
提交 | 用户 | 时间
e57a89 1 package com.jcdm.web.controller.monitor;
2
3 import java.util.List;
4 import javax.servlet.http.HttpServletResponse;
5 import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.security.access.prepost.PreAuthorize;
7 import org.springframework.web.bind.annotation.DeleteMapping;
8 import org.springframework.web.bind.annotation.GetMapping;
9 import org.springframework.web.bind.annotation.PathVariable;
10 import org.springframework.web.bind.annotation.PostMapping;
11 import org.springframework.web.bind.annotation.RequestMapping;
12 import org.springframework.web.bind.annotation.RestController;
13 import com.jcdm.common.annotation.Log;
14 import com.jcdm.common.core.controller.BaseController;
15 import com.jcdm.common.core.domain.AjaxResult;
16 import com.jcdm.common.core.page.TableDataInfo;
17 import com.jcdm.common.enums.BusinessType;
18 import com.jcdm.common.utils.poi.ExcelUtil;
19 import com.jcdm.framework.web.service.SysPasswordService;
20 import com.jcdm.system.domain.SysLogininfor;
21 import com.jcdm.system.service.ISysLogininforService;
22
23 /**
24  * 系统访问记录
25  * 
26  * @author jc
27  */
28 @RestController
29 @RequestMapping("/monitor/logininfor")
30 public class SysLogininforController extends BaseController
31 {
32     @Autowired
33     private ISysLogininforService logininforService;
34
35     @Autowired
36     private SysPasswordService passwordService;
37
38     @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
39     @GetMapping("/list")
40     public TableDataInfo list(SysLogininfor logininfor)
41     {
42         startPage();
43         List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
44         return getDataTable(list);
45     }
46
47     @Log(title = "登录日志", businessType = BusinessType.EXPORT)
48     @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
49     @PostMapping("/export")
50     public void export(HttpServletResponse response, SysLogininfor logininfor)
51     {
52         List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
53         ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
54         util.exportExcel(response, list, "登录日志");
55     }
56
57     @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
58     @Log(title = "登录日志", businessType = BusinessType.DELETE)
59     @DeleteMapping("/{infoIds}")
60     public AjaxResult remove(@PathVariable Long[] infoIds)
61     {
62         return toAjax(logininforService.deleteLogininforByIds(infoIds));
63     }
64
65     @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
66     @Log(title = "登录日志", businessType = BusinessType.CLEAN)
67     @DeleteMapping("/clean")
68     public AjaxResult clean()
69     {
70         logininforService.cleanLogininfor();
71         return success();
72     }
73
74     @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
75     @Log(title = "账户解锁", businessType = BusinessType.OTHER)
76     @GetMapping("/unlock/{userName}")
77     public AjaxResult unlock(@PathVariable("userName") String userName)
78     {
79         passwordService.clearLoginRecordCache(userName);
80         return success();
81     }
82 }