📄 rationaction.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.Ration;
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 RationAction extends BaseAction {
public void doInit(WebForm form, Module module) {
// TODO Auto-generated method stub
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 materialSn=CommUtil.null2String(form.get("queryMaterialSn"));
String productSn=CommUtil.null2String(form.get("querySn"));
if(!productSn.equals(""))
{
scope+=" and productSn=?";
paras.add(productSn);
}
if(!materialSn.equals(""))
{
scope+=" and materialSn=?";
paras.add(materialSn);
}
if(orderField.equals(""))
{
orderField="inputTime";
orderType="desc";
}
if(!orderField.equals(""))
{
scope +=" order by "+orderField;
if(!orderType.equals(""))scope+=" "+orderType;
}
DbPageList pList=new DbPageList(Ration.class,scope,paras);
pList.doList(currentPage,pageSize);
return pList;
}
public Object form2Obj(WebForm form) {
String cid=CommUtil.null2String(form.get("cid"));
String method=CommUtil.null2String(form.get("easyJWebCommand"));
ActiveUser user=(ActiveUser)this.getCurrentUser(form);
Ration obj=null;
if(cid.equals(""))
{
obj=(Ration)form.toPo(Ration.class);
obj.setInputTime(new Date());
obj.setInputUser(this.getCurrentUser(form).getUserName());
obj.setStatus(new Integer(0));
}
else
{
obj=Ration.read(cid);
form.toPo(obj);
}
if(obj!=null)obj.setBelongDept(((ActiveUser)user).getDept());
if("edit".equals(method))
{
form.addResult("productTitle",obj.readProductTitle());
form.addResult("materialTitle",obj.readMaterialTitle());
}
return obj;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -