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
527bc6e1
Commit
527bc6e1
authored
Dec 27, 2018
by
fengshuonan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
菜单查询增加一个条件
parent
74f7da05
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
5 deletions
+17
-5
src/main/java/cn/stylefeng/guns/modular/system/controller/MenuController.java
+3
-2
src/main/java/cn/stylefeng/guns/modular/system/mapper/MenuMapper.java
+1
-1
src/main/java/cn/stylefeng/guns/modular/system/mapper/mapping/MenuMapper.xml
+3
-0
src/main/java/cn/stylefeng/guns/modular/system/service/MenuService.java
+10
-2
No files found.
src/main/java/cn/stylefeng/guns/modular/system/controller/MenuController.java
View file @
527bc6e1
...
...
@@ -129,8 +129,9 @@ public class MenuController extends BaseController {
@RequestMapping
(
value
=
"/list"
)
@ResponseBody
public
Object
list
(
@RequestParam
(
required
=
false
)
String
menuName
,
@RequestParam
(
required
=
false
)
String
level
)
{
List
<
Map
<
String
,
Object
>>
menus
=
this
.
menuService
.
selectMenus
(
menuName
,
level
);
@RequestParam
(
required
=
false
)
String
level
,
@RequestParam
(
required
=
false
)
Long
menuId
)
{
List
<
Map
<
String
,
Object
>>
menus
=
this
.
menuService
.
selectMenus
(
menuName
,
level
,
menuId
);
return
super
.
warpObject
(
new
MenuWarpper
(
menus
));
}
...
...
src/main/java/cn/stylefeng/guns/modular/system/mapper/MenuMapper.java
View file @
527bc6e1
...
...
@@ -25,7 +25,7 @@ public interface MenuMapper extends BaseMapper<Menu> {
* @return
* @date 2017年2月12日 下午9:14:34
*/
List
<
Map
<
String
,
Object
>>
selectMenus
(
@Param
(
"condition"
)
String
condition
,
@Param
(
"level"
)
String
level
);
List
<
Map
<
String
,
Object
>>
selectMenus
(
@Param
(
"condition"
)
String
condition
,
@Param
(
"level"
)
String
level
,
@Param
(
"menuId"
)
Long
menuId
,
@Param
(
"code"
)
String
code
);
/**
* 根据条件查询菜单
...
...
src/main/java/cn/stylefeng/guns/modular/system/mapper/mapping/MenuMapper.xml
View file @
527bc6e1
...
...
@@ -40,6 +40,9 @@
<if
test=
"level != null and level != ''"
>
and LEVELS = #{level}
</if>
<if
test=
"menuId != null and menuId != 0"
>
and (MENU_ID = #{menuId} or MENU_ID in ( select MENU_ID from sys_menu where PCODES like CONCAT('%[', #{code}, ']%') ))
</if>
</select>
<select
id=
"getMenuIdsByRoleId"
resultType=
"long"
>
...
...
src/main/java/cn/stylefeng/guns/modular/system/service/MenuService.java
View file @
527bc6e1
...
...
@@ -108,8 +108,16 @@ public class MenuService extends ServiceImpl<MenuMapper, Menu> {
* @return
* @date 2017年2月12日 下午9:14:34
*/
public
List
<
Map
<
String
,
Object
>>
selectMenus
(
String
condition
,
String
level
)
{
return
this
.
baseMapper
.
selectMenus
(
condition
,
level
);
public
List
<
Map
<
String
,
Object
>>
selectMenus
(
String
condition
,
String
level
,
Long
menuId
)
{
//获取menuId的code
String
code
=
""
;
if
(
menuId
!=
null
)
{
Menu
menu
=
this
.
selectById
(
menuId
);
code
=
menu
.
getCode
();
}
return
this
.
baseMapper
.
selectMenus
(
condition
,
level
,
menuId
,
code
);
}
/**
...
...
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