@Override public void saveUserGroupPermission(long userGroupId, List<Long> permissionIds) { // this.deleteUserGroupPermission(userGroupId); for (Long permissionId : permissionIds) { UserGroupPermission userGroupPermission = new UserGroupPermission(); userGroupPermission.setUserGroupId(userGroupId); userGroupPermission.setPermissionId(permissionId); userGroupPermissionDao.save(userGroupPermission); } }
@Override public void batchDelete(String resourceValue, long userGroupId) { String[] strArray = resourceValue.split(","); Long[] idArray = new Long[strArray.length]; for (int i = 0; i < idArray.length; i++) { idArray[i] = Long.valueOf(strArray[i]); } Map<String, Object> condition = new HashMap<String, Object>(); condition.put("resource", idArray); condition.put("userGroupId", userGroupId); userGroupPermissionDao.batchDelete(condition); }
@Override public List<UserGroupPermission> getUserGroupPermissionByGroupId(long groupId) { return userGroupPermissionDao.findBy("userGroupId", groupId); }
@Override public void deleteUserGroupPermission(long userGroupId) { String hql = "delete UserGroupPermission ugp where ugp.userGroupId=?"; userGroupPermissionDao.delete(hql, userGroupId); }