public class GlobalDbConfig extends Object
Modifier and Type | Field and Description |
---|---|
protected static boolean |
caseInsensitive
是否大小写不敏感(默认大小写不敏感)
|
protected static boolean |
returnGeneratedKey
是否INSERT语句中默认返回主键(默认返回主键)
|
Constructor and Description |
---|
GlobalDbConfig() |
Modifier and Type | Method and Description |
---|---|
static Setting |
createDbSetting()
获取自定义或默认位置数据库配置
Setting |
static void |
setCaseInsensitive(boolean isCaseInsensitive)
设置全局是否在结果中忽略大小写
如果忽略,则在Entity中调用getXXX时,字段值忽略大小写,默认忽略 |
static void |
setDbSettingPath(String customDbSettingPath)
自定义数据库配置文件路径(绝对路径或相对classpath路径)
|
static void |
setReturnGeneratedKey(boolean isReturnGeneratedKey)
设置全局是否INSERT语句中默认返回主键(默认返回主键)
如果false,则在Insert操作后,返回影响行数 主要用于某些数据库不支持返回主键的情况 |
static void |
setShowSql(boolean isShowSql,
boolean isFormatSql,
boolean isShowParams,
Level level)
设置全局配置:是否通过debug日志显示SQL
|
protected static boolean caseInsensitive
protected static boolean returnGeneratedKey
public static void setCaseInsensitive(boolean isCaseInsensitive)
isCaseInsensitive
- 否在结果中忽略大小写public static void setReturnGeneratedKey(boolean isReturnGeneratedKey)
isReturnGeneratedKey
- 是否INSERT语句中默认返回主键public static void setDbSettingPath(String customDbSettingPath)
customDbSettingPath
- 自定义数据库配置文件路径(绝对路径或相对classpath路径)public static Setting createDbSetting()
Setting
public static void setShowSql(boolean isShowSql, boolean isFormatSql, boolean isShowParams, Level level)
isShowSql
- 是否显示SQLisFormatSql
- 是否格式化显示的SQLisShowParams
- 是否打印参数level
- SQL打印到的日志等级Copyright © 2024. All rights reserved.