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

📄 isuserrole.java

📁 一个OA系统
💻 JAVA
字号:
package com.zhou.util;

import java.util.List;

import com.zhou.dao.JurisdictionDAO;
import com.zhou.dao.RoleDAO;
import com.zhou.po.Role;
import com.zhou.po.Userinfo;
import com.zhou.services.SUserinfoDAO;

public class IsUserRole {
	public  boolean test(Object id, String aa) {
		//通过当前用户id查找当前用户的角色ID
		System.out.println();
		Userinfo u = new SUserinfoDAO().findById(new Long(id.toString()));
		RoleDAO roleDAO = new RoleDAO();
		List list = roleDAO.findByProperty("rid", u.getRole().getRid());
		int count = 0;
		for (int i = 0; i < list.size(); i++) {
			Role role = (Role) list.get(i);
			String[] b = role.getJid().split(",");	
			for (int j = 0; j < b.length; j++) {
				String Jremark=this.roleName(b[j]);
				if (!aa.equals(Jremark)) {
					continue;
				}
				count++;
			}
		}
		if(count==0){
			return false;
			
		}else{
			
			return true;
		}

	}

	public String roleName(String id) {
		JurisdictionDAO jurisdiction = new JurisdictionDAO();		
		return jurisdiction.findById(new Long(id)).getJremark();
	}

}

⌨️ 快捷键说明

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