Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzlite
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzlite
提交
b07d248e
提交
b07d248e
编写于
9月 18, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
app
上级
3ea1cdc8
变更
11
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
530 行增加
和
2 行删除
+530
-2
DstSystem.java
.../src/main/java/cn/ibizlab/core/lite/domain/DstSystem.java
+21
-2
PermissionNode.java
...n/ibizlab/core/lite/extensions/domain/PermissionNode.java
+38
-0
PermissionType.java
...n/ibizlab/core/lite/extensions/domain/PermissionType.java
+6
-0
AppNode.java
...bizlab/core/lite/extensions/domain/Structure/AppNode.java
+18
-0
EntityNode.java
...lab/core/lite/extensions/domain/Structure/EntityNode.java
+30
-0
FuncItem.java
...izlab/core/lite/extensions/domain/Structure/FuncItem.java
+14
-0
MenuNode.java
...izlab/core/lite/extensions/domain/Structure/MenuNode.java
+18
-0
UniResNode.java
...lab/core/lite/extensions/domain/Structure/UniResNode.java
+10
-0
SysStructure.java
.../cn/ibizlab/core/lite/extensions/domain/SysStructure.java
+212
-0
DstAppService.java
...n/ibizlab/core/lite/extensions/service/DstAppService.java
+124
-0
LiteModelService.java
...bizlab/core/lite/extensions/service/LiteModelService.java
+39
-0
未找到文件。
ibzlite-core/src/main/java/cn/ibizlab/core/lite/domain/DstSystem.java
浏览文件 @
b07d248e
...
...
@@ -9,7 +9,9 @@ import java.util.HashMap;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
cn.ibizlab.core.lite.domain.handlers.DstAppTypeHandler
;
import
cn.ibizlab.core.lite.extensions.domain.SysModel
;
import
cn.ibizlab.core.lite.extensions.domain.SysStructure
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
...
...
@@ -65,7 +67,16 @@ public class DstSystem extends EntityMP implements Serializable {
@TableField
(
value
=
"sysstructure"
,
typeHandler
=
JacksonTypeHandler
.
class
)
@JSONField
(
name
=
"sysstructure"
)
@JsonProperty
(
"sysstructure"
)
private
SysModel
sysstructure
;
private
SysStructure
sysstructure
;
/**
* 结构
*/
@TableField
(
value
=
"apps"
,
typeHandler
=
DstAppTypeHandler
.
class
)
@JSONField
(
name
=
"apps"
)
@JsonProperty
(
"apps"
)
private
List
<
DstApp
>
apps
;
/**
* 校验
*/
...
...
@@ -94,11 +105,19 @@ public class DstSystem extends EntityMP implements Serializable {
/**
* 设置 [结构]
*/
public
void
setSysstructure
(
Sys
Model
sysstructure
){
public
void
setSysstructure
(
Sys
Structure
sysstructure
){
this
.
sysstructure
=
sysstructure
;
this
.
modify
(
"sysstructure"
,
sysstructure
);
}
/**
* 设置 [APPS]
*/
public
void
setApps
(
List
<
DstApp
>
apps
){
this
.
apps
=
apps
;
this
.
modify
(
"apps"
,
apps
);
}
/**
* 设置 [校验]
*/
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/PermissionNode.java
0 → 100644
浏览文件 @
b07d248e
package
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.ArrayList
;
import
java.util.List
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
PermissionNode
{
private
String
id
;
private
String
label
;
private
String
systemid
;
private
List
<
PermissionNode
>
children
=
new
ArrayList
<>();
private
String
fullName
;
private
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
.
PermissionType
type
;
public
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
.
PermissionNode
setUniKey
(
String
systemid
,
String
id
)
{
this
.
systemid
=
systemid
;
this
.
id
=
systemid
+
"-"
+
id
;
return
this
;
}
public
List
<
PermissionNode
>
getChildren
()
{
if
(
children
==
null
)
children
=
new
ArrayList
<>();
return
children
;
}
}
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/PermissionType.java
0 → 100644
浏览文件 @
b07d248e
package
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
;
public
enum
PermissionType
{
OPPRIV
,
UNIRES
,
APPMENU
}
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/Structure/AppNode.java
0 → 100644
浏览文件 @
b07d248e
package
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
.
Structure
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
AppNode
{
private
String
appid
;
private
String
appname
;
@JsonProperty
(
"appmenu"
)
@JSONField
(
name
=
"appmenu"
)
private
List
<
MenuNode
>
appmenus
;
}
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/Structure/EntityNode.java
0 → 100644
浏览文件 @
b07d248e
package
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
.
Structure
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
EntityNode
{
private
String
dename
;
private
String
delogicname
;
@JsonProperty
(
"sysmoudle"
)
@JSONField
(
name
=
"sysmoudle"
)
private
FuncItem
moudle
;
@JsonProperty
(
"dedataset"
)
@JSONField
(
name
=
"dedataset"
)
private
List
<
FuncItem
>
dataSets
;
@JsonProperty
(
"deaction"
)
@JSONField
(
name
=
"deaction"
)
private
List
<
FuncItem
>
actions
;
@JsonProperty
(
"datascope"
)
@JSONField
(
name
=
"datascope"
)
private
List
<
FuncItem
>
scopes
;
}
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/Structure/FuncItem.java
0 → 100644
浏览文件 @
b07d248e
package
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
.
Structure
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
FuncItem
{
private
String
id
;
private
String
name
;
private
String
type
;
private
List
<
FuncItem
>
items
;
}
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/Structure/MenuNode.java
0 → 100644
浏览文件 @
b07d248e
package
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
.
Structure
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
MenuNode
{
private
String
menuid
;
private
String
menuname
;
@JsonProperty
(
"menuitem"
)
@JSONField
(
name
=
"menuitem"
)
private
List
<
FuncItem
>
menuitems
;
}
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/Structure/UniResNode.java
0 → 100644
浏览文件 @
b07d248e
package
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
.
Structure
;
import
lombok.Data
;
@Data
public
class
UniResNode
{
private
String
unirescode
;
private
String
uniresname
;
}
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/SysStructure.java
0 → 100644
浏览文件 @
b07d248e
package
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
;
import
cn.ibizlab.core.lite.domain.DstApp
;
import
cn.ibizlab.core.lite.extensions.domain.Structure.AppNode
;
import
cn.ibizlab.core.lite.extensions.domain.Structure.EntityNode
;
import
cn.ibizlab.core.lite.extensions.domain.Structure.FuncItem
;
import
cn.ibizlab.core.lite.extensions.domain.Structure.UniResNode
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Data
;
import
java.sql.Timestamp
;
import
java.util.*
;
@Data
public
class
SysStructure
{
private
String
systemid
;
@JsonIgnore
private
String
systemname
;
private
List
<
EntityNode
>
entities
;
@JsonProperty
(
"unires"
)
@JSONField
(
name
=
"unires"
)
private
List
<
UniResNode
>
uniResIds
;
@JsonProperty
(
"appmenus"
)
@JSONField
(
name
=
"appmenus"
)
private
List
<
AppNode
>
apps
;
public
PermissionNode
getPermissionTree
(
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
.
PermissionType
type
)
{
PermissionNode
root
=
PermissionNode
.
builder
().
id
(
systemid
).
label
(
systemname
).
systemid
(
systemid
).
build
();
switch
(
type
)
{
case
OPPRIV:
Map
<
String
,
PermissionNode
>
moudlemap
=
new
LinkedHashMap
<>();
PermissionNode
emptyMoudle
=
PermissionNode
.
builder
().
label
(
"未分类模块"
).
build
().
setUniKey
(
systemid
,
"Ungroup"
);
for
(
EntityNode
node:
this
.
entities
)
{
PermissionNode
moudle
=
null
;
if
(
node
.
getMoudle
()!=
null
)
{
if
(
moudlemap
.
containsKey
(
systemid
+
"-"
+
node
.
getMoudle
().
getId
()))
moudle
=
moudlemap
.
get
(
systemid
+
"-"
+
node
.
getMoudle
().
getId
());
else
{
moudle
=
PermissionNode
.
builder
()
.
label
(
node
.
getMoudle
().
getName
()).
build
()
.
setUniKey
(
systemid
,
node
.
getMoudle
().
getId
());
moudlemap
.
put
(
moudle
.
getId
(),
moudle
);
}
}
else
{
moudle
=
emptyMoudle
;
moudlemap
.
put
(
"Ungroup"
,
moudle
);
}
PermissionNode
enode
=
PermissionNode
.
builder
()
.
label
(
node
.
getDelogicname
()).
build
()
.
setUniKey
(
systemid
,
node
.
getDename
());
moudle
.
getChildren
().
add
(
enode
);
if
(
node
.
getDataSets
()!=
null
)
node
.
getDataSets
().
forEach
(
dataset
->{
String
datasetname
=
dataset
.
getName
();
if
(
datasetname
.
toUpperCase
().
equals
(
"DEFAULT"
))
datasetname
=
""
;
datasetname
=
"查询"
+
datasetname
+
"数据"
;
String
fullname
=
systemid
+
"/操作能力/"
+
enode
.
getLabel
()+
"/"
+
datasetname
;
PermissionNode
dataSetNode
=
PermissionNode
.
builder
()
.
label
(
datasetname
).
type
(
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
.
PermissionType
.
OPPRIV
).
fullName
(
fullname
).
build
()
.
setUniKey
(
systemid
,
node
.
getDename
()+
"-search"
+
dataset
.
getId
()+
"-all"
);
enode
.
getChildren
().
add
(
dataSetNode
);
});
if
(
node
.
getActions
()!=
null
)
{
node
.
getActions
().
forEach
(
action
->
{
String
actionname
=
action
.
getName
();
if
(
action
.
getId
().
toUpperCase
().
equals
(
"CREATE"
))
actionname
=
"新建"
;
else
if
(
action
.
getId
().
toUpperCase
().
equals
(
"UPDATE"
))
actionname
=
"修改"
;
else
if
(
action
.
getId
().
toUpperCase
().
equals
(
"REMOVE"
))
actionname
=
"删除"
;
else
if
(
action
.
getId
().
toUpperCase
().
equals
(
"SAVE"
))
actionname
=
"保存"
;
else
if
(
action
.
getId
().
toUpperCase
().
equals
(
"GET"
))
actionname
=
"查看"
;
else
if
(
action
.
getId
().
toUpperCase
().
equals
(
"CHECKKEY"
)
||
action
.
getId
().
toUpperCase
().
equals
(
"GETDRAFT"
)
||
action
.
getId
().
toUpperCase
().
indexOf
(
"BATCH"
)
>
0
)
return
;
if
(
node
.
getScopes
()
==
null
||
node
.
getScopes
().
size
()
<=
1
)
{
String
fullname
=
systemid
+
"/操作能力/"
+
enode
.
getLabel
()+
"/"
+
actionname
+
"任意数据"
;
enode
.
getChildren
().
add
(
PermissionNode
.
builder
()
.
label
(
actionname
).
type
(
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
.
PermissionType
.
OPPRIV
)
.
fullName
(
fullname
).
build
()
.
setUniKey
(
systemid
,
node
.
getDename
()
+
"-"
+
action
.
getId
()
+
"-all"
));
}
else
{
PermissionNode
actionNode
=
PermissionNode
.
builder
()
.
label
(
actionname
).
build
()
.
setUniKey
(
systemid
,
enode
.
getId
()
+
"-"
+
action
.
getId
());
final
String
preFullname
=
systemid
+
"/操作能力/"
+
enode
.
getLabel
()+
"/"
+
actionname
;
node
.
getScopes
().
forEach
(
scope
->
{
String
scopename
=
scope
.
getName
();
if
(
scope
.
getId
().
equals
(
"all"
))
scopename
=
"任意数据"
;
else
if
(
scope
.
getId
().
equals
(
"createman"
))
{
if
(
action
.
getId
().
toUpperCase
().
equals
(
"CREATE"
))
return
;
scopename
=
"本人创建的数据"
;
}
else
if
(
scope
.
getId
().
equals
(
"curorg"
))
scopename
=
"本单位的数据"
;
else
if
(
scope
.
getId
().
equals
(
"curorgdept"
))
scopename
=
"本部门的数据"
;
else
if
(
scope
.
getId
().
equals
(
"sorg"
))
scopename
=
"本单位及下辖全部单位数据"
;
else
if
(
scope
.
getId
().
equals
(
"curorgdept"
))
scopename
=
"本部门及下辖部门的数据"
;
else
return
;
actionNode
.
getChildren
().
add
(
PermissionNode
.
builder
()
.
label
(
scopename
).
type
(
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
.
PermissionType
.
OPPRIV
)
.
fullName
(
preFullname
+
scopename
).
build
()
.
setUniKey
(
systemid
,
node
.
getDename
()
+
"-"
+
action
.
getId
()
+
"-"
+
scope
.
getId
()));
});
enode
.
getChildren
().
add
(
actionNode
);
}
});
}
}
moudlemap
.
values
().
forEach
(
moudle
->
root
.
getChildren
().
add
(
moudle
));
break
;
case
UNIRES:
if
(
this
.
getUniResIds
()!=
null
)
{
this
.
getUniResIds
().
forEach
(
uniRes
->{
root
.
getChildren
().
add
(
PermissionNode
.
builder
()
.
label
(
uniRes
.
getUniresname
()).
type
(
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
.
PermissionType
.
UNIRES
)
.
fullName
(
systemid
+
"/自定义资源/"
+
uniRes
.
getUniresname
()).
build
()
.
setUniKey
(
systemid
,
uniRes
.
getUnirescode
()));
});
}
break
;
case
APPMENU:
if
(
this
.
getApps
()!=
null
)
{
this
.
getApps
().
forEach
(
app
->{
if
(
app
.
getAppmenus
()!=
null
)
{
app
.
getAppmenus
().
forEach
(
appmenu
->{
PermissionNode
appMenuNode
=
PermissionNode
.
builder
()
.
label
(
"应用-"
+
app
.
getAppname
()+
"菜单-"
+
appmenu
.
getMenuname
()).
build
()
.
setUniKey
(
systemid
,
app
.
getAppid
()+
"-"
+
appmenu
.
getMenuid
());
if
(
appmenu
.
getMenuitems
()!=
null
)
{
appmenu
.
getMenuitems
().
forEach
(
item
->{
appMenuNode
.
getChildren
().
add
(
loopMenuItem
(
app
.
getAppid
(),
appmenu
.
getMenuid
(),
systemid
+
"/菜单/"
+
app
.
getAppname
()+
appmenu
.
getMenuname
(),
item
));
});
}
root
.
getChildren
().
add
(
appMenuNode
);
});
}
});
}
break
;
}
return
root
;
}
private
PermissionNode
loopMenuItem
(
String
appId
,
String
menuId
,
String
fullName
,
FuncItem
item
)
{
fullName
=
fullName
+
"/"
+
item
.
getName
();
PermissionNode
itemNode
=
PermissionNode
.
builder
().
label
(
item
.
getName
()).
fullName
(
fullName
).
type
(
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
.
PermissionType
.
APPMENU
).
build
().
setUniKey
(
systemid
,
appId
+
"-"
+
menuId
+
"-"
+
item
.
getId
());
if
(
item
.
getItems
()!=
null
)
{
final
String
fname
=
fullName
;
item
.
getItems
().
forEach
(
sub
->{
itemNode
.
getChildren
().
add
(
loopMenuItem
(
appId
,
menuId
,
fname
,
sub
));
});
}
return
itemNode
;
}
public
List
<
DstApp
>
getSysApps
(
boolean
web
)
{
List
<
DstApp
>
apps
=
new
ArrayList
<>();
if
(
this
.
getApps
()
==
null
)
return
apps
;
this
.
getApps
().
forEach
(
app
->
{
DstApp
sysApp
=
DstApp
.
builder
()
.
label
(
app
.
getAppname
()).
systemid
(
systemid
).
id
(
systemid
.
toLowerCase
()+
"-"
+
app
.
getAppid
().
toLowerCase
()).
build
();
apps
.
add
(
sysApp
);
});
return
apps
;
}
}
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/service/DstAppService.java
0 → 100644
浏览文件 @
b07d248e
package
cn
.
ibizlab
.
core
.
lite
.
extensions
.
service
;
import
cn.ibizlab.core.lite.domain.DstApp
;
import
cn.ibizlab.core.lite.domain.DstSystem
;
import
cn.ibizlab.core.lite.extensions.domain.PermissionType
;
import
cn.ibizlab.core.lite.filter.DstAppSearchContext
;
import
cn.ibizlab.core.lite.service.IDstSystemService
;
import
cn.ibizlab.core.lite.service.impl.DstAppServiceImpl
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
cn.ibizlab.util.helper.CachedBeanCopier
;
import
cn.ibizlab.util.security.AuthenticationUser
;
import
cn.ibizlab.util.service.IBZConfigService
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.nacos.api.naming.NamingFactory
;
import
com.alibaba.nacos.api.naming.NamingService
;
import
com.alibaba.nacos.api.naming.pojo.Instance
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.security.core.authority.AuthorityUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.*
;
@Primary
@Service
public
class
DstAppService
extends
DstAppServiceImpl
{
@Autowired
private
IDstSystemService
sysPSSystemService
;
@Autowired
private
LiteModelService
liteModelService
;
@Override
public
DstApp
get
(
String
key
)
{
String
systemId
=
key
.
split
(
"-"
)[
0
];
DstSystem
sysPSSystem
=
sysPSSystemService
.
getById
(
systemId
);
if
(
sysPSSystem
!=
null
&&
sysPSSystem
.
getApps
()!=
null
)
{
for
(
DstApp
app:
sysPSSystem
.
getApps
())
{
if
(
app
.
getId
().
equals
(
key
))
return
app
;
}
}
return
null
;
}
@Override
public
boolean
save
(
DstApp
et
)
{
if
(
StringUtils
.
isEmpty
(
et
.
getSystemid
())||
StringUtils
.
isEmpty
(
et
.
getId
()))
throw
new
BadRequestAlertException
(
"应用参数缺失"
,
"DstApp"
,
et
.
getId
());
DstSystem
sysPSSystem
=
sysPSSystemService
.
getById
(
et
.
getSystemid
());
if
(
sysPSSystem
!=
null
&&
sysPSSystem
.
getApps
()!=
null
)
{
boolean
bchange
=
false
;
for
(
DstApp
app:
sysPSSystem
.
getApps
())
{
if
(
app
.
getId
().
equals
(
et
.
getId
()))
{
CachedBeanCopier
.
copy
(
et
,
app
);
bchange
=
true
;
break
;
}
}
sysPSSystem
.
set
(
"ignoreSyncPermission"
,
true
);
if
(
bchange
)
sysPSSystemService
.
update
(
sysPSSystem
);
}
return
true
;
}
@Override
public
boolean
update
(
DstApp
et
)
{
return
this
.
save
(
et
);
}
@Override
public
boolean
create
(
DstApp
et
)
{
return
this
.
save
(
et
);
}
@Override
public
Page
<
DstApp
>
searchDefault
(
DstAppSearchContext
context
)
{
context
.
setSize
(
Integer
.
MAX_VALUE
);
List
<
DstApp
>
content
=
new
ArrayList
<>();
LinkedHashMap
<
String
,
DstApp
>
map
=
liteModelService
.
getApps
();
map
.
values
().
forEach
(
sysApp
->
{
if
(!
StringUtils
.
isEmpty
(
context
.
getN_pssystemid_eq
()))
{
if
(!
sysApp
.
getSystemid
().
equals
(
context
.
getN_pssystemid_eq
()))
return
;
}
if
(!
StringUtils
.
isEmpty
(
context
.
getN_appname_like
()))
{
if
(
sysApp
.
getLabel
().
indexOf
(
context
.
getN_appname_like
())<
0
&&
sysApp
.
getFullname
().
indexOf
(
context
.
getN_appname_like
())<
0
)
return
;
}
if
(!
StringUtils
.
isEmpty
(
context
.
getN_apptype_eq
()))
{
if
(
context
.
getN_apptype_eq
().
equalsIgnoreCase
(
sysApp
.
getType
()))
return
;
}
content
.
add
(
sysApp
);
});
return
new
PageImpl
<
DstApp
>(
content
,
context
.
getPageable
(),
content
.
size
());
}
}
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/service/LiteModelService.java
浏览文件 @
b07d248e
package
cn
.
ibizlab
.
core
.
lite
.
extensions
.
service
;
import
cn.ibizlab.core.lite.domain.DstApp
;
import
cn.ibizlab.core.lite.domain.DstSystem
;
import
cn.ibizlab.core.lite.domain.MetaEntity
;
import
cn.ibizlab.core.lite.domain.MetaRelationship
;
...
...
@@ -12,6 +13,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Caching
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
...
...
@@ -31,6 +34,7 @@ public class LiteModelService {
}
@Autowired
@Lazy
private
IMetaEntityService
metaEntityService
;
public
IMetaEntityService
getMetaEntityService
()
...
...
@@ -39,18 +43,23 @@ public class LiteModelService {
}
@Autowired
@Lazy
private
IMetaFieldService
metaFieldService
;
@Autowired
@Lazy
private
IMetaRelationshipService
metaRelationshipService
;
@Autowired
@Lazy
private
IDstSystemService
dstSystemService
;
@Autowired
@Lazy
private
IDstDataSourceService
dstDataSourceService
;
@Autowired
@Lazy
private
IMetaDataSetService
metaDataSetService
;
@Cacheable
(
value
=
"entitymodel"
,
key
=
"'row:'+#p0+'.'+#p1"
)
...
...
@@ -137,4 +146,34 @@ public class LiteModelService {
}
@Cacheable
(
value
=
"syspssystem"
,
key
=
"'row:all-dst-apps'"
)
public
LinkedHashMap
<
String
,
DstApp
>
getApps
()
{
LinkedHashMap
<
String
,
DstApp
>
appNode
=
new
LinkedHashMap
<>();
dstSystemService
.
list
().
forEach
(
system
->
{
if
(
system
.
getSysstructure
()
==
null
)
{
return
;
}
if
(
system
.
getApps
()
==
null
)
{
system
.
setApps
(
system
.
getSysstructure
().
getSysApps
(
true
));
dstSystemService
.
update
(
system
);
}
system
.
getApps
().
forEach
(
app
->
{
appNode
.
put
(
app
.
getId
(),
app
);
});
});
return
appNode
;
}
@Caching
(
evict
=
{
@CacheEvict
(
value
=
"syspssystem"
,
key
=
"'row:all-apps'"
),
@CacheEvict
(
value
=
"syspssystem"
,
key
=
"'row:all-dst-apps'"
)
})
public
void
resetApps
()
{
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录