Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
36d6fcac
Commit
36d6fcac
authored
Jun 06, 2024
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
减少原因调整
parent
73789ba3
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
8 deletions
+64
-8
SysDictItem.java
...yifu.cloud.plus.v1/yifu/admin/api/entity/SysDictItem.java
+7
-0
DictController.java
...u/cloud/plus/v1/yifu/admin/controller/DictController.java
+15
-2
DictItemRedisInit.java
...yifu/cloud/plus/v1/yifu/admin/init/DictItemRedisInit.java
+2
-0
SysDictItemService.java
.../cloud/plus/v1/yifu/admin/service/SysDictItemService.java
+2
-0
SysDictItemServiceImpl.java
...us/v1/yifu/admin/service/impl/SysDictItemServiceImpl.java
+37
-6
SysDictMapper.xml
...yifu-upms-biz/src/main/resources/mapper/SysDictMapper.xml
+1
-0
No files found.
yifu-upms/yifu-upms-api/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/api/entity/SysDictItem.java
View file @
36d6fcac
...
...
@@ -102,6 +102,13 @@ public class SysDictItem extends BaseEntity {
@Schema
(
description
=
"删除标记,1:已删除,0:正常"
)
private
String
delFlag
;
/**
* 启用禁用 0 启用 1禁用
*/
@TableField
@Schema
(
description
=
"启用禁用 0 启用 1禁用"
)
private
String
disable
;
/**
* 上级字典项标签
*/
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/controller/DictController.java
View file @
36d6fcac
...
...
@@ -189,6 +189,17 @@ public class DictController {
public
R
<
Map
<
String
,
Object
>>
getParentDictItemByTypes
(
String
itemTypes
)
{
return
sysDictItemService
.
getParentDictItemByTypes
(
itemTypes
);
}
/**
* 通过id查询父级字典的字典值
* @param itemTypes
* @return R
*/
@SysLog
(
"通过id查询父级字典的字典值"
)
@GetMapping
(
"/getDictItemsByTypes"
)
public
R
<
Map
<
String
,
List
>>
getDictItemsByTypes
(
String
itemTypes
)
{
return
sysDictItemService
.
getDictItemsByTypes
(
itemTypes
);
}
/**
* 通过id查询字典项
* @param id id
...
...
@@ -222,7 +233,8 @@ public class DictController {
if
(
Common
.
isNotNull
(
dict
.
getParentItemType
())){
return
R
.
ok
(
sysDictItemService
.
list
(
Wrappers
.<
SysDictItem
>
query
().
lambda
()
.
eq
(
SysDictItem:
:
getType
,
dict
.
getParentItemType
())
.
eq
(
SysDictItem:
:
getDelFlag
,
CommonConstants
.
ZERO_STRING
)));
.
eq
(
SysDictItem:
:
getDelFlag
,
CommonConstants
.
ZERO_STRING
)
.
eq
(
SysDictItem:
:
getDisable
,
CommonConstants
.
ZERO_STRING
)));
}
return
R
.
ok
();
}
...
...
@@ -345,7 +357,8 @@ public class DictController {
@PostMapping
(
"/inner/getDictList"
)
public
R
<
List
<
SysDictItem
>>
getDictList
(
@RequestParam
(
value
=
"itemType"
,
required
=
false
)
String
itemType
)
{
List
<
SysDictItem
>
allList
=
sysDictItemService
.
list
(
Wrappers
.<
SysDictItem
>
query
().
lambda
()
.
eq
(
SysDictItem:
:
getDelFlag
,
CommonConstants
.
ZERO_STRING
));
.
eq
(
SysDictItem:
:
getDelFlag
,
CommonConstants
.
ZERO_STRING
)
.
eq
(
SysDictItem:
:
getDisable
,
CommonConstants
.
ZERO_STRING
));
return
new
R
<>(
allList
);
}
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/init/DictItemRedisInit.java
View file @
36d6fcac
...
...
@@ -38,6 +38,7 @@ public class DictItemRedisInit {
@PostConstruct
public
void
init
(){
log
.
info
(
"字典数据加入缓存初始化开始..."
);
//不含禁用状态的字段
Map
<
String
,
Object
>
dictItem
=
dictItemService
.
getAllDictItemSub
();
if
(
Common
.
isNotNull
(
dictItem
)){
for
(
Map
.
Entry
<
String
,
Object
>
entry:
dictItem
.
entrySet
()){
...
...
@@ -48,6 +49,7 @@ public class DictItemRedisInit {
}
log
.
info
(
"字典数据加入缓存初始化结束..."
);
log
.
info
(
"转义字典数据加入缓存初始化开始..."
);
// 包含禁用状态的字段数据
List
<
DictRedisVo
>
lables
=
dictItemService
.
getDictRedisVo
();
if
(
Common
.
isNotNull
(
lables
)){
Map
<
String
,
String
>
lableMap
=
new
HashMap
<>();
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/service/SysDictItemService.java
View file @
36d6fcac
...
...
@@ -89,4 +89,6 @@ public interface SysDictItemService extends IService<SysDictItem> {
R
<
String
>
getLableFronValue
(
String
value
,
String
type
);
List
<
DictRedisVo
>
getDictRedisVo
();
R
<
Map
<
String
,
List
>>
getDictItemsByTypes
(
String
itemTypes
);
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/service/impl/SysDictItemServiceImpl.java
View file @
36d6fcac
...
...
@@ -47,6 +47,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.util.Assert
;
import
javax.validation.constraints.NotNull
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -132,7 +133,8 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
public
R
<
String
>
getLableFronValue
(
String
value
,
String
type
)
{
SysDictItem
sysDictItem
=
baseMapper
.
selectOne
(
Wrappers
.<
SysDictItem
>
query
().
lambda
()
.
eq
(
SysDictItem:
:
getType
,
type
).
eq
(
SysDictItem:
:
getValue
,
value
)
.
eq
(
SysDictItem:
:
getDelFlag
,
CommonConstants
.
ZERO_STRING
));
.
eq
(
SysDictItem:
:
getDelFlag
,
CommonConstants
.
ZERO_STRING
)
.
eq
(
SysDictItem:
:
getDisable
,
CommonConstants
.
ZERO_STRING
));
if
(
Common
.
isNotNull
(
sysDictItem
))
{
return
R
.
ok
(
sysDictItem
.
getLabel
());
}
...
...
@@ -147,7 +149,8 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
private
void
updateDictItem
(
String
type
,
Map
<
String
,
Object
>
resultMap
){
List
<
SysDictItem
>
allList
=
baseMapper
.
selectList
(
Wrappers
.<
SysDictItem
>
query
().
lambda
()
.
in
(
SysDictItem:
:
getType
,
type
)
.
eq
(
SysDictItem:
:
getDelFlag
,
CommonConstants
.
ZERO_STRING
));
.
eq
(
SysDictItem:
:
getDelFlag
,
CommonConstants
.
ZERO_STRING
)
.
eq
(
SysDictItem:
:
getDisable
,
CommonConstants
.
ZERO_STRING
));
extractedCache
(
allList
,
resultMap
);
}
...
...
@@ -208,7 +211,8 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
List
<
SysDictItem
>
allList
=
baseMapper
.
selectList
(
Wrappers
.<
SysDictItem
>
query
().
lambda
()
.
in
(
SysDictItem:
:
getType
,
Common
.
initStrToList
(
itemTypes
,
CommonConstants
.
COMMA_STRING
))
.
eq
(
SysDictItem:
:
getDelFlag
,
CommonConstants
.
ZERO_STRING
));
.
eq
(
SysDictItem:
:
getDelFlag
,
CommonConstants
.
ZERO_STRING
)
.
eq
(
SysDictItem:
:
getDisable
,
CommonConstants
.
ZERO_STRING
));
extracted
(
allList
,
resultMap
);
return
R
.
ok
(
resultMap
);
}
...
...
@@ -228,7 +232,8 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
@Override
public
Map
<
String
,
Object
>
getAllDictItemSub
(){
List
<
SysDictItem
>
allList
=
baseMapper
.
selectList
(
Wrappers
.<
SysDictItem
>
query
().
lambda
()
.
eq
(
SysDictItem:
:
getDelFlag
,
CommonConstants
.
ZERO_STRING
));
.
eq
(
SysDictItem:
:
getDelFlag
,
CommonConstants
.
ZERO_STRING
)
.
eq
(
SysDictItem:
:
getDisable
,
CommonConstants
.
ZERO_STRING
));
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
extracted
(
allList
,
resultMap
);
return
resultMap
;
...
...
@@ -289,7 +294,7 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
private
Map
<
String
,
Map
<
String
,
String
>>
getStringMapMap
(
boolean
type
)
{
List
<
SysDictItem
>
allList
=
baseMapper
.
selectList
(
Wrappers
.<
SysDictItem
>
query
().
lambda
()
.
eq
(
SysDictItem:
:
getDelFlag
,
CommonConstants
.
STATUS_NORMAL
));
.
eq
(
SysDictItem:
:
getDelFlag
,
CommonConstants
.
STATUS_NORMAL
)
.
eq
(
SysDictItem:
:
getDisable
,
CommonConstants
.
ZERO_STRING
)
);
Map
<
String
,
Map
<
String
,
String
>>
resultMap
=
new
HashMap
<>();
doAssemble
(
allList
,
resultMap
,
type
);
return
resultMap
;
...
...
@@ -354,5 +359,31 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
return
node
;
};
}
@Override
public
R
<
Map
<
String
,
List
>>
getDictItemsByTypes
(
String
itemTypes
)
{
if
(
Common
.
isEmpty
(
itemTypes
)){
return
R
.
failed
(
CommonConstants
.
RESULT_EMPTY
);
}
Map
<
String
,
List
>
resultMap
=
new
HashMap
<>();
List
<
SysDictItem
>
allList
=
baseMapper
.
selectList
(
Wrappers
.<
SysDictItem
>
query
().
lambda
()
.
in
(
SysDictItem:
:
getType
,
Common
.
initStrToList
(
itemTypes
,
CommonConstants
.
COMMA_STRING
))
.
eq
(
SysDictItem:
:
getDelFlag
,
CommonConstants
.
ZERO_STRING
)
.
eq
(
SysDictItem:
:
getDisable
,
CommonConstants
.
ZERO_STRING
));
if
(
Common
.
isNotNull
(
allList
)){
List
temp
;
for
(
SysDictItem
item
:
allList
)
{
String
dictCode
=
item
.
getType
();
if
(
resultMap
.
get
(
dictCode
)
==
null
)
{
List
list
=
new
ArrayList
<>();
list
.
add
(
item
);
resultMap
.
put
(
dictCode
,
list
);
}
else
{
temp
=
resultMap
.
get
(
dictCode
);
temp
.
add
(
item
);
resultMap
.
put
(
dictCode
,
temp
);
}
}
}
return
R
.
ok
(
resultMap
);
}
}
yifu-upms/yifu-upms-biz/src/main/resources/mapper/SysDictMapper.xml
View file @
36d6fcac
...
...
@@ -54,6 +54,7 @@
WHERE
a.type = #{type}
AND i.`value` = a.parent_id
AND a.disable ='0'
AND a.`value` = #{value}
AND i.del_flag='0' limit 1
</select>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment