You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
2.0 KiB

2 years ago
package UnitTest.ImportExcel;
import com.jfinal.kit.PropKit;
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
import com.jfinal.plugin.activerecord.CaseInsensitiveContainerFactory;
import com.jfinal.plugin.activerecord.dialect.PostgreSqlDialect;
import com.jfinal.plugin.hikaricp.HikariCpPlugin;
public class createTable {
public static void main(String[] args) throws Exception {
//告之配置文件位置
PropKit.use("application.properties");
HikariCpPlugin hp = new HikariCpPlugin(PropKit.get("jdbcUrl"), PropKit.get("user"),
PropKit.get("password").trim(), PropKit.get("driverClassName"));
hp.start();
// 配置ActiveRecord插件
ActiveRecordPlugin arp = new ActiveRecordPlugin(hp);
//配置默认小写
arp.setContainerFactory(new CaseInsensitiveContainerFactory(true));
arp.setDialect(new PostgreSqlDialect());
arp.start();
2 years ago
// //测试两个导入模板
// String workingPath = "D:\\dsWork\\QingLong\\src\\main\\java\\UnitTest\\ImportExcel\\";
// String filePath = workingPath + "测试1.xlsx";
// String tableName = "ds_gtzz_t_bmwj";//表名研发人员在界面上录入程序需要检查此表名是不是存在如果存在返回错误信息不存在则可以生成创建表的SQL语句
// ExcelUtil.dropTable(tableName);
// ExcelUtil.createTable(tableName, filePath);
// ExcelUtil.importData(tableName, filePath);
//
// filePath = workingPath + "测试2.xlsx";
// tableName = "ds_gtzz_t_zc";//表名研发人员在界面上录入程序需要检查此表名是不是存在如果存在返回错误信息不存在则可以生成创建表的SQL语句
// ExcelUtil.dropTable(tableName);
// ExcelUtil.createTable(tableName, filePath);
// ExcelUtil.importData(tableName, filePath);
//
// System.out.println("恭喜,所有操作成功完成!");
2 years ago
}
}