springboot通过mybatis-plus操作kingbase8

1:pom.xml

dependency>
            <groupId>com.kingbase8</groupId>
            <artifactId>kingbase8-8.6.0</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/libs/kingbase8-8.6.0.jar</systemPath>
        </dependency>

        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.4.1</version>
        </dependency>

 

2:application.properties

server.port=9090
server.servlet.context-path=/test

#datasource config
spring.datasource.url=jdbc:kingbase8://localhost:54321/test
spring.datasource.driver-class-name=com.kingbase8.Driver
spring.datasource.username=system
spring.datasource.password=system

#mybatis-plus config
mybatis-plus.configuration.map-underscore-to-camel-case=true
mybatis-plus.configuration.auto-mapping-behavior=full
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
mybatis-plus.mapper-locations=classpath*:mapper/**/*Mapper.xml

 

3:MybatisPlusConfig.java

@Configuration
public class MybatisPlusConfig {

    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.POSTGRE_SQL));

        return interceptor;
    }
}

 

posted @ 2022-01-19 15:00  yshy  阅读(2118)  评论(0编辑  收藏  举报