📄 myklistpage.java
字号:
package com.chis.model.etjz;
import java.util.List;
import com.stframe.dao.DaoUtil;
import com.stframe.dao.PageUtil;
import com.stframe.form.ActionForm;
import com.stframe.servlet.ActionInstance;
/**
* 儿童免疫卡列表分页
*
* @author zxh
*
*/
public class MykListPage extends ActionInstance {
@Override
public int execute(ActionForm af) throws Exception {
String corp_code = af.getHttpSession().getAttribute("CORP_CODE")
.toString();
String JMJKDAH = af.getHttpRequest().getParameter("JMJKDAH");
String NAME = af.getHttpRequest().getParameter("NAME");
String NLL = af.getHttpRequest().getParameter("NLL");
String NLD = af.getHttpRequest().getParameter("NLD");
int currentpage = 0;
int pagesize = 15;
StringBuffer sbsql = new StringBuffer();
StringBuffer sbpath = new StringBuffer();
// 拼凑SQL语句和PATH路径
sbsql
.append("SELECT a.ID as MYKID,a.JMJKDAH,((year(getdate())-year(b.CSRQ))+1) as NL,* FROM MY_MYK a \n");
sbsql.append(" left join DA_RKXZL b on b.JMJKDAH=a.JMJKDAH \n");
sbsql.append(" WHERE 1=1 and a.CORP_CODE='" + corp_code + "'");
if (!(JMJKDAH == null) && !JMJKDAH.equals("")) {
sbsql.append(" and b.JMJKDAH='" + JMJKDAH + "'");
}
if (NAME != null && !NAME.equals("")) {
sbsql.append(" and b.JMXM like '%" + NAME + "%'");
}
if (NLL != null && !NLL.equals("")) {
sbsql.append(" and ((year(getdate())-year(b.CSRQ))+1) >='" + NLL + "'");
}
if (NLD != null && !NLD.equals("")) {
sbsql.append(" and ((year(getdate())-year(b.CSRQ))+1) <='" + NLD + "'");
}
sbsql.append(" order by a.MYKBH asc ");
sbpath.append(af.getHttpRequest().getContextPath()
+ "/Selevet.do?action=Selevet.do?action=MYK_LIST_PAGE");
try {
currentpage = Integer.parseInt(af.getHttpRequest().getParameter(
"currentpage"));
} catch (Exception e) {
currentpage = 1;
}
PageUtil pageUtil = (PageUtil) DaoUtil.selectPage(af.getConnection(),
sbsql.toString(), currentpage, pagesize);
pageUtil.setPath(sbpath.toString());
List list = pageUtil.getContext();
af.getHttpRequest().setAttribute("NAME", NAME);
af.getHttpRequest().setAttribute("NLL", NLL);
af.getHttpRequest().setAttribute("NLD", NLD);
af.getHttpRequest().setAttribute("JMJKDAH", JMJKDAH);
af.getHttpRequest().setAttribute("myk_list", list);
af.getHttpRequest().setAttribute("num", pageUtil.getContext().size());
af.getHttpRequest().setAttribute("pagebar", pageUtil.pageBar());
return 1;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -