|
|
@ -59,33 +59,38 @@ public class Main {
|
|
|
|
private static String dbType = "postgresql";
|
|
|
|
private static String dbType = "postgresql";
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
|
|
|
|
//1.数据库配置
|
|
|
|
String driver = "org.postgresql.Driver";
|
|
|
|
String driver = "org.postgresql.Driver";
|
|
|
|
String url = "jdbc:postgresql://10.201.145.19:35432/enjoy-oqc?stringtype=unspecified&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false";
|
|
|
|
String url = "jdbc:postgresql://10.201.145.19:35432/enjoy-oqc?stringtype=unspecified&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false";
|
|
|
|
String user = "enjoy";
|
|
|
|
String user = "enjoy";
|
|
|
|
String password = "Nomi1234";
|
|
|
|
String password = "Nomi1234";
|
|
|
|
List<TableEntityVo> tableEntityVoList = printTableStructure(driver, url, user, password, "oqc_project");
|
|
|
|
//2.选择表配置
|
|
|
|
|
|
|
|
String table= "oqc_spot_check_record";
|
|
|
|
generate(bussi_package, "oqc_spot_check_record", "OqcSpotCheckRecord","抽检记录表", tableEntityVoList);
|
|
|
|
String entityName="OqcSpotCheckRecord";//实体类
|
|
|
|
|
|
|
|
String description = "抽检记录表";//备注
|
|
|
|
|
|
|
|
String primaryKeyField = "id";//主键
|
|
|
|
|
|
|
|
List<TableEntityVo> tableEntityVoList = printTableStructure(driver, url, user, password, table);
|
|
|
|
|
|
|
|
//3.生成
|
|
|
|
|
|
|
|
generate(bussi_package, table,primaryKeyField,entityName,description, tableEntityVoList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param bussiPackage
|
|
|
|
* @param bussiPackage
|
|
|
|
* @param tableName
|
|
|
|
* @param tableName
|
|
|
|
* @param entityName
|
|
|
|
* @param entityName
|
|
|
|
* @param originalColumns
|
|
|
|
* @param originalColumns
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private static void generate(String bussiPackage, String tableName, String entityName,String description, List<TableEntityVo> originalColumns) {
|
|
|
|
private static void generate(String bussiPackage,String tableName,String primaryKeyField,String entityName,String description, List<TableEntityVo> originalColumns) {
|
|
|
|
TableVo tableVo = new TableVo();
|
|
|
|
TableVo tableVo = new TableVo();
|
|
|
|
tableVo.setFtlDescription(description);
|
|
|
|
tableVo.setFtlDescription(description);
|
|
|
|
//包名
|
|
|
|
//包名
|
|
|
|
Map<String, Object> dataMap = new HashMap<>();
|
|
|
|
Map<String, Object> dataMap = new HashMap<>();
|
|
|
|
dataMap.put("bussiPackage", bussiPackage);//包
|
|
|
|
dataMap.put("bussiPackage", bussiPackage);//包
|
|
|
|
dataMap.put("entityPackage", "domain");
|
|
|
|
dataMap.put("entityPackage", "domain");//实体类包名 domain/entity
|
|
|
|
dataMap.put("tableName", tableName);//表名称
|
|
|
|
dataMap.put("tableName", tableName);//表名称
|
|
|
|
dataMap.put("tableVo", tableVo);//表属性
|
|
|
|
dataMap.put("tableVo", tableVo);//表属性
|
|
|
|
//主键
|
|
|
|
//主键
|
|
|
|
dataMap.put("primaryKeyField", "id");
|
|
|
|
dataMap.put("primaryKeyField",primaryKeyField);
|
|
|
|
|
|
|
|
|
|
|
|
dataMap.put("entityName", entityName);//实体类名称
|
|
|
|
dataMap.put("entityName", entityName);//实体类名称
|
|
|
|
dataMap.put("author", author);//作者
|
|
|
|
dataMap.put("author", author);//作者
|
|
|
|