15 changed files with 199 additions and 18 deletions
-
2src/main/java/com/example/demo/DemoApplication.java
-
2src/main/java/com/example/demo/config/Mysql3DataSourceConfig.java
-
54src/main/java/com/example/demo/config/Mysql4DataSourceConfig.java
-
54src/main/java/com/example/demo/config/Mysql5DataSourceConfig.java
-
2src/main/java/com/example/demo/controller/bean/BeanRechargeController.java
-
4src/main/java/com/example/demo/domain/vo/bean/BeanConsumeArticle.java
-
6src/main/java/com/example/demo/domain/vo/bean/BeanConsumeLive.java
-
20src/main/java/com/example/demo/mapper/live/LiveMapper.java
-
23src/main/java/com/example/demo/serviceImpl/bean/BeanConsumeServiceImpl.java
-
2src/main/java/com/example/demo/serviceImpl/coin/ExportExcelServiceImpl.java
-
2src/main/resources/application-dev.yml
-
2src/main/resources/application-prod.yml
-
18src/main/resources/application.yml
-
2src/main/resources/jindouMapper/BeanConsumeMapper.xml
-
24src/main/resources/liveMapper/LiveMapper.xml
@ -0,0 +1,54 @@ |
|||
package com.example.demo.config; |
|||
|
|||
import com.zaxxer.hikari.HikariDataSource; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.ibatis.session.SqlSessionFactory; |
|||
import org.mybatis.spring.SqlSessionFactoryBean; |
|||
import org.mybatis.spring.SqlSessionTemplate; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
import org.springframework.boot.jdbc.DataSourceBuilder; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver; |
|||
|
|||
import javax.sql.DataSource; |
|||
|
|||
/** |
|||
* @program: gold-java |
|||
* @ClassName Mysql4DataSourceConfig |
|||
* @description: |
|||
* @author: Ethan |
|||
* @create: 2025−08-01 17:12 |
|||
* @Version 1.0 |
|||
**/ |
|||
@Slf4j |
|||
@Configuration |
|||
public class Mysql4DataSourceConfig { |
|||
@Bean(name = "mysql4DataSource") |
|||
@ConfigurationProperties(prefix = "spring.datasource.mysql4") |
|||
public DataSource mysql4DataSource() { |
|||
return DataSourceBuilder.create().type(HikariDataSource.class).build(); |
|||
} |
|||
@Bean(name = "mysql4SqlSessionFactory") |
|||
// @Primary |
|||
public SqlSessionFactory mysql4SqlSessionFactory(@Qualifier("mysql4DataSource") DataSource dataSource, |
|||
@Qualifier("globalConfiguration4") org.apache.ibatis.session.Configuration globalConfiguration4) throws Exception { |
|||
SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); |
|||
sessionFactory.setDataSource(dataSource); |
|||
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:payMapper/*.xml")); |
|||
sessionFactory.setConfiguration(globalConfiguration4); |
|||
return sessionFactory.getObject(); |
|||
} |
|||
|
|||
@Bean(name = "mysql4SqlSessionTemplate") |
|||
// @Primary |
|||
public SqlSessionTemplate mysql4SqlSessionTemplate(@Qualifier("mysql4SqlSessionFactory") SqlSessionFactory sqlSessionFactory) { |
|||
return new SqlSessionTemplate(sqlSessionFactory); |
|||
} |
|||
@Bean |
|||
@ConfigurationProperties(prefix = "mybatis.configuration.mysql4") |
|||
public org.apache.ibatis.session.Configuration globalConfiguration4() { |
|||
return new org.apache.ibatis.session.Configuration(); |
|||
} |
|||
} |
@ -0,0 +1,54 @@ |
|||
package com.example.demo.config; |
|||
|
|||
import com.zaxxer.hikari.HikariDataSource; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.ibatis.session.SqlSessionFactory; |
|||
import org.mybatis.spring.SqlSessionFactoryBean; |
|||
import org.mybatis.spring.SqlSessionTemplate; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
import org.springframework.boot.jdbc.DataSourceBuilder; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver; |
|||
|
|||
import javax.sql.DataSource; |
|||
|
|||
/** |
|||
* @program: gold-java |
|||
* @ClassName Mysql5DataSourceConfig |
|||
* @description: |
|||
* @author: Ethan |
|||
* @create: 2025−08-01 17:17 |
|||
* @Version 1.0 |
|||
**/ |
|||
@Slf4j |
|||
@Configuration |
|||
public class Mysql5DataSourceConfig { |
|||
@Bean(name = "mysql5DataSource") |
|||
@ConfigurationProperties(prefix = "spring.datasource.mysql5") |
|||
public DataSource mysql5DataSource() { |
|||
return DataSourceBuilder.create().type(HikariDataSource.class).build(); |
|||
} |
|||
@Bean(name = "mysql5SqlSessionFactory") |
|||
// @Primary |
|||
public SqlSessionFactory mysql5SqlSessionFactory(@Qualifier("mysql5DataSource") DataSource dataSource, |
|||
@Qualifier("globalConfiguration5") org.apache.ibatis.session.Configuration globalConfiguration5) throws Exception { |
|||
SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); |
|||
sessionFactory.setDataSource(dataSource); |
|||
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:liveMapper/*.xml")); |
|||
sessionFactory.setConfiguration(globalConfiguration5); |
|||
return sessionFactory.getObject(); |
|||
} |
|||
|
|||
@Bean(name = "mysql5SqlSessionTemplate") |
|||
// @Primary |
|||
public SqlSessionTemplate mysql5SqlSessionTemplate(@Qualifier("mysql5SqlSessionFactory") SqlSessionFactory sqlSessionFactory) { |
|||
return new SqlSessionTemplate(sqlSessionFactory); |
|||
} |
|||
@Bean |
|||
@ConfigurationProperties(prefix = "mybatis.configuration.mysql5") |
|||
public org.apache.ibatis.session.Configuration globalConfiguration5() { |
|||
return new org.apache.ibatis.session.Configuration(); |
|||
} |
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.example.demo.mapper.live; |
|||
|
|||
import com.example.demo.domain.vo.bean.BeanConsumeLive; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @program: gold-java |
|||
* @ClassName liveMapper |
|||
* @description: |
|||
* @author: Ethan |
|||
* @create: 2025−08-01 17:20 |
|||
* @Version 1.0 |
|||
**/ |
|||
@Mapper |
|||
public interface LiveMapper { |
|||
List<BeanConsumeLive> selectLiveBy(@Param("beanConsumeLive") BeanConsumeLive beanConsumeLive); |
|||
} |
@ -0,0 +1,24 @@ |
|||
<?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.example.demo.mapper.live.LiveMapper"> |
|||
|
|||
|
|||
<select id="selectLiveBy" resultType="com.example.demo.domain.vo.bean.BeanConsumeLive"> |
|||
select mi.name as name, |
|||
lgg.jwcode as jwcode, |
|||
mi.deptName as dept, |
|||
lg.name as gift, |
|||
lgg.gold_beans as beanNum, |
|||
lgg.gold_free as freeBean, |
|||
lgg.gold_buy as buyBean, |
|||
lp.title as liveChannel, |
|||
l.name as liveName, |
|||
lgg.created_at as consumeTime |
|||
from live_give_gifts lgg |
|||
left join member_info mi on mi.jwcode = lgg.jwcode |
|||
left join live_gifts lg on lg.id = lgg.g_id |
|||
left join live l on l.id = lgg.live_id |
|||
left join live_pindao lp on lp.id = l.channel_id |
|||
|
|||
</select> |
|||
</mapper> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue