Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dm_project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姚本章
dm_project
Commits
4b65d01d
Commit
4b65d01d
authored
Dec 03, 2020
by
ysongq
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dm_dev' of
http://gitlab.ioubuy.cn/yaobenzhang/dm_project
into dm_dev
parents
e1db4b78
5df3f0c7
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
270 additions
and
257 deletions
+270
-257
pom.xml
jz-dm-mall/pom.xml
+2
-2
DatabaseConfig.java
...l/src/main/java/com/jz/dm/mall/config/DatabaseConfig.java
+254
-254
FinanceTradeFlowController.java
...moduls/controller/finance/FinanceTradeFlowController.java
+0
-1
FinanceTradeFlow.java
...n/java/com/jz/dm/mall/moduls/entity/FinanceTradeFlow.java
+3
-0
application-test.yml
jz-dm-mall/src/main/resources/application-test.yml
+11
-0
No files found.
jz-dm-mall/pom.xml
View file @
4b65d01d
...
...
@@ -74,10 +74,10 @@
</dependency>
<!-- spring boot 和mybatis -->
<dependency>
<
!--<
dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
</dependency>
-->
<!-- mybatis plus -->
<dependency>
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/config/DatabaseConfig.java
View file @
4b65d01d
package
com
.
jz
.
dm
.
mall
.
config
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.mybatis.spring.SqlSessionFactoryBean
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.beans.factory.annotation.Qualifier
;
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.support.PathMatchingResourcePatternResolver
;
import
org.springframework.jdbc.datasource.DataSourceTransactionManager
;
import
javax.sql.DataSource
;
import
java.sql.SQLException
;
/**
* @ProjectName zhaxinle
* @Author: zeroJun
* @Date: 2018/8/16 16:49
* @Description: 主数据源配置类
*/
@Configuration
// 前缀为primary.datasource.druid的配置信息
@ConfigurationProperties
(
prefix
=
"spring.datasource"
)
@MapperScan
(
basePackages
=
DatabaseConfig
.
PACKAGE
,
sqlSessionFactoryRef
=
"sqlSessionFactory"
)
public
class
DatabaseConfig
{
/**
* dao层的包路径
*/
static
final
String
PACKAGE
=
"com.jz.dm.mall.moduls.mapper"
;
/**
* mapper文件的相对路径
*/
private
static
final
String
MAPPER_LOCATION
=
"classpath:mapperconf/*.xml"
;
private
String
filters
;
private
String
url
;
private
String
username
;
private
String
password
;
private
String
driverClassName
;
private
int
initialSize
;
private
int
minIdle
;
private
int
maxActive
;
private
long
maxWait
;
private
long
timeBetweenEvictionRunsMillis
;
private
long
minEvictableIdleTimeMillis
;
private
String
validationQuery
;
private
boolean
testWhileIdle
;
private
boolean
testOnBorrow
;
private
boolean
testOnReturn
;
private
boolean
poolPreparedStatements
;
private
int
maxPoolPreparedStatementPerConnectionSize
;
// 主数据源使用@Primary注解进行标识
//@Primary
@Bean
(
name
=
"dataSource"
)
public
DataSource
dataSource
()
throws
SQLException
{
DruidDataSource
druid
=
new
DruidDataSource
();
// 监控统计拦截的filters
druid
.
setFilters
(
filters
);
// 配置基本属性
druid
.
setDriverClassName
(
driverClassName
);
druid
.
setUsername
(
username
);
druid
.
setPassword
(
password
);
druid
.
setUrl
(
url
);
//初始化时建立物理连接的个数
druid
.
setInitialSize
(
initialSize
);
//最大连接池数量
druid
.
setMaxActive
(
maxActive
);
//最小连接池数量
druid
.
setMinIdle
(
minIdle
);
//获取连接时最大等待时间,单位毫秒。
druid
.
setMaxWait
(
maxWait
);
//间隔多久进行一次检测,检测需要关闭的空闲连接
druid
.
setTimeBetweenEvictionRunsMillis
(
timeBetweenEvictionRunsMillis
);
//一个连接在池中最小生存的时间
druid
.
setMinEvictableIdleTimeMillis
(
minEvictableIdleTimeMillis
);
//用来检测连接是否有效的sql
druid
.
setValidationQuery
(
validationQuery
);
//建议配置为true,不影响性能,并且保证安全性。
druid
.
setTestWhileIdle
(
testWhileIdle
);
//申请连接时执行validationQuery检测连接是否有效
druid
.
setTestOnBorrow
(
testOnBorrow
);
druid
.
setTestOnReturn
(
testOnReturn
);
//是否缓存preparedStatement,也就是PSCache,oracle设为true,mysql设为false。分库分表较多推荐设置为false
druid
.
setPoolPreparedStatements
(
poolPreparedStatements
);
// 打开PSCache时,指定每个连接上PSCache的大小
druid
.
setMaxPoolPreparedStatementPerConnectionSize
(
maxPoolPreparedStatementPerConnectionSize
);
return
druid
;
}
// 创建该数据源的事务管理
@Primary
@Bean
(
name
=
"transactionManager"
)
public
DataSourceTransactionManager
transactionManager
()
throws
SQLException
{
return
new
DataSourceTransactionManager
(
dataSource
());
}
// 创建Mybatis的连接会话工厂实例
@Primary
@Bean
(
name
=
"sqlSessionFactory"
)
public
SqlSessionFactory
sqlSessionFactory
(
@Qualifier
(
"dataSource"
)
DataSource
dataSource
)
throws
Exception
{
final
SqlSessionFactoryBean
sessionFactory
=
new
SqlSessionFactoryBean
();
sessionFactory
.
setDataSource
(
dataSource
);
// 设置数据源bean
sessionFactory
.
setMapperLocations
(
new
PathMatchingResourcePatternResolver
()
.
getResources
(
DatabaseConfig
.
MAPPER_LOCATION
));
// 设置mapper文件路径
return
sessionFactory
.
getObject
();
}
public
String
getFilters
()
{
return
filters
;
}
public
void
setFilters
(
String
filters
)
{
this
.
filters
=
filters
;
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
String
getUsername
()
{
return
username
;
}
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
String
getDriverClassName
()
{
return
driverClassName
;
}
public
void
setDriverClassName
(
String
driverClassName
)
{
this
.
driverClassName
=
driverClassName
;
}
public
int
getInitialSize
()
{
return
initialSize
;
}
public
void
setInitialSize
(
int
initialSize
)
{
this
.
initialSize
=
initialSize
;
}
public
int
getMinIdle
()
{
return
minIdle
;
}
public
void
setMinIdle
(
int
minIdle
)
{
this
.
minIdle
=
minIdle
;
}
public
int
getMaxActive
()
{
return
maxActive
;
}
public
void
setMaxActive
(
int
maxActive
)
{
this
.
maxActive
=
maxActive
;
}
public
long
getMaxWait
()
{
return
maxWait
;
}
public
void
setMaxWait
(
long
maxWait
)
{
this
.
maxWait
=
maxWait
;
}
public
long
getTimeBetweenEvictionRunsMillis
()
{
return
timeBetweenEvictionRunsMillis
;
}
public
void
setTimeBetweenEvictionRunsMillis
(
long
timeBetweenEvictionRunsMillis
)
{
this
.
timeBetweenEvictionRunsMillis
=
timeBetweenEvictionRunsMillis
;
}
public
long
getMinEvictableIdleTimeMillis
()
{
return
minEvictableIdleTimeMillis
;
}
public
void
setMinEvictableIdleTimeMillis
(
long
minEvictableIdleTimeMillis
)
{
this
.
minEvictableIdleTimeMillis
=
minEvictableIdleTimeMillis
;
}
public
String
getValidationQuery
()
{
return
validationQuery
;
}
public
void
setValidationQuery
(
String
validationQuery
)
{
this
.
validationQuery
=
validationQuery
;
}
public
boolean
isTestWhileIdle
()
{
return
testWhileIdle
;
}
public
void
setTestWhileIdle
(
boolean
testWhileIdle
)
{
this
.
testWhileIdle
=
testWhileIdle
;
}
public
boolean
isTestOnBorrow
()
{
return
testOnBorrow
;
}
public
void
setTestOnBorrow
(
boolean
testOnBorrow
)
{
this
.
testOnBorrow
=
testOnBorrow
;
}
public
boolean
isTestOnReturn
()
{
return
testOnReturn
;
}
public
void
setTestOnReturn
(
boolean
testOnReturn
)
{
this
.
testOnReturn
=
testOnReturn
;
}
public
boolean
isPoolPreparedStatements
()
{
return
poolPreparedStatements
;
}
public
void
setPoolPreparedStatements
(
boolean
poolPreparedStatements
)
{
this
.
poolPreparedStatements
=
poolPreparedStatements
;
}
public
int
getMaxPoolPreparedStatementPerConnectionSize
()
{
return
maxPoolPreparedStatementPerConnectionSize
;
}
public
void
setMaxPoolPreparedStatementPerConnectionSize
(
int
maxPoolPreparedStatementPerConnectionSize
)
{
this
.
maxPoolPreparedStatementPerConnectionSize
=
maxPoolPreparedStatementPerConnectionSize
;
}
}
\ No newline at end of file
//package com.jz.dm.mall.config;
//
//import com.alibaba.druid.pool.DruidDataSource;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionFactoryBean;
//import org.mybatis.spring.annotation.MapperScan;
//import org.springframework.beans.factory.annotation.Qualifier;
//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.support.PathMatchingResourcePatternResolver;
//import org.springframework.jdbc.datasource.DataSourceTransactionManager;
//
//import javax.sql.DataSource;
//import java.sql.SQLException;
//
///**
// * @ProjectName zhaxinle
// * @Author: zeroJun
// * @Date: 2018/8/16 16:49
// * @Description: 主数据源配置类
// */
//@Configuration
//// 前缀为primary.datasource.druid的配置信息
//@ConfigurationProperties(prefix = "spring.datasource")
//@MapperScan(basePackages = DatabaseConfig.PACKAGE, sqlSessionFactoryRef = "sqlSessionFactory")
//public class DatabaseConfig {
//
// /**
// * dao层的包路径
// */
// static final String PACKAGE = "com.jz.dm.mall.moduls.mapper";
//
// /**
// * mapper文件的相对路径
// */
// private static final String MAPPER_LOCATION = "classpath:mapperconf/*.xml";
//
// private String filters;
// private String url;
// private String username;
// private String password;
// private String driverClassName;
// private int initialSize;
// private int minIdle;
// private int maxActive;
// private long maxWait;
// private long timeBetweenEvictionRunsMillis;
// private long minEvictableIdleTimeMillis;
// private String validationQuery;
// private boolean testWhileIdle;
// private boolean testOnBorrow;
// private boolean testOnReturn;
// private boolean poolPreparedStatements;
// private int maxPoolPreparedStatementPerConnectionSize;
//
// // 主数据源使用@Primary注解进行标识
// //@Primary
// @Bean(name = "dataSource")
// public DataSource dataSource() throws SQLException {
// DruidDataSource druid = new DruidDataSource();
// // 监控统计拦截的filters
// druid.setFilters(filters);
//
// // 配置基本属性
// druid.setDriverClassName(driverClassName);
// druid.setUsername(username);
// druid.setPassword(password);
// druid.setUrl(url);
//
// //初始化时建立物理连接的个数
// druid.setInitialSize(initialSize);
// //最大连接池数量
// druid.setMaxActive(maxActive);
// //最小连接池数量
// druid.setMinIdle(minIdle);
// //获取连接时最大等待时间,单位毫秒。
// druid.setMaxWait(maxWait);
// //间隔多久进行一次检测,检测需要关闭的空闲连接
// druid.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
// //一个连接在池中最小生存的时间
// druid.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
// //用来检测连接是否有效的sql
// druid.setValidationQuery(validationQuery);
// //建议配置为true,不影响性能,并且保证安全性。
// druid.setTestWhileIdle(testWhileIdle);
// //申请连接时执行validationQuery检测连接是否有效
// druid.setTestOnBorrow(testOnBorrow);
// druid.setTestOnReturn(testOnReturn);
// //是否缓存preparedStatement,也就是PSCache,oracle设为true,mysql设为false。分库分表较多推荐设置为false
// druid.setPoolPreparedStatements(poolPreparedStatements);
// // 打开PSCache时,指定每个连接上PSCache的大小
// druid.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
//
// return druid;
// }
//
// // 创建该数据源的事务管理
// @Primary
// @Bean(name = "transactionManager")
// public DataSourceTransactionManager transactionManager() throws SQLException {
// return new DataSourceTransactionManager(dataSource());
// }
//
// // 创建Mybatis的连接会话工厂实例
// @Primary
// @Bean(name = "sqlSessionFactory")
// public SqlSessionFactory sqlSessionFactory(@Qualifier("dataSource") DataSource dataSource) throws Exception {
// final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
// sessionFactory.setDataSource(dataSource); // 设置数据源bean
// sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
// .getResources(DatabaseConfig.MAPPER_LOCATION)); // 设置mapper文件路径
//
// return sessionFactory.getObject();
// }
//
// public String getFilters() {
// return filters;
// }
//
// public void setFilters(String filters) {
// this.filters = filters;
// }
//
// public String getUrl() {
// return url;
// }
//
// public void setUrl(String url) {
// this.url = url;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public String getDriverClassName() {
// return driverClassName;
// }
//
// public void setDriverClassName(String driverClassName) {
// this.driverClassName = driverClassName;
// }
//
// public int getInitialSize() {
// return initialSize;
// }
//
// public void setInitialSize(int initialSize) {
// this.initialSize = initialSize;
// }
//
// public int getMinIdle() {
// return minIdle;
// }
//
// public void setMinIdle(int minIdle) {
// this.minIdle = minIdle;
// }
//
// public int getMaxActive() {
// return maxActive;
// }
//
// public void setMaxActive(int maxActive) {
// this.maxActive = maxActive;
// }
//
// public long getMaxWait() {
// return maxWait;
// }
//
// public void setMaxWait(long maxWait) {
// this.maxWait = maxWait;
// }
//
// public long getTimeBetweenEvictionRunsMillis() {
// return timeBetweenEvictionRunsMillis;
// }
//
// public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) {
// this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
// }
//
// public long getMinEvictableIdleTimeMillis() {
// return minEvictableIdleTimeMillis;
// }
//
// public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) {
// this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
// }
//
// public String getValidationQuery() {
// return validationQuery;
// }
//
// public void setValidationQuery(String validationQuery) {
// this.validationQuery = validationQuery;
// }
//
// public boolean isTestWhileIdle() {
// return testWhileIdle;
// }
//
// public void setTestWhileIdle(boolean testWhileIdle) {
// this.testWhileIdle = testWhileIdle;
// }
//
// public boolean isTestOnBorrow() {
// return testOnBorrow;
// }
//
// public void setTestOnBorrow(boolean testOnBorrow) {
// this.testOnBorrow = testOnBorrow;
// }
//
// public boolean isTestOnReturn() {
// return testOnReturn;
// }
//
// public void setTestOnReturn(boolean testOnReturn) {
// this.testOnReturn = testOnReturn;
// }
//
// public boolean isPoolPreparedStatements() {
// return poolPreparedStatements;
// }
//
// public void setPoolPreparedStatements(boolean poolPreparedStatements) {
// this.poolPreparedStatements = poolPreparedStatements;
// }
//
// public int getMaxPoolPreparedStatementPerConnectionSize() {
// return maxPoolPreparedStatementPerConnectionSize;
// }
//
// public void setMaxPoolPreparedStatementPerConnectionSize(int maxPoolPreparedStatementPerConnectionSize) {
// this.maxPoolPreparedStatementPerConnectionSize = maxPoolPreparedStatementPerConnectionSize;
// }
//
//}
\ No newline at end of file
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/finance/FinanceTradeFlowController.java
View file @
4b65d01d
...
...
@@ -37,7 +37,6 @@ public class FinanceTradeFlowController extends BaseController {
@GetMapping
(
value
=
"/getAccountMoney"
)
@ApiOperation
(
value
=
"充值----获取账户余额"
,
notes
=
"获取账户余额"
)
public
Result
<
OrderDto
>
getAccountMoney
(
HttpServletRequest
req
)
throws
Exception
{
return
new
Result
<>();
}
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/entity/FinanceTradeFlow.java
View file @
4b65d01d
package
com
.
jz
.
dm
.
mall
.
moduls
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModel
;
...
...
@@ -20,6 +22,7 @@ public class FinanceTradeFlow implements Serializable {
/**
* 交易流水id
*/
@TableId
(
value
=
"trade_flow_id"
,
type
=
IdType
.
AUTO
)
private
Long
tradeFlowId
;
/**
* 订单id
...
...
jz-dm-mall/src/main/resources/application-test.yml
View file @
4b65d01d
...
...
@@ -56,3 +56,14 @@ spring:
-
192.168.31.167:6382
-
192.168.31.167:6383
-
192.168.31.167:6384
#mybatis的配置
mybatis
:
#配置mapper.xml文件所在路径
mapper-locations
:
classpath:mapperconf/*.xml
#配置映射类所在的包名
type-aliases-package
:
com.jz.dm.mall.moduls.entity
logging
:
level
:
com.jz.manage
:
debug
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