
package com.jeelowcode.framework.excel;

import com.jeelowcode.framework.excel.model.ExcelTitleModel;
import com.jeelowcode.framework.excel.read.ExcelImportUtils;
import com.jeelowcode.framework.excel.write.ExcelExportUtils;
import org.apache.commons.collections4.map.LinkedMap;

import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List;
import java.util.Map;

public class JeeLowCodeExcelUtils {


    /**
     * 导出 Excel
     * @param response
     * @param sheetName
     * @param headMap
     * @param dataList
     */
    public static void exportExcel(HttpServletResponse response, String sheetName, LinkedMap<String, ExcelTitleModel> headMap, List<Map<String, Object>> dataList) {
        ExcelExportUtils.exportExcel(response,sheetName,headMap,dataList);
    }

    /**
     * 导入Excel
     * @param inputStream
     * @param headerCou 表头所在的行数
     * @return
     */
    public static List<Map<String, Object>> importExcel(InputStream inputStream, Integer headerCou, Map<String, String> fieldNameAndCodeMap){
        return ExcelImportUtils.importExcel(inputStream,headerCou,fieldNameAndCodeMap);
    }

    /**
     * 导入Excel
     * @param inputStream
     * @param headerCou 表头所在的行数
     * @return
     */
    public static List<Map<String, Object>> importExcel(InputStream inputStream, Integer headerCou,Integer sheet, Map<String, String> fieldNameAndCodeMap){
        return ExcelImportUtils.importExcel(inputStream,headerCou,fieldNameAndCodeMap,sheet);
    }
}