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
27cd61c4
Commit
27cd61c4
authored
Dec 09, 2017
by
naan1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
菜单id改为long
parent
062d16bb
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
77 additions
and
76 deletions
+77
-76
guns-admin/sql/guns.sql
+4
-3
guns-admin/src/main/java/com/stylefeng/guns/common/constant/factory/ConstantFactory.java
+1
-1
guns-admin/src/main/java/com/stylefeng/guns/common/constant/factory/IConstantFactory.java
+1
-1
guns-admin/src/main/java/com/stylefeng/guns/common/persistence/model/Menu.java
+3
-3
guns-admin/src/main/java/com/stylefeng/guns/common/persistence/model/Relation.java
+34
-34
guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/MenuController.java
+4
-4
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/MenuDao.java
+3
-3
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/MenuDao.xml
+1
-1
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IMenuService.java
+2
-2
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/MenuServiceImpl.java
+2
-2
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/RoleServiceImpl.java
+4
-4
guns-core/src/main/java/com/stylefeng/guns/core/node/MenuNode.java
+10
-10
guns-core/src/main/java/com/stylefeng/guns/core/node/ZTreeNode.java
+8
-8
No files found.
guns-admin/sql/guns.sql
View file @
27cd61c4
...
@@ -117,7 +117,7 @@ CREATE TABLE `login_log` (
...
@@ -117,7 +117,7 @@ CREATE TABLE `login_log` (
-- ----------------------------
-- ----------------------------
DROP
TABLE
IF
EXISTS
`menu`
;
DROP
TABLE
IF
EXISTS
`menu`
;
CREATE
TABLE
`menu`
(
CREATE
TABLE
`menu`
(
`id`
int
(
65
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键id'
,
`id`
bigint
(
20
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键id'
,
`code`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'菜单编号'
,
`code`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'菜单编号'
,
`pcode`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'菜单父编号'
,
`pcode`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'菜单父编号'
,
`pcodes`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'当前菜单的所有父菜单编号'
,
`pcodes`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'当前菜单的所有父菜单编号'
,
...
@@ -230,12 +230,13 @@ CREATE TABLE `operation_log` (
...
@@ -230,12 +230,13 @@ CREATE TABLE `operation_log` (
`succeed`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'是否成功'
,
`succeed`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'是否成功'
,
`message`
text
COMMENT
'备注'
,
`message`
text
COMMENT
'备注'
,
PRIMARY
KEY
(
`id`
)
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
54
2
DEFAULT
CHARSET
=
utf8
COMMENT
=
'操作日志'
;
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
54
3
DEFAULT
CHARSET
=
utf8
COMMENT
=
'操作日志'
;
-- ----------------------------
-- ----------------------------
-- Records of operation_log
-- Records of operation_log
-- ----------------------------
-- ----------------------------
INSERT
INTO
`operation_log`
VALUES
(
'541'
,
'业务日志'
,
'清空业务日志'
,
'1'
,
'com.stylefeng.guns.modular.system.controller.LogController'
,
'delLog'
,
'2017-12-07 23:36:45'
,
'成功'
,
'主键id=null'
);
INSERT
INTO
`operation_log`
VALUES
(
'541'
,
'业务日志'
,
'清空业务日志'
,
'1'
,
'com.stylefeng.guns.modular.system.controller.LogController'
,
'delLog'
,
'2017-12-07 23:36:45'
,
'成功'
,
'主键id=null'
);
INSERT
INTO
`operation_log`
VALUES
(
'542'
,
'业务日志'
,
'修改菜单'
,
'1'
,
'com.stylefeng.guns.modular.system.controller.MenuController'
,
'edit'
,
'2017-12-09 18:40:09'
,
'成功'
,
'菜单名称=通知;;;'
);
-- ----------------------------
-- ----------------------------
-- Table structure for relation
-- Table structure for relation
...
@@ -243,7 +244,7 @@ INSERT INTO `operation_log` VALUES ('541', '业务日志', '清空业务日志',
...
@@ -243,7 +244,7 @@ INSERT INTO `operation_log` VALUES ('541', '业务日志', '清空业务日志',
DROP
TABLE
IF
EXISTS
`relation`
;
DROP
TABLE
IF
EXISTS
`relation`
;
CREATE
TABLE
`relation`
(
CREATE
TABLE
`relation`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键'
,
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键'
,
`menuid`
int
(
11
)
DEFAULT
NULL
COMMENT
'菜单id'
,
`menuid`
big
int
(
11
)
DEFAULT
NULL
COMMENT
'菜单id'
,
`roleid`
int
(
11
)
DEFAULT
NULL
COMMENT
'角色id'
,
`roleid`
int
(
11
)
DEFAULT
NULL
COMMENT
'角色id'
,
PRIMARY
KEY
(
`id`
)
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
3737
DEFAULT
CHARSET
=
utf8
COMMENT
=
'角色和菜单关联表'
;
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
3737
DEFAULT
CHARSET
=
utf8
COMMENT
=
'角色和菜单关联表'
;
...
...
guns-admin/src/main/java/com/stylefeng/guns/common/constant/factory/ConstantFactory.java
View file @
27cd61c4
...
@@ -155,7 +155,7 @@ public class ConstantFactory implements IConstantFactory {
...
@@ -155,7 +155,7 @@ public class ConstantFactory implements IConstantFactory {
* 获取菜单名称
* 获取菜单名称
*/
*/
@Override
@Override
public
String
getMenuName
(
Integer
menuId
)
{
public
String
getMenuName
(
Long
menuId
)
{
if
(
ToolUtil
.
isEmpty
(
menuId
))
{
if
(
ToolUtil
.
isEmpty
(
menuId
))
{
return
""
;
return
""
;
}
else
{
}
else
{
...
...
guns-admin/src/main/java/com/stylefeng/guns/common/constant/factory/IConstantFactory.java
View file @
27cd61c4
...
@@ -56,7 +56,7 @@ public interface IConstantFactory {
...
@@ -56,7 +56,7 @@ public interface IConstantFactory {
/**
/**
* 获取菜单名称
* 获取菜单名称
*/
*/
String
getMenuName
(
Integer
menuId
);
String
getMenuName
(
Long
menuId
);
/**
/**
* 获取菜单名称通过编号
* 获取菜单名称通过编号
...
...
guns-admin/src/main/java/com/stylefeng/guns/common/persistence/model/Menu.java
View file @
27cd61c4
...
@@ -23,7 +23,7 @@ public class Menu extends Model<Menu> {
...
@@ -23,7 +23,7 @@ public class Menu extends Model<Menu> {
* 主键id
* 主键id
*/
*/
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
private
Long
id
;
/**
/**
* 菜单编号
* 菜单编号
*/
*/
...
@@ -76,11 +76,11 @@ public class Menu extends Model<Menu> {
...
@@ -76,11 +76,11 @@ public class Menu extends Model<Menu> {
private
Integer
isopen
;
private
Integer
isopen
;
public
Integer
getId
()
{
public
Long
getId
()
{
return
id
;
return
id
;
}
}
public
void
setId
(
Integer
id
)
{
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
}
}
...
...
guns-admin/src/main/java/com/stylefeng/guns/common/persistence/model/Relation.java
View file @
27cd61c4
...
@@ -21,53 +21,53 @@ public class Relation extends Model<Relation> {
...
@@ -21,53 +21,53 @@ public class Relation extends Model<Relation> {
/**
/**
* 主键
* 主键
*/
*/
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
private
Integer
id
;
/**
/**
* 菜单id
* 菜单id
*/
*/
private
Integer
menuid
;
private
Long
menuid
;
/**
/**
* 角色id
* 角色id
*/
*/
private
Integer
roleid
;
private
Integer
roleid
;
public
Integer
getId
()
{
public
Integer
getId
()
{
return
id
;
return
id
;
}
}
public
void
setId
(
Integer
id
)
{
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
}
}
public
Integer
getMenuid
()
{
public
Long
getMenuid
()
{
return
menuid
;
return
menuid
;
}
}
public
void
setMenuid
(
Integer
menuid
)
{
public
void
setMenuid
(
Long
menuid
)
{
this
.
menuid
=
menuid
;
this
.
menuid
=
menuid
;
}
}
public
Integer
getRoleid
()
{
public
Integer
getRoleid
()
{
return
roleid
;
return
roleid
;
}
}
public
void
setRoleid
(
Integer
roleid
)
{
public
void
setRoleid
(
Integer
roleid
)
{
this
.
roleid
=
roleid
;
this
.
roleid
=
roleid
;
}
}
@Override
@Override
protected
Serializable
pkVal
()
{
protected
Serializable
pkVal
()
{
return
this
.
id
;
return
this
.
id
;
}
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"Relation{"
+
return
"Relation{"
+
"id="
+
id
+
"id="
+
id
+
", menuid="
+
menuid
+
", menuid="
+
menuid
+
", roleid="
+
roleid
+
", roleid="
+
roleid
+
"}"
;
"}"
;
}
}
}
}
guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/MenuController.java
View file @
27cd61c4
...
@@ -74,7 +74,7 @@ public class MenuController extends BaseController {
...
@@ -74,7 +74,7 @@ public class MenuController extends BaseController {
*/
*/
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@RequestMapping
(
value
=
"/menu_edit/{menuId}"
)
@RequestMapping
(
value
=
"/menu_edit/{menuId}"
)
public
String
menuEdit
(
@PathVariable
Integer
menuId
,
Model
model
)
{
public
String
menuEdit
(
@PathVariable
Long
menuId
,
Model
model
)
{
if
(
ToolUtil
.
isEmpty
(
menuId
))
{
if
(
ToolUtil
.
isEmpty
(
menuId
))
{
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
}
}
...
@@ -162,7 +162,7 @@ public class MenuController extends BaseController {
...
@@ -162,7 +162,7 @@ public class MenuController extends BaseController {
@RequestMapping
(
value
=
"/remove"
)
@RequestMapping
(
value
=
"/remove"
)
@BussinessLog
(
value
=
"删除菜单"
,
key
=
"menuId"
,
dict
=
MenuDict
.
class
)
@BussinessLog
(
value
=
"删除菜单"
,
key
=
"menuId"
,
dict
=
MenuDict
.
class
)
@ResponseBody
@ResponseBody
public
Tip
remove
(
@RequestParam
Integer
menuId
)
{
public
Tip
remove
(
@RequestParam
Long
menuId
)
{
if
(
ToolUtil
.
isEmpty
(
menuId
))
{
if
(
ToolUtil
.
isEmpty
(
menuId
))
{
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
}
}
...
@@ -179,7 +179,7 @@ public class MenuController extends BaseController {
...
@@ -179,7 +179,7 @@ public class MenuController extends BaseController {
*/
*/
@RequestMapping
(
value
=
"/view/{menuId}"
)
@RequestMapping
(
value
=
"/view/{menuId}"
)
@ResponseBody
@ResponseBody
public
Tip
view
(
@PathVariable
Integer
menuId
)
{
public
Tip
view
(
@PathVariable
Long
menuId
)
{
if
(
ToolUtil
.
isEmpty
(
menuId
))
{
if
(
ToolUtil
.
isEmpty
(
menuId
))
{
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
}
}
...
@@ -214,7 +214,7 @@ public class MenuController extends BaseController {
...
@@ -214,7 +214,7 @@ public class MenuController extends BaseController {
@RequestMapping
(
value
=
"/menuTreeListByRoleId/{roleId}"
)
@RequestMapping
(
value
=
"/menuTreeListByRoleId/{roleId}"
)
@ResponseBody
@ResponseBody
public
List
<
ZTreeNode
>
menuTreeListByRoleId
(
@PathVariable
Integer
roleId
)
{
public
List
<
ZTreeNode
>
menuTreeListByRoleId
(
@PathVariable
Integer
roleId
)
{
List
<
Integer
>
menuIds
=
this
.
menuDao
.
getMenuIdsByRoleId
(
roleId
);
List
<
Long
>
menuIds
=
this
.
menuDao
.
getMenuIdsByRoleId
(
roleId
);
if
(
ToolUtil
.
isEmpty
(
menuIds
))
{
if
(
ToolUtil
.
isEmpty
(
menuIds
))
{
List
<
ZTreeNode
>
roleTreeList
=
this
.
menuDao
.
menuTreeList
();
List
<
ZTreeNode
>
roleTreeList
=
this
.
menuDao
.
menuTreeList
();
return
roleTreeList
;
return
roleTreeList
;
...
...
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/MenuDao.java
View file @
27cd61c4
...
@@ -29,7 +29,7 @@ public interface MenuDao {
...
@@ -29,7 +29,7 @@ public interface MenuDao {
* @return
* @return
* @date 2017年2月12日 下午9:14:34
* @date 2017年2月12日 下午9:14:34
*/
*/
List
<
Integer
>
getMenuIdsByRoleId
(
@Param
(
"roleId"
)
Integer
roleId
);
List
<
Long
>
getMenuIdsByRoleId
(
@Param
(
"roleId"
)
Integer
roleId
);
/**
/**
* 获取菜单列表树
* 获取菜单列表树
...
@@ -45,7 +45,7 @@ public interface MenuDao {
...
@@ -45,7 +45,7 @@ public interface MenuDao {
* @return
* @return
* @date 2017年2月19日 下午1:33:51
* @date 2017年2月19日 下午1:33:51
*/
*/
List
<
ZTreeNode
>
menuTreeListByMenuIds
(
List
<
Integer
>
menuIds
);
List
<
ZTreeNode
>
menuTreeListByMenuIds
(
List
<
Long
>
menuIds
);
/**
/**
* 删除menu关联的relation
* 删除menu关联的relation
...
@@ -54,7 +54,7 @@ public interface MenuDao {
...
@@ -54,7 +54,7 @@ public interface MenuDao {
* @return
* @return
* @date 2017年2月19日 下午4:10:59
* @date 2017年2月19日 下午4:10:59
*/
*/
int
deleteRelationByMenu
(
Integer
menuId
);
int
deleteRelationByMenu
(
Long
menuId
);
/**
/**
* 获取资源url通过角色id
* 获取资源url通过角色id
...
...
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/MenuDao.xml
View file @
27cd61c4
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
</if>
</if>
</select>
</select>
<select
id=
"getMenuIdsByRoleId"
resultType=
"
int
"
>
<select
id=
"getMenuIdsByRoleId"
resultType=
"
long
"
>
select menuid from
select menuid from
relation where roleid = #{roleId}
relation where roleid = #{roleId}
</select>
</select>
...
...
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IMenuService.java
View file @
27cd61c4
...
@@ -14,7 +14,7 @@ public interface IMenuService {
...
@@ -14,7 +14,7 @@ public interface IMenuService {
* @author stylefeng
* @author stylefeng
* @Date 2017/5/5 22:20
* @Date 2017/5/5 22:20
*/
*/
void
delMenu
(
Integer
menuId
);
void
delMenu
(
Long
menuId
);
/**
/**
* 删除菜单包含所有子菜单
* 删除菜单包含所有子菜单
...
@@ -22,5 +22,5 @@ public interface IMenuService {
...
@@ -22,5 +22,5 @@ public interface IMenuService {
* @author stylefeng
* @author stylefeng
* @Date 2017/6/13 22:02
* @Date 2017/6/13 22:02
*/
*/
void
delMenuContainSubMenus
(
Integer
menuId
);
void
delMenuContainSubMenus
(
Long
menuId
);
}
}
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/MenuServiceImpl.java
View file @
27cd61c4
...
@@ -27,7 +27,7 @@ public class MenuServiceImpl implements IMenuService {
...
@@ -27,7 +27,7 @@ public class MenuServiceImpl implements IMenuService {
MenuDao
menuDao
;
MenuDao
menuDao
;
@Override
@Override
public
void
delMenu
(
Integer
menuId
)
{
public
void
delMenu
(
Long
menuId
)
{
//删除菜单
//删除菜单
this
.
menuMapper
.
deleteById
(
menuId
);
this
.
menuMapper
.
deleteById
(
menuId
);
...
@@ -37,7 +37,7 @@ public class MenuServiceImpl implements IMenuService {
...
@@ -37,7 +37,7 @@ public class MenuServiceImpl implements IMenuService {
}
}
@Override
@Override
public
void
delMenuContainSubMenus
(
Integer
menuId
)
{
public
void
delMenuContainSubMenus
(
Long
menuId
)
{
Menu
menu
=
menuMapper
.
selectById
(
menuId
);
Menu
menu
=
menuMapper
.
selectById
(
menuId
);
...
...
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/RoleServiceImpl.java
View file @
27cd61c4
package
com
.
stylefeng
.
guns
.
modular
.
system
.
service
.
impl
;
package
com
.
stylefeng
.
guns
.
modular
.
system
.
service
.
impl
;
import
com.stylefeng.guns.core.util.Convert
;
import
com.stylefeng.guns.modular.system.dao.RoleDao
;
import
com.stylefeng.guns.modular.system.service.IRoleService
;
import
com.stylefeng.guns.common.persistence.dao.RelationMapper
;
import
com.stylefeng.guns.common.persistence.dao.RelationMapper
;
import
com.stylefeng.guns.common.persistence.dao.RoleMapper
;
import
com.stylefeng.guns.common.persistence.dao.RoleMapper
;
import
com.stylefeng.guns.common.persistence.model.Relation
;
import
com.stylefeng.guns.common.persistence.model.Relation
;
import
com.stylefeng.guns.core.util.Convert
;
import
com.stylefeng.guns.modular.system.dao.RoleDao
;
import
com.stylefeng.guns.modular.system.service.IRoleService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -31,7 +31,7 @@ public class RoleServiceImpl implements IRoleService {
...
@@ -31,7 +31,7 @@ public class RoleServiceImpl implements IRoleService {
this
.
roleDao
.
deleteRolesById
(
roleId
);
this
.
roleDao
.
deleteRolesById
(
roleId
);
// 添加新的权限
// 添加新的权限
for
(
Integer
id
:
Convert
.
toIntArray
(
ids
))
{
for
(
Long
id
:
Convert
.
toLongArray
(
true
,
Convert
.
toStrArray
(
","
,
ids
)
))
{
Relation
relation
=
new
Relation
();
Relation
relation
=
new
Relation
();
relation
.
setRoleid
(
roleId
);
relation
.
setRoleid
(
roleId
);
relation
.
setMenuid
(
id
);
relation
.
setMenuid
(
id
);
...
...
guns-core/src/main/java/com/stylefeng/guns/core/node/MenuNode.java
View file @
27cd61c4
...
@@ -17,12 +17,12 @@ public class MenuNode implements Comparable {
...
@@ -17,12 +17,12 @@ public class MenuNode implements Comparable {
/**
/**
* 节点id
* 节点id
*/
*/
private
Integer
id
;
private
Long
id
;
/**
/**
* 父节点
* 父节点
*/
*/
private
Integer
parentId
;
private
Long
parentId
;
/**
/**
* 节点名称
* 节点名称
...
@@ -68,7 +68,7 @@ public class MenuNode implements Comparable {
...
@@ -68,7 +68,7 @@ public class MenuNode implements Comparable {
super
();
super
();
}
}
public
MenuNode
(
Integer
id
,
Integer
parentId
)
{
public
MenuNode
(
Long
id
,
Long
parentId
)
{
super
();
super
();
this
.
id
=
id
;
this
.
id
=
id
;
this
.
parentId
=
parentId
;
this
.
parentId
=
parentId
;
...
@@ -91,22 +91,22 @@ public class MenuNode implements Comparable {
...
@@ -91,22 +91,22 @@ public class MenuNode implements Comparable {
}
}
public
static
MenuNode
createRoot
()
{
public
static
MenuNode
createRoot
()
{
return
new
MenuNode
(
0
,
-
1
);
return
new
MenuNode
(
0
L
,
-
1L
);
}
}
public
Integer
getId
()
{
public
Long
getId
()
{
return
id
;
return
id
;
}
}
public
void
setId
(
Integer
id
)
{
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
}
}
public
Integer
getParentId
()
{
public
Long
getParentId
()
{
return
parentId
;
return
parentId
;
}
}
public
void
setParentId
(
Integer
parentId
)
{
public
void
setParentId
(
Long
parentId
)
{
this
.
parentId
=
parentId
;
this
.
parentId
=
parentId
;
}
}
...
@@ -194,7 +194,7 @@ public class MenuNode implements Comparable {
...
@@ -194,7 +194,7 @@ public class MenuNode implements Comparable {
*
*
* @author fengshuonan
* @author fengshuonan
*/
*/
public
List
<
MenuNode
>
findChildNodes
(
List
<
MenuNode
>
nodeList
,
Integer
parentId
)
{
public
List
<
MenuNode
>
findChildNodes
(
List
<
MenuNode
>
nodeList
,
Long
parentId
)
{
if
(
nodeList
==
null
&&
parentId
==
null
)
if
(
nodeList
==
null
&&
parentId
==
null
)
return
null
;
return
null
;
for
(
Iterator
<
MenuNode
>
iterator
=
nodeList
.
iterator
();
iterator
.
hasNext
();
)
{
for
(
Iterator
<
MenuNode
>
iterator
=
nodeList
.
iterator
();
iterator
.
hasNext
();
)
{
...
@@ -212,7 +212,7 @@ public class MenuNode implements Comparable {
...
@@ -212,7 +212,7 @@ public class MenuNode implements Comparable {
*
*
* @author fengshuonan
* @author fengshuonan
*/
*/
public
void
recursionFn
(
List
<
MenuNode
>
nodeList
,
MenuNode
node
,
Integer
pId
)
{
public
void
recursionFn
(
List
<
MenuNode
>
nodeList
,
MenuNode
node
,
Long
pId
)
{
List
<
MenuNode
>
childList
=
getChildList
(
nodeList
,
node
);
// 得到子节点列表
List
<
MenuNode
>
childList
=
getChildList
(
nodeList
,
node
);
// 得到子节点列表
if
(
childList
.
size
()
>
0
)
{
// 判断是否有子节点
if
(
childList
.
size
()
>
0
)
{
// 判断是否有子节点
if
(
node
.
getParentId
().
equals
(
pId
))
{
if
(
node
.
getParentId
().
equals
(
pId
))
{
...
...
guns-core/src/main/java/com/stylefeng/guns/core/node/ZTreeNode.java
View file @
27cd61c4
...
@@ -9,9 +9,9 @@ package com.stylefeng.guns.core.node;
...
@@ -9,9 +9,9 @@ package com.stylefeng.guns.core.node;
*/
*/
public
class
ZTreeNode
{
public
class
ZTreeNode
{
private
Integer
id
;
//节点id
private
Long
id
;
//节点id
private
Integer
pId
;
//父节点id
private
Long
pId
;
//父节点id
private
String
name
;
//节点名称
private
String
name
;
//节点名称
...
@@ -19,19 +19,19 @@ public class ZTreeNode {
...
@@ -19,19 +19,19 @@ public class ZTreeNode {
private
Boolean
checked
;
//是否被选中
private
Boolean
checked
;
//是否被选中
public
Integer
getId
()
{
public
Long
getId
()
{
return
id
;
return
id
;
}
}
public
void
setId
(
Integer
id
)
{
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
}
}
public
Integer
getpId
()
{
public
Long
getpId
()
{
return
pId
;
return
pId
;
}
}
public
void
setpId
(
Integer
pId
)
{
public
void
setpId
(
Long
pId
)
{
this
.
pId
=
pId
;
this
.
pId
=
pId
;
}
}
...
@@ -70,10 +70,10 @@ public class ZTreeNode {
...
@@ -70,10 +70,10 @@ public class ZTreeNode {
public
static
ZTreeNode
createParent
(){
public
static
ZTreeNode
createParent
(){
ZTreeNode
zTreeNode
=
new
ZTreeNode
();
ZTreeNode
zTreeNode
=
new
ZTreeNode
();
zTreeNode
.
setChecked
(
true
);
zTreeNode
.
setChecked
(
true
);
zTreeNode
.
setId
(
0
);
zTreeNode
.
setId
(
0
L
);
zTreeNode
.
setName
(
"顶级"
);
zTreeNode
.
setName
(
"顶级"
);
zTreeNode
.
setOpen
(
true
);
zTreeNode
.
setOpen
(
true
);
zTreeNode
.
setpId
(
0
);
zTreeNode
.
setpId
(
0
L
);
return
zTreeNode
;
return
zTreeNode
;
}
}
}
}
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