Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sample-form-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
sample-form-platform
Commits
d6c5f6e1
Commit
d6c5f6e1
authored
Apr 23, 2025
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加角色菜单权限新实现
parent
fc77a492
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
414 additions
and
74 deletions
+414
-74
sample-form-manager/src/main/java/com/mortals/xhx/base/login/web/LoginController.java
.../java/com/mortals/xhx/base/login/web/LoginController.java
+19
-73
sample-form-manager/src/main/java/com/mortals/xhx/base/system/menu/web/MenuController.java
.../com/mortals/xhx/base/system/menu/web/MenuController.java
+1
-1
sample-form-manager/src/main/java/com/mortals/xhx/common/code/AuthTypeEnum.java
...c/main/java/com/mortals/xhx/common/code/AuthTypeEnum.java
+67
-0
sample-form-manager/src/main/java/com/mortals/xhx/common/code/CommMenuEnum.java
...c/main/java/com/mortals/xhx/common/code/CommMenuEnum.java
+65
-0
sample-form-manager/src/main/java/com/mortals/xhx/common/code/LinkTypeEnum.java
...c/main/java/com/mortals/xhx/common/code/LinkTypeEnum.java
+66
-0
sample-form-manager/src/main/java/com/mortals/xhx/common/code/MenuTypeEnum.java
...c/main/java/com/mortals/xhx/common/code/MenuTypeEnum.java
+66
-0
sample-form-manager/src/main/java/com/mortals/xhx/common/code/StatusEnum.java
...src/main/java/com/mortals/xhx/common/code/StatusEnum.java
+65
-0
sample-form-manager/src/main/java/com/mortals/xhx/common/code/VisibleEnum.java
...rc/main/java/com/mortals/xhx/common/code/VisibleEnum.java
+65
-0
No files found.
sample-form-manager/src/main/java/com/mortals/xhx/base/login/web/LoginController.java
View file @
d6c5f6e1
package
com.mortals.xhx.base.login.web
;
package
com.mortals.xhx.base.login.web
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.IdUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.ap.GlobalSysInfo
;
import
com.mortals.framework.ap.GlobalSysInfo
;
import
com.mortals.framework.ap.SysConstains
;
import
com.mortals.framework.ap.SysConstains
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.service.ITokenService
;
import
com.mortals.framework.service.ITokenService
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.service.IUser
;
...
@@ -21,7 +23,9 @@ import com.mortals.xhx.base.system.valid.service.ValidCodeService;
...
@@ -21,7 +23,9 @@ import com.mortals.xhx.base.system.valid.service.ValidCodeService;
import
com.mortals.xhx.common.key.RedisKey
;
import
com.mortals.xhx.common.key.RedisKey
;
import
com.mortals.xhx.common.pdu.user.LoginPdu
;
import
com.mortals.xhx.common.pdu.user.LoginPdu
;
import
com.mortals.xhx.common.pdu.user.UserPdu
;
import
com.mortals.xhx.common.pdu.user.UserPdu
;
import
com.mortals.xhx.common.utils.MenuEncodeUtil
;
import
com.mortals.xhx.feign.user.IUserFeign
;
import
com.mortals.xhx.feign.user.IUserFeign
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -34,97 +38,32 @@ import javax.servlet.http.HttpServletResponse;
...
@@ -34,97 +38,32 @@ import javax.servlet.http.HttpServletResponse;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Set
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
ErrorCode
.
ERROR_TOKEN_EXPIRED
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
ErrorCode
.
ERROR_TOKEN_EXPIRED_CONTENT
;
@RestController
@RestController
@Slf4j
@RequestMapping
(
"login"
)
@RequestMapping
(
"login"
)
public
class
LoginController
extends
BaseCRUDJsonBodyMappingController
<
UserService
,
UserEntity
,
Long
>
{
public
class
LoginController
extends
BaseCRUDJsonBodyMappingController
<
UserService
,
UserEntity
,
Long
>
{
@Autowired
private
UserService
userService
;
@Autowired
private
ValidCodeService
validCodeService
;
@Autowired
@Autowired
private
ResourceService
resourceService
;
private
ResourceService
resourceService
;
@Autowired
@Autowired
private
MenuService
menuService
;
private
MenuService
menuService
;
@Autowired
@Autowired
private
ITokenService
tokenService
;
@Autowired
private
ICacheService
cacheService
;
private
ICacheService
cacheService
;
@Autowired
@Autowired
private
IUserFeign
userFeign
;
private
IUserFeign
userFeign
;
private
static
Log
logger
=
LogFactory
.
getLog
(
LoginController
.
class
);
@RequestMapping
(
"login"
)
@RequestMapping
(
"login"
)
public
String
login
(
@RequestBody
LoginForm
loginForm
)
throws
Exception
{
public
String
login
(
@RequestBody
LoginForm
loginForm
)
throws
Exception
{
String
loginName
=
loginForm
.
getLoginName
();
String
loginName
=
loginForm
.
getLoginName
();
String
password
=
loginForm
.
getPassword
();
String
password
=
loginForm
.
getPassword
();
LoginPdu
loginPdu
=
new
LoginPdu
();
LoginPdu
loginPdu
=
new
LoginPdu
();
loginPdu
.
setLoginName
(
loginName
);
loginPdu
.
setLoginName
(
loginName
);
loginPdu
.
setPassword
(
password
);
loginPdu
.
setPassword
(
password
);
loginPdu
.
setSecurityCode
(
"admin"
);
loginPdu
.
setSecurityCode
(
"admin"
);
String
resp
=
userFeign
.
portalLogin
(
loginPdu
);
String
resp
=
userFeign
.
portalLogin
(
loginPdu
);
return
resp
;
return
resp
;
/*JSONObject ret = new JSONObject();
String loginName = loginForm.getLoginName();
String password = loginForm.getPassword();
//String securityCode = loginForm.getSecurityCode();
String ip = super.getRequestIP(request);
if (StringUtils.isEmpty(loginName) || StringUtils.isEmpty(password)) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, "未获取到用户信息,请重新登录");
return ret.toJSONString();
}
UserEntity userEntity = null;
try {
loginForm.validate();
userEntity = userService.doLogin(loginName, password, ip);
userEntity.setLastLoginAddress(ip);
//saveCurrUser(request, response, userEntity);
recordSysLog(request, userEntity, "用户登录系统成功!");
// 返回拥有的菜单数据
Set<String> urls = resourceService.findUrlSetByUserId(userEntity.getId());
List<MenuEntity> outlookBarList = menuService.findTreeMenu(userEntity, urls);
String currUserName = userEntity.getRealName();
if (currUserName == null || currUserName.trim().length() == 0) {
currUserName = "管理员";
}
userEntity.setLoginTime(System.currentTimeMillis());
userEntity.setToken(IdUtil.fastSimpleUUID());
userEntity.setExpireTime(DateUtils.addCurrDate(7).getTime());
String token = authTokenService.createToken(userEntity);
JSONObject data = new JSONObject();
data.put("token", token);
data.put("currUserName", currUserName);
data.put("barList", outlookBarList);
data.put("id", userEntity.getId());
data.put("userType", userEntity.getUserType());
//this.generateBlackCookie(request, response, loginName, urls);
ret.put(KEY_RESULT_DATA, data);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "用户登录系统成功!");
ret.put("resources", urls);
return ret.toJSONString();
} catch (Exception e) {
log.error("login error ", e);
if (userEntity == null) {
userEntity = new UserEntity();
userEntity.setLoginName(loginName);
}
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e));
return ret.toJSONString();
}*/
}
}
@RequestMapping
(
"logout"
)
@RequestMapping
(
"logout"
)
...
@@ -138,21 +77,28 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
...
@@ -138,21 +77,28 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
JSONObject
ret
=
new
JSONObject
();
JSONObject
ret
=
new
JSONObject
();
IUser
user
=
this
.
getCurUser
();
IUser
user
=
this
.
getCurUser
();
if
(
user
==
null
)
{
if
(
user
==
null
)
{
return
""
;
return
JSONObject
.
toJSONString
(
Rest
.
fail
(
ERROR_TOKEN_EXPIRED
,
ERROR_TOKEN_EXPIRED_CONTENT
))
;
}
}
Set
<
String
>
urls
=
resourceService
.
findUrlSetByUserId
(
user
.
getId
());
Set
<
String
>
urls
=
resourceService
.
findUrlSetByUserId
(
user
.
getId
());
List
<
MenuEntity
>
outlookBarList
=
menuService
.
findTreeMenu
(
user
,
urls
);
log
.
info
(
"userId:{},urls:{}"
,
user
.
getId
(),
JSON
.
toJSONString
(
urls
));
// List<MenuEntity> outlookBarList = menuService.findTreeMenu(user, urls);
List
<
MenuEntity
>
treeMenuList
=
menuService
.
findTreeMenu
(
user
);
String
currUserName
=
user
.
getRealName
();
String
currUserName
=
user
.
getRealName
();
if
(
currUserName
==
null
||
currUserName
.
trim
().
length
()
==
0
)
{
if
(
currUserName
==
null
||
currUserName
.
trim
().
length
()
==
0
)
{
currUserName
=
"管理员"
;
currUserName
=
"管理员"
;
}
}
JSONObject
data
=
new
JSONObject
();
JSONObject
data
=
new
JSONObject
();
String
token
=
authTokenService
.
getToken
(
request
);
data
.
put
(
"token"
,
token
);
data
.
put
(
"currUserName"
,
currUserName
);
data
.
put
(
"currUserName"
,
currUserName
);
data
.
put
(
"
barList"
,
outlookBar
List
);
data
.
put
(
"
menuList"
,
treeMenu
List
);
data
.
put
(
"id"
,
user
.
getId
());
data
.
put
(
"id"
,
user
.
getId
());
data
.
put
(
"userType"
,
user
.
getUserType
());
data
.
put
(
"userType"
,
user
.
getUserType
());
ret
.
put
(
KEY_RESULT_DATA
,
data
);
ret
.
put
(
KEY_RESULT_DATA
,
data
);
//this.generateBlackCookie(request, response, user.getLoginName(), urls);
cacheService
.
hset
(
RedisKey
.
KEY_USER_MENU_CACHE
,
user
.
getId
().
toString
(),
MenuEncodeUtil
.
generateMenuUrlCode
(
urls
));
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
ret
.
put
(
KEY_RESULT_MSG
,
"用户登录系统成功!"
);
ret
.
put
(
KEY_RESULT_MSG
,
"用户登录系统成功!"
);
ret
.
put
(
"resources"
,
urls
);
ret
.
put
(
"resources"
,
urls
);
...
...
sample-form-manager/src/main/java/com/mortals/xhx/base/system/menu/web/MenuController.java
View file @
d6c5f6e1
...
@@ -10,7 +10,7 @@ import com.mortals.xhx.base.system.menu.model.MenuEntity;
...
@@ -10,7 +10,7 @@ import com.mortals.xhx.base.system.menu.model.MenuEntity;
import
com.mortals.xhx.base.system.menu.model.MenuQuery
;
import
com.mortals.xhx.base.system.menu.model.MenuQuery
;
import
com.mortals.xhx.base.system.menu.model.MenuTreeSelect
;
import
com.mortals.xhx.base.system.menu.model.MenuTreeSelect
;
import
com.mortals.xhx.base.system.menu.service.MenuService
;
import
com.mortals.xhx.base.system.menu.service.MenuService
;
import
com.mortals.xhx.common.code.
DataSatus
;
import
com.mortals.xhx.common.code.
*
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
...
sample-form-manager/src/main/java/com/mortals/xhx/common/code/AuthTypeEnum.java
0 → 100644
View file @
d6c5f6e1
package
com.mortals.xhx.common.code
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
/**
* 权限类型 (0.无限制,1.无需登录查看,2.需要登录查看,3.需要角色权限查看)枚举类
*
* @author zxfei
*/
public
enum
AuthTypeEnum
{
无限制
(
0
,
"无限制"
),
无需登录查看
(
1
,
"无需登录查看"
),
需要登录查看
(
2
,
"需要登录查看"
),
需要角色权限查看
(
3
,
"需要角色权限查看"
);
private
Integer
value
;
private
String
desc
;
AuthTypeEnum
(
Integer
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
}
public
Integer
getValue
()
{
return
this
.
value
;
}
public
String
getDesc
()
{
return
this
.
desc
;
}
public
static
AuthTypeEnum
getByValue
(
Integer
value
)
{
for
(
AuthTypeEnum
authTypeEnum
:
AuthTypeEnum
.
values
())
{
if
(
authTypeEnum
.
getValue
()
==
value
)
{
return
authTypeEnum
;
}
}
return
null
;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public
static
Map
<
String
,
String
>
getEnumMap
(
Integer
...
eItem
)
{
Map
<
String
,
String
>
resultMap
=
new
LinkedHashMap
<>();
for
(
AuthTypeEnum
item
:
AuthTypeEnum
.
values
())
{
try
{
boolean
hasE
=
false
;
for
(
Integer
e
:
eItem
)
{
if
(
item
.
getValue
()
==
e
)
{
hasE
=
true
;
break
;
}
}
if
(!
hasE
)
{
resultMap
.
put
(
item
.
getValue
()
+
""
,
item
.
getDesc
());
}
}
catch
(
Exception
ex
)
{
}
}
return
resultMap
;
}
}
\ No newline at end of file
sample-form-manager/src/main/java/com/mortals/xhx/common/code/CommMenuEnum.java
0 → 100644
View file @
d6c5f6e1
package
com.mortals.xhx.common.code
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
/**
* 是否常用菜单 (0.非常用,1.常用)枚举类
*
* @author zxfei
*/
public
enum
CommMenuEnum
{
非常用
(
0
,
"非常用"
),
常用
(
1
,
"常用"
);
private
Integer
value
;
private
String
desc
;
CommMenuEnum
(
Integer
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
}
public
Integer
getValue
()
{
return
this
.
value
;
}
public
String
getDesc
()
{
return
this
.
desc
;
}
public
static
CommMenuEnum
getByValue
(
Integer
value
)
{
for
(
CommMenuEnum
commMenuEnum
:
CommMenuEnum
.
values
())
{
if
(
commMenuEnum
.
getValue
()
==
value
)
{
return
commMenuEnum
;
}
}
return
null
;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public
static
Map
<
String
,
String
>
getEnumMap
(
Integer
...
eItem
)
{
Map
<
String
,
String
>
resultMap
=
new
LinkedHashMap
<>();
for
(
CommMenuEnum
item
:
CommMenuEnum
.
values
())
{
try
{
boolean
hasE
=
false
;
for
(
Integer
e
:
eItem
)
{
if
(
item
.
getValue
()
==
e
)
{
hasE
=
true
;
break
;
}
}
if
(!
hasE
)
{
resultMap
.
put
(
item
.
getValue
()
+
""
,
item
.
getDesc
());
}
}
catch
(
Exception
ex
)
{
}
}
return
resultMap
;
}
}
\ No newline at end of file
sample-form-manager/src/main/java/com/mortals/xhx/common/code/LinkTypeEnum.java
0 → 100644
View file @
d6c5f6e1
package
com.mortals.xhx.common.code
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
/**
* 链接方式 (0.普通,1.弹出,2.脚本)枚举类
*
* @author zxfei
*/
public
enum
LinkTypeEnum
{
普通
(
0
,
"普通"
),
弹出
(
1
,
"弹出"
),
脚本
(
2
,
"脚本"
);
private
Integer
value
;
private
String
desc
;
LinkTypeEnum
(
Integer
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
}
public
Integer
getValue
()
{
return
this
.
value
;
}
public
String
getDesc
()
{
return
this
.
desc
;
}
public
static
LinkTypeEnum
getByValue
(
Integer
value
)
{
for
(
LinkTypeEnum
linkTypeEnum
:
LinkTypeEnum
.
values
())
{
if
(
linkTypeEnum
.
getValue
()
==
value
)
{
return
linkTypeEnum
;
}
}
return
null
;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public
static
Map
<
String
,
String
>
getEnumMap
(
Integer
...
eItem
)
{
Map
<
String
,
String
>
resultMap
=
new
LinkedHashMap
<>();
for
(
LinkTypeEnum
item
:
LinkTypeEnum
.
values
())
{
try
{
boolean
hasE
=
false
;
for
(
Integer
e
:
eItem
)
{
if
(
item
.
getValue
()
==
e
)
{
hasE
=
true
;
break
;
}
}
if
(!
hasE
)
{
resultMap
.
put
(
item
.
getValue
()
+
""
,
item
.
getDesc
());
}
}
catch
(
Exception
ex
)
{
}
}
return
resultMap
;
}
}
\ No newline at end of file
sample-form-manager/src/main/java/com/mortals/xhx/common/code/MenuTypeEnum.java
0 → 100644
View file @
d6c5f6e1
package
com.mortals.xhx.common.code
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
/**
* 菜单类型 (0.目录,1.菜单,2.按钮)枚举类
*
* @author zxfei
*/
public
enum
MenuTypeEnum
{
目录
(
0
,
"目录"
),
菜单
(
1
,
"菜单"
),
按钮
(
2
,
"按钮"
);
private
Integer
value
;
private
String
desc
;
MenuTypeEnum
(
Integer
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
}
public
Integer
getValue
()
{
return
this
.
value
;
}
public
String
getDesc
()
{
return
this
.
desc
;
}
public
static
MenuTypeEnum
getByValue
(
Integer
value
)
{
for
(
MenuTypeEnum
menuTypeEnum
:
MenuTypeEnum
.
values
())
{
if
(
menuTypeEnum
.
getValue
()
==
value
)
{
return
menuTypeEnum
;
}
}
return
null
;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public
static
Map
<
String
,
String
>
getEnumMap
(
Integer
...
eItem
)
{
Map
<
String
,
String
>
resultMap
=
new
LinkedHashMap
<>();
for
(
MenuTypeEnum
item
:
MenuTypeEnum
.
values
())
{
try
{
boolean
hasE
=
false
;
for
(
Integer
e
:
eItem
)
{
if
(
item
.
getValue
()
==
e
)
{
hasE
=
true
;
break
;
}
}
if
(!
hasE
)
{
resultMap
.
put
(
item
.
getValue
()
+
""
,
item
.
getDesc
());
}
}
catch
(
Exception
ex
)
{
}
}
return
resultMap
;
}
}
\ No newline at end of file
sample-form-manager/src/main/java/com/mortals/xhx/common/code/StatusEnum.java
0 → 100644
View file @
d6c5f6e1
package
com.mortals.xhx.common.code
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
/**
* 菜单状态 (0.停用,1.启用)枚举类
*
* @author zxfei
*/
public
enum
StatusEnum
{
停用
(
0
,
"停用"
),
启用
(
1
,
"启用"
);
private
Integer
value
;
private
String
desc
;
StatusEnum
(
Integer
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
}
public
Integer
getValue
()
{
return
this
.
value
;
}
public
String
getDesc
()
{
return
this
.
desc
;
}
public
static
StatusEnum
getByValue
(
Integer
value
)
{
for
(
StatusEnum
statusEnum
:
StatusEnum
.
values
())
{
if
(
statusEnum
.
getValue
()
==
value
)
{
return
statusEnum
;
}
}
return
null
;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public
static
Map
<
String
,
String
>
getEnumMap
(
Integer
...
eItem
)
{
Map
<
String
,
String
>
resultMap
=
new
LinkedHashMap
<>();
for
(
StatusEnum
item
:
StatusEnum
.
values
())
{
try
{
boolean
hasE
=
false
;
for
(
Integer
e
:
eItem
)
{
if
(
item
.
getValue
()
==
e
)
{
hasE
=
true
;
break
;
}
}
if
(!
hasE
)
{
resultMap
.
put
(
item
.
getValue
()
+
""
,
item
.
getDesc
());
}
}
catch
(
Exception
ex
)
{
}
}
return
resultMap
;
}
}
\ No newline at end of file
sample-form-manager/src/main/java/com/mortals/xhx/common/code/VisibleEnum.java
0 → 100644
View file @
d6c5f6e1
package
com.mortals.xhx.common.code
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
/**
* 菜单显示状态 (0.显示,1.隐藏)枚举类
*
* @author zxfei
*/
public
enum
VisibleEnum
{
显示
(
0
,
"显示"
),
隐藏
(
1
,
"隐藏"
);
private
Integer
value
;
private
String
desc
;
VisibleEnum
(
Integer
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
}
public
Integer
getValue
()
{
return
this
.
value
;
}
public
String
getDesc
()
{
return
this
.
desc
;
}
public
static
VisibleEnum
getByValue
(
Integer
value
)
{
for
(
VisibleEnum
visibleEnum
:
VisibleEnum
.
values
())
{
if
(
visibleEnum
.
getValue
()
==
value
)
{
return
visibleEnum
;
}
}
return
null
;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public
static
Map
<
String
,
String
>
getEnumMap
(
Integer
...
eItem
)
{
Map
<
String
,
String
>
resultMap
=
new
LinkedHashMap
<>();
for
(
VisibleEnum
item
:
VisibleEnum
.
values
())
{
try
{
boolean
hasE
=
false
;
for
(
Integer
e
:
eItem
)
{
if
(
item
.
getValue
()
==
e
)
{
hasE
=
true
;
break
;
}
}
if
(!
hasE
)
{
resultMap
.
put
(
item
.
getValue
()
+
""
,
item
.
getDesc
());
}
}
catch
(
Exception
ex
)
{
}
}
return
resultMap
;
}
}
\ No newline at end of file
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