package com.foreverwin.minth.generator;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import com.foreverwin.minth.generator.converts.OracleTypeConvert;

/**
 * @author Ervin Chen
 * @date 2019/12/30 13:49
 */
public class GeneratorApplication {
    public static void main(String[] args) {
        generateCode();
    }

    public static void generateCode(){
        MpGenerator.MpGeneratorBuilder mpGeneratorBuilder = MpGenerator.builder();
        DataSourceConfig dataSourceConfig = new DataSourceConfig();
        dataSourceConfig.setDbType( DbType.ORACLE );

        /*dataSourceConfig.setDriverName( "com.sap.db.jdbc.Driver" );
        dataSourceConfig.setUrl( "jdbc:sap:10.18.8.21:30122" );
        dataSourceConfig.setUsername( "wip" );
        dataSourceConfig.setPassword( "Minth@2020" );
        dataSourceConfig.setDbQuery( new HanaQuery() );
        dataSourceConfig.setTypeConvert( new HanaTypeConvert() );*/
        dataSourceConfig.setDriverName( "oracle.jdbc.OracleDriver" );
        dataSourceConfig.setUrl( "jdbc:oracle:thin:@113.98.201.217:1521:ORD" );
        dataSourceConfig.setUsername( "WIP" );
        dataSourceConfig.setPassword( "wip" );
        dataSourceConfig.setTypeConvert( new OracleTypeConvert() );
        MpGenerator mpGenerator = mpGeneratorBuilder.dataSourceConfig(dataSourceConfig)
                .tablePrefix( "APS_", "DS_", "Z_" )
                .packageName( "com.foreverwin.mesnac.dispatch" )
                .tables("Z_SFC_DISPATCH_EMPLOYEE")
                .author("Leon.L")
                .uiAppId("com.foreverwin.me")
                .uiPackage("com.foreverwin.me.production")
                .build();
        mpGenerator.execute();
    }
}