Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzlite
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzlite
提交
065bc20e
提交
065bc20e
编写于
11月 29, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
repair
上级
7f802de5
变更
9
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
81 行增加
和
39 行删除
+81
-39
DstDataSourceExService.java
...izlab/core/extensions/service/DstDataSourceExService.java
+53
-29
DataObj.java
.../java/cn/ibizlab/core/lite/extensions/domain/DataObj.java
+2
-1
EntityObj.java
...ava/cn/ibizlab/core/lite/extensions/domain/EntityObj.java
+5
-0
ModelObj.java
...java/cn/ibizlab/core/lite/extensions/domain/ModelObj.java
+13
-2
Property.java
.../java/cn/ibizlab/core/lite/extensions/model/Property.java
+1
-2
DbEntityService.java
...ibizlab/core/lite/extensions/service/DbEntityService.java
+2
-2
DbEntityMapper.xml
...rc/main/resources/mapper/lite/dbentity/DbEntityMapper.xml
+1
-1
LiteCoreResource.java
...java/cn/ibizlab/api/rest/extensions/LiteCoreResource.java
+3
-1
QueryFilter.java
...til/src/main/java/cn/ibizlab/util/filter/QueryFilter.java
+1
-1
未找到文件。
ibzlite-core/src/main/java/cn/ibizlab/core/extensions/service/DstDataSourceExService.java
浏览文件 @
065bc20e
...
...
@@ -5,6 +5,8 @@ import cn.ibizlab.core.lite.service.IDstDataSourceService;
import
cn.ibizlab.core.lite.service.impl.DstDataSourceServiceImpl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.baomidou.dynamic.datasource.DynamicRoutingDataSource
;
import
com.baomidou.dynamic.datasource.creator.BasicDataSourceCreator
;
import
com.baomidou.dynamic.datasource.creator.DataSourceCreator
;
import
com.baomidou.dynamic.datasource.creator.DruidDataSourceCreator
;
import
com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
...
...
@@ -43,26 +45,30 @@ public class DstDataSourceExService extends DstDataSourceServiceImpl {
public
DstDataSource
buildDS
(
DstDataSource
dstDataSource
)
{
if
(!(
StringUtils
.
isEmpty
(
dstDataSource
.
getDsCfg
())))
{
synchronized
(
lock
)
{
DataSourceProperty
dataSourceProperty
=
new
DataSourceProperty
();
DynamicRoutingDataSource
ds
=
dataSource
;
List
<
Setting
>
settings
=
JSONArray
.
parseArray
(
dstDataSource
.
getDsCfg
(),
Setting
.
class
);
for
(
Setting
setting:
settings
)
List
<
Setting
>
settings
=
JSONArray
.
parseArray
(
dstDataSource
.
getDsCfg
(),
Setting
.
class
);
for
(
Setting
setting
:
settings
)
{
if
(
setting
.
getProperty
().
equalsIgnoreCase
(
"driver-class-name"
))
if
(
setting
.
getProperty
().
equalsIgnoreCase
(
"driver-class-name"
))
dataSourceProperty
.
setDriverClassName
(
setting
.
getValue
());
else
if
(
setting
.
getProperty
().
equalsIgnoreCase
(
"username"
))
else
if
(
setting
.
getProperty
().
equalsIgnoreCase
(
"username"
))
dataSourceProperty
.
setUsername
(
setting
.
getValue
());
else
if
(
setting
.
getProperty
().
equalsIgnoreCase
(
"password"
))
else
if
(
setting
.
getProperty
().
equalsIgnoreCase
(
"password"
))
dataSourceProperty
.
setPassword
(
setting
.
getValue
());
else
if
(
setting
.
getProperty
().
equalsIgnoreCase
(
"url"
))
else
if
(
setting
.
getProperty
().
equalsIgnoreCase
(
"url"
))
dataSourceProperty
.
setUrl
(
setting
.
getValue
());
else
if
(
setting
.
getProperty
().
equalsIgnoreCase
(
"defaultSchema"
))
else
if
(
setting
.
getProperty
().
equalsIgnoreCase
(
"defaultSchema"
))
dataSourceProperty
.
setSchema
(
setting
.
getValue
());
}
DataSource
dataSource
=
druidDataSourceCreator
.
createDataSource
(
dataSourceProperty
);
DataSource
dataSource
=
BasicDataSourceCreator
.
getInstance
()
.
createDataSource
(
dataSourceProperty
);
ds
.
addDataSource
(
dstDataSource
.
getDsName
(),
dataSource
);
check
.
put
(
dstDataSource
.
getDsName
(),
1
);
}
}
return
super
.
buildDS
(
dstDataSource
);
...
...
@@ -77,29 +83,47 @@ public class DstDataSourceExService extends DstDataSourceServiceImpl {
private
DruidDataSourceCreator
druidDataSourceCreator
;
private
HashMap
<
String
,
Integer
>
check
=
new
HashMap
<>();
private
Object
lock
=
new
Object
();
public
void
initDataSource
(
String
dsName
)
{
// if(dataSource.getDataSource(dsName)==null
)
synchronized
(
lock
)
{
if
(
check
.
containsKey
(
dsName
))
return
;
}
DstDataSource
dstDataSource
=
this
.
getOne
(
Wrappers
.<
DstDataSource
>
lambdaQuery
().
eq
(
DstDataSource:
:
getDsId
,
dsName
).
or
().
eq
(
DstDataSource:
:
getDsName
,
dsName
),
false
);
if
(
dstDataSource
!=
null
)
{
dstDataSource
.
setDsName
(
dsName
);
buildDS
(
dstDataSource
);
}
}
}
@Override
public
boolean
update
(
DstDataSource
et
)
{
if
(!
super
.
update
(
et
))
return
false
;
synchronized
(
lock
)
{
DynamicRoutingDataSource
ds
=
(
DynamicRoutingDataSource
)
dataSource
;
if
(
ds
.
getDataSource
(
et
.
getDsId
())!=
null
)
if
(
check
.
containsKey
(
et
.
getDsId
()))
{
ds
.
removeDataSource
(
et
.
getDsId
());
if
(
ds
.
getDataSource
(
et
.
getDsName
())!=
null
)
check
.
remove
(
et
.
getDsId
());
}
if
(
check
.
containsKey
(
et
.
getDsName
()))
{
ds
.
removeDataSource
(
et
.
getDsName
());
check
.
remove
(
et
.
getDsName
());
}
}
buildDS
(
et
);
return
true
;
}
}
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/DataObj.java
浏览文件 @
065bc20e
...
...
@@ -37,7 +37,8 @@ public class DataObj<K,V> extends ConcurrentHashMap<K,V> {
public
<
T
>
T
set
(
String
key
,
V
value
)
{
return
(
T
)
this
.
put
((
K
)
key
.
toUpperCase
(),
value
);
this
.
put
((
K
)
key
.
toUpperCase
(),
value
);
return
(
T
)
this
;
}
@Override
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/EntityObj.java
浏览文件 @
065bc20e
...
...
@@ -99,6 +99,11 @@ public class EntityObj extends DataObj<String,Object> {
return
this
.
set
(
"_DSTSYSTEMID"
,
dstSystemId
);
}
@Override
public
EntityObj
set
(
String
key
,
Object
value
)
{
return
super
.
set
(
key
,
value
);
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/ModelObj.java
浏览文件 @
065bc20e
...
...
@@ -46,7 +46,7 @@ public class ModelObj extends DataObj<String,Object> {
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
Entity
Obj
setDataModelId
(
String
dataModelId
)
public
Model
Obj
setDataModelId
(
String
dataModelId
)
{
return
this
.
set
(
"_DATAMODELID"
,
dataModelId
);
}
...
...
@@ -144,7 +144,11 @@ public class ModelObj extends DataObj<String,Object> {
DataModel
model
=
this
.
getDataModel
().
getNestedDataModel
(
name
);
if
(
model
!=
null
)
return
new
NestedArray
().
setParent
(
this
);
{
NestedArray
array
=
new
NestedArray
().
setParent
(
this
);
this
.
set
(
model
.
getDataModelName
(),
array
);
return
array
;
}
if
(
recursion
)
{
...
...
@@ -158,6 +162,7 @@ public class ModelObj extends DataObj<String,Object> {
tmpModel
=
model
.
getParentDataModel
();
steps
.
add
(
0
,
tmpModel
.
getDataModelName
());
}
steps
.
add
(
model
.
getDataModelName
());
if
(
steps
.
size
()>
1
)
{
...
...
@@ -198,6 +203,12 @@ public class ModelObj extends DataObj<String,Object> {
return
super
.
get
(
key
);
}
@Override
public
ModelObj
set
(
String
key
,
Object
value
)
{
return
super
.
set
(
key
,
value
);
}
@Override
public
String
getRowKey
()
{
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/model/Property.java
浏览文件 @
065bc20e
...
...
@@ -138,7 +138,6 @@ public class Property {
{
if
(!
StringUtils
.
isEmpty
(
cond
))
cond
+=
","
;
else
cond
+=
val
;
}
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/service/DbEntityService.java
浏览文件 @
065bc20e
...
...
@@ -100,8 +100,8 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl
FieldModel
lastModifyField
=
entityModel
.
getLastModifyField
();
QueryFilter
filter
=
new
QueryFilter
();
//
if(lastModifyField!=null)
//
filter.ge(lastModifyField.getColumnName(), lastModify);
if
(
lastModifyField
!=
null
)
filter
.
ge
(
lastModifyField
.
getColumnName
(),
lastModify
);
List
<
EntityObj
>
kEntityObjs
=
this
.
selectCore
(
entityModel
,
filter
);
...
...
ibzlite-core/src/main/resources/mapper/lite/dbentity/DbEntityMapper.xml
浏览文件 @
065bc20e
...
...
@@ -3,7 +3,7 @@
<mapper
namespace=
"cn.ibizlab.core.extensions.mapper.DbEntityMapper"
>
<!--数据集合[Default]-->
<select
id=
"search
Default
"
parameterType=
"cn.ibizlab.core.lite.extensions.filter.DbEntitySearchContext"
resultType=
"cn.ibizlab.core.lite.extensions.domain.EntityObj"
>
<select
id=
"search"
parameterType=
"cn.ibizlab.core.lite.extensions.filter.DbEntitySearchContext"
resultType=
"cn.ibizlab.core.lite.extensions.domain.EntityObj"
>
${sql}
<where><if
test=
"ew!=null and ew.sqlSegment!=null and !ew.emptyOfWhere"
>
${ew.sqlSegment}
</if></where>
<if
test=
"ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere"
>
${ew.sqlSegment}
</if>
...
...
ibzlite-provider/ibzlite-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/LiteCoreResource.java
浏览文件 @
065bc20e
...
...
@@ -56,7 +56,9 @@ public class LiteCoreResource {
if
(
StringUtils
.
isEmpty
(
modelid
))
modelid
=
"dataModelff8080816a8b510c016a8c2f18b10001"
;
return
ResponseEntity
.
ok
(
dbEntityService
.
getModelObjs
(
modelid
,
DataObject
.
getBeginDate
()));
List
<
ModelObj
>
list
=
dbEntityService
.
getModelObjs
(
modelid
,
DataObject
.
getBeginDate
());
return
ResponseEntity
.
ok
(
list
);
}
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/lite/{system}/entitys"
)
...
...
ibzlite-util/src/main/java/cn/ibizlab/util/filter/QueryFilter.java
浏览文件 @
065bc20e
...
...
@@ -130,7 +130,7 @@ public class QueryFilter {
public
QueryFilter
cust
(
String
custSqlSegment
)
{
this
.
custSqlSegment
=
custSqlSegment
;
return
null
;
return
this
;
}
@JsonIgnore
@Transient
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录