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
e1dd3cd5
Commit
e1dd3cd5
authored
Jun 21, 2017
by
naan1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
将性别的查询做成和字典关联
parent
19b9ca4b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
+30
-2
src/main/java/com/stylefeng/guns/common/constant/factory/ConstantFactory.java
+25
-2
src/main/java/com/stylefeng/guns/common/constant/factory/IConstantFactory.java
+5
-0
No files found.
src/main/java/com/stylefeng/guns/common/constant/factory/ConstantFactory.java
View file @
e1dd3cd5
package
com
.
stylefeng
.
guns
.
common
.
constant
.
factory
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.baomidou.mybatisplus.mapper.Wrapper
;
import
com.stylefeng.guns.common.constant.state.ManagerStatus
;
import
com.stylefeng.guns.common.constant.state.MenuStatus
;
import
com.stylefeng.guns.common.constant.state.Sex
;
import
com.stylefeng.guns.common.persistence.dao.*
;
import
com.stylefeng.guns.common.persistence.model.*
;
import
com.stylefeng.guns.core.log.LogObjectHolder
;
...
...
@@ -214,11 +214,34 @@ public class ConstantFactory implements IConstantFactory {
}
/**
* 根据字典名称和字典中的值获取对应的名称
*/
@Override
public
String
getDictsByName
(
String
name
,
Integer
val
)
{
Dict
temp
=
new
Dict
();
temp
.
setName
(
name
);
Dict
dict
=
dictMapper
.
selectOne
(
temp
);
if
(
dict
==
null
)
{
return
null
;
}
else
{
Wrapper
<
Dict
>
wrapper
=
new
EntityWrapper
<>();
wrapper
=
wrapper
.
eq
(
"pid"
,
dict
.
getId
());
List
<
Dict
>
dicts
=
dictMapper
.
selectList
(
wrapper
);
for
(
Dict
item
:
dicts
)
{
if
(
item
.
getNum
()
!=
null
&&
item
.
getNum
().
equals
(
val
))
{
return
item
.
getName
();
}
}
return
""
;
}
}
/**
* 获取性别名称
*/
@Override
public
String
getSexName
(
Integer
sex
)
{
return
Sex
.
valueOf
(
sex
);
return
getDictsByName
(
"性别"
,
sex
);
}
/**
...
...
src/main/java/com/stylefeng/guns/common/constant/factory/IConstantFactory.java
View file @
e1dd3cd5
...
...
@@ -81,6 +81,11 @@ public interface IConstantFactory {
String
getNoticeTitle
(
Integer
dictId
);
/**
* 根据字典名称和字典中的值获取对应的名称
*/
String
getDictsByName
(
String
name
,
Integer
val
);
/**
* 获取性别名称
*/
String
getSexName
(
Integer
sex
);
...
...
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