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

📄 customeraction.java

📁 用jsp写的学生管理系统
💻 JAVA
字号:
package com.easyjf.asp.action;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;

import com.easyjf.asp.business.ActiveUser;
import com.easyjf.asp.business.Customer;
import com.easyjf.asp.business.SystemRegion;
import com.easyjf.util.CommUtil;
import com.easyjf.web.Module;
import com.easyjf.web.WebForm;
import com.easyjf.web.tools.DbPageList;
import com.easyjf.web.tools.IPageList;
public class CustomerAction extends BaseAction {
	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());
		String province=CommUtil.null2String(form.get("queryProvince"));
		String city=CommUtil.null2String(form.get("queryCity"));
		String title=CommUtil.null2String(form.get("queryTitle"));		
		String linkMan=CommUtil.null2String(form.get("queryLinkMan"));
		String sn=CommUtil.null2String(form.get("querySn"));		
		String address=CommUtil.null2String(form.get("queryAddress"));
		if(!province.equals(""))
		{
		    scope+=" and province=?";
		    paras.add(province);
		}
		if(!city.equals(""))
		{
			scope+=" and city=?";
			paras.add(city);
		}	
		if(!title.equals(""))
		{
			scope+=" and title like ?";
			paras.add("%"+title+"%");
		}
		if(!linkMan.equals(""))
		{
			scope+=" and linkMan like ?";
			paras.add("%"+linkMan+"%");
		}
		if(!sn.equals(""))
		{
			scope+=" and sn=?";
			paras.add(sn);
		}
		if(!address.equals(""))
		{
			scope+=" and address like ?";
			paras.add("%"+address+"%");
		}
		if(!title.equals(""))
		{
			scope+=" and title like ?";
			paras.add("%"+title+"%");
		}
		String orderType=CommUtil.null2String(form.get("orderType"));
		String orderField=CommUtil.null2String(form.get("orderField"));			
		if(orderField.equals(""))
		{
		orderField="inputTime";
		orderType="desc";				
		}	
		if(!orderField.equals(""))
		{
		scope +=" order by "+orderField;
		if(!orderType.equals(""))scope+=" "+orderType;
		}
		DbPageList pList=new DbPageList(Customer.class,scope,paras);
		pList.doList(currentPage,pageSize);		
		return pList;
	}
	public void doAfter(WebForm form,Module module) {		
		String method=CommUtil.null2String(form.get("easyJWebCommand"));		
		if((!"del".equals(method)) && (!"add".equals(method)) && (!"update".equals(method)))
		{			
			List provinceList=SystemRegion.query("lev=1");			
			form.addResult("provinceList",provinceList);
		}	
	}
	public Object form2Obj(WebForm form) {
		String cid=CommUtil.null2String(form.get("cid"));
		Customer obj=null;
		if(cid.equals(""))
		{
			obj=(Customer)form.toPo(Customer.class);
			obj.setInputTime(new Date());
			obj.setInputUser(this.getCurrentUser(form).getUserName());
			obj.setStatus(new Integer(0));
		}
		else
		{
			obj=Customer.read(cid);
			form.toPo(obj);
		}		
		if(obj!=null)obj.setBelongDept(((ActiveUser)this.getCurrentUser(form)).getDept());			
		return obj;
	}
}

⌨️ 快捷键说明

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