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
Springboot Plus
Commits
bc5ba410
"src/vscode:/vscode.git/clone" did not exist on "15802e879c7fb9d87b9db272b33c8cb3b8a4ec35"
Commit
bc5ba410
authored
Feb 22, 2018
by
ykb
Browse files
添加菜单查询、新增、删除功能
parent
25057190
Changes
26
Hide whitespace changes
Inline
Side-by-side
admin-console/src/main/java/com/ibeetl/admin/console/web/FunctionController.java
View file @
bc5ba410
package
com.ibeetl.admin.console.web
;
import
com.ibeetl.admin.console.service.FunctionConsoleService
;
import
com.ibeetl.admin.console.web.query.AuditQuery
;
import
com.ibeetl.admin.console.web.query.FunctionQuery
;
import
com.ibeetl.admin.core.annotation.Function
;
import
com.ibeetl.admin.core.annotation.Query
;
import
com.ibeetl.admin.core.entity.CoreFunction
;
import
com.ibeetl.admin.core.entity.CoreOrg
;
import
com.ibeetl.admin.core.rbac.tree.FunctionItem
;
import
com.ibeetl.admin.core.service.CorePlatformService
;
import
com.ibeetl.admin.core.util.AnnotationUtil
;
import
com.ibeetl.admin.core.util.ConvertUtil
;
import
com.ibeetl.admin.core.util.FormFieldException
;
import
com.ibeetl.admin.core.util.PlatformException
;
import
com.ibeetl.admin.core.util.ValidateConfig
;
import
com.ibeetl.admin.core.web.JsonResult
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
...
...
@@ -28,11 +18,20 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.servlet.ModelAndView
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
com.ibeetl.admin.console.service.FunctionConsoleService
;
import
com.ibeetl.admin.console.web.query.FunctionQuery
;
import
com.ibeetl.admin.core.annotation.Function
;
import
com.ibeetl.admin.core.annotation.Query
;
import
com.ibeetl.admin.core.entity.CoreFunction
;
import
com.ibeetl.admin.core.rbac.tree.FunctionItem
;
import
com.ibeetl.admin.core.service.CorePlatformService
;
import
com.ibeetl.admin.core.util.AnnotationUtil
;
import
com.ibeetl.admin.core.util.ConvertUtil
;
import
com.ibeetl.admin.core.util.FormFieldException
;
import
com.ibeetl.admin.core.util.PlatformException
;
import
com.ibeetl.admin.core.util.ValidateConfig
;
import
com.ibeetl.admin.core.web.JsonResult
;
import
com.ibeetl.admin.core.web.dto.FunctionNodeView
;
/**
* 描述: 功能点管理
...
...
@@ -69,7 +68,7 @@ public class FunctionController {
}
@GetMapping
(
MODEL
+
"/edit.do"
)
@Function
(
"function.edit"
)
public
ModelAndView
edit
(
String
id
)
{
public
ModelAndView
edit
(
Integer
id
)
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/function/edit.html"
);
CoreFunction
function
=
functionConsoleService
.
queryById
(
id
);
view
.
addObject
(
"function"
,
function
);
...
...
@@ -188,10 +187,8 @@ public class FunctionController {
@ResponseBody
public
JsonResult
batchDel
(
String
ids
)
{
List
<
Long
>
dels
=
ConvertUtil
.
str2longs
(
ids
);
JsonResult
result
=
new
JsonResult
();
//todo 导致缓存多次操作.
functionConsoleService
.
batchDeleteFunction
(
dels
);
return
r
esult
.
success
();
return
new
JsonR
esult
()
.
success
();
}
...
...
@@ -217,6 +214,7 @@ public class FunctionController {
view
.
setCode
(
item
.
getData
().
getCode
());
view
.
setName
(
item
.
getData
().
getName
());
view
.
setId
(
item
.
getData
().
getId
());
view
.
setAccessUrl
(
item
.
getData
().
getAccessUrl
());
List
<
FunctionNodeView
>
children
=
this
.
buildFunctionTree
(
item
);
view
.
setChildren
(
children
);
views
.
add
(
view
);
...
...
@@ -224,49 +222,6 @@ public class FunctionController {
return
views
;
}
class
FunctionNodeView
{
String
name
;
String
code
;
Long
id
;
String
icon
;
List
<
FunctionNodeView
>
children
=
new
ArrayList
<
FunctionNodeView
>();
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
List
<
FunctionNodeView
>
getChildren
()
{
return
children
;
}
public
void
setChildren
(
List
<
FunctionNodeView
>
children
)
{
this
.
children
=
children
;
}
public
String
getIcon
()
{
return
icon
;
}
public
void
setIcon
(
String
icon
)
{
this
.
icon
=
icon
;
}
}
}
admin-console/src/main/java/com/ibeetl/admin/console/web/MenuController.java
View file @
bc5ba410
...
...
@@ -10,17 +10,22 @@ import org.beetl.sql.core.engine.PageQuery;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.servlet.ModelAndView
;
import
com.ibeetl.admin.console.service.MenuConsoleService
;
import
com.ibeetl.admin.console.web.query.FunctionQuery
;
import
com.ibeetl.admin.console.web.query.MenuQuery
;
import
com.ibeetl.admin.core.annotation.Function
;
import
com.ibeetl.admin.core.annotation.Query
;
import
com.ibeetl.admin.core.entity.CoreFunction
;
import
com.ibeetl.admin.core.entity.CoreMenu
;
import
com.ibeetl.admin.core.rbac.tree.MenuItem
;
import
com.ibeetl.admin.core.service.CorePlatformService
;
import
com.ibeetl.admin.core.util.AnnotationUtil
;
import
com.ibeetl.admin.core.util.ConvertUtil
;
import
com.ibeetl.admin.core.web.JsonResult
;
/**
...
...
@@ -40,7 +45,33 @@ public class MenuController {
@Autowired
CorePlatformService
platformService
;
/*页面*/
@GetMapping
(
MODEL
+
"/index.do"
)
@Function
(
"menu"
)
public
ModelAndView
index
()
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/menu/index.html"
);
view
.
addObject
(
"search"
,
MenuQuery
.
class
.
getName
());
return
view
;
}
@GetMapping
(
MODEL
+
"/add.do"
)
@Function
(
"menu.add"
)
public
ModelAndView
add
()
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/menu/add.html"
);
return
view
;
}
@GetMapping
(
MODEL
+
"/edit.do"
)
@Function
(
"menu.edit"
)
public
ModelAndView
edit
(
Integer
id
)
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/menu/edit.html"
);
CoreMenu
menu
=
menuService
.
queryById
(
id
);
view
.
addObject
(
"menu"
,
menu
);
return
view
;
}
/*Json*/
/**
* 查询
* @param menu
...
...
@@ -122,6 +153,20 @@ public class MenuController {
return
new
JsonResult
().
success
();
}
/**
* 批量删除
* @param ids 菜单id集合
* @return
*/
@PostMapping
(
MODEL
+
"/batchDel.json"
)
@Function
(
"menu.delete"
)
@ResponseBody
public
JsonResult
delete
(
String
ids
)
{
List
<
Long
>
dels
=
ConvertUtil
.
str2longs
(
ids
);
menuService
.
batchDeleteMenuId
(
dels
);
return
new
JsonResult
().
success
();
}
...
...
admin-console/src/main/java/com/ibeetl/admin/console/web/query/MenuQuery.java
View file @
bc5ba410
...
...
@@ -16,6 +16,8 @@ public class MenuQuery extends PageParam {
@Query
(
name
=
"菜单入口地址"
,
display
=
true
,
fuzzy
=
true
)
private
String
url
;
@Query
(
name
=
"上一级菜单"
,
display
=
true
,
type
=
Query
.
TYPE_CONTROL
,
control
=
"menu"
)
private
Long
parentMenuId
;
public
String
getCode
()
{
return
code
;
...
...
@@ -35,6 +37,12 @@ public class MenuQuery extends PageParam {
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
Long
getParentMenuId
()
{
return
parentMenuId
;
}
public
void
setParentMenuId
(
Long
parentMenuId
)
{
this
.
parentMenuId
=
parentMenuId
;
}
...
...
admin-console/src/main/resources/sql/console/menu.md
View file @
bc5ba410
...
...
@@ -21,6 +21,10 @@ queryByCondtion
@if(!isEmpty(name)){
and m.name like #'%'+name+"%"#
@}
@if(!isEmpty(parentMenuId)){
and m.parent_menu_id = #parentMenuId#
@}
...
...
admin-console/src/main/resources/static/js/admin/function/index.js
View file @
bc5ba410
...
...
@@ -2,7 +2,7 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) {
var
form
=
layui
.
form
;
var
laydate
=
layui
.
laydate
;
var
table
=
layui
.
table
;
var
user
Table
=
null
;
var
function
Table
=
null
;
var
view
=
{
init
:
function
(){
...
...
@@ -10,13 +10,13 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) {
this
.
initSearchForm
();
this
.
initToolBar
();
window
.
dataReload
=
function
(){
Lib
.
doSearchForm
(
$
(
"
#functionSearchForm
"
),
user
Table
,
form
)
Lib
.
doSearchForm
(
$
(
"
#functionSearchForm
"
),
function
Table
,
form
)
}
},
initTable
:
function
(){
user
Table
=
table
.
render
({
function
Table
=
table
.
render
({
elem
:
'
#functionTable
'
,
height
:
'
full-280
'
,
method
:
'
post
'
,
...
...
@@ -75,7 +75,7 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) {
},
initSearchForm
:
function
(){
Lib
.
initSearchForm
(
$
(
"
#functionSearchForm
"
),
user
Table
,
form
);
Lib
.
initSearchForm
(
$
(
"
#functionSearchForm
"
),
function
Table
,
form
);
},
initToolBar
:
function
(){
toolbar
=
{
...
...
admin-console/src/main/resources/static/js/admin/menu/add.js
0 → 100644
View file @
bc5ba410
layui
.
define
([
'
form
'
,
'
laydate
'
,
'
table
'
,
'
menuApi
'
],
function
(
exports
)
{
var
form
=
layui
.
form
;
var
menuApi
=
layui
.
menuApi
;
var
index
=
layui
.
index
;
var
view
=
{
init
:
function
(){
Lib
.
initGenrealForm
(
$
(
"
#addForm
"
),
form
);
this
.
initSubmit
();
$
(
'
#parentMenuId
'
).
val
(
0
);
$
(
'
#seq
'
).
val
(
1
);
},
initSubmit
:
function
(){
$
(
"
#saveMenu
"
).
click
(
function
(){
menuApi
.
addMenu
(
function
(){
Common
.
info
(
"
添加成功
"
);
Lib
.
closeFrame
();
});
parent
.
window
.
dataReload
();
});
$
(
"
#saveMenu-cancel
"
).
click
(
function
(){
Lib
.
closeFrame
();
});
}
}
exports
(
'
add
'
,
view
);
});
\ No newline at end of file
admin-console/src/main/resources/static/js/admin/menu/del.js
0 → 100644
View file @
bc5ba410
layui
.
define
([
'
table
'
,
'
menuApi
'
],
function
(
exports
)
{
var
menuApi
=
layui
.
menuApi
;
var
table
=
layui
.
table
;
var
view
=
{
init
:
function
(){
},
delBatch
:
function
(){
var
data
=
Common
.
getMoreDataFromTable
(
table
,
"
menuTable
"
);
if
(
data
==
null
){
return
;
}
Common
.
openConfirm
(
"
确认要删除这些菜单?
"
,
function
(){
var
ids
=
Common
.
concatBatchId
(
data
);
menuApi
.
del
(
ids
,
function
(){
Common
.
info
(
"
删除成功
"
);
dataReload
();
})
})
}
}
exports
(
'
del
'
,
view
);
});
\ No newline at end of file
admin-console/src/main/resources/static/js/admin/menu/index.js
0 → 100644
View file @
bc5ba410
layui
.
define
([
'
form
'
,
'
laydate
'
,
'
table
'
],
function
(
exports
)
{
var
form
=
layui
.
form
;
var
laydate
=
layui
.
laydate
;
var
table
=
layui
.
table
;
var
menuTable
=
null
;
var
view
=
{
init
:
function
(){
this
.
initTable
();
this
.
initSearchForm
();
this
.
initToolBar
();
window
.
dataReload
=
function
(){
Lib
.
doSearchForm
(
$
(
"
#menuSearchForm
"
),
menuTable
,
form
)
}
},
initTable
:
function
(){
menuTable
=
table
.
render
({
elem
:
'
#menuTable
'
,
height
:
'
full-280
'
,
method
:
'
post
'
,
url
:
Common
.
CTX
+
'
/admin/menu/list.json
'
//数据接口
,
page
:
{
"
layout
"
:[
'
count
'
,
'
prev
'
,
'
page
'
,
'
next
'
]}
//开启分页
,
limit
:
10
,
cols
:
[
[
//表头
{
type
:
'
checkbox
'
,
fixed
:
'
left
'
,
},
{
field
:
'
id
'
,
title
:
'
id
'
,
width
:
80
,
fixed
:
'
left
'
,
sort
:
true
},
{
field
:
'
code
'
,
title
:
'
菜单代码
'
,
width
:
150
},
{
field
:
'
name
'
,
title
:
'
菜单名称
'
,
width
:
150
,
sort
:
true
},
{
field
:
'
accessUrl
'
,
title
:
'
菜单入口地址
'
,
width
:
300
,
sort
:
true
},
{
field
:
'
parentMenuName
'
,
title
:
'
上一级菜单
'
,
width
:
120
,
sort
:
true
},{
field
:
'
typeText
'
,
title
:
'
菜单类型
'
,
width
:
120
,
sort
:
true
},
{
field
:
'
createTime
'
,
title
:
'
创建时间
'
,
width
:
120
,
templet
:
function
(
d
){
return
Common
.
getDate
(
d
.
createTime
);
},
sort
:
true
}
]
]
});
},
initSearchForm
:
function
(){
Lib
.
initSearchForm
(
$
(
"
#menuSearchForm
"
),
menuTable
,
form
);
},
initToolBar
:
function
(){
toolbar
=
{
add
:
function
()
{
//获取选中数据
var
url
=
"
/admin/menu/add.do
"
;
Common
.
openDlg
(
url
,
"
菜单管理>新增
"
);
},
edit
:
function
()
{
//获取选中数目
var
data
=
Common
.
getOneFromTable
(
table
,
"
menuTable
"
);
if
(
data
==
null
){
return
;
}
var
url
=
"
/admin/menu/edit.do?id=
"
+
data
.
id
;
Common
.
openDlg
(
url
,
"
菜单管理>编辑
"
);
},
del
:
function
()
{
layui
.
use
([
'
del
'
],
function
(){
var
delView
=
layui
.
del
delView
.
delBatch
();
});
}
};
$
(
'
.ext-toolbar
'
).
on
(
'
click
'
,
function
()
{
var
type
=
$
(
this
).
data
(
'
type
'
);
toolbar
[
type
]
?
toolbar
[
type
].
call
(
this
)
:
''
;
});
}
}
exports
(
'
index
'
,
view
);
});
\ No newline at end of file
admin-console/src/main/resources/static/js/admin/menu/menuApi.js
0 → 100644
View file @
bc5ba410
/*访问后台的代码*/
layui
.
define
([],
function
(
exports
)
{
var
api
=
{
updateMenu
:
function
(
callback
){
Lib
.
submitForm
(
$
(
'
#updateForm
'
),{},
callback
)
},
addMenu
:
function
(
callback
){
Lib
.
submitForm
(
$
(
'
#addForm
'
),{},
callback
)
},
del
:
function
(
ids
,
callback
){
Common
.
post
(
"
/admin/menu/batchDel.json
"
,{
"
ids
"
:
ids
},
function
(){
callback
();
})
}
};
exports
(
'
menuApi
'
,
api
);
});
\ No newline at end of file
admin-console/src/main/resources/templates/admin/function/index.html
View file @
bc5ba410
...
...
@@ -5,7 +5,7 @@
<div
class=
"layui-btn-group"
>
<layui:accessButton
function=
"function.add"
action=
"add"
>
增加
</layui:accessButton>
<layui:accessButton
function=
"function.edit"
action=
"edit"
>
编辑
</layui:accessButton>
<layui:accessButton
function=
"function.del"
action=
"del"
>
删除
</layui:accessButton>
<layui:accessButton
function=
"function.del
ete
"
action=
"del"
>
删除
</layui:accessButton>
</div>
<table
id=
"functionTable"
lay-filter=
"functionTable"
></table>
<!--#} -->
...
...
admin-console/src/main/resources/templates/admin/menu/add.html
0 → 100644
View file @
bc5ba410
<!--# layout("/common/layout.html",{"jsBase":"/js/admin/menu/"}){ -->
<form
class=
"layui-form layui-form-pane"
id=
"addForm"
action=
"/admin/menu/save.json"
>
<div
class=
"layui-row"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
菜单名
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"name"
autocomplete=
"off"
placeholder=
"请输入名称"
class=
"layui-input"
value=
""
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
菜单代码
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"code"
lay-verify=
"required"
placeholder=
"请输入"
autocomplete=
"off"
class=
"layui-input"
value=
""
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
菜单地址
</label>
<layui:menuFunctionInput
style=
'layui-input-inline'
name=
"functionId"
id=
"functionId"
value=
""
></layui:menuFunctionInput>
</div>
</div>
<div
class=
"layui-row"
>
<div
class=
"layui-col-xs4"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
菜单排序
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"seq"
id=
"seq"
lay-verify=
"required"
placeholder=
"请输入"
autocomplete=
"off"
class=
"layui-input"
value=
""
>
</div>
</div>
</div>
<div
class=
"layui-col-xs4"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
菜单图标
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"icon"
lay-verify=
"required"
placeholder=
"请输入"
autocomplete=
"off"
class=
"layui-input"
value=
""
>
</div>
</div>
</div>
</div>
<div
class=
"layui-row"
>
<div
class=
"layui-col-xs4"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
所在父菜单
</label>
<layui:menuInput
style=
'layui-input-inline'
name=
"parentMenuId"
id=
"parentMenuId"
value=
""
></layui:menuInput>
</div>
</div>
</div>
<div
class=
"layui-col-xs4"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
菜单类型
</label>
<layui:simpleDictSelect
style=
'layui-input-inline'
type=
"menu_type"
id=
"type"
name=
"type"
value=
""
/>
</div>
</div>
</div>
<layui:submitButtons
id=
"saveMenu"
/>
</form>
<!--#} -->
<script>
layui
.
use
([
'
add
'
],
function
(){
var
menuAdd
=
layui
.
add
menuAdd
.
init
();
});
</script>
admin-console/src/main/resources/templates/admin/menu/index.html
0 → 100644
View file @
bc5ba410
<!--#layout("/common/layout.html",{"jsBase":"/js/admin/menu/"}){ -->
<layui:searchForm
formId=
"menuSearchForm"
condition=
"${search}"
>
</layui:searchForm>
<div
class=
"layui-btn-group"
>
<layui:accessButton
function=
"menu.add"
action=
"add"
>
增加
</layui:accessButton>
<layui:accessButton
function=
"menu.edit"
action=
"edit"
>
编辑
</layui:accessButton>
<layui:accessButton
function=
"menu.delete"
action=
"del"
>
删除
</layui:accessButton>
</div>
<table
id=
"menuTable"
lay-filter=
"menuTable"
></table>
<!--#} -->
<script>
layui
.
use
([
'
index
'
],
function
(){
var
index
=
layui
.
index
index
.
init
();
});
</script>
admin-core/src/main/java/com/ibeetl/admin/core/conf/BeetlConf.java
View file @
bc5ba410
...
...
@@ -24,7 +24,9 @@ import com.ibeetl.admin.core.service.CorePlatformService;
import
com.ibeetl.admin.core.util.beetl.DictQueryByValueFunction
;
import
com.ibeetl.admin.core.util.beetl.DictQueryFunction
;
import
com.ibeetl.admin.core.util.beetl.DictUpQueryFunction
;
import
com.ibeetl.admin.core.util.beetl.FunAccessUrlFunction
;
import
com.ibeetl.admin.core.util.beetl.FunFunction
;
import
com.ibeetl.admin.core.util.beetl.MenuFunction
;
import
com.ibeetl.admin.core.util.beetl.OrgFunction
;
import
com.ibeetl.admin.core.util.beetl.RoleFunction
;
import
com.ibeetl.admin.core.util.beetl.SearchCondtionFunction
;
...
...
@@ -70,6 +72,12 @@ public class BeetlConf {
@Autowired
FunFunction
funFunction
;
@Autowired
FunAccessUrlFunction
funAccessUrlFunction
;
@Autowired
MenuFunction
menuFunction
;
@Bean
public
WebSimulate
getWebSimulate
(
GroupTemplate
gt
,
ObjectMapper
objectMapper
)
{
return
new
WebSimulate
(
gt
,
new
ObjectMapperJsonUtil
(
objectMapper
))
{
...
...
@@ -88,6 +96,8 @@ public class BeetlConf {
groupTemplate
.
registerFunctionPackage
(
"queryCondtion"
,
new
QueryParser
());
groupTemplate
.
registerFunction
(
"core.orgName"
,
orgFunction
);
groupTemplate
.
registerFunction
(
"core.functionName"
,
funFunction
);
groupTemplate
.
registerFunction
(
"core.funAccessUrl"
,
funAccessUrlFunction
);
groupTemplate
.
registerFunction
(
"core.menuName"
,
menuFunction
);
groupTemplate
.
registerFunction
(
"core.searchCondtion"
,
searchCondtionFunction
);
groupTemplate
.
registerFunction
(
"core.dictDownQuery"
,
dictDownQueryFunction
);
groupTemplate
.
registerFunction
(
"core.dictLevel"
,
dictUpQueryFunction
);
...
...
admin-core/src/main/java/com/ibeetl/admin/core/entity/CoreMenu.java
View file @
bc5ba410
...
...
@@ -30,7 +30,7 @@ public class CoreMenu extends BaseEntity {
protected
Date
createTime
;
//菜单代码
@NotBlank
(
message
=
"菜单
编
码不能为空"
,
groups
=
ValidateConfig
.
ADD
.
class
)
@NotBlank
(
message
=
"菜单
代
码不能为空"
,
groups
=
ValidateConfig
.
ADD
.
class
)
private
String
code
;
//功能id
...
...
admin-core/src/main/java/com/ibeetl/admin/core/util/beetl/FunAccessUrlFunction.java
0 → 100644
View file @
bc5ba410
package
com.ibeetl.admin.core.util.beetl
;
import
org.beetl.core.Context
;
import
org.beetl.core.Function
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
com.ibeetl.admin.core.rbac.tree.FunctionItem
;
import
com.ibeetl.admin.core.service.CorePlatformService
;
/**
* 通过functionId获取AccessUrl,从缓存中获取
*/
@Component
public
class
FunAccessUrlFunction
implements
Function
{
@Autowired
CorePlatformService
platFormService
;
public
Object
call
(
Object
[]
paras
,
Context
ctx
)
{
FunctionItem
tree
=
platFormService
.
buildFunction
();
FunctionItem
item
=
tree
.
findChild
((
Long
)
paras
[
0
]);
return
item
.
getData
().
getAccessUrl
();
}
}
admin-core/src/main/java/com/ibeetl/admin/core/util/beetl/FunFunction.java
View file @
bc5ba410
...
...
@@ -6,11 +6,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
com.ibeetl.admin.core.rbac.tree.FunctionItem
;
import
com.ibeetl.admin.core.rbac.tree.OrgItem
;
import
com.ibeetl.admin.core.service.CorePlatformService
;
import
java.util.List
;
/**
* 通过functionId获取functionName,从缓存中获取
*/
...
...
admin-core/src/main/java/com/ibeetl/admin/core/util/beetl/MenuFunction.java
0 → 100644
View file @
bc5ba410
package
com.ibeetl.admin.core.util.beetl
;
import
org.beetl.core.Context
;
import
org.beetl.core.Function
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
com.ibeetl.admin.core.rbac.tree.MenuItem
;
import
com.ibeetl.admin.core.service.CorePlatformService
;
/**
* 通过menuId获取menuName,从缓存中获取
*/
@Component
public
class
MenuFunction
implements
Function
{
@Autowired
CorePlatformService
platFormService
;
public
Object
call
(
Object
[]
paras
,
Context
ctx
)
{
MenuItem
tree
=
platFormService
.
buildMenu
();
MenuItem
item
=
tree
.
findChild
((
Long
)
paras
[
0
]);
return
item
.
getName
();
}
}
admin-core/src/main/java/com/ibeetl/admin/core/web/CoreUserController.java
View file @
bc5ba410
...
...
@@ -8,7 +8,6 @@ import org.apache.commons.logging.Log;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
...
...
@@ -23,6 +22,9 @@ import com.ibeetl.admin.core.service.CorePlatformService;
import
com.ibeetl.admin.core.service.CoreUserService
;
import
com.ibeetl.admin.core.util.DictUtil
;
import
com.ibeetl.admin.core.util.HttpRequestLocal
;
import
com.ibeetl.admin.core.web.dto.FunctionNodeView
;
import
com.ibeetl.admin.core.web.dto.MenuNodeView
;
import
com.ibeetl.admin.core.web.dto.SystemMenuView
;
@Controller
@SuppressWarnings
(
"unchecked"
)
...
...
@@ -197,7 +199,7 @@ public class CoreUserController {
*
* @return
*/
@
Ge
tMapping
(
MODEL
+
"/menu/tree.json"
)
@
Pos
tMapping
(
MODEL
+
"/menu/tree.json"
)
@ResponseBody
public
JsonResult
<
List
<
MenuNodeView
>>
getMenuTree
()
{
MenuItem
menuItem
=
platformService
.
buildMenu
();
...
...
@@ -251,161 +253,12 @@ public class CoreUserController {
view
.
setCode
(
item
.
getData
().
getCode
());
view
.
setName
(
item
.
getData
().
getName
());
view
.
setId
(
item
.
getData
().
getId
());
view
.
setAccessUrl
(
item
.
getData
().
getAccessUrl
());
List
<
FunctionNodeView
>
children
=
this
.
buildFunctionTree
(
item
);
view
.
setChildren
(
children
);
views
.
add
(
view
);
}
return
views
;
}
class
SystemMenuView
{
String
code
;
Long
id
;
String
name
;
String
icon
;
public
SystemMenuView
(
Long
id
,
String
code
,
String
name
)
{
this
.
id
=
id
;
this
.
code
=
code
;
this
.
name
=
name
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getIcon
()
{
return
icon
;
}
public
void
setIcon
(
String
icon
)
{
this
.
icon
=
icon
;
}
}
class
MenuNodeView
{
String
name
;
String
code
;
Long
id
;
String
path
;
String
icon
;
List
<
MenuNodeView
>
children
=
new
ArrayList
<
MenuNodeView
>();
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
List
<
MenuNodeView
>
getChildren
()
{
return
children
;
}
public
void
setChildren
(
List
<
MenuNodeView
>
children
)
{
this
.
children
=
children
;
}
public
String
getPath
()
{
return
path
;
}
public
void
setPath
(
String
path
)
{
this
.
path
=
path
;
}
public
String
getIcon
()
{
return
icon
;
}
public
void
setIcon
(
String
icon
)
{
this
.
icon
=
icon
;
}
}
class
FunctionNodeView
{
String
name
;
String
code
;
Long
id
;
String
icon
;
List
<
FunctionNodeView
>
children
=
new
ArrayList
<
FunctionNodeView
>();
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
List
<
FunctionNodeView
>
getChildren
()
{
return
children
;
}
public
void
setChildren
(
List
<
FunctionNodeView
>
children
)
{
this
.
children
=
children
;
}
public
String
getIcon
()
{
return
icon
;
}
public
void
setIcon
(
String
icon
)
{
this
.
icon
=
icon
;
}
}
}
admin-core/src/main/java/com/ibeetl/admin/core/web/dto/FunctionNodeView.java
0 → 100644
View file @
bc5ba410
package
com.ibeetl.admin.core.web.dto
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
FunctionNodeView
{
private
String
name
;
private
String
code
;
private
String
accessUrl
;
private
Long
id
;
String
icon
;
List
<
FunctionNodeView
>
children
=
new
ArrayList
<
FunctionNodeView
>();
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
List
<
FunctionNodeView
>
getChildren
()
{
return
children
;
}
public
void
setChildren
(
List
<
FunctionNodeView
>
children
)
{
this
.
children
=
children
;
}
public
String
getIcon
()
{
return
icon
;
}
public
void
setIcon
(
String
icon
)
{
this
.
icon
=
icon
;
}
public
String
getAccessUrl
()
{
return
accessUrl
;
}
public
void
setAccessUrl
(
String
accessUrl
)
{
this
.
accessUrl
=
accessUrl
;
}
}
admin-core/src/main/java/com/ibeetl/admin/core/web/dto/MenuNodeView.java
0 → 100644
View file @
bc5ba410
package
com.ibeetl.admin.core.web.dto
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
MenuNodeView
{
private
String
name
;
private
String
code
;
private
Long
id
;
private
String
path
;
private
String
icon
;
private
List
<
MenuNodeView
>
children
=
new
ArrayList
<
MenuNodeView
>();
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
List
<
MenuNodeView
>
getChildren
()
{
return
children
;
}
public
void
setChildren
(
List
<
MenuNodeView
>
children
)
{
this
.
children
=
children
;
}
public
String
getPath
()
{
return
path
;
}
public
void
setPath
(
String
path
)
{
this
.
path
=
path
;
}
public
String
getIcon
()
{
return
icon
;
}
public
void
setIcon
(
String
icon
)
{
this
.
icon
=
icon
;
}
}
Prev
1
2
Next
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