All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.develop.CodeGenerator Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.develop;

import org.zodiac.develop.support.PlatformCodeGenerator;
import org.zodiac.mybatisplus.config.MyBatisPlusGeneratorConfigInfo;

import com.baomidou.mybatisplus.annotation.DbType;

/**
 * 代码生成器。
 *
 */
public class CodeGenerator {

    /**
     * 代码生成的模块名
     */
    public static String CODE_NAME = "应用管理";
    /**
     * 代码所在服务名
     */
    public static String SERVICE_NAME = "platfrom-system";
    /**
     * 代码生成的包名
     */
    public static String PACKAGE_NAME = "org.zodiac.system";
    /**
     * 前端代码生成所属系统
     */
    public static String SYSTEM_NAME = "saber";
    /**
     * 前端代码生成地址
     */
    public static String PACKAGE_WEB_DIR = "/users/workspaces/product/saber";
    /**
     * 需要去掉的表前缀
     */
    public static String[] TABLE_PREFIX = {"t_platfrom_"};
    /**
     * 需要生成的表名(两者只能取其一)
     */
    public static String[] INCLUDE_TABLES = {"platfrom_client"};
    /**
     * 需要排除的表名(两者只能取其一)
     */
    public static String[] EXCLUDE_TABLES = {};
    /**
     * 是否包含基础业务字段
     */
    public static boolean HAS_SUPER_ENTITY = true;
    /**
     * 基础业务字段
     */
    public static String[] SUPER_ENTITY_COLUMNS =
        {"id", "create_time", "create_user", "create_dept", "update_time", "update_user", "status", "is_deleted"};

    /**
     * RUN THIS.
     */
    public static void run() {
        run(null, null);
    }

    /**
     * RUN THIS.
     * 
     * @param dbType databse type
     * @param myBatisPlusGeneratorConfigInfo MyBatis-Plus代码生成配置
     */
    public static void run(DbType dbType, MyBatisPlusGeneratorConfigInfo myBatisPlusGeneratorConfigInfo) {
        PlatformCodeGenerator generator = new PlatformCodeGenerator(dbType, myBatisPlusGeneratorConfigInfo);
        generator.setCodeName(CODE_NAME);
        generator.setServiceName(SERVICE_NAME);
        generator.setSystemName(SYSTEM_NAME);
        generator.setPackageName(PACKAGE_NAME);
        generator.setPackageWebDir(PACKAGE_WEB_DIR);
        generator.setTablePrefix(TABLE_PREFIX);
        generator.setIncludeTables(INCLUDE_TABLES);
        generator.setExcludeTables(EXCLUDE_TABLES);
        generator.setHasSuperEntity(HAS_SUPER_ENTITY);
        generator.setSuperEntityColumns(SUPER_ENTITY_COLUMNS);
        generator.run();
    }

    /**
     * RUN THIS.
     * 
     * @param serviceName system-name
     * @param systemName system name
     * @param packageName package name
     * @param packageWebDir package web dir
     * @param tablePrefix table name prefix
     */
    public static void run(String serviceName, String systemName, String packageName,
        String packageWebDir, String[] tablePrefix) {
        run(serviceName, systemName, packageName, packageWebDir, tablePrefix, null, null);
    }

    /**
     * RUN THIS.
     * 
     * @param serviceName system-name
     * @param systemName system name
     * @param packageName package name
     * @param packageWebDir package web dir
     * @param tablePrefix table name prefix
     * @param dbType databse type
     * @param myBatisPlusGeneratorConfigInfo MyBatis-Plus代码生成配置
     */
    public static void run(String serviceName, String systemName, String packageName,
        String packageWebDir, String[] tablePrefix, DbType dbType, MyBatisPlusGeneratorConfigInfo myBatisPlusGeneratorConfigInfo) {
        PlatformCodeGenerator generator = new PlatformCodeGenerator(dbType, myBatisPlusGeneratorConfigInfo);
        generator.setCodeName(CODE_NAME);
        generator.setServiceName(null != serviceName ? serviceName : SERVICE_NAME);
        generator.setSystemName(null != systemName ? systemName : SYSTEM_NAME);
        generator.setPackageName(null != packageName ? packageName : PACKAGE_NAME);
        generator.setPackageWebDir(null != packageWebDir ? packageWebDir : PACKAGE_WEB_DIR);
        generator.setTablePrefix(null != tablePrefix ? tablePrefix : TABLE_PREFIX);
        generator.setIncludeTables(INCLUDE_TABLES);
        generator.setExcludeTables(EXCLUDE_TABLES);
        generator.setHasSuperEntity(HAS_SUPER_ENTITY);
        generator.setSuperEntityColumns(SUPER_ENTITY_COLUMNS);
        generator.run();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy