Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qg-bl-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data-spider
qg-bl-service
Commits
8f321041
Commit
8f321041
authored
Jul 03, 2019
by
data爬虫-冯 军凯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据库初始化
parent
0652b808
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
123 additions
and
2 deletions
+123
-2
BlackListSourceConfig.java
...p/qgblservice/config/blacklist/BlackListSourceConfig.java
+2
-2
MasterProperties.java
...uantgroup/qgblservice/config/master/MasterProperties.java
+30
-0
MasterSourceConfig.java
...ntgroup/qgblservice/config/master/MasterSourceConfig.java
+70
-0
test.java
...up/qgblservice/repository/mybatis/entity/master/test.java
+8
-0
TestMapper.java
...lservice/repository/mybatis/mapper/master/TestMapper.java
+8
-0
TestMapper.xml
.../qgblservice/repository/mybatis/xml/master/TestMapper.xml
+5
-0
No files found.
src/main/java/cn/quantgroup/qgblservice/config/blacklist/BlackListSourceConfig.java
View file @
8f321041
...
...
@@ -41,14 +41,14 @@ public class BlackListSourceConfig {
@Bean
(
name
=
"dataSource"
)
public
DataSource
blackListDataSource
()
{
HikariConfig
config
=
new
HikariConfig
();
config
.
setJdbcUrl
(
blackListProperties
.
getJdbcUrl
());
config
.
setPassword
(
blackListProperties
.
getPassword
());
config
.
setJdbcUrl
(
blackListProperties
.
getJdbcUrl
());
config
.
setUsername
(
blackListProperties
.
getUsername
());
config
.
setMaximumPoolSize
(
blackListProperties
.
getMaxPoolSize
());
config
.
setMinimumIdle
(
blackListProperties
.
getMinPoolSize
());
config
.
addDataSourceProperty
(
"cachePrepStmts"
,
"true"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSize"
,
"250"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSqlLimit"
,
"2048"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSize"
,
"250"
);
return
new
HikariDataSource
(
config
);
}
...
...
src/main/java/cn/quantgroup/qgblservice/config/master/MasterProperties.java
0 → 100644
View file @
8f321041
package
cn
.
quantgroup
.
qgblservice
.
config
.
master
;
import
lombok.Data
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
/**
* 原先黑名单库
*
* @Author fengjunkai
* @Date 2019-07-02 11:58
*/
@Data
@Configuration
public
class
MasterProperties
{
@Value
(
"${master.db.driver}"
)
private
String
driverClass
;
@Value
(
"${master.db.minPoolSize}"
)
private
int
minPoolSize
;
@Value
(
"${master.db.maxPoolSize}"
)
private
int
maxPoolSize
;
@Value
(
"${master.db.url}"
)
private
String
jdbcUrl
;
@Value
(
"${master.db.username}"
)
private
String
username
;
@Value
(
"${master.db.password}"
)
private
String
password
;
}
src/main/java/cn/quantgroup/qgblservice/config/master/MasterSourceConfig.java
0 → 100644
View file @
8f321041
package
cn
.
quantgroup
.
qgblservice
.
config
.
master
;
import
cn.quantgroup.qgblservice.config.blacklist.BlackListProperties
;
import
com.zaxxer.hikari.HikariConfig
;
import
com.zaxxer.hikari.HikariDataSource
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.mybatis.spring.SqlSessionFactoryBean
;
import
org.mybatis.spring.SqlSessionTemplate
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.core.io.support.PathMatchingResourcePatternResolver
;
import
javax.sql.DataSource
;
/**
* @Author fengjunkai
* @Date 2019-07-02 11:58
*/
@Import
({
MasterProperties
.
class
})
@MapperScan
(
basePackages
=
MasterSourceConfig
.
PACKAGE
,
sqlSessionFactoryRef
=
"masterSqlSessionFactory"
)
@Configuration
public
class
MasterSourceConfig
{
static
final
String
PACKAGE
=
"cn.quantgroup.qgblservice.repository.mybatis.mapper.master"
;
@Value
(
"${master.mapper-locations}"
)
private
String
mapperLocations
;
@Value
(
"${master.type-aliases-package}"
)
private
String
typeAliasesPackage
;
@Value
(
"${master.config-location}"
)
private
String
configLocation
;
@Autowired
private
MasterProperties
masterProperties
;
@Bean
(
name
=
"dataSource"
)
public
DataSource
masterDataSource
()
{
HikariConfig
config
=
new
HikariConfig
();
config
.
setJdbcUrl
(
masterProperties
.
getJdbcUrl
());
config
.
setPassword
(
masterProperties
.
getPassword
());
config
.
setMaximumPoolSize
(
masterProperties
.
getMaxPoolSize
());
config
.
setUsername
(
masterProperties
.
getUsername
());
config
.
setMinimumIdle
(
masterProperties
.
getMinPoolSize
());
config
.
addDataSourceProperty
(
"prepStmtCacheSize"
,
"250"
);
config
.
addDataSourceProperty
(
"cachePrepStmts"
,
"true"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSqlLimit"
,
"2048"
);
return
new
HikariDataSource
(
config
);
}
@Bean
(
name
=
"masterSqlSessionFactory"
)
public
SqlSessionFactory
masterSqlSessionFactory
(
@Qualifier
(
"dataSource"
)
DataSource
dataSource
)
throws
Exception
{
final
SqlSessionFactoryBean
sessionFactory
=
new
SqlSessionFactoryBean
();
sessionFactory
.
setDataSource
(
dataSource
);
sessionFactory
.
setMapperLocations
(
new
PathMatchingResourcePatternResolver
().
getResources
(
mapperLocations
));
sessionFactory
.
setTypeAliasesPackage
(
typeAliasesPackage
);
sessionFactory
.
setConfigLocation
(
new
PathMatchingResourcePatternResolver
().
getResource
(
configLocation
));
return
sessionFactory
.
getObject
();
}
@Bean
(
name
=
"masterSqlSessionTemplate"
)
public
SqlSessionTemplate
masterSqlSessionTemplate
(
@Qualifier
(
"masterSqlSessionFactory"
)
SqlSessionFactory
sqlSessionFactory
)
throws
Exception
{
return
new
SqlSessionTemplate
(
sqlSessionFactory
);
}
}
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/entity/master/test.java
0 → 100644
View file @
8f321041
package
cn
.
quantgroup
.
qgblservice
.
repository
.
mybatis
.
entity
.
master
;
/**
* @Author fengjunkai
* @Date 2019-07-02 14:50
*/
public
class
test
{
}
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/mapper/master/TestMapper.java
0 → 100644
View file @
8f321041
package
cn
.
quantgroup
.
qgblservice
.
repository
.
mybatis
.
mapper
.
master
;
/**
* @Author fengjunkai
* @Date 2019-07-02 14:50
*/
public
interface
TestMapper
{
}
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/xml/master/TestMapper.xml
0 → 100644
View file @
8f321041
<?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=
"cn.quantgroup.qgblservice.repository.mybatis.mapper.master.TestMapper"
>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment