📄 usermanageaction.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.User;
/**
* 使用添删改查action
* @author 大峡
*
*/
public class userManageAction 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"));
String userName = CommUtil.null2String(form.get("queryUserName"));
String tel = CommUtil.null2String(form.get("queryTel"));
if (!userName.equals("")) {
scope += " and userName like ?";
paras.add("%" + userName + "%");
}
if (!tel.equals("")) {
scope += " and tel like ?";
paras.add("%" + tel + "%");
}
if (orderField.equals(""))// 默认按用户名排序
{
orderField = "userName";
orderType = "desc";
}
if (!orderField.equals("")) {
scope += " order by " + orderField;
if (!orderType.equals(""))
scope += " " + orderType;
}
DbPageList pList = new DbPageList(User.class, scope, paras);
pList.doList(currentPage, pageSize);
return pList;
}
/**
* 这个方法负责根据Form中的数据转换成java对象。
*
*/
public Object form2Obj(WebForm form) {
String cid = (String) form.get("cid");
User user = null;
if (cid != null && (!cid.equals("")))
user = User.read(cid);
if (user == null)
user = new User();
return form.toPo(user);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -