Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
3965e1da
Commit
3965e1da
authored
Apr 27, 2017
by
fsn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
字典管理表格增加详情一列
parent
d7202e51
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
2 deletions
+36
-2
src/main/java/com/stylefeng/guns/common/constant/factory/ConstantFactory.java
+23
-0
src/main/java/com/stylefeng/guns/modular/system/warpper/DictWarpper.java
+13
-2
No files found.
src/main/java/com/stylefeng/guns/common/constant/factory/ConstantFactory.java
View file @
3965e1da
package
com
.
stylefeng
.
guns
.
common
.
constant
.
factory
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.stylefeng.guns.common.constant.cache.Cache
;
import
com.stylefeng.guns.common.constant.cache.CacheKey
;
import
com.stylefeng.guns.common.constant.state.ManagerStatus
;
...
...
@@ -10,13 +11,17 @@ import com.stylefeng.guns.core.util.Convert;
import
com.stylefeng.guns.core.util.SpringContextHolder
;
import
com.stylefeng.guns.core.util.ToolUtil
;
import
com.stylefeng.guns.persistence.dao.DeptMapper
;
import
com.stylefeng.guns.persistence.dao.DictMapper
;
import
com.stylefeng.guns.persistence.dao.RoleMapper
;
import
com.stylefeng.guns.persistence.model.Dept
;
import
com.stylefeng.guns.persistence.model.Dict
;
import
com.stylefeng.guns.persistence.model.Role
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.context.annotation.DependsOn
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
* 常量的生产工厂
*
...
...
@@ -29,6 +34,7 @@ public class ConstantFactory {
private
RoleMapper
roleMapper
=
SpringContextHolder
.
getBean
(
RoleMapper
.
class
);
private
DeptMapper
deptMapper
=
SpringContextHolder
.
getBean
(
DeptMapper
.
class
);
private
DictMapper
dictMapper
=
SpringContextHolder
.
getBean
(
DictMapper
.
class
);
public
static
ConstantFactory
me
()
{
return
SpringContextHolder
.
getBean
(
"constantFactory"
);
...
...
@@ -113,4 +119,21 @@ public class ConstantFactory {
return
MenuStatus
.
valueOf
(
status
);
}
/**
* 查询字典
*/
public
List
<
Dict
>
findInDict
(
Integer
id
){
if
(
ToolUtil
.
isEmpty
(
id
)){
return
null
;
}
else
{
EntityWrapper
<
Dict
>
wrapper
=
new
EntityWrapper
<>();
List
<
Dict
>
dicts
=
dictMapper
.
selectList
(
wrapper
.
eq
(
"pid"
,
id
));
if
(
dicts
==
null
||
dicts
.
size
()
==
0
){
return
null
;
}
else
{
return
dicts
;
}
}
}
}
src/main/java/com/stylefeng/guns/modular/system/warpper/DictWarpper.java
View file @
3965e1da
package
com
.
stylefeng
.
guns
.
modular
.
system
.
warpper
;
import
com.stylefeng.guns.common.constant.factory.ConstantFactory
;
import
com.stylefeng.guns.common.warpper.BaseControllerWarpper
;
import
com.stylefeng.guns.core.util.ToolUtil
;
import
com.stylefeng.guns.persistence.model.Dict
;
import
java.util.List
;
import
java.util.Map
;
/**
...
...
@@ -18,8 +22,15 @@ public class DictWarpper extends BaseControllerWarpper {
@Override
public
void
warpTheMap
(
Map
<
String
,
Object
>
map
)
{
StringBuffer
detail
=
new
StringBuffer
();
Integer
id
=
(
Integer
)
map
.
get
(
"id"
);
List
<
Dict
>
dicts
=
ConstantFactory
.
me
().
findInDict
(
id
);
if
(
dicts
!=
null
){
for
(
Dict
dict
:
dicts
)
{
detail
.
append
(
dict
.
getNum
()
+
":"
+
dict
.
getName
()
+
","
);
}
map
.
put
(
"detail"
,
ToolUtil
.
removeSuffix
(
detail
.
toString
(),
","
));
}
}
}
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