📄 systemtongxunluaction.java
字号:
package com.easycrm.asp.action;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import com.easycrm.asp.business.*;
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 SystemTongxunluAction 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 name=CommUtil.null2String(form.get("queryName"));
String sn=CommUtil.null2String(form.get("querySn"));
String address=CommUtil.null2String(form.get("queryAddress"));
if(!name.equals(""))
{
scope+=" and name like ?";
paras.add("%"+name+"%");
}
if(!sn.equals(""))
{
scope+=" and sn=?";
paras.add(sn);
}
if(!address.equals(""))
{
scope+=" and address like ?";
paras.add("%"+address+"%");
}
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(SystemTongxunlu.class,scope,paras);
pList.doList(currentPage,pageSize);
return pList;
}
public Object form2Obj(WebForm form) {
String cid=CommUtil.null2String(form.get("cid"));
SystemTongxunlu obj=null;
if(cid.equals(""))
{
obj=(SystemTongxunlu)form.toPo(SystemTongxunlu.class);
obj.setInputTime(new Date());
obj.setInputUser(this.getCurrentUser(form).getUserName());
obj.setStatus(new Integer(0));
obj.setSn(SystemTongxunluAction.madeSn());
}
else
{
obj=SystemTongxunlu.read(cid);
form.toPo(obj);
}
if(obj!=null)obj.setBelongDept(((ActiveUser)this.getCurrentUser(form)).getDept());
return obj;
}
private static String madeSn(){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String s=sdf.format(new Date());
System.out.println(s);
String a=s.substring(0,4);
String b=s.substring(5,7);
String c=s.substring(8,10);
String e=s.substring(11,13);
String f=s.substring(14,16);
String g=s.substring(17,19);
String sn = a+b+c+e+f+g;
System.out.println(sn);
return sn;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -