www.pudn.com > erp0.1.zip > SystemUserAction.java


package com.easyjf.asp.action; 
 
import java.util.ArrayList; 
import java.util.Collection; 
import java.util.Date; 
 
 
import com.easyjf.asp.business.ActiveUser; 
import com.easyjf.asp.business.SystemUser; 
import com.easyjf.util.CommUtil; 
import com.easyjf.web.Module; 
import com.easyjf.web.Page; 
import com.easyjf.web.WebForm; 
 
import com.easyjf.web.tools.DbPageList; 
import com.easyjf.web.tools.IActiveUser; 
import com.easyjf.web.tools.IPageList; 
 
public class SystemUserAction extends BaseAction {	 
	public Page doSetting(WebForm form, Module module) { 
		SystemUser u=SystemUser.readByUserName(this.getCurrentUser(form).getUserName());			 
		if(u!=null) 
		{ 
		form.addPo(u);	 
		} 
		return module.findPage("edit");	 
	} 
	public IPageList doQuery(WebForm form, int currentPage, int pageSize) { 
		ActiveUser u=(ActiveUser)this.getCurrentUser(form);		 
		String scope="belongDept=?"; 
		Collection paras=new ArrayList(); 
		paras.add(u.getDept()); 
		DbPageList pList=new DbPageList(SystemUser.class,scope,paras); 
		pList.doList(currentPage,pageSize); 
		return pList; 
		} 
	public Object form2Obj(WebForm form) { 
		String cid=CommUtil.null2String(form.get("cid")); 
		SystemUser obj=null; 
		if(cid.equals("")) 
		{ 
			obj=(SystemUser)form.toPo(SystemUser.class); 
			obj.setInputTime(new Date()); 
			obj.setInputUser(this.getCurrentUser(form).getUserName()); 
			obj.setStatus(new Integer(0)); 
		} 
		else 
		{ 
			obj=SystemUser.read(cid); 
			form.toPo(obj); 
		}		 
		if(obj!=null)obj.setBelongDept(((ActiveUser)this.getCurrentUser(form)).getDept()); 
		return obj; 
	} 
 
}