| | |
| | | package com.whyc.service; |
| | | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.OperationLogConditionDTO; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.OperationLogMapper; |
| | | import com.whyc.pojo.OperationLog; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class OperationLogService { |
| | |
| | | * @param userName |
| | | * @param terminalIp 通过request.getRemoteAddr()获取 |
| | | */ |
| | | public void record(String content,String userName,String terminalIp){ |
| | | OperationLog operationLog = new OperationLog(content, terminalIp, userName); |
| | | public void record(String type,String content,String param,String userName,String terminalIp){ |
| | | OperationLog operationLog = new OperationLog(type,content,param,terminalIp, userName); |
| | | mapper.insert(operationLog); |
| | | } |
| | | |
| | | public Response<PageInfo<OperationLog>> getPage(int pageNum, int pageSize, OperationLogConditionDTO logConditionDTO) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<OperationLog> operationLogList = mapper.getAllByCondition(logConditionDTO); |
| | | PageInfo<OperationLog> operationLogPageInfo = new PageInfo<>(operationLogList); |
| | | return new Response<PageInfo<OperationLog>>().set(1,operationLogPageInfo); |
| | | } |
| | | } |