提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.system.controller.admin.sms; |
H |
2 |
|
|
3 |
import com.iailab.framework.apilog.core.annotation.ApiAccessLog; |
|
4 |
import com.iailab.framework.common.pojo.CommonResult; |
|
5 |
import com.iailab.framework.common.pojo.PageParam; |
|
6 |
import com.iailab.framework.common.pojo.PageResult; |
|
7 |
import com.iailab.framework.common.util.object.BeanUtils; |
|
8 |
import com.iailab.framework.excel.core.util.ExcelUtils; |
|
9 |
import com.iailab.module.system.controller.admin.sms.vo.log.SmsLogPageReqVO; |
|
10 |
import com.iailab.module.system.controller.admin.sms.vo.log.SmsLogRespVO; |
|
11 |
import com.iailab.module.system.dal.dataobject.sms.SmsLogDO; |
|
12 |
import com.iailab.module.system.service.sms.SmsLogService; |
|
13 |
import io.swagger.v3.oas.annotations.Operation; |
|
14 |
import io.swagger.v3.oas.annotations.tags.Tag; |
|
15 |
import org.springframework.security.access.prepost.PreAuthorize; |
|
16 |
import org.springframework.validation.annotation.Validated; |
|
17 |
import org.springframework.web.bind.annotation.GetMapping; |
|
18 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
19 |
import org.springframework.web.bind.annotation.RestController; |
|
20 |
|
|
21 |
import javax.annotation.Resource; |
|
22 |
import javax.servlet.http.HttpServletResponse; |
|
23 |
import javax.validation.Valid; |
|
24 |
import java.io.IOException; |
|
25 |
import java.util.List; |
|
26 |
|
|
27 |
import static com.iailab.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
|
28 |
import static com.iailab.framework.common.pojo.CommonResult.success; |
|
29 |
|
|
30 |
@Tag(name = "管理后台 - 短信日志") |
|
31 |
@RestController |
|
32 |
@RequestMapping("/system/sms-log") |
|
33 |
@Validated |
|
34 |
public class SmsLogController { |
|
35 |
|
|
36 |
@Resource |
|
37 |
private SmsLogService smsLogService; |
|
38 |
|
|
39 |
@GetMapping("/page") |
|
40 |
@Operation(summary = "获得短信日志分页") |
|
41 |
@PreAuthorize("@ss.hasPermission('system:sms-log:query')") |
|
42 |
public CommonResult<PageResult<SmsLogRespVO>> getSmsLogPage(@Valid SmsLogPageReqVO pageReqVO) { |
|
43 |
PageResult<SmsLogDO> pageResult = smsLogService.getSmsLogPage(pageReqVO); |
|
44 |
return success(BeanUtils.toBean(pageResult, SmsLogRespVO.class)); |
|
45 |
} |
|
46 |
|
|
47 |
@GetMapping("/export-excel") |
|
48 |
@Operation(summary = "导出短信日志 Excel") |
|
49 |
@PreAuthorize("@ss.hasPermission('system:sms-log:export')") |
|
50 |
@ApiAccessLog(operateType = EXPORT) |
|
51 |
public void exportSmsLogExcel(@Valid SmsLogPageReqVO exportReqVO, |
|
52 |
HttpServletResponse response) throws IOException { |
|
53 |
exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
|
54 |
List<SmsLogDO> list = smsLogService.getSmsLogPage(exportReqVO).getList(); |
|
55 |
// 导出 Excel |
|
56 |
ExcelUtils.write(response, "短信日志.xls", "数据", SmsLogRespVO.class, |
|
57 |
BeanUtils.toBean(list, SmsLogRespVO.class)); |
|
58 |
} |
|
59 |
|
|
60 |
} |