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

📄 usermanagelisttag.java

📁 本代码是一个权限管理系统源代码
💻 JAVA
字号:
/**
 * 
 */
package com.seavision.PermissionManage.tag.unitManage;

import java.util.HashMap;
import java.util.List;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import com.seavision.PermissionManage.common.BaseTag;
import com.seavision.PermissionManage.components.CompanyManage;
import com.seavision.PermissionManage.components.DepartmentManage;
import com.seavision.PermissionManage.components.UserManage;
import com.seavision.PermissionManage.help.DaoFectory;
import com.seavision.PermissionManage.vo.CompanyVO;
import com.seavision.PermissionManage.vo.DepartmentVO;
import com.seavision.PermissionManage.vo.UserVO;

/**
 * @author qiao rong
 * @date 2007-05-15
 * @param null
 * @function 用户列表tag 得到用户列表信息,打印 循环打印部门列表(放入下拉框)
 * 
 */
public class UserManageListTag extends BaseTag {

	public int doStartTag() throws JspException {
		this.initializeTag("DepartmentManageNewTag"); // 初始化类
		try {
			this.appendMessage("<root>");
			DepartmentVO departmentVO_temp = null; // 部门vo,用于从list中取vo时的暂存
			UserVO userVO_temp = null; // 暂存
			List list_depa = null; // 存放部门信息
			List list_user = null; // 存放用户信息
			CompanyVO companyVO = null; // 公司vo
			DepartmentVO departmentVO = null; // 部门vo
			String companyID_temp = null; // 公司Id,临时存放页面传来的公司ID
			String departmentID_temp = null; // 部门Id,临时存放页面传来的部门ID
			int companyId_temp = 0; // 临时存放 公司ID
			int departmentId_temp = 0; // 临时存放 公司ID

			DepartmentManage departmentManage = DaoFectory.getDepantManage();
			CompanyManage companyManage = DaoFectory.getCompanyManage();
			UserManage userManage = DaoFectory.getUserManage();

			departmentID_temp = this.getParameter("departmentId");// 页面传来部门ID

			// 循环打印(某公司下)部门名称 和 部门id
			list_depa = departmentManage.getDepartmentList(companyID_temp);
			this.appendMessage("<departmentList>");

			for (int i = 0; i < list_depa.size(); i++) {
				departmentVO_temp = (DepartmentVO) list_depa.get(i);
				this.appendMessage("<department>");
				this.appendMessage("<departmentId>"	+ departmentVO_temp.getDepartmentId()+ "</departmentId>");// 部门编号
				this.appendMessage("<departmentName>"+ departmentVO_temp.getDepartmentName()	+ "</departmentName>"); // 部门名称
				this.appendMessage("</department>");
			}
			this.appendMessage("</departmentList>");

			// 循环打印所有用户相关信息
			list_user = (List) userManage.getUserList(companyID_temp,departmentID_temp); // 得到所有用户

			this.appendMessage("<orderList>");
			for (int i = 0; i < list_user.size(); i++) {
				userVO_temp = (UserVO) list_user.get(i);
				this.appendMessage("<order>");
				this.appendMessage("<id>" + (i + 1) + "</id>"); // 序号
				this.appendMessage("<userId>" + userVO_temp.getUserId()+ "</userId>");// 员工编号
				this.appendMessage("<userName>" + userVO_temp.getUserName()+ "</userName>"); // 员工姓名
				this.appendMessage("<companyId>" + userVO_temp.getCompanyId()+ "</companyId>"); // 公司id
				// 得到公司名称. 并打印
				companyId_temp = (userVO_temp.getCompanyId());
				companyVO = companyManage.getCompany(companyId_temp);
				this.appendMessage("<companyName>" + companyVO.getCompanyName()+"</companyName>"); // 公司名称

				// 得到部门名称. 并打印departmentName
				departmentId_temp = userVO_temp.getDepartmentId();
				departmentVO = departmentManage.getDepartment(String.valueOf(departmentId_temp));
				this.appendMessage("<departmentName>"+ departmentVO.getDepartmentName()+ "</departmentName>");

				// 操作及状态
				this.appendMessage("<operateEdit>" + "修改" + "</operateEdit>");// 修改
				this.appendMessage("<operateDelete>" + "删除" + "</operateDelete>");// 删除

				// String state_temp = "1";//用户状态标记,

				int state_temp = userVO_temp.getUserState();// 用户状态标记,
				// 0可用,1不可用
				if (state_temp == 0) {
					this.appendMessage("<userState>" + "正常" + "</userState>");// 状态
				} else {
					this.appendMessage("<userState>" + "不正常" + "</userState>");// 状态
				}
				this.appendMessage("</order>");
			}
			this.appendMessage("</orderList>");
			this.appendMessage("</root>");

			this.outputMessage();
		} catch (Exception ex) {
			this.outputStandardErrorMessage();
			ex.printStackTrace();
			print("userlistTag出现异常");

		} // end catch

		return TagSupport.EVAL_BODY_INCLUDE; // 继续计算BODY体
	} // end doStartTag method

	public int doEndTag() throws JspException {
		return EVAL_PAGE;
	}// doEndTag method

}

⌨️ 快捷键说明

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