Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdict
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdict
提交
45045129
提交
45045129
编写于
8月 05, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
codelist接管
上级
ce59407e
变更
7
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
148 行增加
和
21 行删除
+148
-21
CacheRefreshAspect.java
...izlab/core/dict/extensions/aspect/CacheRefreshAspect.java
+3
-1
DictCoreService.java
...ibizlab/core/dict/extensions/service/DictCoreService.java
+53
-0
Catalog.java
...main/java/cn/ibizlab/core/dict/extensions/vo/Catalog.java
+2
-14
CodeItem.java
...ain/java/cn/ibizlab/core/dict/extensions/vo/CodeItem.java
+43
-0
CodeList.java
...ain/java/cn/ibizlab/core/dict/extensions/vo/CodeList.java
+38
-0
Option.java
.../main/java/cn/ibizlab/core/dict/extensions/vo/Option.java
+0
-6
DictCoreResource.java
...java/cn/ibizlab/api/rest/extensions/DictCoreResource.java
+9
-0
未找到文件。
ibzdict-core/src/main/java/cn/ibizlab/core/dict/extensions/aspect/CacheRefreshAspect.java
浏览文件 @
45045129
...
...
@@ -42,8 +42,10 @@ public class CacheRefreshAspect
if
(
obj
instanceof
DictCatalog
)
{
String
code
=((
DictCatalog
)
obj
).
getCode
();
if
(!
StringUtils
.
isEmpty
(
code
))
if
(!
StringUtils
.
isEmpty
(
code
))
{
dictCoreService
.
resetDictCatalog
(
code
);
dictCoreService
.
resetCodeListCatalog
(
code
);
}
}
}
...
...
ibzdict-core/src/main/java/cn/ibizlab/core/dict/extensions/service/DictCoreService.java
浏览文件 @
45045129
...
...
@@ -3,6 +3,8 @@ package cn.ibizlab.core.dict.extensions.service;
import
cn.ibizlab.core.dict.domain.DictCatalog
;
import
cn.ibizlab.core.dict.domain.DictOption
;
import
cn.ibizlab.core.dict.extensions.vo.Catalog
;
import
cn.ibizlab.core.dict.extensions.vo.CodeItem
;
import
cn.ibizlab.core.dict.extensions.vo.CodeList
;
import
cn.ibizlab.core.dict.extensions.vo.Option
;
import
cn.ibizlab.core.dict.service.IDictCatalogService
;
import
cn.ibizlab.core.dict.service.IDictOptionService
;
...
...
@@ -65,6 +67,39 @@ public class DictCoreService
}
@Cacheable
(
value
=
"dictcatalog"
,
key
=
"'codelist:'+#p0"
)
public
CodeList
getCodeListCatalog
(
String
code
)
{
CodeList
catalog
=
new
CodeList
();
DictCatalog
dictCatalog
=
dictCatalogService
.
getOne
(
Wrappers
.<
DictCatalog
>
query
().
eq
(
"ccode"
,
code
));
catalog
.
setCode
(
dictCatalog
.
getCode
()).
setName
(
dictCatalog
.
getName
());
List
<
CodeItem
>
list
=
new
ArrayList
<>();
optionService
.
list
(
Wrappers
.<
DictOption
>
query
().
eq
(
"catalog_id"
,
dictCatalog
.
getId
()).
orderByAsc
(
"showorder"
)).
forEach
(
item
->{
Map
<
String
,
Object
>
extension
=
new
HashMap
<>();
if
(!
StringUtils
.
isEmpty
(
item
.
getExtension
()))
extension
=
JSONObject
.
parseObject
(
item
.
getExtension
(),
Map
.
class
);
list
.
add
(
new
CodeItem
().
setValue
(
item
.
getValue
()).
setId
(
item
.
getValue
())
.
setDisabled
(((
item
.
getDisabled
()!=
null
&&
item
.
getDisabled
()==
1
)||(
item
.
getExpired
()!=
null
&&
item
.
getExpired
()==
1
))?
true
:
false
)
.
setFilter
(
item
.
getFilter
()).
setIconClass
(
item
.
getIconClass
()).
setLabel
(
item
.
getLabel
()).
setParent
(
item
.
getParent
()).
setExtension
(
extension
)
);
});
List
<
CodeItem
>
codeItemTreeList
=
new
ArrayList
<
CodeItem
>();
codeItemTreeList
=
loopCodeItem
(
list
,
""
);
catalog
.
setOptions
(
codeItemTreeList
);
return
catalog
;
}
@CacheEvict
(
value
=
"dictcatalog"
,
key
=
"'codelist:'+#p0"
)
public
void
resetCodeListCatalog
(
String
code
)
{
}
public
List
<
Option
>
loop
(
List
<
Option
>
listCodeItem
,
Object
parentValue
)
{
List
<
Option
>
trees
=
new
ArrayList
<
Option
>();
for
(
Option
codeItem
:
listCodeItem
)
{
...
...
@@ -83,4 +118,22 @@ public class DictCoreService
return
trees
;
}
public
List
<
CodeItem
>
loopCodeItem
(
List
<
CodeItem
>
listCodeItem
,
Object
parentValue
)
{
List
<
CodeItem
>
trees
=
new
ArrayList
<
CodeItem
>();
for
(
CodeItem
codeItem
:
listCodeItem
)
{
String
codeItemParentValue
=
codeItem
.
getParent
();
if
(
StringUtils
.
isEmpty
(
codeItemParentValue
))
{
codeItemParentValue
=
""
;
}
if
(
parentValue
.
equals
(
codeItemParentValue
))
{
List
<
CodeItem
>
childCodeItem
=
loopCodeItem
(
listCodeItem
,
codeItem
.
getValue
());
if
(
childCodeItem
.
size
()
>
0
)
{
codeItem
.
setChildren
(
childCodeItem
);
}
trees
.
add
(
codeItem
);
}
}
return
trees
;
}
}
ibzdict-core/src/main/java/cn/ibizlab/core/dict/extensions/vo/Catalog.java
浏览文件 @
45045129
...
...
@@ -25,20 +25,8 @@ public class Catalog
private
String
code
;
private
String
name
;
@JSONField
(
name
=
"srfkey"
)
@JsonProperty
(
"srfkey"
)
public
String
getSrfkey
()
{
return
code
;
}
@JSONField
(
name
=
"emptytext"
)
@JsonProperty
(
"emptytext"
)
public
String
getEmptytext
()
{
return
""
;
}
@JSONField
(
name
=
"items"
)
@JsonProperty
(
"items"
)
private
List
<
Option
>
options
=
new
ArrayList
<>();
}
ibzdict-core/src/main/java/cn/ibizlab/core/dict/extensions/vo/CodeItem.java
0 → 100644
浏览文件 @
45045129
package
cn
.
ibizlab
.
core
.
dict
.
extensions
.
vo
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
java.util.List
;
import
java.util.Map
;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Accessors
(
chain
=
true
)
public
class
CodeItem
{
private
String
id
;
private
Object
value
;
private
String
label
;
@JSONField
(
name
=
"items"
)
@JsonProperty
(
"items"
)
private
List
<
CodeItem
>
children
;
private
String
iconClass
;
private
String
filter
;
private
Boolean
disabled
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
String
parent
;
private
Map
<
String
,
Object
>
extension
;
@JSONField
(
name
=
"text"
)
@JsonProperty
(
"text"
)
public
String
getText
()
{
return
label
;
}
}
ibzdict-core/src/main/java/cn/ibizlab/core/dict/extensions/vo/CodeList.java
0 → 100644
浏览文件 @
45045129
package
cn
.
ibizlab
.
core
.
dict
.
extensions
.
vo
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
java.util.ArrayList
;
import
java.util.List
;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Accessors
(
chain
=
true
)
public
class
CodeList
{
@JSONField
(
name
=
"srfkey"
)
@JsonProperty
(
"srfkey"
)
private
String
code
;
private
String
name
;
@JSONField
(
name
=
"emptytext"
)
@JsonProperty
(
"emptytext"
)
public
String
getEmptytext
()
{
return
""
;
}
@JSONField
(
name
=
"items"
)
@JsonProperty
(
"items"
)
private
List
<
CodeItem
>
options
=
new
ArrayList
<>();
}
ibzdict-core/src/main/java/cn/ibizlab/core/dict/extensions/vo/Option.java
浏览文件 @
45045129
...
...
@@ -31,10 +31,4 @@ public class Option
private
String
parent
;
private
Map
<
String
,
Object
>
extension
;
@JSONField
(
name
=
"text"
)
@JsonProperty
(
"text"
)
public
String
getText
()
{
return
label
;
}
}
ibzdict-provider/ibzdict-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/DictCoreResource.java
浏览文件 @
45045129
...
...
@@ -5,10 +5,12 @@ import cn.ibizlab.api.mapping.DictCatalogMapping;
import
cn.ibizlab.core.dict.domain.DictCatalog
;
import
cn.ibizlab.core.dict.extensions.service.DictCoreService
;
import
cn.ibizlab.core.dict.extensions.vo.Catalog
;
import
cn.ibizlab.core.dict.extensions.vo.CodeList
;
import
cn.ibizlab.core.dict.extensions.vo.Option
;
import
cn.ibizlab.core.dict.filter.DictCatalogSearchContext
;
import
cn.ibizlab.core.dict.service.IDictCatalogService
;
import
cn.ibizlab.util.annotation.VersionCheck
;
import
com.alibaba.fastjson.JSONObject
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -53,6 +55,13 @@ public class DictCoreResource {
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
catalog
.
getOptions
());
}
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/dictionarys/codelist/{code}"
)
public
ResponseEntity
<
CodeList
>
getCodeList
(
@PathVariable
(
"code"
)
String
code
)
{
CodeList
catalog
=
dictCoreService
.
getCodeListCatalog
(
code
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
catalog
);
}
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dictionarys/catalogs"
)
public
ResponseEntity
<
Boolean
>
save
(
@RequestBody
DictCatalogDTO
dictcatalogdto
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dictcatalogService
.
save
(
dictcatalogMapping
.
toDomain
(
dictcatalogdto
)));
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录