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

📄 deptaction.java

📁 java开发的系统,主要用SS框架,以供大家研究和参考学习.
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.fpms.wwyz.struts.action.baseInfoManage.baseInfo;

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.apache.struts.actions.DispatchAction;

import com.fpms.wwyz.model.service.baseInfoManage.baseInfo.IDeptinfoService;
import com.fpms.wwyz.model.utils.DozerUtil;
import com.fpms.wwyz.model.utils.Page;
import com.fpms.wwyz.struts.form.baseInfoManage.baseInfo.DeptinfoForm;
import com.fpms.wwyz.struts.form.baseInfoManage.baseInfo.PrlinfoForm;
import com.fpms.wwyz.vo.baseInfoManage.baseInfo.DeptinfoVO;
import com.fpms.wwyz.vo.baseInfoManage.baseInfo.PrlinfoVO;

/**
 * MyEclipse Struts Creation date: 10-29-2008
 * 
 * XDoclet definition:
 * 
 * @struts.action path="/dept" name="DeptinfoForm" parameter="method"
 *                scope="request" validate="true"
 */
public class DeptAction extends DispatchAction {
	private IDeptinfoService deptservice;

	public void setDeptservice(IDeptinfoService deptservice) {
		this.deptservice = deptservice;
	}

	/*
	 * Generated Methods
	 */

	/**
	 * Method execute
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	@Override
	protected ActionForward unspecified(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		// TODO Auto-generated method stub
		return listDept(mapping, form, request, response);
	}

	public ActionForward listDept(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DeptinfoForm deptinfoForm = (DeptinfoForm) form;// TODO Auto-generated
		Page page = new Page(request, 12);
		page.setUrl(request.getContextPath() + "/deptEdit.do?method=listDept");
		page.setMaxRowNum(deptservice.getDeptRows());
		List<DeptinfoVO> deptinfolist = deptservice.findAllDept(page);
		List<DeptinfoVO> deptnamelist = deptservice.findAllDeptname();
		request.getSession().setAttribute("deptnamelist", deptnamelist);
		request.setAttribute("page", page);
		request.setAttribute("deptinfolist", deptinfolist);
		return mapping.findForward("deptlist");
	}

	public ActionForward showDept(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DeptinfoForm deptinfoForm = (DeptinfoForm) form;// TODO Auto-generated
		request.setAttribute("ActionName", "saveAddDept");
		request.setAttribute("TitleName", "新增部门信息");
		return mapping.getInputForward();
	}

	public ActionForward saveAddDept(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DeptinfoForm deptinfoForm = (DeptinfoForm) form;// TODO Auto-generated
		// method stub
		DeptinfoVO deptinfo = (DeptinfoVO) DozerUtil.getMapperIF().map(
				deptinfoForm, DeptinfoVO.class);
		deptservice.saveDept(deptinfo);
		return mapping.findForward("listAction");
	}

	public ActionForward showUpdateDept(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DeptinfoForm deptinfoForm = (DeptinfoForm) form;// TODO Auto-generated
		String uuid = request.getParameter("uuid");
		if (uuid == null) {
			return mapping.findForward("listAction");
		}
		DeptinfoVO deptinfo = deptservice.getDeptById(Integer.valueOf(uuid));
		if (deptinfo != null) {
			deptinfoForm.setUuid(String.valueOf(deptinfo.getUuid()));
			deptinfoForm.setDepname(deptinfo.getDepname());
			deptinfoForm.setDepcode(deptinfo.getDepcode());
			deptinfoForm.setDepremark(deptinfo.getDepremark());

		}
		request.setAttribute("ActionName", "saveUpdateDept");
		request.setAttribute("TitleName", "修改部门信息");
		return mapping.getInputForward();
	}

	public ActionForward saveUpdateDept(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DeptinfoForm deptinfoForm = (DeptinfoForm) form;// TODO Auto-generated
		DeptinfoVO deptinfo = (DeptinfoVO) DozerUtil.getMapperIF().map(
				deptinfoForm, DeptinfoVO.class);
		if (deptinfo != null) {

			deptservice.updateDept(deptinfo);

		}
		return mapping.findForward("listAction");
	}

	public ActionForward deleteDept(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DeptinfoForm deptinfoForm = (DeptinfoForm) form;// TODO Auto-generated
		String[] uuids = request.getParameterValues("uuid");
		if (uuids != null && uuids.length > 0) {
			for (String uuid : uuids) {
				if (!"".equals(uuid)) {
					deptservice.deletDept(Integer.valueOf(uuid));
				}
			}
		}

		return mapping.findForward("listAction");
	}

	public ActionForward querryDept(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DeptinfoForm deptinfoForm = (DeptinfoForm) form;// TODO Auto-generated
		DeptinfoVO deptinfo = (DeptinfoVO) DozerUtil.getMapperIF().map(
				deptinfoForm, DeptinfoVO.class);
		Page page = new Page(request, 5);
		page.setUrl(request.getContextPath()
				+ "/deptEdit.do?method=querryDept&depname="
				+ deptinfo.getDepname());
		page.setMaxRowNum(deptservice.getDeptRowsByDeptname(deptinfo));
		List<DeptinfoVO> querrynamelist = deptservice.findDeptByDeptname(
				deptinfo, page);
		request.setAttribute("page", page);
		request.setAttribute("querrynamelist", querrynamelist);
		return mapping.findForward("deptlist");
	}
}

⌨️ 快捷键说明

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