package com.docus.server;

import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.docus.infrastructure.generator.BaseCodeGenerator;

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

public class CodeGenerator {
    public static void main(String[] args) {
        //字段名和枚举名的映射，不区分表名
        Map<String, String> enumColumnMap = new HashMap<>();
        enumColumnMap.put("PROFILE_ITЕM", "AdminProfileItemEnum");

        enumColumnMap.put("ORGANIZATION_TYPE", "OrganizationTypeEnum ");
        enumColumnMap.put("OPERATE_STATUS", "OperateStatusEnum");
        enumColumnMap.put("STATE", "StateEnum");
        enumColumnMap.put("PRIVILEGE_LEVEL", "PrivilegeLevelEnum");
        enumColumnMap.put("FLAG", "FlagEnum");
        enumColumnMap.put("collect_type", "CollectTypeEnum");
        BaseCodeGenerator.setEnumColumnMap(enumColumnMap);
        BaseCodeGenerator.setModuleName("common-docus/docus-archivefile");//多个module，需要指定modulename
        //指定entity生成到独立module里，并生成 api interface
        BaseCodeGenerator.setClientInterfaceModuleName("docus-client-interface");
        BaseCodeGenerator.setClientInterfaceSubFolder("auth");//文件夹
        BaseCodeGenerator.setClientInterfaceBasePackage("com.docus.server");
        AutoGenerator defaultConfig = BaseCodeGenerator.getDefaultConfig();
        defaultConfig.getGlobalConfig().setSwagger2(true);
        defaultConfig.getStrategy().setEntityLombokModel(true);
        defaultConfig.getStrategy().setInclude("task_config_test");//需要生成的表，可指定多个，留空为全部生成
        BaseCodeGenerator.generate(defaultConfig);
    }
}
