Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xzxt-control
Overview
Overview
Details
Activity
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
常超
xzxt-control
Commits
52602246
Commit
52602246
authored
Mar 07, 2019
by
chang_chao@founder.com.cn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加xzxt多数据源配置
parent
2e0332fb
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
377 additions
and
75 deletions
+377
-75
pom.xml
+44
-0
src/main/java/com/cc/bean/AutoSysUser.java
+24
-0
src/main/java/com/cc/config/DataSourceMysqlConfig.java
+42
-0
src/main/java/com/cc/config/DataSourceXzxtConfig.java
+46
-0
src/main/java/com/cc/controller/DeptController.java
+2
-2
src/main/java/com/cc/controller/HelloController.java
+15
-1
src/main/java/com/cc/mapper/mysql/DepartmentMapper.java
+1
-1
src/main/java/com/cc/mapper/mysql/DocumentDao.java
+1
-1
src/main/java/com/cc/mapper/mysql/EmployeeMapper.java
+1
-1
src/main/java/com/cc/mapper/mysql/ResourceMapper.java
+1
-1
src/main/java/com/cc/mapper/mysql/ServiceMapper.java
+1
-1
src/main/java/com/cc/mapper/mysql/UserMapper.java
+1
-1
src/main/java/com/cc/mapper/xzxt/UserXzxtDemoMapper.java
+20
-0
src/main/java/com/cc/service/UserXzxtDmeoService.java
+23
-0
src/main/java/com/cc/service/serviceimpl/DocumentService.java
+1
-1
src/main/java/com/cc/service/serviceimpl/ResourceServiceImpl.java
+1
-3
src/main/java/com/cc/service/serviceimpl/ServiceIServiceImpl.java
+1
-4
src/main/java/com/cc/service/serviceimpl/UserServiceImpl.java
+1
-3
src/main/java/com/cc/service/serviceimpl/UserServiceXzxtDemoImpl.java
+35
-0
src/main/resources/application-dev.yml
+11
-24
src/main/resources/application-pro.yml
+13
-26
src/main/resources/application.properties
+1
-1
src/main/resources/mybatis/mapper/mysql/EmployeeMapper.xml
+1
-1
src/main/resources/mybatis/mapper/mysql/ResourceMapper.xml
+1
-1
src/main/resources/mybatis/mapper/mysql/ServiceMapper.xml
+1
-1
src/main/resources/mybatis/mapper/mysql/UserMapper.xml
+1
-1
src/main/resources/mybatis/mapper/xzxt/UserXzxtDemoMapper.xml
+87
-0
No files found.
pom.xml
View file @
52602246
...
@@ -24,7 +24,45 @@
...
@@ -24,7 +24,45 @@
<httpclient.version>
4.3.5
</httpclient.version>
<httpclient.version>
4.3.5
</httpclient.version>
<java.version>
1.8
</java.version>
<java.version>
1.8
</java.version>
</properties>
</properties>
<!-- 公司的maven仓库 -->
<repositories>
<repository>
<id>
founder
</id>
<url>
http://47.92.108.28:8081/nexus/content/groups/public/
</url>
<releases>
<enabled>
true
</enabled>
</releases>
<snapshots>
<enabled>
true
</enabled>
</snapshots>
</repository>
</repositories>
<!-- 指定maven plugin仓库 -->
<pluginRepositories>
<!-- 公司的maven plugin仓库 -->
<pluginRepository>
<id>
founder
</id>
<url>
http://47.92.108.28:8081/nexus/content/groups/public/
</url>
<releases>
<enabled>
true
</enabled>
</releases>
<snapshots>
<enabled>
true
</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<!-- 上传资源到nexus私服,构建部署项目 -->
<distributionManagement>
<repository>
<id>
releases
</id>
<url>
http://47.92.108.28:8081/nexus/content/repositories/releases/
</url>
</repository>
<snapshotRepository>
<id>
snapshots
</id>
<url>
http://47.92.108.28:8081/nexus/content/repositories/snapshots/
</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
...
@@ -55,6 +93,12 @@
...
@@ -55,6 +93,12 @@
<artifactId>
mysql-connector-java
</artifactId>
<artifactId>
mysql-connector-java
</artifactId>
<scope>
runtime
</scope>
<scope>
runtime
</scope>
</dependency>
</dependency>
<!-- 数据库驱动包 -->
<dependency>
<groupId>
org.oracle
</groupId>
<artifactId>
ojdbc6
</artifactId>
<version>
10
</version>
</dependency>
<dependency>
<dependency>
<groupId>
jstl
</groupId>
<groupId>
jstl
</groupId>
<artifactId>
jstl
</artifactId>
<artifactId>
jstl
</artifactId>
...
...
src/main/java/com/cc/bean/AutoSysUser.java
0 → 100644
View file @
52602246
package
com
.
cc
.
bean
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
AutoSysUser
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
id
;
private
String
unitcode
;
private
String
trueName
;
private
String
identitycard
;
private
String
telephone
;
private
String
unitname
;
}
\ No newline at end of file
src/main/java/com/cc/config/DataSourceMysqlConfig.java
0 → 100644
View file @
52602246
package
com
.
cc
.
config
;
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.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
;
/**
* Created by summer on 2016/11/25.
*/
@Configuration
//@MapperScan对指定dao包建立映射,确保在多个数据源下,自动选择合适的数据源
@MapperScan
(
basePackages
=
"com.cc.mapper.mysql"
,
sqlSessionTemplateRef
=
"mysqlSqlSessionTemplate"
)
public
class
DataSourceMysqlConfig
{
@Bean
(
name
=
"mysqlDataSource"
)
@ConfigurationProperties
(
prefix
=
"spring.datasource.mysql"
)
public
DataSource
gxzxtDataSource
()
{
return
DataSourceBuilder
.
create
().
build
();
}
@Bean
(
name
=
"mysqlSqlSessionFactory"
)
public
SqlSessionFactory
gxzxtSqlSessionFactory
(
@Qualifier
(
"mysqlDataSource"
)
DataSource
dataSource
)
throws
Exception
{
SqlSessionFactoryBean
bean
=
new
SqlSessionFactoryBean
();
bean
.
setDataSource
(
dataSource
);
bean
.
setMapperLocations
(
new
PathMatchingResourcePatternResolver
().
getResources
(
"classpath:mybatis/mapper/mysql/*.xml"
));
return
bean
.
getObject
();
}
@Bean
(
name
=
"mysqlSqlSessionTemplate"
)
public
SqlSessionTemplate
gxzxtSqlSessionTemplate
(
@Qualifier
(
"mysqlSqlSessionFactory"
)
SqlSessionFactory
sqlSessionFactory
)
throws
Exception
{
return
new
SqlSessionTemplate
(
sqlSessionFactory
);
}
}
src/main/java/com/cc/config/DataSourceXzxtConfig.java
0 → 100644
View file @
52602246
package
com
.
cc
.
config
;
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.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.context.annotation.Primary
;
import
org.springframework.core.io.support.PathMatchingResourcePatternResolver
;
import
javax.sql.DataSource
;
/**
* Created by summer on 2016/11/25.
*/
@Configuration
@MapperScan
(
basePackages
=
"com.cc.mapper.xzxt"
,
sqlSessionTemplateRef
=
"xzxtSqlSessionTemplate"
)
public
class
DataSourceXzxtConfig
{
@Bean
(
name
=
"xzxtDataSource"
)
@ConfigurationProperties
(
prefix
=
"spring.datasource.xzxt"
)
//主数据源
@Primary
public
DataSource
xzxtDataSource
()
{
return
DataSourceBuilder
.
create
().
build
();
}
@Bean
(
name
=
"xzxtSqlSessionFactory"
)
@Primary
public
SqlSessionFactory
xzxtSqlSessionFactory
(
@Qualifier
(
"xzxtDataSource"
)
DataSource
dataSource
)
throws
Exception
{
SqlSessionFactoryBean
bean
=
new
SqlSessionFactoryBean
();
bean
.
setDataSource
(
dataSource
);
bean
.
setMapperLocations
(
new
PathMatchingResourcePatternResolver
().
getResources
(
"classpath:mybatis/mapper/xzxt/*.xml"
));
return
bean
.
getObject
();
}
@Bean
(
name
=
"xzxtSqlSessionTemplate"
)
@Primary
public
SqlSessionTemplate
xzxtSqlSessionTemplate
(
@Qualifier
(
"xzxtSqlSessionFactory"
)
SqlSessionFactory
sqlSessionFactory
)
throws
Exception
{
return
new
SqlSessionTemplate
(
sqlSessionFactory
);
}
}
src/main/java/com/cc/controller/DeptController.java
View file @
52602246
...
@@ -3,8 +3,8 @@ package com.cc.controller;
...
@@ -3,8 +3,8 @@ package com.cc.controller;
import
com.cc.bean.Department
;
import
com.cc.bean.Department
;
import
com.cc.bean.Employee
;
import
com.cc.bean.Employee
;
import
com.cc.mapper.DepartmentMapper
;
import
com.cc.mapper.
mysql.
DepartmentMapper
;
import
com.cc.mapper.EmployeeMapper
;
import
com.cc.mapper.
mysql.
EmployeeMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
...
...
src/main/java/com/cc/controller/HelloController.java
View file @
52602246
package
com
.
cc
.
controller
;
package
com
.
cc
.
controller
;
import
com.cc.bean.AutoSysUser
;
import
com.cc.common.ResultMap
;
import
com.cc.service.UserXzxtDmeoService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
java.util.List
;
@Controller
@Controller
public
class
HelloController
{
public
class
HelloController
{
@Autowired
UserXzxtDmeoService
userXzxtDmeoService
;
@GetMapping
(
"/abc"
)
@GetMapping
(
"/abc"
)
public
String
hello
(
Model
model
){
public
String
hello
(
Model
model
){
model
.
addAttribute
(
"msg"
,
"你好"
);
model
.
addAttribute
(
"msg"
,
"你好"
);
return
"login"
;
return
"login"
;
}
}
@ResponseBody
@GetMapping
(
"/xzxtdemo"
)
public
ResultMap
xzxtdemo
(
Model
model
){
return
userXzxtDmeoService
.
userAll
();
}
}
}
src/main/java/com/cc/mapper/DepartmentMapper.java
→
src/main/java/com/cc/mapper/
mysql/
DepartmentMapper.java
View file @
52602246
package
com
.
cc
.
mapper
;
package
com
.
cc
.
mapper
.
mysql
;
import
com.cc.bean.Department
;
import
com.cc.bean.Department
;
import
org.apache.ibatis.annotations.*
;
import
org.apache.ibatis.annotations.*
;
...
...
src/main/java/com/cc/mapper/DocumentDao.java
→
src/main/java/com/cc/mapper/
mysql/
DocumentDao.java
View file @
52602246
package
com
.
cc
.
mapper
;
package
com
.
cc
.
mapper
.
mysql
;
import
com.cc.bean.Document
;
import
com.cc.bean.Document
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.Insert
;
...
...
src/main/java/com/cc/mapper/EmployeeMapper.java
→
src/main/java/com/cc/mapper/
mysql/
EmployeeMapper.java
View file @
52602246
package
com
.
cc
.
mapper
;
package
com
.
cc
.
mapper
.
mysql
;
import
com.cc.bean.Employee
;
import
com.cc.bean.Employee
;
...
...
src/main/java/com/cc/mapper/ResourceMapper.java
→
src/main/java/com/cc/mapper/
mysql/
ResourceMapper.java
View file @
52602246
package
com
.
cc
.
mapper
;
package
com
.
cc
.
mapper
.
mysql
;
import
com.cc.bean.Resource
;
import
com.cc.bean.Resource
;
import
com.cc.bean.Services
;
import
com.cc.bean.Services
;
...
...
src/main/java/com/cc/mapper/ServiceMapper.java
→
src/main/java/com/cc/mapper/
mysql/
ServiceMapper.java
View file @
52602246
package
com
.
cc
.
mapper
;
package
com
.
cc
.
mapper
.
mysql
;
import
com.cc.bean.Services
;
import
com.cc.bean.Services
;
import
java.util.List
;
import
java.util.List
;
...
...
src/main/java/com/cc/mapper/UserMapper.java
→
src/main/java/com/cc/mapper/
mysql/
UserMapper.java
View file @
52602246
package
com
.
cc
.
mapper
;
package
com
.
cc
.
mapper
.
mysql
;
import
com.cc.bean.PageBean
;
import
com.cc.bean.PageBean
;
...
...
src/main/java/com/cc/mapper/xzxt/UserXzxtDemoMapper.java
0 → 100644
View file @
52602246
package
com
.
cc
.
mapper
.
xzxt
;
import
com.cc.bean.User
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
UserXzxtDemoMapper
{
/**
* 获取所有用户
*
*
* @return
*/
List
<
User
>
userAll
();
}
src/main/java/com/cc/service/UserXzxtDmeoService.java
0 → 100644
View file @
52602246
package
com
.
cc
.
service
;
import
com.cc.bean.User
;
import
com.cc.common.ResultMap
;
import
com.cc.common.XzxtRestResult
;
/**
* @author yutons
*/
public
interface
UserXzxtDmeoService
{
/**
* 登录逻辑
* 1、先根据用户名查询用户对象
* 2、如果有用户对象,则继续匹配密码
* 如果没有用户对象,则抛出异常
*
* @return
*/
ResultMap
userAll
();
}
src/main/java/com/cc/service/serviceimpl/DocumentService.java
View file @
52602246
package
com
.
cc
.
service
.
serviceimpl
;
package
com
.
cc
.
service
.
serviceimpl
;
import
com.cc.bean.Document
;
import
com.cc.bean.Document
;
import
com.cc.mapper.DocumentDao
;
import
com.cc.mapper.
mysql.
DocumentDao
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
...
src/main/java/com/cc/service/serviceimpl/ResourceServiceImpl.java
View file @
52602246
package
com
.
cc
.
service
.
serviceimpl
;
package
com
.
cc
.
service
.
serviceimpl
;
import
com.cc.bean.Services
;
import
com.cc.common.ResultMap
;
import
com.cc.common.ResultMap
;
import
com.cc.common.XzxtRestResult
;
import
com.cc.common.XzxtRestResult
;
import
com.cc.mapper.ResourceMapper
;
import
com.cc.mapper.mysql.ResourceMapper
;
import
com.cc.mapper.ServiceMapper
;
import
com.cc.service.ResourceService
;
import
com.cc.service.ResourceService
;
import
com.cc.service.ServiceService
;
import
com.cc.service.ServiceService
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
...
src/main/java/com/cc/service/serviceimpl/ServiceIServiceImpl.java
View file @
52602246
...
@@ -2,19 +2,16 @@ package com.cc.service.serviceimpl;
...
@@ -2,19 +2,16 @@ package com.cc.service.serviceimpl;
import
com.cc.common.ResultMap
;
import
com.cc.common.ResultMap
;
import
com.cc.common.XzxtRestResult
;
import
com.cc.common.XzxtRestResult
;
import
com.cc.mapper.ServiceMapper
;
import
com.cc.mapper.
mysql.
ServiceMapper
;
import
com.cc.service.ServiceService
;
import
com.cc.service.ServiceService
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
com.cc.bean.Services
;
import
com.cc.bean.Services
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.io.*
;
import
java.io.*
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.List
;
import
java.util.List
;
@Service
@Service
...
...
src/main/java/com/cc/service/serviceimpl/UserServiceImpl.java
View file @
52602246
package
com
.
cc
.
service
.
serviceimpl
;
package
com
.
cc
.
service
.
serviceimpl
;
import
com.cc.bean.PageBean
;
import
com.cc.bean.User
;
import
com.cc.bean.User
;
import
com.cc.common.ResultMap
;
import
com.cc.common.ResultMap
;
import
com.cc.common.XzxtRestResult
;
import
com.cc.common.XzxtRestResult
;
import
com.cc.mapper.UserMapper
;
import
com.cc.mapper.
mysql.
UserMapper
;
import
com.cc.service.UserService
;
import
com.cc.service.UserService
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -13,7 +12,6 @@ import org.springframework.util.StringUtils;
...
@@ -13,7 +12,6 @@ import org.springframework.util.StringUtils;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
@Service
@Service
public
class
UserServiceImpl
implements
UserService
{
public
class
UserServiceImpl
implements
UserService
{
...
...
src/main/java/com/cc/service/serviceimpl/UserServiceXzxtDemoImpl.java
0 → 100644
View file @
52602246
package
com
.
cc
.
service
.
serviceimpl
;
import
com.cc.bean.User
;
import
com.cc.common.ResultMap
;
import
com.cc.common.XzxtRestResult
;
import
com.cc.mapper.mysql.UserMapper
;
import
com.cc.mapper.xzxt.UserXzxtDemoMapper
;
import
com.cc.service.UserService
;
import
com.cc.service.UserXzxtDmeoService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
javax.annotation.Resource
;
import
java.util.List
;
@Service
public
class
UserServiceXzxtDemoImpl
implements
UserXzxtDmeoService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
UserServiceXzxtDemoImpl
.
class
);
@Resource
private
UserXzxtDemoMapper
userXzxtDemoMapper
;
@Override
public
ResultMap
userAll
()
{
List
<
User
>
userlist
=
userXzxtDemoMapper
.
userAll
();
ResultMap
resultMap
=
new
ResultMap
();
if
(!
StringUtils
.
isEmpty
(
userlist
))
{
resultMap
.
setData
(
userlist
);
return
resultMap
;
}
return
resultMap
;
}
}
src/main/resources/application-dev.yml
View file @
52602246
spring
:
spring
:
datasource
:
datasource
:
# 数据源基本配置
# 数据源基本配置
mysql
:
driverClassName
:
com.mysql.jdbc.Driver
username
:
root
username
:
root
password
:
123
password
:
123
driver-class-name
:
com.mysql.jdbc.Driver
# spring2.0此处为jdbc-url
url
:
jdbc:mysql://127.0.0.1:3306/mybatis
jdbc-url
:
jdbc:mysql://127.0.0.1:3306/mybatis
type
:
com.alibaba.druid.pool.DruidDataSource
xzxt
:
driverClassName
:
oracle.jdbc.driver.OracleDriver
username
:
XZXT
password
:
XZXT
# spring2.0此处为jdbc-url
jdbc-url
:
jdbc:oracle:thin:@127.0.0.1:1521:XZXT
type
:
com.alibaba.druid.pool.DruidDataSource
type
:
com.alibaba.druid.pool.DruidDataSource
# 数据源其他配置
initialSize
:
5
minIdle
:
5
maxActive
:
20
maxWait
:
60000
timeBetweenEvictionRunsMillis
:
60000
minEvictableIdleTimeMillis
:
300000
validationQuery
:
SELECT 1 FROM DUAL
testWhileIdle
:
true
testOnBorrow
:
false
testOnReturn
:
false
poolPreparedStatements
:
true
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
filters
:
stat,wall,log4j
maxPoolPreparedStatementPerConnectionSize
:
20
useGlobalDataSourceStat
:
true
connectionProperties
:
druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500
mybatis
:
# 指定全局配置文件位置
config-location
:
classpath:mybatis/mybatis-config.xml
# 指定sql映射文件位置
mapper-locations
:
classpath:mybatis/mapper/*.xml
#schema:
#schema:
# - classpath:sql/department.sql
# - classpath:sql/department.sql
...
...
src/main/resources/application-pro.yml
View file @
52602246
spring
:
spring
:
datasource
:
datasource
:
# 数据源基本配置
#数据源基本配置
mysql
:
driverClassName
:
com.mysql.jdbc.Driver
username
:
root
username
:
root
password
:
123456
password
:
123
driver-class-name
:
com.mysql.jdbc.Driver
# spring2.0此处为jdbc-url
url
:
jdbc:mysql://10.94.61.158:3306/mybatis
jdbc-url
:
jdbc:mysql://127.0.0.1:3306/mybatis
type
:
com.alibaba.druid.pool.DruidDataSource
xzxt
:
driverClassName
:
oracle.jdbc.driver.OracleDriver
username
:
XZXT
password
:
XZXT
# spring2.0此处为jdbc-url
jdbc-url
:
jdbc:oracle:thin:@192.168.1.109:1521:XZXT
type
:
com.alibaba.druid.pool.DruidDataSource
type
:
com.alibaba.druid.pool.DruidDataSource
# 数据源其他配置
initialSize
:
5
minIdle
:
5
maxActive
:
20
maxWait
:
60000
timeBetweenEvictionRunsMillis
:
60000
minEvictableIdleTimeMillis
:
300000
validationQuery
:
SELECT 1 FROM DUAL
testWhileIdle
:
true
testOnBorrow
:
false
testOnReturn
:
false
poolPreparedStatements
:
true
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
filters
:
stat,wall,log4j
maxPoolPreparedStatementPerConnectionSize
:
20
useGlobalDataSourceStat
:
true
connectionProperties
:
druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500
mybatis
:
# 指定全局配置文件位置
config-location
:
classpath:mybatis/mybatis-config.xml
# 指定sql映射文件位置
mapper-locations
:
classpath:mybatis/mapper/*.xml
#schema:
#schema:
# - classpath:sql/department.sql
# - classpath:sql/department.sql
...
...
src/main/resources/application.properties
View file @
52602246
...
@@ -11,7 +11,7 @@ spring.mvc.view.suffix=.jsp
...
@@ -11,7 +11,7 @@ spring.mvc.view.suffix=.jsp
logging.level.com.cc
=
debug
logging.level.com.cc
=
debug
spring.profiles.active
=
pro
spring.profiles.active
=
dev
#logging.path=
#logging.path=
# \u4E0D\u6307\u5B9A\u8DEF\u5F84\u5728\u5F53\u524D\u9879\u76EE\u4E0B\u751F\u6210springboot.log\u65E5\u5FD7
# \u4E0D\u6307\u5B9A\u8DEF\u5F84\u5728\u5F53\u524D\u9879\u76EE\u4E0B\u751F\u6210springboot.log\u65E5\u5FD7
...
...
src/main/resources/mybatis/mapper/EmployeeMapper.xml
→
src/main/resources/mybatis/mapper/
mysql/
EmployeeMapper.xml
View file @
52602246
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<!DOCTYPE mapper
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.cc.mapper.EmployeeMapper"
>
<mapper
namespace=
"com.cc.mapper.
mysql.
EmployeeMapper"
>
<!-- public Employee getEmpById(Integer id);
<!-- public Employee getEmpById(Integer id);
...
...
src/main/resources/mybatis/mapper/ResourceMapper.xml
→
src/main/resources/mybatis/mapper/
mysql/
ResourceMapper.xml
View file @
52602246
<?xml version="1.0" encoding="UTF-8" ?>
<?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" >
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.cc.mapper.ResourceMapper"
>
<mapper
namespace=
"com.cc.mapper.
mysql.
ResourceMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.cc.bean.Resource"
>
<resultMap
id=
"BaseResultMap"
type=
"com.cc.bean.Resource"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"resource_name"
property=
"resourceName"
jdbcType=
"VARCHAR"
/>
<result
column=
"resource_name"
property=
"resourceName"
jdbcType=
"VARCHAR"
/>
...
...
src/main/resources/mybatis/mapper/ServiceMapper.xml
→
src/main/resources/mybatis/mapper/
mysql/
ServiceMapper.xml
View file @
52602246
<?xml version="1.0" encoding="UTF-8" ?>
<?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" >
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.cc.mapper.ServiceMapper"
>
<mapper
namespace=
"com.cc.mapper.
mysql.
ServiceMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.cc.bean.Services"
>
<resultMap
id=
"BaseResultMap"
type=
"com.cc.bean.Services"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"service_name"
property=
"serviceName"
jdbcType=
"VARCHAR"
/>
<result
column=
"service_name"
property=
"serviceName"
jdbcType=
"VARCHAR"
/>
...
...
src/main/resources/mybatis/mapper/UserMapper.xml
→
src/main/resources/mybatis/mapper/
mysql/
UserMapper.xml
View file @
52602246
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<!DOCTYPE mapper
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.cc.mapper.UserMapper"
>
<mapper
namespace=
"com.cc.mapper.
mysql.
UserMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.cc.bean.User"
>
<resultMap
id=
"BaseResultMap"
type=
"com.cc.bean.User"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"email"
property=
"email"
jdbcType=
"VARCHAR"
/>
<result
column=
"email"
property=
"email"
jdbcType=
"VARCHAR"
/>
...
...
src/main/resources/mybatis/mapper/xzxt/UserXzxtDemoMapper.xml
0 → 100644
View file @
52602246
<?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.cc.mapper.xzxt.UserXzxtDemoMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.cc.bean.AutoSysUser"
>
<id
column=
"id"
property=
"id"
jdbcType=
"VARCHAR"
/>
<result
column=
"birthday"
property=
"birthday"
jdbcType=
"VARCHAR"
/>
<result
column=
"gzzm_zcy"
property=
"gzzmZcy"
jdbcType=
"VARCHAR"
/>
<result
column=
"glybz"
property=
"glybz"
jdbcType=
"VARCHAR"
/>
<result
column=
"lrdwmc"
property=
"lrdwmc"
jdbcType=
"VARCHAR"
/>
<result
column=
"lrdwdm"
property=
"lrdwdm"
jdbcType=
"VARCHAR"
/>
<result
column=
"policemanid"
property=
"policemanid"
jdbcType=
"VARCHAR"
/>
<result
column=
"gzzm_play"
property=
"gzzmPlay"
jdbcType=
"VARCHAR"
/>
<result
column=
"grade"
property=
"grade"
jdbcType=
"VARCHAR"
/>
<result
column=
"sex"
property=
"sex"
jdbcType=
"VARCHAR"
/>
<result
column=
"username"
property=
"username"
jdbcType=
"VARCHAR"
/>
<result
column=
"password"
property=
"password"
jdbcType=
"VARCHAR"
/>
<result
column=
"true_name"
property=
"trueName"
jdbcType=
"VARCHAR"
/>
<result
column=
"unitcode"
property=
"unitcode"
jdbcType=
"VARCHAR"
/>
<result
column=
"gxsj"
property=
"gxsj"
jdbcType=
"VARCHAR"
/>
<result
column=
"lrsj"
property=
"lrsj"
jdbcType=
"VARCHAR"
/>
<result
column=
"scbz"
property=
"scbz"
jdbcType=
"VARCHAR"
/>
<result
column=
"unitname"
property=
"unitname"
jdbcType=
"VARCHAR"
/>
<result
column=
"tqyhbz"
property=
"tqyhbz"
jdbcType=
"VARCHAR"
/>
<result
column=
"gxr"
property=
"gxr"
jdbcType=
"VARCHAR"
/>
<result
column=
"lrr"
property=
"lrr"
jdbcType=
"VARCHAR"
/>
<result
column=
"ip"
property=
"ip"
jdbcType=
"VARCHAR"
/>
<result
column=
"default_model"
property=
"defaultModel"
jdbcType=
"VARCHAR"
/>
<result
column=
"remark"
property=
"remark"
jdbcType=
"VARCHAR"
/>
<result
column=
"default_desktop"
property=
"defaultDesktop"
jdbcType=
"VARCHAR"
/>
<result
column=
"lastlogintime"
property=
"lastlogintime"
jdbcType=
"VARCHAR"
/>
<result
column=
"lastchecktime"
property=
"lastchecktime"
jdbcType=
"VARCHAR"
/>
<result
column=
"theme"
property=
"theme"
jdbcType=
"VARCHAR"
/>
<result
column=
"gzzm_zhy"
property=
"gzzmZhy"
jdbcType=
"VARCHAR"
/>
<result
column=
"open_flag"
property=
"openFlag"
jdbcType=
"VARCHAR"
/>
<result
column=
"gzzm_ypy"
property=
"gzzmYpy"
jdbcType=
"VARCHAR"
/>
<result
column=
"identitycard"
property=
"identitycard"
jdbcType=
"VARCHAR"
/>
<result
column=
"telephone"
property=
"telephone"
jdbcType=
"VARCHAR"
/>
<result
column=
"xxzyurl"
property=
"xxzyurl"
jdbcType=
"VARCHAR"
/>
</resultMap>
<!-- public Employee getEmpById(Integer id);
public void insertEmp(Employee employee);-->
<sql
id=
"Base_Column_List"
>
birthday
,gzzm_zcy
,glybz
,lrdwmc
,lrdwdm
,policemanid
,gzzm_play
,grade
,sex
,username
,password
,true_name
,unitcode
,gxsj
,lrsj
,scbz
,unitname
,tqyhbz
,gxr
,lrr
,id
,ip
,default_model
,remark
,default_desktop
,lastlogintime
,lastchecktime
,theme
,gzzm_zhy
,open_flag
,gzzm_ypy
,identitycard
,telephone
,xxzyurl
</sql>
<select
id=
"userAll"
resultType=
"com.cc.bean.AutoSysUser"
>
SELECT * FROM sys_user
</select>
</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