package com.jcdm.web.controller.monitor; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.jcdm.common.annotation.Log; import com.jcdm.common.core.controller.BaseController; import com.jcdm.common.core.domain.AjaxResult; import com.jcdm.common.core.page.TableDataInfo; import com.jcdm.common.enums.BusinessType; import com.jcdm.common.utils.poi.ExcelUtil; import com.jcdm.framework.web.service.SysPasswordService; import com.jcdm.system.domain.SysLogininfor; import com.jcdm.system.service.ISysLogininforService; /** * 系统访问记录 * * @author jc */ @RestController @RequestMapping("/monitor/logininfor") public class SysLogininforController extends BaseController { @Autowired private ISysLogininforService logininforService; @Autowired private SysPasswordService passwordService; @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')") @GetMapping("/list") public TableDataInfo list(SysLogininfor logininfor) { startPage(); List list = logininforService.selectLogininforList(logininfor); return getDataTable(list); } @Log(title = "登录日志", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") @PostMapping("/export") public void export(HttpServletResponse response, SysLogininfor logininfor) { List list = logininforService.selectLogininforList(logininfor); ExcelUtil util = new ExcelUtil(SysLogininfor.class); util.exportExcel(response, list, "登录日志"); } @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") @Log(title = "登录日志", businessType = BusinessType.DELETE) @DeleteMapping("/{infoIds}") public AjaxResult remove(@PathVariable Long[] infoIds) { return toAjax(logininforService.deleteLogininforByIds(infoIds)); } @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") @Log(title = "登录日志", businessType = BusinessType.CLEAN) @DeleteMapping("/clean") public AjaxResult clean() { logininforService.cleanLogininfor(); return success(); } @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')") @Log(title = "账户解锁", businessType = BusinessType.OTHER) @GetMapping("/unlock/{userName}") public AjaxResult unlock(@PathVariable("userName") String userName) { passwordService.clearLoginRecordCache(userName); return success(); } }