Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdict
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdict
提交
32da2eba
提交
32da2eba
编写于
4月 24, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ibizdev提交
上级
a95b013b
变更
7
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
168 行增加
和
36 行删除
+168
-36
DevBootApplication.java
...ict-boot/src/main/java/cn/ibizlab/DevBootApplication.java
+3
-1
pom.xml
ibzdict-core/pom.xml
+12
-0
LiquibaseConfiguration.java
...a/cn/ibizlab/core/util/config/LiquibaseConfiguration.java
+72
-0
pom.xml
ibzdict-dependencies/pom.xml
+15
-0
IBZDictItemResource.java
...ain/java/cn/ibizlab/dictapi/rest/IBZDictItemResource.java
+13
-13
LiquibaseProp.java
...l/src/main/java/cn/ibizlab/util/domain/LiquibaseProp.java
+23
-0
application-sys.yml
ibzdict-util/src/main/resources/application-sys.yml
+30
-22
未找到文件。
ibzdict-boot/src/main/java/cn/ibizlab/DevBootApplication.java
浏览文件 @
32da2eba
...
...
@@ -11,7 +11,9 @@ import org.springframework.boot.SpringApplication;
@EnableDiscoveryClient
@Configuration
@EnableTransactionManagement
@SpringBootApplication
@SpringBootApplication
(
exclude
=
{
com
.
alibaba
.
druid
.
spring
.
boot
.
autoconfigure
.
DruidDataSourceAutoConfigure
.
class
})
public
class
DevBootApplication
{
public
static
void
main
(
String
[]
args
)
{
...
...
ibzdict-core/pom.xml
浏览文件 @
32da2eba
...
...
@@ -86,6 +86,18 @@
<artifactId>
spring-boot-starter-data-mongodb
</artifactId>
</dependency>
<!--Liquibase数据库版本更新工具-->
<dependency>
<groupId>
org.liquibase
</groupId>
<artifactId>
liquibase-core
</artifactId>
</dependency>
<!--Mybatis-plus动态数据源-->
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
dynamic-datasource-spring-boot-starter
</artifactId>
</dependency>
</dependencies>
</project>
ibzdict-core/src/main/java/cn/ibizlab/core/util/config/LiquibaseConfiguration.java
0 → 100644
浏览文件 @
32da2eba
package
cn
.
ibizlab
.
core
.
util
.
config
;
import
com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor
;
import
com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
javax.sql.DataSource
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
org.apache.ibatis.mapping.VendorDatabaseIdProvider
;
import
org.apache.ibatis.mapping.DatabaseIdProvider
;
import
java.util.Properties
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.boot.jdbc.DataSourceBuilder
;
import
cn.ibizlab.util.domain.LiquibaseProp
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
liquibase.integration.spring.SpringLiquibase
;
import
org.springframework.util.StringUtils
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
org.apache.ibatis.session.SqlSessionFactory
;
@Configuration
public
class
LiquibaseConfiguration
{
/**
* 主数据源版本管理
* @param
* @return
*/
@Bean
public
SpringLiquibase
masterliquibase
(
LiquibaseProp
masterProperties
)
{
return
LiquibaseInit
(
masterProperties
);
}
/**
* liquibase初始化数据库
* @param properties
* @return
*/
private
SpringLiquibase
LiquibaseInit
(
LiquibaseProp
properties
){
DruidDataSource
druidDataSource
=
new
DruidDataSource
();
druidDataSource
.
setUsername
(
properties
.
getUsername
());
druidDataSource
.
setPassword
(
properties
.
getPassword
());
druidDataSource
.
setUrl
(
properties
.
getUrl
());
SpringLiquibase
liquibase
=
new
SpringLiquibase
();
liquibase
.
setDataSource
(
druidDataSource
);
liquibase
.
setChangeLog
(
getChangelog
(
properties
.
getIsSyncDBSchema
(),
properties
.
getConf
()));
liquibase
.
setContexts
(
"development,test,production"
);
liquibase
.
setShouldRun
(
true
);
liquibase
.
setDefaultSchema
(
properties
.
getDefaultSchema
());
return
liquibase
;
}
/**
* 获取数据库差异文件
* @param isSyncDBSchema 是否同步表结构
* @param conf //liquibase配置文件
* @return
*/
private
String
getChangelog
(
String
isSyncDBSchema
,
String
conf
){
String
defaultChangelog
=
"classpath:liquibase/empty.xml"
;
if
((!
StringUtils
.
isEmpty
(
isSyncDBSchema
))&&(!
StringUtils
.
isEmpty
(
conf
))){
if
(
isSyncDBSchema
.
toLowerCase
().
equals
(
"true"
))
defaultChangelog
=
conf
;
}
return
defaultChangelog
;
}
}
\ No newline at end of file
ibzdict-dependencies/pom.xml
浏览文件 @
32da2eba
...
...
@@ -62,6 +62,9 @@
<!--Java Web Token-->
<jsonwebtoken-jjwt.version>
0.9.1
</jsonwebtoken-jjwt.version>
<!--Liquibase数据库版本更新工具-->
<liquibase.version>
3.6.3
</liquibase.version>
</properties>
<dependencyManagement>
...
...
@@ -216,6 +219,12 @@
<version>
${jsonwebtoken-jjwt.version}
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid-spring-boot-starter
</artifactId>
<version>
${alibaba-druid.version}
</version>
</dependency>
</dependencies>
</dependencyManagement>
...
...
@@ -263,6 +272,12 @@
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
<!-- 阿里Druid数据源 -->
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid-spring-boot-starter
</artifactId>
</dependency>
<!-- Error -->
<!-- Security -->
...
...
ibzdict-provider/ibzdict-provider-dictapi/src/main/java/cn/ibizlab/dictapi/rest/IBZDictItemResource.java
浏览文件 @
32da2eba
...
...
@@ -177,7 +177,7 @@ public class IBZDictItemResource {
@ApiOperation
(
value
=
"GetByIBZDict"
,
tags
=
{
"IBZDictItemByIBZDict"
},
notes
=
"GetByIBZDict"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/
dictapi/
ibzdicts/{ibzdict_id}/ibzdictitems/{ibzdictitem_id}"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/ibzdicts/{ibzdict_id}/ibzdictitems/{ibzdictitem_id}"
)
public
ResponseEntity
<
IBZDictItemDTO
>
getByIBZDict
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
,
@PathVariable
(
"ibzdictitem_id"
)
String
ibzdictitem_id
)
{
IBZDictItem
domain
=
ibzdictitemService
.
get
(
ibzdictitem_id
);
IBZDictItemDTO
dto
=
ibzdictitemMapping
.
toDto
(
domain
);
...
...
@@ -185,7 +185,7 @@ public class IBZDictItemResource {
}
@ApiOperation
(
value
=
"GetDraftByIBZDict"
,
tags
=
{
"IBZDictItemByIBZDict"
},
notes
=
"GetDraftByIBZDict"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/
dictapi/
ibzdicts/{ibzdict_id}/ibzdictitems/getdraft"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/ibzdicts/{ibzdict_id}/ibzdictitems/getdraft"
)
public
ResponseEntity
<
IBZDictItemDTO
>
getDraftByIBZDict
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
)
{
IBZDictItem
domain
=
new
IBZDictItem
();
domain
.
setDictid
(
ibzdict_id
);
...
...
@@ -193,7 +193,7 @@ public class IBZDictItemResource {
}
@ApiOperation
(
value
=
"SaveByIBZDict"
,
tags
=
{
"IBZDictItemByIBZDict"
},
notes
=
"SaveByIBZDict"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/
dictapi/
ibzdicts/{ibzdict_id}/ibzdictitems/save"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/ibzdicts/{ibzdict_id}/ibzdictitems/save"
)
public
ResponseEntity
<
Boolean
>
saveByIBZDict
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
,
@RequestBody
IBZDictItemDTO
ibzdictitemdto
)
{
IBZDictItem
domain
=
ibzdictitemMapping
.
toDomain
(
ibzdictitemdto
);
domain
.
setDictid
(
ibzdict_id
);
...
...
@@ -201,34 +201,34 @@ public class IBZDictItemResource {
}
@ApiOperation
(
value
=
"SaveBatchByIBZDict"
,
tags
=
{
"SaveBatchByIBZDict"
},
notes
=
"SaveBatchByIBZDict"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/
dictapi/
ibzdicts/{ibzdict_id}/ibzdictitems/savebatch"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/ibzdicts/{ibzdict_id}/ibzdictitems/savebatch"
)
public
ResponseEntity
<
Boolean
>
saveBatchByIBZDict
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
,
@RequestBody
List
<
IBZDictItemDTO
>
ibzdictitemdtos
)
{
ibzdictitemService
.
saveBatch
(
ibzdictitemMapping
.
toDomain
(
ibzdictitemdtos
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@ApiOperation
(
value
=
"CheckKeyByIBZDict"
,
tags
=
{
"IBZDictItemByIBZDict"
},
notes
=
"CheckKeyByIBZDict"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/
dictapi/
ibzdicts/{ibzdict_id}/ibzdictitems/checkkey"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/ibzdicts/{ibzdict_id}/ibzdictitems/checkkey"
)
public
ResponseEntity
<
Boolean
>
checkKeyByIBZDict
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
,
@RequestBody
IBZDictItemDTO
ibzdictitemdto
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
ibzdictitemService
.
checkKey
(
ibzdictitemMapping
.
toDomain
(
ibzdictitemdto
)));
}
@ApiOperation
(
value
=
"RemoveByIBZDict"
,
tags
=
{
"IBZDictItemByIBZDict"
},
notes
=
"RemoveByIBZDict"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/
dictapi/
ibzdicts/{ibzdict_id}/ibzdictitems/{ibzdictitem_id}"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/ibzdicts/{ibzdict_id}/ibzdictitems/{ibzdictitem_id}"
)
@Transactional
public
ResponseEntity
<
Boolean
>
removeByIBZDict
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
,
@PathVariable
(
"ibzdictitem_id"
)
String
ibzdictitem_id
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
ibzdictitemService
.
remove
(
ibzdictitem_id
));
}
@ApiOperation
(
value
=
"RemoveBatchByIBZDict"
,
tags
=
{
"RemoveBatchByIBZDict"
},
notes
=
"RemoveBatchByIBZDict"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/
dictapi/
ibzdicts/{ibzdict_id}/ibzdictitems/removebatch"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/ibzdicts/{ibzdict_id}/ibzdictitems/removebatch"
)
public
ResponseEntity
<
Boolean
>
removeBatchByIBZDict
(
@RequestBody
List
<
String
>
ids
)
{
ibzdictitemService
.
removeBatch
(
ids
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@ApiOperation
(
value
=
"CreateByIBZDict"
,
tags
=
{
"IBZDictItemByIBZDict"
},
notes
=
"CreateByIBZDict"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/
dictapi/
ibzdicts/{ibzdict_id}/ibzdictitems"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/ibzdicts/{ibzdict_id}/ibzdictitems"
)
@Transactional
public
ResponseEntity
<
IBZDictItemDTO
>
createByIBZDict
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
,
@RequestBody
IBZDictItemDTO
ibzdictitemdto
)
{
IBZDictItem
domain
=
ibzdictitemMapping
.
toDomain
(
ibzdictitemdto
);
...
...
@@ -239,14 +239,14 @@ public class IBZDictItemResource {
}
@ApiOperation
(
value
=
"createBatchByIBZDict"
,
tags
=
{
"createBatchByIBZDict"
},
notes
=
"createBatchByIBZDict"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/
dictapi/
ibzdicts/{ibzdict_id}/ibzdictitems/createbatch"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/ibzdicts/{ibzdict_id}/ibzdictitems/createbatch"
)
public
ResponseEntity
<
Boolean
>
createBatchByIBZDict
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
,
@RequestBody
List
<
IBZDictItemDTO
>
ibzdictitemdtos
)
{
ibzdictitemService
.
createBatch
(
ibzdictitemMapping
.
toDomain
(
ibzdictitemdtos
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@ApiOperation
(
value
=
"UpdateByIBZDict"
,
tags
=
{
"IBZDictItemByIBZDict"
},
notes
=
"UpdateByIBZDict"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/
dictapi/
ibzdicts/{ibzdict_id}/ibzdictitems/{ibzdictitem_id}"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/ibzdicts/{ibzdict_id}/ibzdictitems/{ibzdictitem_id}"
)
@Transactional
public
ResponseEntity
<
IBZDictItemDTO
>
updateByIBZDict
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
,
@PathVariable
(
"ibzdictitem_id"
)
String
ibzdictitem_id
,
@RequestBody
IBZDictItemDTO
ibzdictitemdto
)
{
IBZDictItem
domain
=
ibzdictitemMapping
.
toDomain
(
ibzdictitemdto
);
...
...
@@ -258,14 +258,14 @@ public class IBZDictItemResource {
}
@ApiOperation
(
value
=
"UpdateBatchByIBZDict"
,
tags
=
{
"UpdateBatchByIBZDict"
},
notes
=
"UpdateBatchByIBZDict"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/
dictapi/
ibzdicts/{ibzdict_id}/ibzdictitems/updatebatch"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/ibzdicts/{ibzdict_id}/ibzdictitems/updatebatch"
)
public
ResponseEntity
<
Boolean
>
updateBatchByIBZDict
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
,
@RequestBody
List
<
IBZDictItemDTO
>
ibzdictitemdtos
)
{
ibzdictitemService
.
updateBatch
(
ibzdictitemMapping
.
toDomain
(
ibzdictitemdtos
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@ApiOperation
(
value
=
"fetchDEFAULTByIBZDict"
,
tags
=
{
"IBZDictItemByIBZDict"
}
,
notes
=
"fetchDEFAULTByIBZDict"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/
dictapi/
ibzdicts/{ibzdict_id}/ibzdictitems/fetchdefault"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/ibzdicts/{ibzdict_id}/ibzdictitems/fetchdefault"
)
public
ResponseEntity
<
List
<
IBZDictItemDTO
>>
fetchIBZDictItemDefaultByIBZDict
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
,
IBZDictItemSearchContext
context
)
{
Page
<
IBZDictItem
>
domains
=
ibzdictitemService
.
searchDefault
(
context
)
;
List
<
IBZDictItemDTO
>
list
=
ibzdictitemMapping
.
toDto
(
domains
.
getContent
());
...
...
@@ -277,7 +277,7 @@ public class IBZDictItemResource {
}
@ApiOperation
(
value
=
"searchDEFAULTByIBZDict"
,
tags
=
{
"IBZDictItemByIBZDict"
}
,
notes
=
"searchDEFAULTByIBZDict"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/
dictapi/
ibzdicts/{ibzdict_id}/ibzdictitems/searchdefault"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/ibzdicts/{ibzdict_id}/ibzdictitems/searchdefault"
)
public
ResponseEntity
<
Page
<
IBZDictItemDTO
>>
searchIBZDictItemDefaultByIBZDict
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
,
IBZDictItemSearchContext
context
)
{
Page
<
IBZDictItem
>
domains
=
ibzdictitemService
.
searchDefault
(
context
)
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/domain/LiquibaseProp.java
0 → 100644
浏览文件 @
32da2eba
package
cn
.
ibizlab
.
util
.
domain
;
import
lombok.Data
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.stereotype.Component
;
@Component
@ConfigurationProperties
(
prefix
=
"spring.datasource.dynamic.datasource.master"
)
@Data
public
class
LiquibaseProp
{
private
String
url
;
private
String
username
;
private
String
password
;
private
String
isSyncDBSchema
;
private
String
defaultSchema
;
private
String
conf
;
}
\ No newline at end of file
ibzdict-util/src/main/resources/application-sys.yml
浏览文件 @
32da2eba
...
...
@@ -5,28 +5,36 @@ spring:
discovery
:
server-addr
:
172.16.102.211:8848
datasource
:
password
:
'
E6@8@7ce'
username
:
a_A_5ae9eb39a
url
:
jdbc:mysql://172.16.180.232:3306/a_A_5ae9eb39a?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true
driver-class-name
:
com.mysql.jdbc.Driver
filters
:
stat,wall,log4j2
#配置初始化大小/最小/最大
initial-size
:
1
min-idle
:
1
max-active
:
20
#获取连接等待超时时间
max-wait
:
60000
#间隔多久进行一次检测,检测需要关闭的空闲连接
time-between-eviction-runs-millis
:
60000
#一个连接在池中最小生存的时间
min-evictable-idle-time-millis
:
300000
validation-query
:
SELECT 1 FROM DUAL
test-while-idle
:
true
test-on-borrow
:
false
test-on-return
:
false
#打开PSCache,并指定每个连接上PSCache的大小。oracle设为true,mysql设为false。分库分表较多推荐设置为false
pool-prepared-statements
:
false
max-pool-prepared-statement-per-connection-size
:
20
dynamic
:
druid
:
#以下是全局默认值,可以全局更改
filters
:
stat,wall,log4j2
#配置初始化大小/最小/最大
initial-size
:
1
min-idle
:
1
max-active
:
20
#获取连接等待超时时间
max-wait
:
60000
#间隔多久进行一次检测,检测需要关闭的空闲连接
time-between-eviction-runs-millis
:
60000
#一个连接在池中最小生存的时间
min-evictable-idle-time-millis
:
300000
validation-query
:
SELECT 1 FROM DUAL
test-while-idle
:
true
test-on-borrow
:
false
test-on-return
:
false
#打开PSCache,并指定每个连接上PSCache的大小。oracle设为true,mysql设为false。分库分表较多推荐设置为false
pool-prepared-statements
:
false
max-pool-prepared-statement-per-connection-size
:
20
primary
:
master
#设置默认的数据源或者数据源组,默认值即为master
datasource
:
master
:
username
:
a_A_5ae9eb39a
password
:
'
E6@8@7ce'
url
:
jdbc:mysql://172.16.180.232:3306/a_A_5ae9eb39a?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true
driver-class-name
:
com.mysql.jdbc.Driver
isSyncDBSchema
:
false
defaultSchema
:
a_A_5ae9eb39a
conf
:
classpath:liquibase/master.xml
#Mybatis-plus配置
mybatis-plus
:
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录