跳到主要内容

修改配置文件


  • 修改Nacos上 mdata-dev-fengkai-mysql.yml配置文件

注意修驱动类名 url 账号 密码

type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://192.168.1.206:1433;DatabaseName=emis_system
username: 123456
password: 123456
spring:
application:
name: mdata
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://${server.database-host}:3329/emis_springboot_monomer?characterEncoding=UTF-8&useSSL=true&serverTimezone=Asia/Shanghai
username: customer
password: customer@ewsd.cn
default:
# 使用druid数据源
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://${server.database-host}:3329/emis_springboot_monomer?characterEncoding=UTF-8&useSSL=true&serverTimezone=Asia/Shanghai
username: 123456
password: 123456
filters: stat
maxActive: 20
initialSize: 1
maxWait: 60000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: select 'x'
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
sqlserverdatasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://192.168.1.206:1433;DatabaseName=emis_system
username: sa
password: 123456
filters: stat
maxActive: 20
initialSize: 1
maxWait: 60000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: select 'x'
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
  • 注释mdata.yml中pagehelper配置
#分页
pagehelper:
#指定分页插件使用哪种方言。配置时,可以使用下面的缩写值: oracle,mysql,mariadb,sqlite,hsqldb,postgresql,db2,sqlserver,informix,h2,sqlserver2012,derby
helperDialect: mysql
#分页合理化参数,默认值为false。当该参数设置为 true 时,pageNum<=0 时会查询第一页
reasonable: true
#支持通过 Mapper 接口参数来传递分页参数
supportMethodsArguments: true
#用于从对象中根据属性名取值, 可以配置 pageNum,pageSize,count,pageSizeZero,reasonable
params: count=countSql
  • mdata.yml修改model xml指向地址
mybatis:
#mybatis指定model访问路径
type-aliases-package:
- com.misboot.mdata.model.sqlserver
- com.misboot.mdata.model.mdata
#指定mapper.xml访问路径
mapper-locations: classpath*:com/misboot/mapper/**/*.xml
configuration:
#开启驼峰
map-underscore-to-camel-case: true