# postgresql-spring-boot-mybatis-plus
**Repository Path**: athe/postgresql-spring-boot-mybatis-plus
## Basic Information
- **Project Name**: postgresql-spring-boot-mybatis-plus
- **Description**: postgresql 数据库使用mybatis-plus ,使用druid 连接chi
- **Primary Language**: Java
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 1
- **Forks**: 1
- **Created**: 2018-05-17
- **Last Updated**: 2021-04-21
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# postgresql-spring-boot-mybatis-plus
#### 项目介绍
postgresql 数据库使用mybatis-plus ,使用druid 连接chi
#### 软件架构
软件架构说明
#### 使用说明
postgresql-spring-boot-mybatis-plus
postgresql 数据库使用mybatis-plus
添加依赖
com.baomidou
mybatisplus-spring-boot-starter
1.0.5
com.baomidou
mybatis-plus
2.3
org.apache.velocity
velocity
1.7
com.alibaba
druid
1.0.25
org.postgresql
postgresql
log4j log4j 1.2.17
配置文件
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource spring.datasource.url=jdbc:postgresql://ip:port/db spring.datasource.username=username spring.datasource.password=password spring.datasource.driver-class-name=org.postgresql.Driver #配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
#连接池的配置信息 spring.datasource.initialSize=5 spring.datasource.minIdle=5 spring.datasource.maxActive=20 spring.datasource.maxWait=60000 spring.datasource.timeBetweenEvictionRunsMillis=60000 spring.datasource.minEvictableIdleTimeMillis=300000 spring.datasource.validationQuery=SELECT 1 FROM DUAL spring.datasource.testWhileIdle=true spring.datasource.testOnBorrow=false spring.datasource.testOnReturn=false spring.datasource.poolPreparedStatements=true spring.datasource.maxPoolPreparedStatementPerConnectionSize=20 spring.datasource.filters=stat,wall,log4j spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
mybatis-plus.mapper-locations=classpath:/mapper/*Mapper.xml 注意model文件夹配置,错了回导致生成model出错 mybatis-plus.typeAliasesPackage=com.gitee.web.model
注意事项
设置数据源类型时修改 数据库类型 // 数据源配置 DataSourceConfig dsc = new DataSourceConfig(); dsc.setDbType(DbType.POSTGRE_SQL);
使用分叶插件时需要修改拦截的数据库类型,postgresql分页与mysql有一点差别,limit 1 offset 1 ```java /**
mybatis-plus 分页插件 */
@Bean public PaginationInterceptor paginationInterceptor() { PaginationInterceptor page = new PaginationInterceptor(); page.setDialectType("postgresql"); return page; }
#### 参与贡献
1. Fork 本项目
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 码云特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
5. 码云官方提供的使用手册 [http://git.mydoc.io/](http://git.mydoc.io/)
6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)