63 lines
2.7 KiB
Java
63 lines
2.7 KiB
Java
package com.cnbm.admin.controller;
|
||
|
||
import com.cnbm.admin.annotation.LogOperation;
|
||
import com.cnbm.admin.dto.SysLogOperationDTO;
|
||
import com.cnbm.admin.execl.SysLogOperationExcel;
|
||
import com.cnbm.admin.service.SysLogOperationService;
|
||
import com.cnbm.common.utils.ExcelUtils;
|
||
import com.cnbm.common.constant.Constant;
|
||
import com.cnbm.common.page.PageData;
|
||
import com.cnbm.common.utils.Result;
|
||
import io.swagger.annotations.Api;
|
||
import io.swagger.annotations.ApiImplicitParam;
|
||
import io.swagger.annotations.ApiImplicitParams;
|
||
import io.swagger.annotations.ApiOperation;
|
||
import org.springframework.beans.factory.annotation.Autowired;
|
||
import org.springframework.web.bind.annotation.GetMapping;
|
||
import org.springframework.web.bind.annotation.RequestMapping;
|
||
import org.springframework.web.bind.annotation.RequestParam;
|
||
import org.springframework.web.bind.annotation.RestController;
|
||
import springfox.documentation.annotations.ApiIgnore;
|
||
|
||
import javax.servlet.http.HttpServletResponse;
|
||
import java.util.List;
|
||
import java.util.Map;
|
||
|
||
/**
|
||
* @Author weihongyang
|
||
* @Date 2022/6/10 9:51 AM
|
||
* @Version 1.0
|
||
*/
|
||
@RestController
|
||
@RequestMapping("sys/log/operation")
|
||
@Api(tags="操作日志")
|
||
public class SysLogOperationController {
|
||
@Autowired
|
||
private SysLogOperationService sysLogOperationService;
|
||
|
||
@GetMapping("page")
|
||
@ApiOperation("分页")
|
||
@ApiImplicitParams({
|
||
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) ,
|
||
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) ,
|
||
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) ,
|
||
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class) ,
|
||
@ApiImplicitParam(name = "status", value = "状态 0:失败 1:成功", paramType = "query", dataTypeClass=String.class)
|
||
})
|
||
public Result<PageData<SysLogOperationDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
|
||
PageData<SysLogOperationDTO> page = sysLogOperationService.page(params);
|
||
|
||
return new Result<PageData<SysLogOperationDTO>>().ok(page);
|
||
}
|
||
|
||
@GetMapping("export")
|
||
@ApiOperation("导出")
|
||
@LogOperation("导出")
|
||
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
|
||
List<SysLogOperationDTO> list = sysLogOperationService.list(params);
|
||
|
||
ExcelUtils.exportExcelToTarget(response, null, list, SysLogOperationExcel.class);
|
||
}
|
||
|
||
}
|