package com.ruoyi.generator;


import com.ruoyi.generator.utils.MybatisGeneratorUtil;
import com.ruoyi.generator.utils.PropertiesFileUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * 代码生成类
 *
 * @author Cesar
 * @date 2017/1/10.
 */
public class Generator {

    /**
     * 根据命名规范，只修改此常量值即可
     */
    private static String MODULE = "ruoyi-generator";
    private static String DATABASE = "wst-be";
    private static String TABLE_PREFIX = "";
    private static String TABLE_NAME = "grid_work_report_item";
    private static String PACKAGE_NAME = "com.ruoyi.generator";
    private static String JDBC_DRIVER = PropertiesFileUtil.getInstance("generator").get("generator.jdbc.driver");
    private static String JDBC_URL = PropertiesFileUtil.getInstance("generator").get("generator.jdbc.url");
    private static String JDBC_USERNAME = PropertiesFileUtil.getInstance("generator").get("generator.jdbc.username");
    private static String JDBC_PASSWORD = PropertiesFileUtil.getInstance("generator").get("generator.jdbc.password");
    /**
     * 需要insert后返回主键的表配置，key:表名,value:主键名
     * com.eazytec.zqtong.pc.backend.frame.dao.model.ws
     * D:\develop\workspace\wanshi\xushe-grid-backend\zqtong-pc-backend-frame-dao\src\main\java\com\eazytec\zqtong\pc\backend\frame\dao\mapper\ws
     * com.eazytec.zqtong.pc.backend.frame.service.api.ws
     * com.eazytec.zqtong.pc.backend.frame.service.impl.ws
     */

    private static Map<String, String> LAST_INSERT_ID_TABLES = new HashMap<>();

    static {
    }

    /**
     * 自动代码生成
     *
     * @param args
     */
    public static void main(String[] args) throws Exception {
        MybatisGeneratorUtil.generator(JDBC_DRIVER, JDBC_URL, JDBC_USERNAME, JDBC_PASSWORD, MODULE, DATABASE,
                TABLE_PREFIX, PACKAGE_NAME, TABLE_NAME, LAST_INSERT_ID_TABLES);
    }

}
