package fileIO;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
public class IOTEST {
/**
* @Title: main
* @Description: TODO(描述这个方法的作用)
* @param: @param args
* @return: void
* @throws
*/
public static void main(String[] args) {
IOTEST io = new IOTEST();
String[] tableCol = {"VERSION", "NAME", "CATALOG1", "CATALOG2", "CATALOG3", "CATALOG4", "SORTED", "CONTENT", "IMG"};
String sql = "insert into MANUAL_SEARCH_T(ID";
int id = 1;
try {
String filePath = "";
Workbook wb = (filePath);
if (wb != null) {
Sheet sheet = (0);
int rowNum = ();
for (int index = 1; index <= rowNum; index++) {
Row row = (index);
int colNum = ();
String rowSql = sql;
String valueSql = "" + id;
for (int indexC = 0; indexC < colNum; indexC++) {
Cell cell = (indexC);
if (cell == null) {
} else {
();
rowSql = rowSql + ", " + tableCol[indexC];
String value = ();
if (indexC == 8) {
value = "0.0".equals(value) ? "0" : "1";
}
valueSql = valueSql + ", " + "'" + () + "'";
}
}
rowSql = rowSql + ") values (" + valueSql + ");";
(rowSql);
id++;
}
}
} catch (Exception e) {
();
}
}
public Workbook getExcel(String path) {
Workbook workbook = null;
File file = new File(path);
if (!()) {
("文件不存在");
} else {
// 获取文件后缀
String fileType = (("."));
try {
InputStream is = new FileInputStream(file);
// 根据后缀生成workbook实例
if (".xlsx".equals(fileType)) {
workbook = new XSSFWorkbook(is);
} else if (".xls".equals(fileType)) {
workbook = new HSSFWorkbook(is);
} else {
("格式有误");
}
} catch (Exception e) {
();
}
}
return workbook;
}
}