mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 01:28:24 +08:00
add banner print
This commit is contained in:
parent
42f3ecc016
commit
4a016cc893
@ -31,6 +31,11 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
*/
|
*/
|
||||||
public class FlexGlobalConfig {
|
public class FlexGlobalConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动是否打印 banner 和 版本好
|
||||||
|
*/
|
||||||
|
private boolean printBanner = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 默认使用 Mysql 数据库类型
|
* 默认使用 Mysql 数据库类型
|
||||||
*/
|
*/
|
||||||
@ -66,6 +71,13 @@ public class FlexGlobalConfig {
|
|||||||
private Object normalValueOfLogicDelete = FlexConsts.LOGIC_DELETE_NORMAL;
|
private Object normalValueOfLogicDelete = FlexConsts.LOGIC_DELETE_NORMAL;
|
||||||
private Object deletedValueOfLogicDelete = FlexConsts.LOGIC_DELETE_DELETED;
|
private Object deletedValueOfLogicDelete = FlexConsts.LOGIC_DELETE_DELETED;
|
||||||
|
|
||||||
|
public boolean isPrintBanner() {
|
||||||
|
return printBanner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrintBanner(boolean printBanner) {
|
||||||
|
this.printBanner = printBanner;
|
||||||
|
}
|
||||||
|
|
||||||
public DbType getDbType() {
|
public DbType getDbType() {
|
||||||
return dbType;
|
return dbType;
|
||||||
|
|||||||
@ -62,6 +62,7 @@ public class FlexConfiguration extends Configuration {
|
|||||||
initDefaultMappers();
|
initDefaultMappers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置 mybatis-flex 默认的 Mapper
|
* 设置 mybatis-flex 默认的 Mapper
|
||||||
* 当前只有 RowMapper {@link RowMapper}
|
* 当前只有 RowMapper {@link RowMapper}
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.mybatisflex.core.mybatis;
|
package com.mybatisflex.core.mybatis;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.FlexConsts;
|
||||||
import com.mybatisflex.core.FlexGlobalConfig;
|
import com.mybatisflex.core.FlexGlobalConfig;
|
||||||
import com.mybatisflex.core.dialect.DbType;
|
import com.mybatisflex.core.dialect.DbType;
|
||||||
import com.mybatisflex.core.dialect.DbTypeUtil;
|
import com.mybatisflex.core.dialect.DbTypeUtil;
|
||||||
@ -63,10 +64,25 @@ public class FlexSqlSessionFactoryBuilder extends SqlSessionFactoryBuilder {
|
|||||||
//设置全局配置的 sessionFactory 和 dbType
|
//设置全局配置的 sessionFactory 和 dbType
|
||||||
initGlobalConfig(configuration, sessionFactory, dbType);
|
initGlobalConfig(configuration, sessionFactory, dbType);
|
||||||
|
|
||||||
|
printBanner();
|
||||||
|
|
||||||
return sessionFactory;
|
return sessionFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void printBanner() {
|
||||||
|
if (!FlexGlobalConfig.getDefaultConfig().isPrintBanner()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String banner = " __ __ _ _ _ _____ _ \n" +
|
||||||
|
" | \\/ |_ _| |__ __ _| |_(_)___ | ___| | _____ __\n" +
|
||||||
|
" | |\\/| | | | | '_ \\ / _` | __| / __| | |_ | |/ _ \\ \\/ /\n" +
|
||||||
|
" | | | | |_| | |_) | (_| | |_| \\__ \\ | _| | | __/> < \n" +
|
||||||
|
" |_| |_|\\__, |_.__/ \\__,_|\\__|_|___/ |_| |_|\\___/_/\\_\\\n" +
|
||||||
|
" |___/ v" + FlexConsts.VERSION + " https://mybatis-flex.com";
|
||||||
|
System.out.println(banner);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置全局配置
|
* 设置全局配置
|
||||||
*
|
*
|
||||||
@ -84,5 +100,4 @@ public class FlexSqlSessionFactoryBuilder extends SqlSessionFactoryBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user