📄 productaction.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.Product;
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 ProductAction extends BaseAction {
public void doInit(WebForm form, Module module) {
// TODO Auto-generated method stub
//System.out.println("初始化");
super.doInit(form, module);
}
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 orderType=CommUtil.null2String(form.get("orderType"));
String orderField=CommUtil.null2String(form.get("orderField"));
String sn=CommUtil.null2String(form.get("querySn"));
String title=CommUtil.null2String(form.get("queryTitle"));
String types=CommUtil.null2String(form.get("queryTypes"));
if(!sn.equals(""))
{
scope+=" and sn like ?";
paras.add("%"+sn+"%");
}
if(!title.equals(""))
{
scope+=" and title like ?";
paras.add("%"+title+"%");
}
if(!types.equals(""))
{
scope+=" and types=?";
paras.add(types);
}
if(orderField.equals(""))
{
orderField="inputTime";
orderType="desc";
}
if(!orderField.equals(""))
{
scope +=" order by "+orderField;
if(!orderType.equals(""))scope+=" "+orderType;
}
DbPageList pList=new DbPageList(Product.class,scope,paras);
pList.doList(currentPage,pageSize);
return pList;
}
public Object form2Obj(WebForm form) {
ActiveUser user=(ActiveUser)this.getCurrentUser(form);
String cid=CommUtil.null2String(form.get("cid"));
Product obj=null;
if(cid.equals(""))
{
obj=(Product)form.toPo(Product.class);
obj.setInputTime(new Date());
obj.setInputUser(user.getUserName());
obj.setStatus(new Integer(0));
}
else
{
obj=Product.read(cid);
form.toPo(obj);
}
if(obj!=null)obj.setBelongDept(user.getDept());
return obj;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -