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

📄 roleaction.java

📁 crm系统 有源码 及相关文档sql2005 数据库 客户反馈模块
💻 JAVA
字号:
package org.jb.y272.team0.web.action;

import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.jb.common.web.action.BaseAction;
import org.jb.y272.team0.biz.RoleBiz;
import org.jb.y272.team0.entity.SysRight;
import org.jb.y272.team0.entity.SysRole;
//import org.jb.y272.team0.biz.UserBiz;
import org.jb.y272.team0.web.form.RoleForm;

public class RoleAction extends BaseAction {
	//private UserBiz userBiz = null;
	private RoleBiz roleBiz = null;
//	public void setUserBiz(UserBiz userBiz){
//		this.userBiz = userBiz; 
//	}
	public void setRoleBiz(RoleBiz roleBiz){
		this.roleBiz = roleBiz; 
	}
	public ActionForward toList(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception{
		RoleForm myForm = (RoleForm)form;
		this.roleBiz.getList(myForm.getItem(), myForm.getPageResult());
		return mapping.findForward("list");
	}
	public ActionForward toAssignRights(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception{
		RoleForm myForm = (RoleForm)form;
		String id = request.getParameter("id");
		SysRole role = this.roleBiz.getRoleWithRights(Long.parseLong(id));
		myForm.setItem(role);
		
		List allRights = this.roleBiz.getRights();
		Iterator it = allRights.iterator();
		while(it.hasNext()){
			SysRight right = (SysRight)it.next();
			if (role.getRights().contains(right)){
				right.setIsSelected("checked=\"on\"");
			}
		}
		request.setAttribute("ALL_RIGHTS_LIST", allRights);

		return mapping.findForward("assign_rights");
	}
	public ActionForward doAssignRights(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception{
		String[] selectedRightCodes = request.getParameterValues("selectedRights");
		RoleForm myForm = (RoleForm)form;
		Long roleId = myForm.getItem().getRoleId();
		
		this.roleBiz.assignRights(roleId,selectedRightCodes);
		
		response.sendRedirect("role.do?o=toAssignRights&id="+roleId);
		return null;
	}
}

⌨️ 快捷键说明

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