提交 1e61c5bd 作者: guofeng

demo

上级 81af90f4
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>huazheng-project-quartz</artifactId>
<packaging>jar</packaging>
<name>huazheng-project-quartz</name>
<parent>
<groupId>com.huazheng.project</groupId>
<artifactId>huazheng-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<!-- 提交到maven仓库 -->
<distributionManagement>
<repository>
<id>maven-releases</id>
<name>maven Releases</name>
<url>http://47.103.50.109:18084/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>maven-snapshots</id>
<name>maven Snapshots</name>
<url>http://47.103.50.109:18084/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>maven-snapshots</id>
<name>maven-snapshots</name>
<url>http://47.103.50.109:18084/repository/maven-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</repository>
<repository>
<id>maven-releases</id>
<name>maven-releases</name>
<url>http://47.103.50.109:18084/repository/maven-releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId>
</dependency>
<!-- mysql驱动 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.pivotal</groupId>
<artifactId>greenplum-jdbc</artifactId>
<version>5.1.4</version>
</dependency>
<!-- 连接池 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
</dependency>
<!-- mybatis 分页插件 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
<!-- mybatis -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<!-- hutool -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
</dependency>
<!-- lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>ngdbc</groupId>
<artifactId>ngdbc</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>sqljdbc42</groupId>
<artifactId>sqljdbc42</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.74</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
<mainClass>com.huazheng.project.Application</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>huazheng-project-quartz</artifactId>
<packaging>jar</packaging>
<name>huazheng-project-quartz</name>
<parent>
<groupId>com.huazheng.project</groupId>
<artifactId>huazheng-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<!-- 提交到maven仓库 -->
<distributionManagement>
<repository>
<id>maven-releases</id>
<name>maven Releases</name>
<url>http://47.103.50.109:18084/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>maven-snapshots</id>
<name>maven Snapshots</name>
<url>http://47.103.50.109:18084/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>maven-snapshots</id>
<name>maven-snapshots</name>
<url>http://47.103.50.109:18084/repository/maven-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</repository>
<repository>
<id>maven-releases</id>
<name>maven-releases</name>
<url>http://47.103.50.109:18084/repository/maven-releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId>
</dependency>
<!-- mysql驱动 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.pivotal</groupId>
<artifactId>greenplum-jdbc</artifactId>
<version>5.1.4</version>
</dependency>
<!-- 连接池 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
</dependency>
<!-- mybatis 分页插件 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
<!-- mybatis -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<!-- hutool -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
</dependency>
<!-- lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>ngdbc</groupId>
<artifactId>ngdbc</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>sqljdbc42</groupId>
<artifactId>sqljdbc42</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.74</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
<mainClass>com.huazheng.project.Application</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
package com.huazheng.project.config;
import javax.sql.DataSource;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
@Configuration
@MapperScan(basePackages = "com.huazheng.project.greenplum.mapper", sqlSessionFactoryRef = "greenplumSqlSessionFactory")
public class GreenplumConfig {
//主数据源配置 ds2数据源
@Primary
@Bean(name = "greenplumDataSourceProperties")
@ConfigurationProperties(prefix = "spring.datasource.greenplum")
public DataSourceProperties ds2DataSourceProperties() {
return new DataSourceProperties();
}
//主数据源 ds2数据源
@Primary
@Bean(name = "greenplumDataSource")
public DataSource ds2DataSource(@Qualifier("greenplumDataSourceProperties") DataSourceProperties dataSourceProperties) {
return dataSourceProperties.initializeDataSourceBuilder().build();
}
// 主数据源 ds2数据源
@Primary
@Bean("greenplumSqlSessionFactory")
public SqlSessionFactory ds2SqlSessionFactory(@Qualifier("greenplumDataSource") DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean sqlSessionFactory = new MybatisSqlSessionFactoryBean();
sqlSessionFactory.setDataSource(dataSource);
sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/greenplum/*.xml"));
sqlSessionFactory.setPlugins(new Interceptor[] { new PaginationInterceptor(),
// new PerformanceInterceptor()
// .setFormat(true),
});
sqlSessionFactory.setGlobalConfig(new GlobalConfig().setBanner(false));
sqlSessionFactory.setConfigLocation(new ClassPathResource("mybatis/mybatis-config.xml"));
sqlSessionFactory.setTypeAliasesPackage("com.huazheng.project.greenplum.model");
return sqlSessionFactory.getObject();
}
@Primary
@Bean(name = "greenplumTransactionManager")
public DataSourceTransactionManager ds2TransactionManager(@Qualifier("greenplumDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Primary
@Bean(name = "greenplumSqlSessionTemplate")
public SqlSessionTemplate ds2SqlSessionTemplate(@Qualifier("greenplumSqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
}
package com.huazheng.project.config;
import javax.sql.DataSource;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
@Configuration
@MapperScan(basePackages = "com.huazheng.project.greenplum.mapper", sqlSessionFactoryRef = "greenplumSqlSessionFactory")
public class GreenplumConfig {
//主数据源配置 ds2数据源
@Primary
@Bean(name = "greenplumDataSourceProperties")
@ConfigurationProperties(prefix = "spring.datasource.greenplum")
public DataSourceProperties ds2DataSourceProperties() {
return new DataSourceProperties();
}
//主数据源 ds2数据源
@Primary
@Bean(name = "greenplumDataSource")
public DataSource ds2DataSource(@Qualifier("greenplumDataSourceProperties") DataSourceProperties dataSourceProperties) {
return dataSourceProperties.initializeDataSourceBuilder().build();
}
// 主数据源 ds2数据源
@Primary
@Bean("greenplumSqlSessionFactory")
public SqlSessionFactory ds2SqlSessionFactory(@Qualifier("greenplumDataSource") DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean sqlSessionFactory = new MybatisSqlSessionFactoryBean();
sqlSessionFactory.setDataSource(dataSource);
sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/greenplum/*.xml"));
sqlSessionFactory.setPlugins(new Interceptor[] { new PaginationInterceptor(),
// new PerformanceInterceptor()
// .setFormat(true),
});
sqlSessionFactory.setGlobalConfig(new GlobalConfig().setBanner(false));
sqlSessionFactory.setConfigLocation(new ClassPathResource("mybatis/mybatis-config.xml"));
sqlSessionFactory.setTypeAliasesPackage("com.huazheng.project.greenplum.model");
return sqlSessionFactory.getObject();
}
@Primary
@Bean(name = "greenplumTransactionManager")
public DataSourceTransactionManager ds2TransactionManager(@Qualifier("greenplumDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Primary
@Bean(name = "greenplumSqlSessionTemplate")
public SqlSessionTemplate ds2SqlSessionTemplate(@Qualifier("greenplumSqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
}
package com.huazheng.project.config;
import javax.sql.DataSource;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
@Configuration
@MapperScan(basePackages = "com.huazheng.project.hana.mapper", sqlSessionTemplateRef = "hanaSqlSessionTemplate")
public class HanaConfig {
//主数据源配置 ds1数据源
@Primary
@Bean(name = "hanaDataSourceProperties")
@ConfigurationProperties(prefix = "spring.datasource.hana")
public DataSourceProperties ds1DataSourceProperties() {
return new DataSourceProperties();
}
//主数据源 ds1数据源
@Primary
@Bean(name = "hanaDataSource")
public DataSource ds1DataSource(@Qualifier("hanaDataSourceProperties") DataSourceProperties dataSourceProperties) {
return dataSourceProperties.initializeDataSourceBuilder().build();
}
// 主数据源 ds1数据源
@Primary
@Bean("hanaSqlSessionFactory")
public SqlSessionFactory ds1SqlSessionFactory(@Qualifier("hanaDataSource") DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean sqlSessionFactory = new MybatisSqlSessionFactoryBean();
sqlSessionFactory.setDataSource(dataSource);
sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/hana/*.xml"));
sqlSessionFactory.setPlugins(new Interceptor[] { new PaginationInterceptor(),
// new PerformanceInterceptor()
// .setFormat(true),
});
sqlSessionFactory.setGlobalConfig(new GlobalConfig().setBanner(false));
sqlSessionFactory.setConfigLocation(new ClassPathResource("mybatis/mybatis-config.xml"));
sqlSessionFactory.setTypeAliasesPackage("com.huazheng.project.hana.model");
return sqlSessionFactory.getObject();
}
@Primary
@Bean(name = "hanaTransactionManager")
public DataSourceTransactionManager ds1TransactionManager(@Qualifier("hanaDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Primary
@Bean(name = "hanaSqlSessionTemplate")
public SqlSessionTemplate ds1SqlSessionTemplate(@Qualifier("hanaSqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
}
package com.huazheng.project.config;
import javax.sql.DataSource;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
@Configuration
@MapperScan(basePackages = "com.huazheng.project.hana.mapper", sqlSessionTemplateRef = "hanaSqlSessionTemplate")
public class HanaConfig {
//主数据源配置 ds1数据源
@Primary
@Bean(name = "hanaDataSourceProperties")
@ConfigurationProperties(prefix = "spring.datasource.hana")
public DataSourceProperties ds1DataSourceProperties() {
return new DataSourceProperties();
}
//主数据源 ds1数据源
@Primary
@Bean(name = "hanaDataSource")
public DataSource ds1DataSource(@Qualifier("hanaDataSourceProperties") DataSourceProperties dataSourceProperties) {
return dataSourceProperties.initializeDataSourceBuilder().build();
}
// 主数据源 ds1数据源
@Primary
@Bean("hanaSqlSessionFactory")
public SqlSessionFactory ds1SqlSessionFactory(@Qualifier("hanaDataSource") DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean sqlSessionFactory = new MybatisSqlSessionFactoryBean();
sqlSessionFactory.setDataSource(dataSource);
sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/hana/*.xml"));
sqlSessionFactory.setPlugins(new Interceptor[] { new PaginationInterceptor(),
// new PerformanceInterceptor()
// .setFormat(true),
});
sqlSessionFactory.setGlobalConfig(new GlobalConfig().setBanner(false));
sqlSessionFactory.setConfigLocation(new ClassPathResource("mybatis/mybatis-config.xml"));
sqlSessionFactory.setTypeAliasesPackage("com.huazheng.project.hana.model");
return sqlSessionFactory.getObject();
}
@Primary
@Bean(name = "hanaTransactionManager")
public DataSourceTransactionManager ds1TransactionManager(@Qualifier("hanaDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Primary
@Bean(name = "hanaSqlSessionTemplate")
public SqlSessionTemplate ds1SqlSessionTemplate(@Qualifier("hanaSqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
}
package com.huazheng.project.config;
import javax.sql.DataSource;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
@Configuration
@MapperScan(basePackages = "com.huazheng.project.mssql.mapper", sqlSessionFactoryRef = "mssqlSqlSessionFactory")
public class MssqlConfig {
//主数据源配置 ds2数据源
@Primary
@Bean(name = "mssqlDataSourceProperties")
@ConfigurationProperties(prefix = "spring.datasource.mssql")
public DataSourceProperties ds2DataSourceProperties() {
return new DataSourceProperties();
}
//主数据源 ds2数据源
@Primary
@Bean(name = "mssqlDataSource")
public DataSource ds2DataSource(@Qualifier("mssqlDataSourceProperties") DataSourceProperties dataSourceProperties) {
return dataSourceProperties.initializeDataSourceBuilder().build();
}
// 主数据源 ds2数据源
@Primary
@Bean("mssqlSqlSessionFactory")
public SqlSessionFactory ds2SqlSessionFactory(@Qualifier("mssqlDataSource") DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean sqlSessionFactory = new MybatisSqlSessionFactoryBean();
sqlSessionFactory.setDataSource(dataSource);
sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/mssql/*.xml"));
sqlSessionFactory.setPlugins(new Interceptor[] { new PaginationInterceptor(),
// new PerformanceInterceptor()
// .setFormat(true),
});
sqlSessionFactory.setGlobalConfig(new GlobalConfig().setBanner(false));
sqlSessionFactory.setConfigLocation(new ClassPathResource("mybatis/mybatis-config.xml"));
sqlSessionFactory.setTypeAliasesPackage("com.huazheng.project.mssql.model");
return sqlSessionFactory.getObject();
}
@Primary
@Bean(name = "mssqlTransactionManager")
public DataSourceTransactionManager ds2TransactionManager(@Qualifier("mssqlDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Primary
@Bean(name = "mssqlSqlSessionTemplate")
public SqlSessionTemplate ds2SqlSessionTemplate(@Qualifier("mssqlSqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
}
package com.huazheng.project.config;
import javax.sql.DataSource;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
@Configuration
@MapperScan(basePackages = "com.huazheng.project.mssql.mapper", sqlSessionFactoryRef = "mssqlSqlSessionFactory")
public class MssqlConfig {
//主数据源配置 ds2数据源
@Primary
@Bean(name = "mssqlDataSourceProperties")
@ConfigurationProperties(prefix = "spring.datasource.mssql")
public DataSourceProperties ds2DataSourceProperties() {
return new DataSourceProperties();
}
//主数据源 ds2数据源
@Primary
@Bean(name = "mssqlDataSource")
public DataSource ds2DataSource(@Qualifier("mssqlDataSourceProperties") DataSourceProperties dataSourceProperties) {
return dataSourceProperties.initializeDataSourceBuilder().build();
}
// 主数据源 ds2数据源
@Primary
@Bean("mssqlSqlSessionFactory")
public SqlSessionFactory ds2SqlSessionFactory(@Qualifier("mssqlDataSource") DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean sqlSessionFactory = new MybatisSqlSessionFactoryBean();
sqlSessionFactory.setDataSource(dataSource);
sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/mssql/*.xml"));
sqlSessionFactory.setPlugins(new Interceptor[] { new PaginationInterceptor(),
// new PerformanceInterceptor()
// .setFormat(true),
});
sqlSessionFactory.setGlobalConfig(new GlobalConfig().setBanner(false));
sqlSessionFactory.setConfigLocation(new ClassPathResource("mybatis/mybatis-config.xml"));
sqlSessionFactory.setTypeAliasesPackage("com.huazheng.project.mssql.model");
return sqlSessionFactory.getObject();
}
@Primary
@Bean(name = "mssqlTransactionManager")
public DataSourceTransactionManager ds2TransactionManager(@Qualifier("mssqlDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Primary
@Bean(name = "mssqlSqlSessionTemplate")
public SqlSessionTemplate ds2SqlSessionTemplate(@Qualifier("mssqlSqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
}
package com.huazheng.project.config;
import javax.sql.DataSource;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
@Configuration
@MapperScan(basePackages = "com.huazheng.project.mysql.mapper", sqlSessionFactoryRef = "mysqlSqlSessionFactory")
public class MysqlConfig {
//主数据源配置 ds2数据源
@Primary
@Bean(name = "mysqlDataSourceProperties")
@ConfigurationProperties(prefix = "spring.datasource.mysql")
public DataSourceProperties ds2DataSourceProperties() {
return new DataSourceProperties();
}
//主数据源 ds2数据源
@Primary
@Bean(name = "mysqlDataSource")
public DataSource ds2DataSource(@Qualifier("mysqlDataSourceProperties") DataSourceProperties dataSourceProperties) {
return dataSourceProperties.initializeDataSourceBuilder().build();
}
// 主数据源 ds2数据源
@Primary
@Bean("mysqlSqlSessionFactory")
public SqlSessionFactory ds2SqlSessionFactory(@Qualifier("mysqlDataSource") DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean sqlSessionFactory = new MybatisSqlSessionFactoryBean();
sqlSessionFactory.setDataSource(dataSource);
sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/mysql/*.xml"));
sqlSessionFactory.setPlugins(new Interceptor[] { new PaginationInterceptor(),
// new PerformanceInterceptor()
// .setFormat(true),
});
sqlSessionFactory.setGlobalConfig(new GlobalConfig().setBanner(false));
sqlSessionFactory.setConfigLocation(new ClassPathResource("mybatis/mybatis-config.xml"));
sqlSessionFactory.setTypeAliasesPackage("com.huazheng.project.mysql.model");
return sqlSessionFactory.getObject();
}
@Primary
@Bean(name = "mysqlTransactionManager")
public DataSourceTransactionManager ds2TransactionManager(@Qualifier("mysqlDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Primary
@Bean(name = "mysqlSqlSessionTemplate")
public SqlSessionTemplate ds2SqlSessionTemplate(@Qualifier("mysqlSqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
}
package com.huazheng.project.config;
import javax.sql.DataSource;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
@Configuration
@MapperScan(basePackages = "com.huazheng.project.mysql.mapper", sqlSessionFactoryRef = "mysqlSqlSessionFactory")
public class MysqlConfig {
//主数据源配置 ds2数据源
@Primary
@Bean(name = "mysqlDataSourceProperties")
@ConfigurationProperties(prefix = "spring.datasource.mysql")
public DataSourceProperties ds2DataSourceProperties() {
return new DataSourceProperties();
}
//主数据源 ds2数据源
@Primary
@Bean(name = "mysqlDataSource")
public DataSource ds2DataSource(@Qualifier("mysqlDataSourceProperties") DataSourceProperties dataSourceProperties) {
return dataSourceProperties.initializeDataSourceBuilder().build();
}
// 主数据源 ds2数据源
@Primary
@Bean("mysqlSqlSessionFactory")
public SqlSessionFactory ds2SqlSessionFactory(@Qualifier("mysqlDataSource") DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean sqlSessionFactory = new MybatisSqlSessionFactoryBean();
sqlSessionFactory.setDataSource(dataSource);
sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/mysql/*.xml"));
sqlSessionFactory.setPlugins(new Interceptor[] { new PaginationInterceptor(),
// new PerformanceInterceptor()
// .setFormat(true),
});
sqlSessionFactory.setGlobalConfig(new GlobalConfig().setBanner(false));
sqlSessionFactory.setConfigLocation(new ClassPathResource("mybatis/mybatis-config.xml"));
sqlSessionFactory.setTypeAliasesPackage("com.huazheng.project.mysql.model");
return sqlSessionFactory.getObject();
}
@Primary
@Bean(name = "mysqlTransactionManager")
public DataSourceTransactionManager ds2TransactionManager(@Qualifier("mysqlDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Primary
@Bean(name = "mysqlSqlSessionTemplate")
public SqlSessionTemplate ds2SqlSessionTemplate(@Qualifier("mysqlSqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
}
package com.huazheng.project.greenplum.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huazheng.project.greenplum.model.GpAbc;
public interface GpAbcMapper extends BaseMapper<GpAbc> {
package com.huazheng.project.greenplum.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huazheng.project.greenplum.model.GpAbc;
public interface GpAbcMapper extends BaseMapper<GpAbc> {
}
\ No newline at end of file
package com.huazheng.project.greenplum.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huazheng.project.greenplum.model.GpTb1;
public interface GpTb1Mapper extends BaseMapper<GpTb1> {
package com.huazheng.project.greenplum.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huazheng.project.greenplum.model.GpTb1;
public interface GpTb1Mapper extends BaseMapper<GpTb1> {
}
\ No newline at end of file
package com.huazheng.project.greenplum.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huazheng.project.greenplum.model.GpTest1;
public interface GpTest1Mapper extends BaseMapper<GpTest1> {
package com.huazheng.project.greenplum.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huazheng.project.greenplum.model.GpTest1;
public interface GpTest1Mapper extends BaseMapper<GpTest1> {
}
\ No newline at end of file
package com.huazheng.project.greenplum.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.huazheng.project.greenplum.model.GpAbc;
import com.huazheng.project.greenplum.model.GpTb1;
import com.huazheng.project.greenplum.model.GpTest1;
public interface GreenplumMapper {
List<GpAbc> selectGpAbcList(@Param(Constants.WRAPPER) Wrapper<GpAbc> queryWrapper);
List<GpTb1> selectGpTb1List(@Param(Constants.WRAPPER) Wrapper<GpTb1> queryWrapper);
List<GpTest1> selectGpTest1List(@Param(Constants.WRAPPER) Wrapper<GpTest1> queryWrapper);
}
package com.huazheng.project.greenplum.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.huazheng.project.greenplum.model.GpAbc;
import com.huazheng.project.greenplum.model.GpTb1;
import com.huazheng.project.greenplum.model.GpTest1;
public interface GreenplumMapper {
List<GpAbc> selectGpAbcList(@Param(Constants.WRAPPER) Wrapper<GpAbc> queryWrapper);
List<GpTb1> selectGpTb1List(@Param(Constants.WRAPPER) Wrapper<GpTb1> queryWrapper);
List<GpTest1> selectGpTest1List(@Param(Constants.WRAPPER) Wrapper<GpTest1> queryWrapper);
}
package com.huazheng.project.greenplum.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@Builder
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("mssql_abc")
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="GpAbc对象", description="测试表")
public class GpAbc extends Model<GpAbc> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("id")
private Integer id;
@ApiModelProperty(value = "用户")
@TableField("username")
private String username;
@ApiModelProperty(value = "密码")
@TableField("userpswd")
private String userpswd;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.huazheng.project.greenplum.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@Builder
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("mssql_abc")
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="GpAbc对象", description="测试表")
public class GpAbc extends Model<GpAbc> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("id")
private Integer id;
@ApiModelProperty(value = "用户")
@TableField("username")
private String username;
@ApiModelProperty(value = "密码")
@TableField("userpswd")
private String userpswd;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.huazheng.project.greenplum.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@Builder
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("mysql_tb1")
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="GpTb1对象", description="测试表")
public class GpTb1 extends Model<GpTb1> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("id")
private Integer id;
@ApiModelProperty(value = "用户")
@TableField("username")
private String username;
@ApiModelProperty(value = "密码")
@TableField("userpswd")
private String userpswd;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.huazheng.project.greenplum.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@Builder
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("mysql_tb1")
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="GpTb1对象", description="测试表")
public class GpTb1 extends Model<GpTb1> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("id")
private Integer id;
@ApiModelProperty(value = "用户")
@TableField("username")
private String username;
@ApiModelProperty(value = "密码")
@TableField("userpswd")
private String userpswd;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.huazheng.project.greenplum.model;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@Builder
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("hana_test1")
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="GpTest1对象", description="测试表")
public class GpTest1 extends Model<GpTest1> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("id")
private Integer id;
@ApiModelProperty(value = "用户")
@TableField("\"user\"")
private String user;
@ApiModelProperty(value = "密码")
@TableField("pswd")
private String pswd;
@ApiModelProperty(value = "时间")
@TableField("times")
private Date times;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.huazheng.project.greenplum.model;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@Builder
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("hana_test1")
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="GpTest1对象", description="测试表")
public class GpTest1 extends Model<GpTest1> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("id")
private Integer id;
@ApiModelProperty(value = "用户")
@TableField("\"user\"")
private String user;
@ApiModelProperty(value = "密码")
@TableField("pswd")
private String pswd;
@ApiModelProperty(value = "时间")
@TableField("times")
private Date times;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.huazheng.project.hana.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.huazheng.project.hana.model.HanaTest1;
public interface HanaMapper {
List<HanaTest1> selectHanaTest1List(@Param(Constants.WRAPPER) Wrapper<HanaTest1> queryWrapper);
}
package com.huazheng.project.hana.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.huazheng.project.hana.model.HanaTest1;
public interface HanaMapper {
List<HanaTest1> selectHanaTest1List(@Param(Constants.WRAPPER) Wrapper<HanaTest1> queryWrapper);
}
package com.huazheng.project.hana.model;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@Builder
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("test1")
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="HanaTest1对象", description="测试表")
public class HanaTest1 extends Model<HanaTest1> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("id")
private Integer id;
@ApiModelProperty(value = "用户")
@TableField("user")
private String user;
@ApiModelProperty(value = "密码")
@TableField("pswd")
private String pswd;
@ApiModelProperty(value = "时间")
@TableField("times")
private Date times;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.huazheng.project.hana.model;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@Builder
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("test1")
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="HanaTest1对象", description="测试表")
public class HanaTest1 extends Model<HanaTest1> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("id")
private Integer id;
@ApiModelProperty(value = "用户")
@TableField("user")
private String user;
@ApiModelProperty(value = "密码")
@TableField("pswd")
private String pswd;
@ApiModelProperty(value = "时间")
@TableField("times")
private Date times;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.huazheng.project.mssql.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.huazheng.project.mssql.model.MsSqlAbc;
public interface MsSqlMapper {
List<MsSqlAbc> selectMsSqlAbcList(@Param(Constants.WRAPPER) Wrapper<MsSqlAbc> queryWrapper);
}
package com.huazheng.project.mssql.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.huazheng.project.mssql.model.MsSqlAbc;
public interface MsSqlMapper {
List<MsSqlAbc> selectMsSqlAbcList(@Param(Constants.WRAPPER) Wrapper<MsSqlAbc> queryWrapper);
}
package com.huazheng.project.mssql.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@Builder
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("abc")
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="MsSqlAbc对象", description="测试表")
public class MsSqlAbc extends Model<MsSqlAbc> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("id")
private Integer id;
@ApiModelProperty(value = "用户")
@TableField("username")
private String username;
@ApiModelProperty(value = "密码")
@TableField("userpswd")
private String userpswd;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.huazheng.project.mssql.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@Builder
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("abc")
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="MsSqlAbc对象", description="测试表")
public class MsSqlAbc extends Model<MsSqlAbc> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("id")
private Integer id;
@ApiModelProperty(value = "用户")
@TableField("username")
private String username;
@ApiModelProperty(value = "密码")
@TableField("userpswd")
private String userpswd;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.huazheng.project.mysql.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.huazheng.project.mysql.model.MySqlTb1;
public interface MySqlMapper {
List<MySqlTb1> selectMySqlTb1List(@Param(Constants.WRAPPER) Wrapper<MySqlTb1> queryWrapper);
}
package com.huazheng.project.mysql.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.huazheng.project.mysql.model.MySqlTb1;
public interface MySqlMapper {
List<MySqlTb1> selectMySqlTb1List(@Param(Constants.WRAPPER) Wrapper<MySqlTb1> queryWrapper);
}
package com.huazheng.project.mysql.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@Builder
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb1")
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="MySqlTb1对象", description="测试表")
public class MySqlTb1 extends Model<MySqlTb1> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("id")
private Integer id;
@ApiModelProperty(value = "用户")
@TableField("username")
private String username;
@ApiModelProperty(value = "密码")
@TableField("userpswd")
private String userpswd;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.huazheng.project.mysql.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@Builder
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb1")
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="MySqlTb1对象", description="测试表")
public class MySqlTb1 extends Model<MySqlTb1> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("id")
private Integer id;
@ApiModelProperty(value = "用户")
@TableField("username")
private String username;
@ApiModelProperty(value = "密码")
@TableField("userpswd")
private String userpswd;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.huazheng.project.service.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;
import com.huazheng.project.greenplum.mapper.GpAbcMapper;
import com.huazheng.project.greenplum.model.GpAbc;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
@Service
public class GpAbcServiceImpl {
private Log log = LogFactory.getLog(getClass());
@Autowired
private GpAbcMapper mapper;
@KafkaListener(topics = "sqlserver.test2.dbo.abc")
public void mssqlData(ConsumerRecord<?, ?> record) {
Object value = record.value();
if (value != null) {
String data = value.toString();
JSONObject json = JSONUtil.parseObj(data);
JSONObject payload = json.getJSONObject("payload");
String op = payload.getStr("op");
JSONObject before = payload.getJSONObject("before");
JSONObject after = payload.getJSONObject("after");
if (op.equals("c")) {
GpAbc bean = JSONUtil.toBean(after, GpAbc.class);
mapper.insert(bean);
log.info("mssql insert --> " + bean);
} else if (op.equals("u")) {
GpAbc bean = JSONUtil.toBean(after, GpAbc.class);
mapper.updateById(bean);
log.info("mssql update --> " + bean);
} else if (op.equals("d")) {
GpAbc bean = JSONUtil.toBean(before, GpAbc.class);
mapper.deleteById(bean.getId());
log.info("mssql delete --> " + bean);
}
}
}
}
package com.huazheng.project.service.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;
import com.huazheng.project.greenplum.mapper.GpAbcMapper;
import com.huazheng.project.greenplum.model.GpAbc;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
@Service
public class GpAbcServiceImpl {
private Log log = LogFactory.getLog(getClass());
@Autowired
private GpAbcMapper mapper;
@KafkaListener(topics = "sqlserver.test2.dbo.abc")
public void mssqlData(ConsumerRecord<?, ?> record) {
Object value = record.value();
if (value != null) {
String data = value.toString();
JSONObject json = JSONUtil.parseObj(data);
JSONObject payload = json.getJSONObject("payload");
String op = payload.getStr("op");
JSONObject before = payload.getJSONObject("before");
JSONObject after = payload.getJSONObject("after");
if (op.equals("c")) {
GpAbc bean = JSONUtil.toBean(after, GpAbc.class);
mapper.insert(bean);
log.info("mssql insert --> " + bean);
} else if (op.equals("u")) {
GpAbc bean = JSONUtil.toBean(after, GpAbc.class);
mapper.updateById(bean);
log.info("mssql update --> " + bean);
} else if (op.equals("d")) {
GpAbc bean = JSONUtil.toBean(before, GpAbc.class);
mapper.deleteById(bean.getId());
log.info("mssql delete --> " + bean);
}
}
}
}
package com.huazheng.project.service.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;
import com.huazheng.project.greenplum.mapper.GpTb1Mapper;
import com.huazheng.project.greenplum.model.GpTb1;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
@Service
public class GpTb1ServiceImpl {
private Log log = LogFactory.getLog(getClass());
@Autowired
private GpTb1Mapper mapper;
@KafkaListener(topics = "mysql.abc.abc.tb1")
public void mysqlData(ConsumerRecord<?, ?> record) {
Object value = record.value();
if (value != null) {
String data = value.toString();
JSONObject json = JSONUtil.parseObj(data);
JSONObject payload = json.getJSONObject("payload");
String op = payload.getStr("op");
JSONObject before = payload.getJSONObject("before");
JSONObject after = payload.getJSONObject("after");
if (op.equals("c")) {
GpTb1 bean = JSONUtil.toBean(after, GpTb1.class);
mapper.insert(bean);
log.info("mysql insert --> " + bean);
} else if (op.equals("u")) {
GpTb1 bean = JSONUtil.toBean(after, GpTb1.class);
mapper.updateById(bean);
log.info("mysql update --> " + bean);
} else if (op.equals("d")) {
GpTb1 bean = JSONUtil.toBean(before, GpTb1.class);
mapper.deleteById(bean.getId());
log.info("mysql delete --> " + bean);
}
}
}
}
package com.huazheng.project.service.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;
import com.huazheng.project.greenplum.mapper.GpTb1Mapper;
import com.huazheng.project.greenplum.model.GpTb1;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
@Service
public class GpTb1ServiceImpl {
private Log log = LogFactory.getLog(getClass());
@Autowired
private GpTb1Mapper mapper;
@KafkaListener(topics = "mysql.abc.abc.tb1")
public void mysqlData(ConsumerRecord<?, ?> record) {
Object value = record.value();
if (value != null) {
String data = value.toString();
JSONObject json = JSONUtil.parseObj(data);
JSONObject payload = json.getJSONObject("payload");
String op = payload.getStr("op");
JSONObject before = payload.getJSONObject("before");
JSONObject after = payload.getJSONObject("after");
if (op.equals("c")) {
GpTb1 bean = JSONUtil.toBean(after, GpTb1.class);
mapper.insert(bean);
log.info("mysql insert --> " + bean);
} else if (op.equals("u")) {
GpTb1 bean = JSONUtil.toBean(after, GpTb1.class);
mapper.updateById(bean);
log.info("mysql update --> " + bean);
} else if (op.equals("d")) {
GpTb1 bean = JSONUtil.toBean(before, GpTb1.class);
mapper.deleteById(bean.getId());
log.info("mysql delete --> " + bean);
}
}
}
}
package com.huazheng.project.service.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;
import com.huazheng.project.greenplum.mapper.GpTest1Mapper;
import com.huazheng.project.greenplum.model.GpTest1;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
@Service
public class GpTest1ServiceImpl {
private Log log = LogFactory.getLog(getClass());
@Autowired
private GpTest1Mapper mapper;
@KafkaListener(topics = "test_topic_2")
public void hanaData(ConsumerRecord<?, ?> record) {
Object value = record.value();
if (value != null) {
String data = value.toString();
JSONObject json = JSONUtil.parseObj(data);
JSONObject payload = json.getJSONObject("payload");
String op = payload.getStr("TYPE");
JSONObject before = payload.getJSONObject("BEFORE");
JSONObject after = payload.getJSONObject("AFTER");
if (op.equals("c")) {
after.set("times", after.getStr("times").substring(0, 19));
GpTest1 bean = JSONUtil.toBean(after, GpTest1.class);
mapper.insert(bean);
log.info("hana insert --> " + bean);
} else if (op.equals("u")) {
after.set("times", after.getStr("times").substring(0, 19));
GpTest1 bean = JSONUtil.toBean(after, GpTest1.class);
mapper.updateById(bean);
log.info("hana update --> " + bean);
} else if (op.equals("d")) {
before.set("times", before.getStr("times").substring(0, 19));
GpTest1 bean = JSONUtil.toBean(before, GpTest1.class);
mapper.deleteById(bean.getId());
log.info("hana delete --> " + bean);
}
}
}
}
package com.huazheng.project.service.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;
import com.huazheng.project.greenplum.mapper.GpTest1Mapper;
import com.huazheng.project.greenplum.model.GpTest1;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
@Service
public class GpTest1ServiceImpl {
private Log log = LogFactory.getLog(getClass());
@Autowired
private GpTest1Mapper mapper;
@KafkaListener(topics = "test_topic_2")
public void hanaData(ConsumerRecord<?, ?> record) {
Object value = record.value();
if (value != null) {
String data = value.toString();
JSONObject json = JSONUtil.parseObj(data);
JSONObject payload = json.getJSONObject("payload");
String op = payload.getStr("TYPE");
JSONObject before = payload.getJSONObject("BEFORE");
JSONObject after = payload.getJSONObject("AFTER");
if (op.equals("c")) {
after.set("times", after.getStr("times").substring(0, 19));
GpTest1 bean = JSONUtil.toBean(after, GpTest1.class);
mapper.insert(bean);
log.info("hana insert --> " + bean);
} else if (op.equals("u")) {
after.set("times", after.getStr("times").substring(0, 19));
GpTest1 bean = JSONUtil.toBean(after, GpTest1.class);
mapper.updateById(bean);
log.info("hana update --> " + bean);
} else if (op.equals("d")) {
before.set("times", before.getStr("times").substring(0, 19));
GpTest1 bean = JSONUtil.toBean(before, GpTest1.class);
mapper.deleteById(bean.getId());
log.info("hana delete --> " + bean);
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.huazheng.project.greenplum.mapper.GreenplumMapper">
<select id="selectGpAbcList" resultType="GpAbc">
select * from mssql_abc ${ew.customSqlSegment}
</select>
<select id="selectGpTb1List" resultType="GpTb1">
select * from mysql_tb1 ${ew.customSqlSegment}
</select>
<select id="selectGpTest1List" resultType="GpTest1">
select * from hana_test1 ${ew.customSqlSegment}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.huazheng.project.greenplum.mapper.GreenplumMapper">
<select id="selectGpAbcList" resultType="GpAbc">
select * from mssql_abc ${ew.customSqlSegment}
</select>
<select id="selectGpTb1List" resultType="GpTb1">
select * from mysql_tb1 ${ew.customSqlSegment}
</select>
<select id="selectGpTest1List" resultType="GpTest1">
select * from hana_test1 ${ew.customSqlSegment}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.huazheng.project.hana.mapper.HanaMapper">
<select id="selectHanaTest1List" resultType="HanaTest1">
select * from test1 ${ew.customSqlSegment}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.huazheng.project.hana.mapper.HanaMapper">
<select id="selectHanaTest1List" resultType="HanaTest1">
select * from test1 ${ew.customSqlSegment}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.huazheng.project.mssql.mapper.MsSqlMapper">
<select id="selectMsSqlAbcList" resultType="MsSqlAbc">
select * from abc ${ew.customSqlSegment}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.huazheng.project.mssql.mapper.MsSqlMapper">
<select id="selectMsSqlAbcList" resultType="MsSqlAbc">
select * from abc ${ew.customSqlSegment}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.huazheng.project.mysql.mapper.MySqlMapper">
<select id="selectMySqlTb1List" resultType="MySqlTb1">
select * from tb1 ${ew.customSqlSegment}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.huazheng.project.mysql.mapper.MySqlMapper">
<select id="selectMySqlTb1List" resultType="MySqlTb1">
select * from tb1 ${ew.customSqlSegment}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration
PUBLIC "-//ibatis.apache.org//DTD Config 3.0//EN"
"http://ibatis.apache.org/dtd/ibatis-3-config.dtd">
<configuration>
<settings>
<setting name="cacheEnabled" value="false" />
<setting name="lazyLoadingEnabled" value="false" />
<setting name="aggressiveLazyLoading" value="true" />
<setting name="callSettersOnNulls" value="true"/>
<setting name="logImpl" value="STDOUT_LOGGING" />
<!-- <setting name="logImpl" value="LOG4J"/> -->
</settings>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration
PUBLIC "-//ibatis.apache.org//DTD Config 3.0//EN"
"http://ibatis.apache.org/dtd/ibatis-3-config.dtd">
<configuration>
<settings>
<setting name="cacheEnabled" value="false" />
<setting name="lazyLoadingEnabled" value="false" />
<setting name="aggressiveLazyLoading" value="true" />
<setting name="callSettersOnNulls" value="true"/>
<setting name="logImpl" value="STDOUT_LOGGING" />
<!-- <setting name="logImpl" value="LOG4J"/> -->
</settings>
</configuration>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论