Commit 27cd61c4 by naan1993

菜单id改为long

parent 062d16bb
......@@ -117,7 +117,7 @@ CREATE TABLE `login_log` (
-- ----------------------------
DROP TABLE IF EXISTS `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 '菜单编号',
`pcode` varchar(255) DEFAULT NULL COMMENT '菜单父编号',
`pcodes` varchar(255) DEFAULT NULL COMMENT '当前菜单的所有父菜单编号',
......@@ -230,12 +230,13 @@ CREATE TABLE `operation_log` (
`succeed` varchar(255) DEFAULT NULL COMMENT '是否成功',
`message` text COMMENT '备注',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=542 DEFAULT CHARSET=utf8 COMMENT='操作日志';
) ENGINE=InnoDB AUTO_INCREMENT=543 DEFAULT CHARSET=utf8 COMMENT='操作日志';
-- ----------------------------
-- 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 ('542', '业务日志', '修改菜单', '1', 'com.stylefeng.guns.modular.system.controller.MenuController', 'edit', '2017-12-09 18:40:09', '成功', '菜单名称=通知;;;');
-- ----------------------------
-- Table structure for relation
......@@ -243,7 +244,7 @@ INSERT INTO `operation_log` VALUES ('541', '业务日志', '清空业务日志',
DROP TABLE IF EXISTS `relation`;
CREATE TABLE `relation` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`menuid` int(11) DEFAULT NULL COMMENT '菜单id',
`menuid` bigint(11) DEFAULT NULL COMMENT '菜单id',
`roleid` int(11) DEFAULT NULL COMMENT '角色id',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3737 DEFAULT CHARSET=utf8 COMMENT='角色和菜单关联表';
......
......@@ -155,7 +155,7 @@ public class ConstantFactory implements IConstantFactory {
* 获取菜单名称
*/
@Override
public String getMenuName(Integer menuId) {
public String getMenuName(Long menuId) {
if (ToolUtil.isEmpty(menuId)) {
return "";
} else {
......
......@@ -56,7 +56,7 @@ public interface IConstantFactory {
/**
* 获取菜单名称
*/
String getMenuName(Integer menuId);
String getMenuName(Long menuId);
/**
* 获取菜单名称通过编号
......
......@@ -23,7 +23,7 @@ public class Menu extends Model<Menu> {
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private Long id;
/**
* 菜单编号
*/
......@@ -76,11 +76,11 @@ public class Menu extends Model<Menu> {
private Integer isopen;
public Integer getId() {
public Long getId() {
return id;
}
public void setId(Integer id) {
public void setId(Long id) {
this.id = id;
}
......
......@@ -21,12 +21,12 @@ public class Relation extends Model<Relation> {
/**
* 主键
*/
@TableId(value="id", type= IdType.AUTO)
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 菜单id
*/
private Integer menuid;
private Long menuid;
/**
* 角色id
*/
......@@ -41,11 +41,11 @@ public class Relation extends Model<Relation> {
this.id = id;
}
public Integer getMenuid() {
public Long getMenuid() {
return menuid;
}
public void setMenuid(Integer menuid) {
public void setMenuid(Long menuid) {
this.menuid = menuid;
}
......
......@@ -74,7 +74,7 @@ public class MenuController extends BaseController {
*/
@Permission(Const.ADMIN_NAME)
@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)) {
throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
}
......@@ -162,7 +162,7 @@ public class MenuController extends BaseController {
@RequestMapping(value = "/remove")
@BussinessLog(value = "删除菜单", key = "menuId", dict = MenuDict.class)
@ResponseBody
public Tip remove(@RequestParam Integer menuId) {
public Tip remove(@RequestParam Long menuId) {
if (ToolUtil.isEmpty(menuId)) {
throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
}
......@@ -179,7 +179,7 @@ public class MenuController extends BaseController {
*/
@RequestMapping(value = "/view/{menuId}")
@ResponseBody
public Tip view(@PathVariable Integer menuId) {
public Tip view(@PathVariable Long menuId) {
if (ToolUtil.isEmpty(menuId)) {
throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
}
......@@ -214,7 +214,7 @@ public class MenuController extends BaseController {
@RequestMapping(value = "/menuTreeListByRoleId/{roleId}")
@ResponseBody
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)) {
List<ZTreeNode> roleTreeList = this.menuDao.menuTreeList();
return roleTreeList;
......
......@@ -29,7 +29,7 @@ public interface MenuDao {
* @return
* @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 {
* @return
* @date 2017年2月19日 下午1:33:51
*/
List<ZTreeNode> menuTreeListByMenuIds(List<Integer> menuIds);
List<ZTreeNode> menuTreeListByMenuIds(List<Long> menuIds);
/**
* 删除menu关联的relation
......@@ -54,7 +54,7 @@ public interface MenuDao {
* @return
* @date 2017年2月19日 下午4:10:59
*/
int deleteRelationByMenu(Integer menuId);
int deleteRelationByMenu(Long menuId);
/**
* 获取资源url通过角色id
......
......@@ -21,7 +21,7 @@
</if>
</select>
<select id="getMenuIdsByRoleId" resultType="int">
<select id="getMenuIdsByRoleId" resultType="long">
select menuid from
relation where roleid = #{roleId}
</select>
......
......@@ -14,7 +14,7 @@ public interface IMenuService {
* @author stylefeng
* @Date 2017/5/5 22:20
*/
void delMenu(Integer menuId);
void delMenu(Long menuId);
/**
* 删除菜单包含所有子菜单
......@@ -22,5 +22,5 @@ public interface IMenuService {
* @author stylefeng
* @Date 2017/6/13 22:02
*/
void delMenuContainSubMenus(Integer menuId);
void delMenuContainSubMenus(Long menuId);
}
......@@ -27,7 +27,7 @@ public class MenuServiceImpl implements IMenuService {
MenuDao menuDao;
@Override
public void delMenu(Integer menuId) {
public void delMenu(Long menuId) {
//删除菜单
this.menuMapper.deleteById(menuId);
......@@ -37,7 +37,7 @@ public class MenuServiceImpl implements IMenuService {
}
@Override
public void delMenuContainSubMenus(Integer menuId) {
public void delMenuContainSubMenus(Long menuId) {
Menu menu = menuMapper.selectById(menuId);
......
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.RoleMapper;
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.transaction.annotation.Transactional;
......@@ -31,7 +31,7 @@ public class RoleServiceImpl implements IRoleService {
this.roleDao.deleteRolesById(roleId);
// 添加新的权限
for (Integer id : Convert.toIntArray(ids)) {
for (Long id : Convert.toLongArray(true, Convert.toStrArray(",", ids))) {
Relation relation = new Relation();
relation.setRoleid(roleId);
relation.setMenuid(id);
......
......@@ -17,12 +17,12 @@ public class MenuNode implements Comparable {
/**
* 节点id
*/
private Integer id;
private Long id;
/**
* 父节点
*/
private Integer parentId;
private Long parentId;
/**
* 节点名称
......@@ -68,7 +68,7 @@ public class MenuNode implements Comparable {
super();
}
public MenuNode(Integer id, Integer parentId) {
public MenuNode(Long id, Long parentId) {
super();
this.id = id;
this.parentId = parentId;
......@@ -91,22 +91,22 @@ public class MenuNode implements Comparable {
}
public static MenuNode createRoot() {
return new MenuNode(0, -1);
return new MenuNode(0L, -1L);
}
public Integer getId() {
public Long getId() {
return id;
}
public void setId(Integer id) {
public void setId(Long id) {
this.id = id;
}
public Integer getParentId() {
public Long getParentId() {
return parentId;
}
public void setParentId(Integer parentId) {
public void setParentId(Long parentId) {
this.parentId = parentId;
}
......@@ -194,7 +194,7 @@ public class MenuNode implements Comparable {
*
* @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)
return null;
for (Iterator<MenuNode> iterator = nodeList.iterator(); iterator.hasNext(); ) {
......@@ -212,7 +212,7 @@ public class MenuNode implements Comparable {
*
* @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);// 得到子节点列表
if (childList.size() > 0) {// 判断是否有子节点
if (node.getParentId().equals(pId)) {
......
......@@ -9,9 +9,9 @@ package com.stylefeng.guns.core.node;
*/
public class ZTreeNode {
private Integer id; //节点id
private Long id; //节点id
private Integer pId;//父节点id
private Long pId;//父节点id
private String name;//节点名称
......@@ -19,19 +19,19 @@ public class ZTreeNode {
private Boolean checked;//是否被选中
public Integer getId() {
public Long getId() {
return id;
}
public void setId(Integer id) {
public void setId(Long id) {
this.id = id;
}
public Integer getpId() {
public Long getpId() {
return pId;
}
public void setpId(Integer pId) {
public void setpId(Long pId) {
this.pId = pId;
}
......@@ -70,10 +70,10 @@ public class ZTreeNode {
public static ZTreeNode createParent(){
ZTreeNode zTreeNode = new ZTreeNode();
zTreeNode.setChecked(true);
zTreeNode.setId(0);
zTreeNode.setId(0L);
zTreeNode.setName("顶级");
zTreeNode.setOpen(true);
zTreeNode.setpId(0);
zTreeNode.setpId(0L);
return zTreeNode;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment