| | |
| | | package com.ycl.controller.user; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ycl.annotation.LogSave; |
| | | import com.ycl.api.CommonResult; |
| | | import com.ycl.dto.log.LogQueryParams; |
| | |
| | | import com.ycl.entity.user.vo.UmsAdminLogVO; |
| | | import com.ycl.service.user.IAdminLoginLogService; |
| | | import com.ycl.service.user.UmsAdminService; |
| | | import com.ycl.utils.EasyExcelUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.SneakyThrows; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | |
| | | @SneakyThrows |
| | | @LogSave(operationType = "日志管理", contain = "导出日志") |
| | | public void export(HttpServletResponse response, LogQueryParams logQueryParams) { |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx"); |
| | | EasyExcel |
| | | .write(response.getOutputStream(), UmsAdminLogVO.class) |
| | | .sheet("数据") |
| | | .doWrite(iAdminLoginLogService.pageList(logQueryParams).getRecords()); |
| | | String sheet = "数据"; |
| | | EasyExcelUtils.export(response, sheet, UmsAdminLogVO.class, iAdminLoginLogService.pageList(logQueryParams).getRecords()); |
| | | } |
| | | } |