📄 listsysuserwithpage.java.svn-base
字号:
package com.chis.model.user;
import com.stframe.dao.DaoUtil;
import com.stframe.dao.PageUtil;
import com.stframe.form.ActionForm;
import com.stframe.servlet.ActionInstance;
/**
* 带分页的用户列表
* @author zxh
*
*/
public class ListSysUserWithPage extends ActionInstance{
public int execute(ActionForm af) throws Exception {
String hbdwbh = (String) af.getHttpSession().getAttribute("HBDWBH");
int currentpage = 0;
int pagesize = 15;
//获取参数
String deptartment = af.getHttpRequest().getParameter("deptartment");
String deptartment_old=deptartment;
String status = af.getHttpRequest().getParameter("status");
String subDep =af.getHttpRequest().getParameter("subDep");
StringBuffer sbsql = new StringBuffer();
StringBuffer sbpath = new StringBuffer();
//拼凑SQL语句和PATH路径
sbsql.append("select u.id,u.logon_name,u.name,u.status,u.DEPARTMENT_ID,u.reg_date,u.create_date,\n");
sbsql.append("u.create_user_name,u.update_date,u.update_user_name,d.BM_NAME as DEPTNAME\n");
sbsql.append(" from sys_user u \n");
sbsql.append(" left join T_BM d on u.DEPARTMENT_ID=d.ID \n");
sbsql.append(" where 1=1 and CORP_ID='"+hbdwbh+"'");
sbpath.append(af.getHttpRequest().getContextPath()+"/Selevet.do?action=BASE_SYSUSER_LIST");
if(deptartment != null && !"-1".equals(deptartment))
{
deptartment=deptartment.trim();
sbsql.append(" AND (u.DEPARTMENT_ID ='"+deptartment+"'");
sbpath.append("&deptartment="+deptartment);
sbsql.append(") ");
}
if(status != null && !"-1".equals(status))
{
sbsql.append(" AND u.STATUS='"+status+"'");
sbpath.append("&status="+status);
}
try {
currentpage = Integer.parseInt(af.getHttpRequest().getParameter("currentpage"));
} catch (Exception e) {
currentpage = 1;
}
sbsql.append(" ORDER BY u.name ASC ");
PageUtil pageUtil = (PageUtil)DaoUtil.selectPage(af.getConnection(),sbsql.toString(),currentpage, pagesize);
pageUtil.setPath(sbpath.toString());
deptartment=deptartment_old;
//初始化选择
af.getHttpRequest().setAttribute("deptartment",deptartment);
af.getHttpRequest().setAttribute("status",status);
af.getHttpRequest().setAttribute("subDep",subDep);
af.getHttpRequest().setAttribute("userlist", pageUtil.getContext());
af.getHttpRequest().setAttribute("pagebar", pageUtil.pageBar());
return 1;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -