import com.engine.salary.util.excel.ExcelParseHelper; import org.apache.commons.lang3.StringUtils; import java.io.FileInputStream; import java.io.InputStream; import java.util.List; public class ParseTaxApi { public static void main(String[] args) { readExcel("H:\\code\\salary\\resource\\sql\\ApiDes.xlsx"); } public static void readExcel(String path) { try { // 获取文件输入流 InputStream inputStream = new FileInputStream(path); List apiDesList = ExcelParseHelper.parse2Map(inputStream, ApiDes.class, 0, 1, 5, "ApiDes.xlsx"); /** * 字段名称 字段含义 字段类型 必填 说明 * qtzzlx 其他证件类型 String(64) 条件必填 见证件类型字典 * * private String qtzzlx; */ apiDesList.forEach(des -> { String type = des.getType(); if(StringUtils.isNotEmpty(type)){ if(type.startsWith("String")){ type= "String"; } } String a = "/** * " + des.getMean() +" " + "必填:" + des.getRequired() +" " + des.getDes() + " */" + " private " + type + " " + des.getName() + ";"; System.out.println(a); }); } catch (Exception e) { e.printStackTrace(); } } }