移除手动配置mybatis下划线转驼峰
This commit is contained in:
parent
db51c6ae88
commit
7e818d0c07
@ -58,9 +58,7 @@ spring:
|
|||||||
url: jdbc:postgresql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true&allowPublicKeyRetrieval=true
|
url: jdbc:postgresql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true&allowPublicKeyRetrieval=true
|
||||||
username: root
|
username: root
|
||||||
password: 12345678
|
password: 12345678
|
||||||
mybatis:
|
|
||||||
configuration:
|
|
||||||
map-underscore-to-camel-case: true
|
|
||||||
pagehelper:
|
pagehelper:
|
||||||
helper-dialect: postgresql
|
helper-dialect: postgresql
|
||||||
```
|
```
|
||||||
@ -74,9 +72,7 @@ spring:
|
|||||||
url: jdbc:kingbase8://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=utf8
|
url: jdbc:kingbase8://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=utf8
|
||||||
username: root
|
username: root
|
||||||
password: 12345678
|
password: 12345678
|
||||||
mybatis:
|
|
||||||
configuration:
|
|
||||||
map-underscore-to-camel-case: true
|
|
||||||
pagehelper:
|
pagehelper:
|
||||||
helper-dialect: postgresql
|
helper-dialect: postgresql
|
||||||
```
|
```
|
||||||
|
36
src/main/java/com/genersoft/iot/vmp/conf/MybatisConfig.java
Normal file
36
src/main/java/com/genersoft/iot/vmp/conf/MybatisConfig.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package com.genersoft.iot.vmp.conf;
|
||||||
|
|
||||||
|
import org.apache.ibatis.logging.stdout.StdOutImpl;
|
||||||
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
|
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.annotation.Order;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置mybatis
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@Order(value=1)
|
||||||
|
public class MybatisConfig {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserSetting userSetting;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception {
|
||||||
|
final SqlSessionFactoryBean sqlSessionFactory = new SqlSessionFactoryBean();
|
||||||
|
sqlSessionFactory.setDataSource(dataSource);
|
||||||
|
org.apache.ibatis.session.Configuration config = new org.apache.ibatis.session.Configuration();
|
||||||
|
if (userSetting.getSqlLog()){
|
||||||
|
config.setLogImpl(StdOutImpl.class);
|
||||||
|
}
|
||||||
|
config.setMapUnderscoreToCamelCase(true);
|
||||||
|
sqlSessionFactory.setConfiguration(config);
|
||||||
|
return sqlSessionFactory.getObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -48,6 +48,7 @@ public class UserSetting {
|
|||||||
private Boolean syncChannelOnDeviceOnline = Boolean.FALSE;
|
private Boolean syncChannelOnDeviceOnline = Boolean.FALSE;
|
||||||
|
|
||||||
private Boolean sipLog = Boolean.FALSE;
|
private Boolean sipLog = Boolean.FALSE;
|
||||||
|
private Boolean sqlLog = Boolean.FALSE;
|
||||||
private Boolean sendToPlatformsWhenIdLost = Boolean.FALSE;
|
private Boolean sendToPlatformsWhenIdLost = Boolean.FALSE;
|
||||||
|
|
||||||
private Boolean refuseChannelStatusChannelFormNotify = Boolean.FALSE;
|
private Boolean refuseChannelStatusChannelFormNotify = Boolean.FALSE;
|
||||||
@ -286,4 +287,12 @@ public class UserSetting {
|
|||||||
public void setUseCustomSsrcForParentInvite(Boolean useCustomSsrcForParentInvite) {
|
public void setUseCustomSsrcForParentInvite(Boolean useCustomSsrcForParentInvite) {
|
||||||
this.useCustomSsrcForParentInvite = useCustomSsrcForParentInvite;
|
this.useCustomSsrcForParentInvite = useCustomSsrcForParentInvite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getSqlLog() {
|
||||||
|
return sqlLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSqlLog(Boolean sqlLog) {
|
||||||
|
this.sqlLog = sqlLog;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,6 +194,8 @@ user-settings:
|
|||||||
sip-use-source-ip-as-remote-address: false
|
sip-use-source-ip-as-remote-address: false
|
||||||
# 是否开启sip日志
|
# 是否开启sip日志
|
||||||
sip-log: true
|
sip-log: true
|
||||||
|
# 是否开启sql日志
|
||||||
|
sql-log: true
|
||||||
# 消息通道功能-缺少国标ID是否给所有上级发送消息
|
# 消息通道功能-缺少国标ID是否给所有上级发送消息
|
||||||
send-to-platforms-when-id-lost: true
|
send-to-platforms-when-id-lost: true
|
||||||
# 保持通道状态,不接受notify通道状态变化, 兼容海康平台发送错误消息
|
# 保持通道状态,不接受notify通道状态变化, 兼容海康平台发送错误消息
|
||||||
|
Loading…
Reference in New Issue
Block a user