Commit 7cde7d54 by fsn

代码整理

parent d9143243
...@@ -12,6 +12,7 @@ import com.stylefeng.guns.common.node.ZTreeNode; ...@@ -12,6 +12,7 @@ import com.stylefeng.guns.common.node.ZTreeNode;
import com.stylefeng.guns.core.log.LogObjectHolder; import com.stylefeng.guns.core.log.LogObjectHolder;
import com.stylefeng.guns.core.util.ToolUtil; import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.dao.MenuDao; import com.stylefeng.guns.modular.system.dao.MenuDao;
import com.stylefeng.guns.modular.system.service.IMenuService;
import com.stylefeng.guns.modular.system.warpper.MenuWarpper; import com.stylefeng.guns.modular.system.warpper.MenuWarpper;
import com.stylefeng.guns.persistence.dao.MenuMapper; import com.stylefeng.guns.persistence.dao.MenuMapper;
import com.stylefeng.guns.persistence.model.Menu; import com.stylefeng.guns.persistence.model.Menu;
...@@ -46,6 +47,9 @@ public class MenuController extends BaseController { ...@@ -46,6 +47,9 @@ public class MenuController extends BaseController {
@Resource @Resource
MenuDao menuDao; MenuDao menuDao;
@Resource
IMenuService menuService;
/** /**
* 跳转到菜单列表列表页面 * 跳转到菜单列表列表页面
*/ */
...@@ -128,13 +132,7 @@ public class MenuController extends BaseController { ...@@ -128,13 +132,7 @@ public class MenuController extends BaseController {
if (ToolUtil.isEmpty(menuId)) { if (ToolUtil.isEmpty(menuId)) {
throw new BussinessException(BizExceptionEnum.REQUEST_NULL); throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
} }
this.menuService.delMenu(menuId);
//删除菜单
this.menuMapper.deleteById(menuId);
//删除关联的relation
this.menuDao.deleteRelationByMenu(menuId);
return SUCCESS_TIP; return SUCCESS_TIP;
} }
......
...@@ -158,10 +158,7 @@ public class RoleController extends BaseController { ...@@ -158,10 +158,7 @@ public class RoleController extends BaseController {
if (ToolUtil.isEmpty(roleId)) { if (ToolUtil.isEmpty(roleId)) {
throw new BussinessException(BizExceptionEnum.REQUEST_NULL); throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
} }
this.roleMapper.deleteById(roleId); this.roleService.delRoleById(roleId);
// 删除该角色所有的权限
this.roleDao.deleteRolesById(roleId);
//删除缓存 //删除缓存
CacheKit.removeAll(Cache.CONSTANT); CacheKit.removeAll(Cache.CONSTANT);
......
package com.stylefeng.guns.modular.system.service;
/**
* 菜单服务
*
* @author fengshuonan
* @date 2017-05-05 22:19
*/
public interface IMenuService {
/**
* 删除菜单
*
* @author stylefeng
* @Date 2017/5/5 22:20
*/
void delMenu(Integer menuId);
}
...@@ -16,4 +16,12 @@ public interface IRoleService { ...@@ -16,4 +16,12 @@ public interface IRoleService {
* @date 2017年2月13日 下午8:26:53 * @date 2017年2月13日 下午8:26:53
*/ */
void setAuthority(Integer roleId, String ids); void setAuthority(Integer roleId, String ids);
/**
* 删除角色
*
* @author stylefeng
* @Date 2017/5/5 22:24
*/
void delRoleById(Integer roleId);
} }
package com.stylefeng.guns.modular.system.service.impl;
import com.stylefeng.guns.modular.system.dao.MenuDao;
import com.stylefeng.guns.modular.system.service.IMenuService;
import com.stylefeng.guns.persistence.dao.MenuMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 菜单服务
*
* @author fengshuonan
* @date 2017-05-05 22:20
*/
@Service
public class MenuServiceImpl implements IMenuService {
@Resource
MenuMapper menuMapper;
@Resource
MenuDao menuDao;
@Override
public void delMenu(Integer menuId) {
//删除菜单
this.menuMapper.deleteById(menuId);
//删除关联的relation
this.menuDao.deleteRelationByMenu(menuId);
}
}
...@@ -5,6 +5,7 @@ import com.stylefeng.guns.core.util.Convert; ...@@ -5,6 +5,7 @@ import com.stylefeng.guns.core.util.Convert;
import com.stylefeng.guns.modular.system.dao.RoleDao; import com.stylefeng.guns.modular.system.dao.RoleDao;
import com.stylefeng.guns.modular.system.service.IRoleService; import com.stylefeng.guns.modular.system.service.IRoleService;
import com.stylefeng.guns.persistence.dao.RelationMapper; import com.stylefeng.guns.persistence.dao.RelationMapper;
import com.stylefeng.guns.persistence.dao.RoleMapper;
import com.stylefeng.guns.persistence.model.Relation; import com.stylefeng.guns.persistence.model.Relation;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -15,6 +16,9 @@ import javax.annotation.Resource; ...@@ -15,6 +16,9 @@ import javax.annotation.Resource;
public class RoleServiceImpl implements IRoleService { public class RoleServiceImpl implements IRoleService {
@Resource @Resource
RoleMapper roleMapper;
@Resource
RoleDao roleDao; RoleDao roleDao;
@Resource @Resource
...@@ -37,4 +41,13 @@ public class RoleServiceImpl implements IRoleService { ...@@ -37,4 +41,13 @@ public class RoleServiceImpl implements IRoleService {
} }
} }
@Override
public void delRoleById(Integer roleId) {
//删除角色
this.roleMapper.deleteById(roleId);
// 删除该角色所有的权限
this.roleDao.deleteRolesById(roleId);
}
} }
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