|  |  |  | 
|---|
|  |  |  | package com.ruoyi.system.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.ruoyi.common.core.domain.R; | 
|---|
|  |  |  | import com.ruoyi.common.core.web.domain.AjaxResult; | 
|---|
|  |  |  | import com.ruoyi.common.core.web.page.BasePage; | 
|---|
|  |  |  | import com.ruoyi.common.core.web.page.PageInfo; | 
|---|
|  |  |  | import com.ruoyi.system.api.domain.SysLoginLog; | 
|---|
|  |  |  | import com.ruoyi.system.service.ISysLoginLogService; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  | import java.time.LocalDateTime; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * <p> | 
|---|
|  |  |  | *  前端控制器 | 
|---|
|  |  |  | * </p> | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @author luodangjia | 
|---|
|  |  |  | * @since 2024-11-21 | 
|---|
|  |  |  | * @author zhibing.pu | 
|---|
|  |  |  | * @Date 2024/8/12 15:48 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @RequestMapping("/sys-login-log") | 
|---|
|  |  |  | @RequestMapping("/sysLoginLog") | 
|---|
|  |  |  | public class SysLoginLogController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private ISysLoginLogService sysLoginLogService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @GetMapping("/pageList") | 
|---|
|  |  |  | @ApiOperation(value = "获取登录日志列表", tags = {"管理后台-登录日志"}) | 
|---|
|  |  |  | public AjaxResult<PageInfo<SysLoginLog>> pageList(String name, BasePage basePage){ | 
|---|
|  |  |  | PageInfo<SysLoginLog> pageInfo = sysLoginLogService.pageList(name, basePage); | 
|---|
|  |  |  | return AjaxResult.success(pageInfo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping("/addLoginLog") | 
|---|
|  |  |  | @ApiOperation(value = "添加登录日志", tags = {"管理后台-登录日志"}) | 
|---|
|  |  |  | public AjaxResult addLoginLog(@RequestBody SysLoginLog loginLog){ | 
|---|
|  |  |  | return sysLoginLogService.addLoginLog(loginLog); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 添加登陆日志 | 
|---|
|  |  |  | * @param loginLog | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PostMapping("/saveLoginLog") | 
|---|
|  |  |  | public R saveLoginLog(@RequestBody SysLoginLog loginLog){ | 
|---|
|  |  |  | loginLog.setCreateTime(LocalDateTime.now()); | 
|---|
|  |  |  | loginLog.setDelFlag(0); | 
|---|
|  |  |  | sysLoginLogService.save(loginLog); | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|