⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usersrightmanager.java

📁 负责公文的传输及一些处理功能
💻 JAVA
字号:
package com.example.gw.system.permission;

import com.example.exception.LogicException;
import java.util.Vector;
import java.util.List;
import java.util.Iterator;
import com.example.gw.role.Role;
import com.example.gw.role.IRoleDao;
import com.example.util.StringUtils;
public class UsersRightManager implements IUsersRightManager{
	
	private IUsersRightDao rightDao;
	private IRoleDao roleDao;
	public void setRightDao(IUsersRightDao rightDao) {
		this.rightDao = rightDao;
	}

	public IUsersRightDao getRightDao() {
		return rightDao;
	}
	public void setRoleDao(IRoleDao roleDao){
		this.roleDao = roleDao;
	}
	public IRoleDao getRoleDao(){
		return roleDao;
	}
	public void saveUsersRight(UsersRight right) throws LogicException{
		rightDao.save(right);
	}
	
    /**
     * 根据用户userId返回用户所具有的权限
     * @param userId
     * @return vector(用户权限)
     * @throws SQLException
     * @throws DBPoolException
     * @throws NotFoundException
     */

  public  Vector getPermissionIDsByUserId(int userId) throws Exception{
    int i;
    Vector v=new Vector();
    String sql=" from Role where roleid in (select roleId from UsersRight where userId="+userId+")";
    List list = roleDao.find(sql);
    Iterator iter = list.iterator();
    while(iter.hasNext()){
    	Role role = (Role)iter.next();
        String strIds[] = StringUtils.split(role.getContent(),",");
        for(i = 0; i < strIds.length; i++){
           v.add(strIds[i]);
        }
    }
    return v;
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -