예제 #1
0
 @Transactional(readOnly = false)
 public void saveRole(Role role) {
   if (role.getId() == null) {
     role.setUser(UserUtils.getUser());
   }
   roleDao.save(role);
   systemRealm.clearAllCachedAuthorizationInfo();
 }
예제 #2
0
 @Transactional(readOnly = false)
 public void saveMenu(Menu menu) {
   menu.setParent(this.getMenu(menu.getParent().getId()));
   String oldParentIds = menu.getParentIds(); // 获取修改前的parentIds,用于更新子节点的parentIds
   menu.setParentIds(menu.getParent().getParentIds() + menu.getParent().getId() + ",");
   if (menu.getId() == null) {
     menu.setUser(UserUtils.getUser());
   }
   menuDao.clear();
   menuDao.save(menu);
   // 更新子节点 parentIds
   List<Menu> list = menuDao.findByParentIdsLike("%," + menu.getId() + ",%");
   for (Menu e : list) {
     e.setParentIds(e.getParentIds().replace(oldParentIds, menu.getParentIds()));
   }
   menuDao.save(list);
   systemRealm.clearAllCachedAuthorizationInfo();
 }
예제 #3
0
 @Transactional(readOnly = false)
 public void deleteMenu(Long id) {
   menuDao.deleteById(id, "%," + id + ",%");
   systemRealm.clearAllCachedAuthorizationInfo();
 }
예제 #4
0
 @Transactional(readOnly = false)
 public void deleteRole(Long id) {
   roleDao.deleteById(id);
   systemRealm.clearAllCachedAuthorizationInfo();
 }