Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdict
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdict
提交
6cec7d04
提交
6cec7d04
编写于
12月 25, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
代码表支持参数
上级
d9f8d35c
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
85 行增加
和
43 行删除
+85
-43
DictCoreService.java
...ibizlab/core/dict/extensions/service/DictCoreService.java
+11
-4
DictCoreResource.java
...java/cn/ibizlab/api/rest/extensions/DictCoreResource.java
+74
-39
未找到文件。
ibzdict-core/src/main/java/cn/ibizlab/core/dict/extensions/service/DictCoreService.java
浏览文件 @
6cec7d04
...
@@ -6,6 +6,7 @@ import cn.ibizlab.core.dict.extensions.vo.Catalog;
...
@@ -6,6 +6,7 @@ import cn.ibizlab.core.dict.extensions.vo.Catalog;
import
cn.ibizlab.core.dict.extensions.vo.CodeItem
;
import
cn.ibizlab.core.dict.extensions.vo.CodeItem
;
import
cn.ibizlab.core.dict.extensions.vo.CodeList
;
import
cn.ibizlab.core.dict.extensions.vo.CodeList
;
import
cn.ibizlab.core.dict.extensions.vo.Option
;
import
cn.ibizlab.core.dict.extensions.vo.Option
;
import
cn.ibizlab.core.dict.filter.DictOptionSearchContext
;
import
cn.ibizlab.core.dict.service.IDictCatalogService
;
import
cn.ibizlab.core.dict.service.IDictCatalogService
;
import
cn.ibizlab.core.dict.service.IDictOptionService
;
import
cn.ibizlab.core.dict.service.IDictOptionService
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
...
@@ -36,7 +37,10 @@ public class DictCoreService
...
@@ -36,7 +37,10 @@ public class DictCoreService
private
IDictOptionService
optionService
;
private
IDictOptionService
optionService
;
@Cacheable
(
value
=
"dictcatalog"
,
key
=
"'dict:'+#p0"
)
@Cacheable
(
value
=
"dictcatalog"
,
key
=
"'dict:'+#p0"
)
public
Catalog
getDictCatalog
(
String
code
)
public
Catalog
getDictCatalog
(
String
code
){
return
getDictCatalog
(
code
,
new
DictOptionSearchContext
());
}
public
Catalog
getDictCatalog
(
String
code
,
DictOptionSearchContext
context
)
{
{
Catalog
catalog
=
new
Catalog
();
Catalog
catalog
=
new
Catalog
();
DictCatalog
dictCatalog
=
dictCatalogService
.
getOne
(
Wrappers
.<
DictCatalog
>
query
().
eq
(
"ccode"
,
code
));
DictCatalog
dictCatalog
=
dictCatalogService
.
getOne
(
Wrappers
.<
DictCatalog
>
query
().
eq
(
"ccode"
,
code
));
...
@@ -44,7 +48,7 @@ public class DictCoreService
...
@@ -44,7 +48,7 @@ public class DictCoreService
List
<
Option
>
list
=
new
ArrayList
<>();
List
<
Option
>
list
=
new
ArrayList
<>();
optionService
.
list
(
Wrappers
.<
DictOption
>
query
().
eq
(
"cid"
,
dictCatalog
.
getId
()).
orderByAsc
(
"showorder"
)).
forEach
(
item
->{
optionService
.
list
(
context
.
getSelectCond
().
eq
(
"cid"
,
dictCatalog
.
getId
()).
orderByAsc
(
"showorder"
)).
forEach
(
item
->{
Map
<
String
,
Object
>
extension
=
new
HashMap
<>();
Map
<
String
,
Object
>
extension
=
new
HashMap
<>();
if
(!
StringUtils
.
isEmpty
(
item
.
getExtension
()))
if
(!
StringUtils
.
isEmpty
(
item
.
getExtension
()))
extension
=
JSONObject
.
parseObject
(
item
.
getExtension
(),
Map
.
class
);
extension
=
JSONObject
.
parseObject
(
item
.
getExtension
(),
Map
.
class
);
...
@@ -69,7 +73,10 @@ public class DictCoreService
...
@@ -69,7 +73,10 @@ public class DictCoreService
@Cacheable
(
value
=
"dictcatalog"
,
key
=
"'codelist:'+#p0"
)
@Cacheable
(
value
=
"dictcatalog"
,
key
=
"'codelist:'+#p0"
)
public
CodeList
getCodeListCatalog
(
String
code
)
public
CodeList
getCodeListCatalog
(
String
code
){
return
getCodeListCatalog
(
code
,
new
DictOptionSearchContext
());
}
public
CodeList
getCodeListCatalog
(
String
code
,
DictOptionSearchContext
context
)
{
{
CodeList
catalog
=
new
CodeList
();
CodeList
catalog
=
new
CodeList
();
DictCatalog
dictCatalog
=
dictCatalogService
.
getOne
(
Wrappers
.<
DictCatalog
>
query
().
eq
(
"ccode"
,
code
));
DictCatalog
dictCatalog
=
dictCatalogService
.
getOne
(
Wrappers
.<
DictCatalog
>
query
().
eq
(
"ccode"
,
code
));
...
@@ -77,7 +84,7 @@ public class DictCoreService
...
@@ -77,7 +84,7 @@ public class DictCoreService
List
<
CodeItem
>
list
=
new
ArrayList
<>();
List
<
CodeItem
>
list
=
new
ArrayList
<>();
optionService
.
list
(
Wrappers
.<
DictOption
>
query
().
eq
(
"cid"
,
dictCatalog
.
getId
()).
orderByAsc
(
"showorder"
)).
forEach
(
item
->{
optionService
.
list
(
context
.
getSelectCond
().
eq
(
"cid"
,
dictCatalog
.
getId
()).
orderByAsc
(
"showorder"
)).
forEach
(
item
->{
Map
<
String
,
Object
>
extension
=
new
HashMap
<>();
Map
<
String
,
Object
>
extension
=
new
HashMap
<>();
if
(!
StringUtils
.
isEmpty
(
item
.
getExtension
()))
if
(!
StringUtils
.
isEmpty
(
item
.
getExtension
()))
extension
=
JSONObject
.
parseObject
(
item
.
getExtension
(),
Map
.
class
);
extension
=
JSONObject
.
parseObject
(
item
.
getExtension
(),
Map
.
class
);
...
...
ibzdict-provider/ibzdict-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/DictCoreResource.java
浏览文件 @
6cec7d04
...
@@ -10,6 +10,7 @@ import cn.ibizlab.core.dict.extensions.vo.CodeItem;
...
@@ -10,6 +10,7 @@ import cn.ibizlab.core.dict.extensions.vo.CodeItem;
import
cn.ibizlab.core.dict.extensions.vo.CodeList
;
import
cn.ibizlab.core.dict.extensions.vo.CodeList
;
import
cn.ibizlab.core.dict.extensions.vo.Option
;
import
cn.ibizlab.core.dict.extensions.vo.Option
;
import
cn.ibizlab.core.dict.filter.DictCatalogSearchContext
;
import
cn.ibizlab.core.dict.filter.DictCatalogSearchContext
;
import
cn.ibizlab.core.dict.filter.DictOptionSearchContext
;
import
cn.ibizlab.core.dict.service.IDictCatalogService
;
import
cn.ibizlab.core.dict.service.IDictCatalogService
;
import
cn.ibizlab.core.dict.service.IDictOptionService
;
import
cn.ibizlab.core.dict.service.IDictOptionService
;
import
cn.ibizlab.util.annotation.VersionCheck
;
import
cn.ibizlab.util.annotation.VersionCheck
;
...
@@ -55,57 +56,91 @@ public class DictCoreResource {
...
@@ -55,57 +56,91 @@ public class DictCoreResource {
@Lazy
@Lazy
private
DictCoreService
dictCoreService
;
private
DictCoreService
dictCoreService
;
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/dictionarys/catalogs/{code}"
)
@RequestMapping
(
method
=
{
RequestMethod
.
GET
},
value
=
"/dictionarys/catalogs/{code}"
)
public
ResponseEntity
<
Catalog
>
getCatalogs
(
@PathVariable
(
"code"
)
String
code
)
{
public
ResponseEntity
<
Catalog
>
getCatalogs
(
@PathVariable
(
"code"
)
String
code
,
DictOptionSearchContext
context
)
{
Catalog
catalog
=
dictCoreService
.
getDictCatalog
(
code
);
Catalog
catalog
=
null
;
if
(
context
==
null
||
StringUtils
.
isEmpty
(
context
.
getSelectCond
().
getSqlSegment
()))
catalog
=
dictCoreService
.
getDictCatalog
(
code
);
else
catalog
=
dictCoreService
.
getDictCatalog
(
code
,
context
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
catalog
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
catalog
);
}
}
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/dictionarys/catalogs/{code}/options"
)
@RequestMapping
(
method
=
{
RequestMethod
.
GET
},
value
=
"/dictionarys/catalogs/{code}/options"
)
public
ResponseEntity
<
List
<
Option
>>
getOptions
(
@PathVariable
(
"code"
)
String
code
)
{
public
ResponseEntity
<
List
<
Option
>>
getOptions
(
@PathVariable
(
"code"
)
String
code
,
DictOptionSearchContext
context
)
{
Catalog
catalog
=
dictCoreService
.
getDictCatalog
(
code
);
Catalog
catalog
=
null
;
if
(
context
==
null
||
StringUtils
.
isEmpty
(
context
.
getSelectCond
().
getSqlSegment
()))
catalog
=
dictCoreService
.
getDictCatalog
(
code
);
else
catalog
=
dictCoreService
.
getDictCatalog
(
code
,
context
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
catalog
.
getOptions
());
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
catalog
.
getOptions
());
}
}
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dictionarys/catalogs/{code}/options"
)
public
ResponseEntity
<
List
<
Option
>>
getOptions
(
@PathVariable
(
"code"
)
String
code
,
@RequestBody
List
<
String
>
values
)
{
List
<
Option
>
list
=
new
ArrayList
<>();
@RequestMapping
(
method
=
{
RequestMethod
.
GET
},
value
=
"/dictionarys/codelist/{code}"
)
optionService
.
list
(
Wrappers
.<
DictOption
>
lambdaQuery
().
eq
(
DictOption:
:
getCatalog
,
code
).
in
(
DictOption:
:
getValue
,
values
).
orderByAsc
(
DictOption:
:
getShoworder
)).
forEach
(
item
->
public
ResponseEntity
<
CodeList
>
getCodeList
(
@PathVariable
(
"code"
)
String
code
,
DictOptionSearchContext
context
)
{
{
CodeList
catalog
=
null
;
Map
<
String
,
Object
>
extension
=
new
HashMap
<>();
if
(
context
==
null
||
StringUtils
.
isEmpty
(
context
.
getSelectCond
().
getSqlSegment
()))
if
(!
StringUtils
.
isEmpty
(
item
.
getExtension
()))
catalog
=
dictCoreService
.
getCodeListCatalog
(
code
);
extension
=
JSONObject
.
parseObject
(
item
.
getExtension
(),
Map
.
class
);
else
list
.
add
(
new
Option
().
setValue
(
item
.
getValue
()).
setId
(
item
.
getValue
())
catalog
=
dictCoreService
.
getCodeListCatalog
(
code
,
context
);
.
setDisabled
(((
item
.
getDisabled
()!=
null
&&
item
.
getDisabled
()==
1
)||(
item
.
getExpired
()!=
null
&&
item
.
getExpired
()==
1
))?
true
:
false
)
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
catalog
);
.
setFilter
(
item
.
getFilter
()).
setIconClass
(
item
.
getIconClass
()).
setLabel
(
item
.
getLabel
()).
setParent
(
item
.
getParent
()).
setExtension
(
extension
)
);
}
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
list
);
}
}
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/dictionarys/codelist/{code}"
)
public
ResponseEntity
<
CodeList
>
getCodeList
(
@PathVariable
(
"code"
)
String
code
)
{
@RequestMapping
(
method
=
{
RequestMethod
.
GET
},
value
=
"/dictionarys/codelist/{code}/items"
)
CodeList
catalog
=
dictCoreService
.
getCodeListCatalog
(
code
);
public
ResponseEntity
<
List
<
CodeItem
>>
getCodeItems
(
@PathVariable
(
"code"
)
String
code
,
DictOptionSearchContext
context
)
{
CodeList
catalog
=
null
;
if
(
context
==
null
||
StringUtils
.
isEmpty
(
context
.
getSelectCond
().
getSqlSegment
()))
catalog
=
dictCoreService
.
getCodeListCatalog
(
code
);
else
catalog
=
dictCoreService
.
getCodeListCatalog
(
code
,
context
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
catalog
.
getOptions
());
}
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
"/dictionarys/catalogs/{code}"
)
public
ResponseEntity
<
Catalog
>
catalogs
(
@PathVariable
(
"code"
)
String
code
,
@RequestBody
(
required
=
false
)
DictOptionSearchContext
context
)
{
Catalog
catalog
=
null
;
if
(
context
==
null
||
StringUtils
.
isEmpty
(
context
.
getSelectCond
().
getSqlSegment
()))
catalog
=
dictCoreService
.
getDictCatalog
(
code
);
else
catalog
=
dictCoreService
.
getDictCatalog
(
code
,
context
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
catalog
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
catalog
);
}
}
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
"/dictionarys/catalogs/{code}/options"
)
public
ResponseEntity
<
List
<
Option
>>
options
(
@PathVariable
(
"code"
)
String
code
,
@RequestBody
(
required
=
false
)
DictOptionSearchContext
context
)
{
Catalog
catalog
=
null
;
if
(
context
==
null
||
StringUtils
.
isEmpty
(
context
.
getSelectCond
().
getSqlSegment
()))
catalog
=
dictCoreService
.
getDictCatalog
(
code
);
else
catalog
=
dictCoreService
.
getDictCatalog
(
code
,
context
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
catalog
.
getOptions
());
}
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
"/dictionarys/codelist/{code}"
)
public
ResponseEntity
<
CodeList
>
codeList
(
@PathVariable
(
"code"
)
String
code
,
@RequestBody
(
required
=
false
)
DictOptionSearchContext
context
)
{
CodeList
catalog
=
null
;
if
(
context
==
null
||
StringUtils
.
isEmpty
(
context
.
getSelectCond
().
getSqlSegment
()))
catalog
=
dictCoreService
.
getCodeListCatalog
(
code
);
else
catalog
=
dictCoreService
.
getCodeListCatalog
(
code
,
context
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
catalog
);
}
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dictionarys/codelist/{code}/items"
)
public
ResponseEntity
<
List
<
CodeItem
>>
getCodeItems
(
@PathVariable
(
"code"
)
String
code
,
@RequestBody
List
<
String
>
values
)
{
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
"/dictionarys/codelist/{code}/items"
)
List
<
CodeItem
>
list
=
new
ArrayList
<>();
public
ResponseEntity
<
List
<
CodeItem
>>
codeItems
(
@PathVariable
(
"code"
)
String
code
,
@RequestBody
(
required
=
false
)
DictOptionSearchContext
context
)
{
optionService
.
list
(
Wrappers
.<
DictOption
>
lambdaQuery
().
eq
(
DictOption:
:
getCatalog
,
code
).
in
(
DictOption:
:
getValue
,
values
).
orderByAsc
(
DictOption:
:
getShoworder
)).
forEach
(
item
->
CodeList
catalog
=
null
;
{
if
(
context
==
null
||
StringUtils
.
isEmpty
(
context
.
getSelectCond
().
getSqlSegment
()))
Map
<
String
,
Object
>
extension
=
new
HashMap
<>();
catalog
=
dictCoreService
.
getCodeListCatalog
(
code
);
if
(!
StringUtils
.
isEmpty
(
item
.
getExtension
()))
else
extension
=
JSONObject
.
parseObject
(
item
.
getExtension
(),
Map
.
class
);
catalog
=
dictCoreService
.
getCodeListCatalog
(
code
,
context
);
list
.
add
(
new
CodeItem
().
setValue
(
item
.
getValue
()).
setId
(
item
.
getValue
())
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
catalog
.
getOptions
());
.
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
)
);
}
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
list
);
}
}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录