doc/_content/introduction/config.md | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/genersoft/iot/vmp/conf/MybatisConfig.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/all-application.yml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
doc/_content/introduction/config.md
@@ -58,9 +58,7 @@ 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 password: 12345678 mybatis: configuration: map-underscore-to-camel-case: true pagehelper: helper-dialect: postgresql ``` @@ -74,9 +72,7 @@ url: jdbc:kingbase8://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=utf8 username: root password: 12345678 mybatis: configuration: map-underscore-to-camel-case: true pagehelper: helper-dialect: postgresql ``` src/main/java/com/genersoft/iot/vmp/conf/MybatisConfig.java
New 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(); } } src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java
@@ -48,6 +48,7 @@ private Boolean syncChannelOnDeviceOnline = Boolean.FALSE; private Boolean sipLog = Boolean.FALSE; private Boolean sqlLog = Boolean.FALSE; private Boolean sendToPlatformsWhenIdLost = Boolean.FALSE; private Boolean refuseChannelStatusChannelFormNotify = Boolean.FALSE; @@ -286,4 +287,12 @@ public void setUseCustomSsrcForParentInvite(Boolean useCustomSsrcForParentInvite) { this.useCustomSsrcForParentInvite = useCustomSsrcForParentInvite; } public Boolean getSqlLog() { return sqlLog; } public void setSqlLog(Boolean sqlLog) { this.sqlLog = sqlLog; } } src/main/resources/all-application.yml
@@ -194,6 +194,8 @@ sip-use-source-ip-as-remote-address: false # 是否开启sip日志 sip-log: true # 是否开启sql日志 sql-log: true # 消息通道功能-缺少国标ID是否给所有上级发送消息 send-to-platforms-when-id-lost: true # 保持通道状态,不接受notify通道状态变化, 兼容海康平台发送错误消息