package com.ruoyi.web.controller.monitor;
|
|
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.system.service.ISysOperLogService;
|
import io.swagger.annotations.Api;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* 操作日志记录
|
*
|
* @author ruoyi
|
*/
|
@Slf4j
|
@Api(tags = "操作日志记录")
|
@RestController
|
@RequestMapping("/monitor/operlog")
|
public class SysOperlogController extends BaseController
|
{
|
@Autowired
|
private ISysOperLogService operLogService;
|
|
// @ApiOperation(value = "操作日志分页列表")
|
// @PostMapping("/list")
|
// public AjaxResult list(@RequestBody SysOperLogQuery query)
|
// {
|
// startPage(query.getPageNum(), query.getPageSize());
|
// List<SysOperLogVO> list = operLogService.selectOperLogPageList(query);
|
// operLogService.getLogDetail(list);
|
// return AjaxResult.success(getDataTable(list));
|
// }
|
|
/**
|
* 查询操作日志列表导出
|
*/
|
// @ApiOperation(value = "查询操作日志列表导出")
|
// @Log(title = "操作日志-查询操作日志列表导出", businessType = BusinessType.EXPORT)
|
// @PostMapping("/exportOperLog")
|
// public void exportOperLog(@RequestBody SysOperLogQuery query)
|
// {
|
// List<SysOperLogVO> list = operLogService.selectOperLogPageList(query);
|
// List<TOperLogExport> operLogExports = new ArrayList<>();
|
// for (SysOperLogVO sysOperLogVO : list) {
|
// TOperLogExport operLogExport = new TOperLogExport();
|
// BeanUtils.copyProperties(sysOperLogVO,operLogExport);
|
// operLogService.getLogDetail(list);
|
// operLogExports.add(operLogExport);
|
// }
|
// Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TOperLogExport.class, operLogExports);
|
// HttpServletResponse response = WebUtils.response();
|
// response.setContentType("application/vnd.ms-excel");
|
// response.setCharacterEncoding("utf-8");
|
// ServletOutputStream outputStream = null;
|
// try {
|
// String fileName = URLEncoder.encode("操作日志信息.xls", "utf-8");
|
// response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
|
// response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
// response.setHeader("Pragma", "no-cache");
|
// response.setHeader("Cache-Control", "no-cache");
|
// outputStream = response.getOutputStream();
|
// workbook.write(outputStream);
|
// } catch (IOException e) {
|
// e.printStackTrace();
|
// log.error("操作日志导出信息导出失败!");
|
// } finally {
|
// try {
|
// outputStream.close();
|
// } catch (IOException e) {
|
// e.printStackTrace();
|
// }
|
// }
|
// }
|
|
// @Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
// @PostMapping("/export")
|
// public void export(HttpServletResponse response, SysOperLog operLog)
|
// {
|
// List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
// ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
// util.exportExcel(response, list, "操作日志");
|
// }
|
|
@Log(title = "操作日志", businessType = BusinessType.DELETE)
|
@DeleteMapping("/deleteById/{operIds}")
|
public AjaxResult remove(@PathVariable String operIds)
|
{
|
String[] split = operIds.split(",");
|
List<Long> id = new ArrayList<>();
|
for (String s : split) {
|
id.add(Long.valueOf(s));
|
}
|
return AjaxResult.success(operLogService.deleteOperLogByIds(id));
|
}
|
|
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
@DeleteMapping("/clean")
|
public AjaxResult clean()
|
{
|
operLogService.cleanOperLog();
|
return success();
|
}
|
}
|