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
eb529a77
Commit
eb529a77
authored
Apr 18, 2017
by
fsn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
菜单管理增加菜单级别搜索条件
parent
b6da4907
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
69 deletions
+76
-69
src/main/java/com/stylefeng/guns/modular/system/controller/MenuController.java
+2
-2
src/main/java/com/stylefeng/guns/modular/system/dao/MenuDao.java
+1
-1
src/main/java/com/stylefeng/guns/modular/system/dao/mapping/MenuDao.xml
+3
-0
src/main/webapp/WEB-INF/view/system/menu/menu.html
+3
-0
src/main/webapp/static/modular/system/menu/menu.js
+67
-66
No files found.
src/main/java/com/stylefeng/guns/modular/system/controller/MenuController.java
View file @
eb529a77
...
...
@@ -96,8 +96,8 @@ public class MenuController extends BaseController {
*/
@RequestMapping
(
value
=
"/list"
)
@ResponseBody
public
Object
list
(
@RequestParam
(
required
=
false
)
String
menuName
)
{
List
<
Map
<
String
,
Object
>>
menus
=
this
.
menuDao
.
selectMenus
(
menuName
);
public
Object
list
(
@RequestParam
(
required
=
false
)
String
menuName
,
@RequestParam
(
required
=
false
)
String
level
)
{
List
<
Map
<
String
,
Object
>>
menus
=
this
.
menuDao
.
selectMenus
(
menuName
,
level
);
return
super
.
warpObject
(
new
MenuWarpper
(
menus
));
}
...
...
src/main/java/com/stylefeng/guns/modular/system/dao/MenuDao.java
View file @
eb529a77
...
...
@@ -21,7 +21,7 @@ public interface MenuDao {
* @return
* @date 2017年2月12日 下午9:14:34
*/
public
List
<
Map
<
String
,
Object
>>
selectMenus
(
@Param
(
"condition"
)
String
condition
);
public
List
<
Map
<
String
,
Object
>>
selectMenus
(
@Param
(
"condition"
)
String
condition
,
@Param
(
"level"
)
String
level
);
/**
* 根据条件查询菜单
...
...
src/main/java/com/stylefeng/guns/modular/system/dao/mapping/MenuDao.xml
View file @
eb529a77
...
...
@@ -16,6 +16,9 @@
<if
test=
"condition != null and condition != ''"
>
and (name like CONCAT('%',#{condition},'%') or code like CONCAT('%',#{condition},'%'))
</if>
<if
test=
"level != null and level != ''"
>
and levels = #{level}
</if>
</select>
<select
id=
"getMenuIdsByRoleId"
resultType=
"int"
>
...
...
src/main/webapp/WEB-INF/view/system/menu/menu.html
View file @
eb529a77
...
...
@@ -13,6 +13,9 @@
<
#
NameCon
id=
"menuName"
name=
"菜单名称"
/>
</div>
<div
class=
"col-sm-3"
>
<
#
NameCon
id=
"level"
name=
"层级"
/>
</div>
<div
class=
"col-sm-3"
>
<
#
button
name=
"搜索"
icon=
"fa-search"
clickFun=
"Menu.search()"
/>
</div>
</div>
...
...
src/main/webapp/static/modular/system/menu/menu.js
View file @
eb529a77
...
...
@@ -2,113 +2,114 @@
* 角色管理的单例
*/
var
Menu
=
{
id
:
"menuTable"
,
//表格id
seItem
:
null
,
//选中的条目
table
:
null
,
layerIndex
:
-
1
id
:
"menuTable"
,
//表格id
seItem
:
null
,
//选中的条目
table
:
null
,
layerIndex
:
-
1
};
/**
* 初始化表格的列
*/
Menu
.
initColumn
=
function
()
{
var
columns
=
[
{
field
:
'selectItem'
,
radio
:
true
},
{
title
:
'id'
,
field
:
'id'
,
visible
:
false
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'菜单编号'
,
field
:
'code'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'菜单父编号'
,
field
:
'pcode'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'菜单名称'
,
field
:
'name'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'请求地址'
,
field
:
'url'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'排序'
,
field
:
'num'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'层级'
,
field
:
'levels'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'状态'
,
field
:
'statusName'
,
align
:
'center'
,
valign
:
'middle'
}]
return
columns
;
Menu
.
initColumn
=
function
()
{
var
columns
=
[
{
field
:
'selectItem'
,
radio
:
true
},
{
title
:
'id'
,
field
:
'id'
,
visible
:
false
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'菜单编号'
,
field
:
'code'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'菜单父编号'
,
field
:
'pcode'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'菜单名称'
,
field
:
'name'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'请求地址'
,
field
:
'url'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'排序'
,
field
:
'num'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'层级'
,
field
:
'levels'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'状态'
,
field
:
'statusName'
,
align
:
'center'
,
valign
:
'middle'
}]
return
columns
;
};
/**
* 绑定表格的事件
*/
Menu
.
bindEvent
=
function
()
{
$
(
'#'
+
this
.
id
).
on
(
'click-row.bs.table'
,
function
(
e
,
row
,
$element
)
{
Menu
.
seItem
=
row
;
Menu
.
bindEvent
=
function
()
{
$
(
'#'
+
this
.
id
).
on
(
'click-row.bs.table'
,
function
(
e
,
row
,
$element
)
{
Menu
.
seItem
=
row
;
});
};
/**
* 检查是否选中
*/
Menu
.
check
=
function
()
{
if
(
this
.
seItem
==
null
)
{
Feng
.
info
(
"请先选中表格中的某一记录!"
);
return
false
;
}
else
{
return
true
;
}
Menu
.
check
=
function
()
{
if
(
this
.
seItem
==
null
)
{
Feng
.
info
(
"请先选中表格中的某一记录!"
);
return
false
;
}
else
{
return
true
;
}
};
/**
* 点击添加菜单
*/
Menu
.
openAddMenu
=
function
()
{
var
index
=
layer
.
open
({
type
:
2
,
title
:
'添加菜单'
,
area
:
[
'800px'
,
'450px'
],
//宽高
fix
:
false
,
//不固定
maxmin
:
true
,
content
:
Feng
.
ctxPath
+
'/menu/menu_add'
});
this
.
layerIndex
=
index
;
Menu
.
openAddMenu
=
function
()
{
var
index
=
layer
.
open
({
type
:
2
,
title
:
'添加菜单'
,
area
:
[
'800px'
,
'450px'
],
//宽高
fix
:
false
,
//不固定
maxmin
:
true
,
content
:
Feng
.
ctxPath
+
'/menu/menu_add'
});
this
.
layerIndex
=
index
;
};
/**
* 点击修改
*/
Menu
.
openChangeMenu
=
function
()
{
if
(
this
.
check
())
{
var
index
=
layer
.
open
({
type
:
2
,
title
:
'修改菜单'
,
area
:
[
'800px'
,
'450px'
],
//宽高
fix
:
false
,
//不固定
maxmin
:
true
,
content
:
Feng
.
ctxPath
+
'/menu/menu_edit/'
+
this
.
seItem
.
id
});
this
.
layerIndex
=
index
;
}
Menu
.
openChangeMenu
=
function
()
{
if
(
this
.
check
())
{
var
index
=
layer
.
open
({
type
:
2
,
title
:
'修改菜单'
,
area
:
[
'800px'
,
'450px'
],
//宽高
fix
:
false
,
//不固定
maxmin
:
true
,
content
:
Feng
.
ctxPath
+
'/menu/menu_edit/'
+
this
.
seItem
.
id
});
this
.
layerIndex
=
index
;
}
};
/**
* 删除
*/
Menu
.
delMenu
=
function
()
{
if
(
this
.
check
())
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/menu/remove/"
+
this
.
seItem
.
id
,
function
(
data
)
{
Feng
.
success
(
"删除成功!"
);
Menu
.
table
.
refresh
();
},
function
(
data
)
{
Feng
.
error
(
"删除失败!"
);
});
ajax
.
start
();
}
Menu
.
delMenu
=
function
()
{
if
(
this
.
check
())
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/menu/remove/"
+
this
.
seItem
.
id
,
function
(
data
)
{
Feng
.
success
(
"删除成功!"
);
Menu
.
table
.
refresh
();
},
function
(
data
)
{
Feng
.
error
(
"删除失败!"
);
});
ajax
.
start
();
}
};
/**
* 搜索
*/
Menu
.
search
=
function
()
{
Menu
.
search
=
function
()
{
var
queryData
=
{};
queryData
[
'menuName'
]
=
$
(
"#menuName"
).
val
();
queryData
[
'level'
]
=
$
(
"#level"
).
val
();
Menu
.
table
.
refresh
({
query
:
queryData
});
}
$
(
function
()
{
var
defaultColunms
=
Menu
.
initColumn
();
var
table
=
new
BSTable
(
Menu
.
id
,
"/menu/list"
,
defaultColunms
);
table
.
setPaginationType
(
"client"
);
table
.
init
();
Menu
.
bindEvent
();
Menu
.
table
=
table
;
$
(
function
()
{
var
defaultColunms
=
Menu
.
initColumn
();
var
table
=
new
BSTable
(
Menu
.
id
,
"/menu/list"
,
defaultColunms
);
table
.
setPaginationType
(
"client"
);
table
.
init
();
Menu
.
bindEvent
();
Menu
.
table
=
table
;
});
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