Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzlite
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzlite
提交
d85166d0
提交
d85166d0
编写于
12月 07, 2020
作者:
Tyl666
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【Liquibase逆向工程】第三版 结构整合
上级
50c9e157
变更
4
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
22 行增加
和
77 行删除
+22
-77
DstDataSourceExService.java
...izlab/core/extensions/service/DstDataSourceExService.java
+12
-9
DstLiquibaseService.java
...ava/cn/ibizlab/core/lite/service/DstLiquibaseService.java
+10
-6
IDstLiquibaseService.java
...va/cn/ibizlab/core/lite/service/IDstLiquibaseService.java
+0
-15
DstLiquibaseServiceImpl.java
...izlab/core/lite/service/impl/DstLiquibaseServiceImpl.java
+0
-47
未找到文件。
ibzlite-core/src/main/java/cn/ibizlab/core/extensions/service/DstDataSourceExService.java
浏览文件 @
d85166d0
...
...
@@ -3,7 +3,7 @@ package cn.ibizlab.core.extensions.service;
import
cn.ibizlab.core.lite.extensions.domain.Setting
;
import
cn.ibizlab.core.lite.extensions.domain.SysModel
;
import
cn.ibizlab.core.lite.extensions.service.LiteCoreService
;
import
cn.ibizlab.core.lite.service.
I
DstLiquibaseService
;
import
cn.ibizlab.core.lite.service.DstLiquibaseService
;
import
cn.ibizlab.core.lite.service.impl.DstDataSourceServiceImpl
;
import
cn.ibizlab.util.domain.LiquibaseProp
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
...
...
@@ -12,7 +12,6 @@ import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import
com.baomidou.dynamic.datasource.creator.DataSourceCreator
;
import
com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
cn.ibizlab.core.util.config.GenerateLiquibaseChangeLog
;
import
lombok.extern.slf4j.Slf4j
;
import
cn.ibizlab.core.lite.domain.DstDataSource
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -45,7 +44,7 @@ public class DstDataSourceExService extends DstDataSourceServiceImpl {
public
LiteCoreService
liteCoreService
;
@Resource
public
I
DstLiquibaseService
dstLiquibaseService
;
public
DstLiquibaseService
dstLiquibaseService
;
/**
* [BuildDS:buildDS] 行为扩展
...
...
@@ -145,23 +144,27 @@ public class DstDataSourceExService extends DstDataSourceServiceImpl {
@Override
@Transactional
public
DstDataSource
initDS
(
DstDataSource
et
)
{
DstDataSource
ds
=
get
(
et
.
getDsId
());
DstDataSource
dstDataSource
=
buildDS
(
et
);
if
(
ObjectUtils
.
isEmpty
(
dstDataSource
)){
throw
new
BadRequestAlertException
(
"数据源不存在,请检查是否填写正确"
,
""
,
"ibzInit"
);
}
DstDataSource
ds
=
get
(
dstDataSource
.
getDsId
());
String
datasourceMessage
=
ds
.
getDsCfg
();
if
(
ObjectUtils
.
isEmpty
(
datasourceMessage
)){
throw
new
BadRequestAlertException
(
"数据源不能为空
!
"
,
""
,
"ibzInit"
);
throw
new
BadRequestAlertException
(
"数据源不能为空"
,
""
,
"ibzInit"
);
}
Map
datasourceMap
=
parseDatasource
(
datasourceMessage
);
if
(
ObjectUtils
.
isEmpty
(
datasourceMap
.
get
(
"username"
))){
throw
new
BadRequestAlertException
(
"数据源用户名不能为空
!
"
,
""
,
"ibzInit"
);
throw
new
BadRequestAlertException
(
"数据源用户名不能为空"
,
""
,
"ibzInit"
);
}
if
(
ObjectUtils
.
isEmpty
(
datasourceMap
.
get
(
"password"
))){
throw
new
BadRequestAlertException
(
"数据源密码不能为空
!
"
,
""
,
"ibzInit"
);
throw
new
BadRequestAlertException
(
"数据源密码不能为空"
,
""
,
"ibzInit"
);
}
if
(
ObjectUtils
.
isEmpty
(
datasourceMap
.
get
(
"url"
))){
throw
new
BadRequestAlertException
(
"数据源地址不能为空
!
"
,
""
,
"ibzInit"
);
throw
new
BadRequestAlertException
(
"数据源地址不能为空"
,
""
,
"ibzInit"
);
}
if
(
ObjectUtils
.
isEmpty
(
datasourceMap
.
get
(
"defaultSchema"
))){
throw
new
BadRequestAlertException
(
"数据源默认数据库不能为空
!
"
,
""
,
"ibzInit"
);
throw
new
BadRequestAlertException
(
"数据源默认数据库不能为空"
,
""
,
"ibzInit"
);
}
LiquibaseProp
lp
=
new
LiquibaseProp
();
lp
.
setUsername
(
datasourceMap
.
get
(
"username"
)
==
null
?
""
:
datasourceMap
.
get
(
"username"
).
toString
());
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/
util/config/GenerateLiquibaseChangeLog
.java
→
ibzlite-core/src/main/java/cn/ibizlab/core/
lite/service/DstLiquibaseService
.java
浏览文件 @
d85166d0
package
cn
.
ibizlab
.
core
.
util
.
config
;
package
cn
.
ibizlab
.
core
.
lite
.
service
;
import
cn.hutool.core.util.ObjectUtil
;
...
...
@@ -7,6 +7,7 @@ import cn.hutool.json.XML;
import
cn.ibizlab.core.lite.domain.MetaField
;
import
cn.ibizlab.core.lite.extensions.domain.MetaEntityModel
;
import
cn.ibizlab.core.lite.extensions.domain.SysModel
;
import
cn.ibizlab.core.util.config.LiquibaseConfiguration
;
import
cn.ibizlab.util.domain.LiquibaseProp
;
import
com.alibaba.fastjson.JSON
;
import
liquibase.Liquibase
;
...
...
@@ -25,9 +26,7 @@ import lombok.SneakyThrows;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.IOUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.liquibase.LiquibaseDataSource
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.DigestUtils
;
import
javax.annotation.Resource
;
...
...
@@ -41,8 +40,9 @@ import java.util.*;
import
java.util.concurrent.CopyOnWriteArrayList
;
@Slf4j
@Configuration
public
class
GenerateLiquibaseChangeLog
{
@Service
(
"DstLiquibaseService"
)
public
class
DstLiquibaseService
{
private
boolean
ignoreClasspathPrefix
=
true
;
protected
String
contexts
;
...
...
@@ -81,6 +81,10 @@ public class GenerateLiquibaseChangeLog{
@Resource
public
LiquibaseConfiguration
liquibaseConfiguration
;
public
SysModel
generateLiquibase
(
LiquibaseProp
liquibaseProp
,
String
name
)
{
SysModel
sysModel
=
liquibaseGenerateChangeLog
(
liquibaseProp
,
name
);
return
sysModel
;
}
@SneakyThrows
public
SysModel
liquibaseGenerateChangeLog
(
LiquibaseProp
liquibaseProp
,
String
name
){
// 根据指定数据源生成对象
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/lite/service/IDstLiquibaseService.java
已删除
100644 → 0
浏览文件 @
50c9e157
package
cn
.
ibizlab
.
core
.
lite
.
service
;
import
cn.ibizlab.core.lite.extensions.domain.SysModel
;
import
cn.ibizlab.util.domain.LiquibaseProp
;
public
interface
IDstLiquibaseService
{
SysModel
generateLiquibase
(
LiquibaseProp
liquibaseProp
,
String
name
);
}
ibzlite-core/src/main/java/cn/ibizlab/core/lite/service/impl/DstLiquibaseServiceImpl.java
已删除
100644 → 0
浏览文件 @
50c9e157
package
cn
.
ibizlab
.
core
.
lite
.
service
.
impl
;
import
cn.ibizlab.core.lite.domain.DstConfig
;
import
cn.ibizlab.core.lite.extensions.domain.SysModel
;
import
cn.ibizlab.core.lite.extensions.service.LiteCoreService
;
import
cn.ibizlab.core.lite.filter.DstConfigSearchContext
;
import
cn.ibizlab.core.lite.mapper.DstConfigMapper
;
import
cn.ibizlab.core.lite.service.IDstConfigService
;
import
cn.ibizlab.core.lite.service.IDstLiquibaseService
;
import
cn.ibizlab.core.util.config.GenerateLiquibaseChangeLog
;
import
cn.ibizlab.util.domain.LiquibaseProp
;
import
cn.ibizlab.util.helper.CachedBeanCopier
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.ObjectUtils
;
import
javax.annotation.Resource
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
@Slf4j
@Service
(
"DstLiquibaseServiceImpl"
)
public
class
DstLiquibaseServiceImpl
extends
ServiceImpl
<
DstConfigMapper
,
DstConfig
>
implements
IDstLiquibaseService
{
@Resource
public
GenerateLiquibaseChangeLog
generateLiquibaseChangeLog
;
@Override
public
SysModel
generateLiquibase
(
LiquibaseProp
liquibaseProp
,
String
name
)
{
SysModel
sysModel
=
generateLiquibaseChangeLog
.
liquibaseGenerateChangeLog
(
liquibaseProp
,
name
);
return
sysModel
;
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录