临时工作进度
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -32,3 +32,4 @@ build/
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
/hs_err_pid**.log
|
||||
/truffle.log
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package quant.rich.emoney.mapper.postgre;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import quant.rich.emoney.entity.postgre.EmoneyIndex;
|
||||
import quant.rich.emoney.entity.postgre.StockStrategy;
|
||||
|
||||
@Component
|
||||
@Mapper
|
||||
@DS("postgre")
|
||||
public interface StockStrategyMapper extends BaseMapper<StockStrategy> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package quant.rich.emoney.service.postgre;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import quant.rich.emoney.config.PostgreMybatisConfig;
|
||||
|
||||
/**
|
||||
* 使用 PostgreSQL 存储数据的 ServiceImpl,重写了部分使用 Transactional 的方法
|
||||
*/
|
||||
public abstract class PostgreServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<M, T> {
|
||||
|
||||
@Transactional(transactionManager = PostgreMybatisConfig.POSTGRE_TRANSACTION_MANAGER, rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean saveBatch(Collection<T> entityList) {
|
||||
return super.saveBatch(entityList);
|
||||
}
|
||||
|
||||
@Transactional(transactionManager = PostgreMybatisConfig.POSTGRE_TRANSACTION_MANAGER, rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean saveBatch(Collection<T> entityList, int batchSize) {
|
||||
return super.saveBatch(entityList, batchSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(transactionManager = PostgreMybatisConfig.POSTGRE_TRANSACTION_MANAGER, rollbackFor = Exception.class)
|
||||
public boolean saveOrUpdateBatch(Collection<T> entityList) {
|
||||
return super.saveOrUpdateBatch(entityList);
|
||||
}
|
||||
|
||||
@Transactional(transactionManager = PostgreMybatisConfig.POSTGRE_TRANSACTION_MANAGER, rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean saveOrUpdateBatch(Collection<T> entityList, int batchSize) {
|
||||
return super.saveOrUpdateBatch(entityList, batchSize);
|
||||
}
|
||||
|
||||
@Transactional(transactionManager = PostgreMybatisConfig.POSTGRE_TRANSACTION_MANAGER,rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean updateBatchById(Collection<T> entityList, int batchSize) {
|
||||
return super.updateBatchById(entityList, batchSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(transactionManager = PostgreMybatisConfig.POSTGRE_TRANSACTION_MANAGER,rollbackFor = Exception.class)
|
||||
public boolean removeByIds(Collection<?> list) {
|
||||
return super.removeByIds(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(transactionManager = PostgreMybatisConfig.POSTGRE_TRANSACTION_MANAGER,rollbackFor = Exception.class)
|
||||
public boolean removeByIds(Collection<?> list, boolean useFill) {
|
||||
return super.removeByIds(list, useFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(transactionManager = PostgreMybatisConfig.POSTGRE_TRANSACTION_MANAGER,rollbackFor = Exception.class)
|
||||
public boolean removeBatchByIds(Collection<?> list) {
|
||||
return super.removeBatchByIds(list, DEFAULT_BATCH_SIZE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(transactionManager = PostgreMybatisConfig.POSTGRE_TRANSACTION_MANAGER,rollbackFor = Exception.class)
|
||||
public boolean removeBatchByIds(Collection<?> list, int batchSize) {
|
||||
return super.removeBatchByIds(list, batchSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(transactionManager = PostgreMybatisConfig.POSTGRE_TRANSACTION_MANAGER,rollbackFor = Exception.class)
|
||||
public boolean removeBatchByIds(Collection<?> list, int batchSize, boolean useFill) {
|
||||
return super.removeBatchByIds(list, batchSize, useFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(transactionManager = PostgreMybatisConfig.POSTGRE_TRANSACTION_MANAGER,rollbackFor = Exception.class)
|
||||
public boolean removeBatchByIds(Collection<?> list, boolean useFill) {
|
||||
return super.removeBatchByIds(list, useFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(transactionManager = PostgreMybatisConfig.POSTGRE_TRANSACTION_MANAGER,rollbackFor = Exception.class)
|
||||
public boolean updateBatchById(Collection<T> entityList) {
|
||||
return super.updateBatchById(entityList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package quant.rich.emoney.service.postgre;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
|
||||
import quant.rich.emoney.entity.postgre.StockStrategy;
|
||||
import quant.rich.emoney.mapper.postgre.StockStrategyMapper;
|
||||
|
||||
@DS("postgre")
|
||||
@Service
|
||||
public class StockStrategyService extends PostgreServiceImpl<StockStrategyMapper, StockStrategy> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
## 使用触发器在 SQLite3 数据表内实现唯一的默认配置
|
||||
|
||||
20
src/test/resources/application-local.yml
Normal file
20
src/test/resources/application-local.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:postgresql://localhost:5432/verich
|
||||
username: postgres
|
||||
password: 123456
|
||||
driver-class-name: org.postgresql.Driver
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
hikari:
|
||||
minimum-idle: 5
|
||||
connection-test-query: SELECT 1
|
||||
maximum-pool-size: 2000
|
||||
auto-commit: true
|
||||
idle-timeout: 30000
|
||||
pool-name: SpringBootDemoHikariCP
|
||||
max-lifetime: 60000
|
||||
connection-timeout: 30000
|
||||
sql:
|
||||
init:
|
||||
mode: always
|
||||
continue-on-error: true
|
||||
29
src/test/resources/application-remote.yml
Normal file
29
src/test/resources/application-remote.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
spring:
|
||||
cache.type: simple
|
||||
datasource:
|
||||
postgre:
|
||||
jdbc-url: jdbc:postgresql://localhost:5432/verich
|
||||
username: postgres
|
||||
password: 123456
|
||||
driver-class-name: org.postgresql.Driver
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
mapper-locations: classpath*:mapper/postgre/*.xml
|
||||
type-aliases-package: quant.rich.emoney.entity.postgre
|
||||
hikari:
|
||||
minimum-idle: 5
|
||||
connection-test-query: SELECT 1
|
||||
maximum-pool-size: 2000
|
||||
auto-commit: true
|
||||
idle-timeout: 30000
|
||||
pool-name: SpringBootDemoHikariCP
|
||||
max-lifetime: 60000
|
||||
connection-timeout: 30000
|
||||
sqlite:
|
||||
jdbc-url: jdbc:sqlite:E:/eclipse-workspace/emo-grab/src/main/resources/database.db
|
||||
driver-class-name: org.sqlite.JDBC
|
||||
mapper-locations: classpath*:mapper/sqlite/*.xml
|
||||
type-aliases-package: quant.rich.emoney.entity.sqlite
|
||||
sql:
|
||||
init:
|
||||
mode: always
|
||||
continue-on-error: true
|
||||
Reference in New Issue
Block a user