package com.gyee.frame.controller.file;


import com.gyee.frame.common.file.ExcelExport;
import com.gyee.frame.model.auto.Alertrule2;
import com.gyee.frame.service.Alertrule2ervice;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@RestController
@RequestMapping("/excelexport")
@Api(value = "excle数据导出功能",tags =  "excle数据导出功能")
public class ExcelExportController {

    @Resource
    private Alertrule2ervice alertrule2ervice;

    /**
     * 信息导出
     */
    @GetMapping("/excelexport")
    public void exprotExcel(HttpServletResponse response){

        //将查询到的数据导出
        List<Alertrule2> studentExportList=alertrule2ervice.getAlertruleAllList() ;
        //创建一个数组用于设置表头
        String[] arr = new String[]{"年级","学号","姓名","专业","二级学院","联系方式","性别"};
        String heardName="学生信息表";
        //调用Excel导出工具类
        ExcelExport.export(response,studentExportList,arr,heardName,6);
    }

}