?? crudaction.java
字號:
package com.easyjweb.action;
import java.util.ArrayList;
import java.util.Collection;
import com.easyjf.util.CommUtil;
import com.easyjf.web.WebForm;
import com.easyjf.web.tools.CrudAction;
import com.easyjf.web.tools.DbPageList;
import com.easyjf.web.tools.IPageList;
import com.easyjweb.business.$tableName;
/**
* 使用添刪改查action
* @author easyjwebtools
*
*/
public class ${tableName}Action extends CrudAction {
/**
* 查詢及分頁,通過實現(xiàn)AbstractCrudAction中的抽象方法實現(xiàn)
*/
public IPageList doQuery(WebForm form, int currentPage, int pageSize) {
String scope = "1=1";
Collection paras = new ArrayList();
String orderType = CommUtil.null2String(form.get("orderType"));
String orderField = CommUtil.null2String(form.get("orderField"));
if (!"".equals(orderField)) {
scope += " order by " + orderField;
if (!"".equals(orderType))
scope += " " + orderType;
}
DbPageList pList = new DbPageList(${tableName}.class, scope, paras);
pList.doList(currentPage, pageSize);
return pList;
}
/**
* 這個方法負責根據(jù)Form中的數(shù)據(jù)轉(zhuǎn)換成java對象。
*
*/
public Object form2Obj(WebForm form) {
String cid = (String) form.get("cid");
$!tableName obj = null;
if (cid != null && (!cid.equals("")))
obj =($tableName)this.getDao().get(${tableName}.class,cid);
if (obj == null)
obj = new ${tableName}();
return form.toPo(obj);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -