package com.post.excel.post;

import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.domain.excel.SysPostExcelBean;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.List;

public class PostImportTest {
    public static void main(String[] args) throws Exception {

        // 文件绝对磁盘路径（含文件名称）
        String downloadPath = "C:\\Users\\15753\\Desktop\\$临时\\惠州炼化EHR导出岗位表.xlsx";

        File file = new File(downloadPath);
        InputStream inputStream = new FileInputStream(file);


        ExcelUtil excelUtil = new ExcelUtil(SysPostExcelBean.class);
        List<SysPostExcelBean> postList = excelUtil.importExcel(inputStream);
        for (int i = 0; i < postList.size(); i++) {
            SysPostExcelBean sysPost = postList.get(i);
            System.out.println((i + 2) + "\t" + sysPost);
        }
    }
}
