miduo_server/jieling-dbgen/src/main/java/com/dbgen/LdbMain.java

40 lines
1.4 KiB
Java

package com.dbgen;
import java.io.File;
import java.util.Map;
/**
* Description:
* 数据对象配置化 自动生成工具
* 目的:逻辑组装数据库对象时繁琐过程,生产环境数据库对象漏存,数据库和逻辑分开
* mongo键值自动组装
* 添加辅助log集合类 对map set list操作监听 引用操作自动入库
* 支持类型 详见Visitor
*
* jdb.xml -> java bena -> mongo string
* activity 活动类替换
* Author: zsx
* CreateDate: 2020/4/15 17:02
*/
public class LdbMain {
public static File inputPath = new File("./jieling-dbgen");
public static File outputPath = new File("./serverlogic/src/main/java/com/ljsd/jieling/jbean");
public static void main(String args[]) throws Exception {
System.setProperty("star", "\n");
String xmlfile = "gameldb.xml";
File file = new File(inputPath, xmlfile);
System.out.println("db文件位置 --> " + file.getCanonicalPath());
Project currentProject = new Project(new Naming.Root(), XMLUtils.getRootElement(file));
for (Map.Entry<Naming,String> entry : Naming.child2Parent.entrySet()) {
for (Naming child : entry.getKey().getParent().getChildren()) {
if (child.getName().equals(entry.getValue())) {
entry.getKey().getChildren().addAll(child.getChildren());
break;
}
}
}
currentProject.make();
}
}