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

📄 crudaction.java

📁 一个简单的java邮件系统源码
💻 JAVA
字号:
package $package;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;

import com.easyjf.web.tools.CommTool;
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 ${beanPackage}.$tableName;

/**
 * 使用添删改查action
 * @author easyjwebtools
 *
 */
public class ${tableName}Action extends CrudAction {
	/**
	 * 查询及分页,通过实现AbstractCrudAction中的抽象方法实现
	 */
	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;
	}

	/**
	 * 这个方法负责根据Form中的数据转换成java对象。
	 * 
	 */
	public Object form2Obj(WebForm form) {
		Serializable id = (Serializable) form.get("id");
		$!tableName obj = null;
		if (id != null && (!id.equals("")))
			obj =(${tableName})this.getDao().get(${tableName}.class,CommTool.convertIdValue(id, ${tableName}.class));			
		if (obj == null)
			obj = new ${tableName}();
		return form.toPo(obj);
	}
}

⌨️ 快捷键说明

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