package com.mortals.xhx.base.framework.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * 读取代码生成相关配置
 *
 * @author: zxfei
 * @date: 2021/9/28 15:45
 */
@Component
@ConfigurationProperties(prefix = "gen")
@PropertySource(value = {"classpath:generator.yml"})
public class GenConfig {
    /**
     * 作者
     */
    public static String author;

    /**
     * 生成包路径
     */
    public static String packageName;

    /**
     * 系统包路径
     */
    public static String systemPackageName="com.mortals.xhx.base";

    /**
     * 生成moduleName
     */
    public static String moduleName;

    /**
     * 系统module名称
     */
    public static String systemModuleName="system";

    /**
     * 自动去除表前缀，默认是false
     */
    public static boolean autoRemovePre;

    /**
     * 表前缀(类名不会包含表前缀)
     */
    public static String tablePrefix;

    public static String systemTable="mortals_xhx_user,mortals_xhx_valid_code,mortals_xhx_uploadfile,mortals_xhx_task," +
            "mortals_xhx_table_index,mortals_xhx_role,mortals_xhx_role_auth,mortals_xhx_role_user,mortals_xhx_menu," +
            "mortals_xhx_oper_log,mortals_xhx_param,mortals_xhx_idgenerator,mortals_xhx_area,mortals_xhx_resource";

    public static String getAuthor() {
        return author;
    }

    @Value("${author}")
    public void setAuthor(String author) {
        GenConfig.author = author;
    }

    public static String getPackageName() {
        return packageName;
    }

    @Value("${packageName}")
    public void setPackageName(String packageName) {
        GenConfig.packageName = packageName;
    }


    public static String getModuleName() {
        return moduleName;
    }

    @Value("${moduleName}")
    public void setModuleName(String moduleName) {
        GenConfig.moduleName = moduleName;
    }

    public static boolean getAutoRemovePre() {
        return autoRemovePre;
    }

    @Value("${autoRemovePre}")
    public void setAutoRemovePre(boolean autoRemovePre) {
        GenConfig.autoRemovePre = autoRemovePre;
    }

    public static String getTablePrefix() {
        return tablePrefix;
    }

    @Value("${tablePrefix}")
    public void setTablePrefix(String tablePrefix) {
        GenConfig.tablePrefix = tablePrefix;
    }


    public static String getSystemTable() {
        return systemTable;
    }

    @Value("${systemTable}")
    public static void setSystemTable(String systemTable) {
        GenConfig.systemTable = systemTable;
    }

    public static String getSystemPackageName() {
        return systemPackageName;
    }

    @Value("${systemPackageName}")
    public static void setSystemPackageName(String systemPackageName) {
        GenConfig.systemPackageName = systemPackageName;
    }

    public static String getSystemModuleName() {
        return systemModuleName;
    }

    @Value("${systemModuleName}")
    public static void setSystemModuleName(String systemModuleName) {
        GenConfig.systemModuleName = systemModuleName;
    }
}
