需求:有一个数据字典全量汇总表,其中第一个sheet为目录,包括编号和表名,第二个以后为表的明细。其中sheet名就是表名但无序,sheet内字段序号无序有空行
现在要求将其中101,104,107,111表中的格式列和字段名称以及表名取出,生成批量语句,要求按给的编号有序输出,字段出要有序并排除窄。
输出结果如下:
insert into t_export(export_id,owner,table_name,col_name,format) values(101,'T_A','scott','id','20180308001');
insert into t_export(export_id,owner,table_name,col_name,format) values(101,'T_A','scott','sal','2000');
insert into t_export(export_id,owner,table_name,col_name,format) values(101,'T_A','scott','20','张三');
insert into t_export(export_id,owner,table_name,col_name,format) values(101,'T_A','scott','remark','hello');
insert into t_export(export_id,owner,table_name,col_name,format) values(101,'T_A','scott','birthday','40479');
insert into t_export(export_id,owner,table_name,col_name,format) values(101,'T_A','scott','age','20');
.
.
.
至111
excel如下:
下载poi包poi-3.17.jar并引入eclipse的java工程,仅需要RowInfo.java,ShowExcel.java
RowInfo.java:
package pu;
public class RowInfo implements Comparable{//实现字段排序
private int rownumb;
private int expId;
private String tableName;
private String columnName;
private String formatInfo;
public RowInfo(int rownumb,int expId, String tableName, String columnName,String formatInfo) {
super();
this.rownumb=rownumb;
this.expId = expId;
this