| | |
| | | package com.hxzk.controller; |
| | | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.hxzk.pojo.TbLoginLog; |
| | | import com.hxzk.pojo.TbPerson; |
| | | import com.hxzk.pojo.TbSystemOperationLog; |
| | | import com.hxzk.service.SystemLogService; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | public class SystemLogController { |
| | | @Autowired |
| | | SystemLogService systemLogService; |
| | | public static SystemLogService staticSystemLogService; |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | | staticSystemLogService = this.systemLogService; |
| | | } |
| | | @GetMapping("findSystemLog") |
| | | public result<List<TbSystemOperationLog>> findSystemLog(Integer page, Integer limit){ |
| | | PageInfo<TbSystemOperationLog> cz= systemLogService.findAll(page, limit); |
| | | return resultutil.returnSuccess(cz.getTotal(), cz.getList()); |
| | | } |
| | | |
| | | @GetMapping("findSystemLogSearch") |
| | | result<List<TbSystemOperationLog>> findSystemLogSearch(Integer page, Integer limit, TbSystemOperationLog systemOperationLog){ |
| | | PageInfo<TbSystemOperationLog> cz= systemLogService.findSystemLogSearch(page, limit,systemOperationLog); |
| | | return resultutil.returnSuccess(cz.getTotal(), cz.getList()); |
| | | } |
| | | public String gettime(){ |
| | | Date now = new Date(); |
| | | // 创建日期格式化对象,设置格式为 "yyyy-MM-dd HH:mm" |
| | |
| | | String formattedDate = sdf.format(now); |
| | | return formattedDate; |
| | | } |
| | | |
| | | public static void InsertSystemLog(String name,String time,String content,String type,String ip){ |
| | | TbSystemOperationLog systemOperationLog = new TbSystemOperationLog(); |
| | | systemOperationLog.setTime(time); |
| | | systemOperationLog.setName(name); |
| | | systemOperationLog.setContent(content); |
| | | systemOperationLog.setType(type); |
| | | systemOperationLog.setIp(ip); |
| | | staticSystemLogService.insertSystem(systemOperationLog); |
| | | } |
| | | } |