Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
80c25cc3
Commit
80c25cc3
authored
Jul 27, 2022
by
季圣华
Browse files
优化功能菜单模块的接口
parent
32fccee9
Changes
2
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/FunctionController.java
View file @
80c25cc3
...
...
@@ -244,58 +244,4 @@ public class FunctionController {
}
return
res
;
}
/**
* 根据用户id查询菜单
* @param userId
* @param request
* @return
* @throws Exception
*/
@GetMapping
(
value
=
"/getMenuByUserId"
)
@ApiOperation
(
value
=
"根据用户id查询菜单"
)
public
BaseResponseInfo
getMenuByUserId
(
@RequestParam
(
"userId"
)
Long
userId
,
HttpServletRequest
request
)
throws
Exception
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
try
{
JSONArray
dataArray
=
new
JSONArray
();
Long
roleId
=
0L
;
String
fc
=
""
;
List
<
UserBusiness
>
roleList
=
userBusinessService
.
getBasicData
(
userId
.
toString
(),
"UserRole"
);
if
(
roleList
!=
null
&&
roleList
.
size
()>
0
){
String
value
=
roleList
.
get
(
0
).
getValue
();
if
(
StringUtil
.
isNotEmpty
(
value
)){
String
roleIdStr
=
value
.
replace
(
"["
,
""
).
replace
(
"]"
,
""
);
roleId
=
Long
.
parseLong
(
roleIdStr
);
}
}
//当前用户所拥有的功能列表,格式如:[1][2][5]
List
<
UserBusiness
>
funList
=
userBusinessService
.
getBasicData
(
roleId
.
toString
(),
"RoleFunctions"
);
if
(
funList
!=
null
&&
funList
.
size
()>
0
){
fc
=
funList
.
get
(
0
).
getValue
();
}
List
<
Function
>
dataList
=
functionService
.
getRoleFunctionLeaf
();
if
(
dataList
.
size
()
!=
0
)
{
for
(
Function
function
:
dataList
)
{
if
(
fc
.
contains
(
"["
+
function
.
getId
().
toString
()
+
"]"
))
{
String
page
=
function
.
getUrl
();
page
=
page
.
replace
(
"/system/"
,
""
).
replace
(
"/bill/"
,
""
)
.
replace
(
"/financial/"
,
""
).
replace
(
"/report/"
,
""
)
.
replace
(
"/material/"
,
""
);
JSONObject
item
=
new
JSONObject
();
item
.
put
(
"id"
,
function
.
getId
());
item
.
put
(
"page"
,
page
);
dataArray
.
add
(
item
);
}
}
}
res
.
code
=
200
;
res
.
data
=
dataArray
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
res
.
code
=
500
;
res
.
data
=
"获取数据失败"
;
}
return
res
;
}
}
jshERP-boot/src/main/java/com/jsh/erp/service/functions/FunctionService.java
View file @
80c25cc3
...
...
@@ -178,26 +178,6 @@ public class FunctionService {
return
list
;
}
/**
* 获取功能列表的叶子节点
* @return
* @throws Exception
*/
public
List
<
Function
>
getRoleFunctionLeaf
()
throws
Exception
{
FunctionExample
example
=
new
FunctionExample
();
example
.
createCriteria
().
andEnabledEqualTo
(
true
).
andParentNumberNotEqualTo
(
"0"
)
.
andComponentNotEqualTo
(
"/layouts/IframePageView"
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"Sort"
);
List
<
Function
>
list
=
null
;
try
{
list
=
functionsMapper
.
selectByExample
(
example
);
}
catch
(
Exception
e
){
JshException
.
readFail
(
logger
,
e
);
}
return
list
;
}
public
List
<
Function
>
findRoleFunction
(
String
pnumber
)
throws
Exception
{
FunctionExample
example
=
new
FunctionExample
();
example
.
createCriteria
().
andEnabledEqualTo
(
true
).
andParentNumberEqualTo
(
pnumber
)
...
...
Write
Preview
Supports
Markdown
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