文件名称:hibernate sprint 封装应用
文件大小:3KB
文件格式:RAR
更新时间:2014-08-10 03:55:08
hibernate sprint 封装应用
自己做的简单的封装程序,很方便。 IService s = this.getService(); String xm = request.getParameter("xm"); String rxsj = request.getParameter("rxsj"); String yx = request.getParameter("yx"); String zy = request.getParameter("zy"); String sf = request.getParameter("sf"); String mz = request.getParameter("mz"); String xb = request.getParameter("xb"); String pagenum = request.getParameter("pagenum"); String pxfield = request.getParameter("pxfield"); String px = request.getParameter("px"); String forward = request.getParameter("forward"); xm = (xm == null) ? "" : xm; rxsj = (rxsj == null) ? "" : rxsj; yx = (yx == null) ? "" : yx; zy = (zy == null) ? "" : zy; sf = (sf == null) ? "" : sf; mz = (mz == null) ? "" : mz; xb = (xb == null) ? "" : xb; pagenum = (pagenum == null) ? "20" : pagenum; pxfield = (pxfield == null) ? "XH" : pxfield; px = (px == null) ? "asc" : px; int pnum = Integer.parseInt(pagenum); // 翻页初始化 String curpage = request.getParameter("curpage"); if (curpage == null || curpage.trim().length() == 0) curpage = "1"; int cpage = Integer.parseInt(curpage); // 过滤条件赋值 List fls = new ArrayList(); fls.add(new QCls("XM", QCls._STRING_, QCls._F_LIKE_, xm).getThis()); fls.add(new QCls("RXSJ", QCls._INT_, QCls._F_EQUAL_, rxsj).getThis()); fls.add(new QCls("YXDM", QCls._STRING_, QCls._F_EQUAL_, yx).getThis()); fls.add(new QCls("LQZY", QCls._STRING_, QCls._F_EQUAL_, zy).getThis()); fls.add(new QCls("SF", QCls._STRING_, QCls._F_EQUAL_, sf).getThis()); fls.add(new QCls("MZDM", QCls._STRING_, QCls._F_EQUAL_, mz).getThis()); fls.add(new QCls("XBDM", QCls._STRING_, QCls._F_EQUAL_, xb).getThis()); fls.add(new QCls(null, null, null, " order by " + pxfield + " " + px)); Map m = s.getQueryList(new String[] { "from T_TDD", "select count(*) from T_TDD" }, fls, cpage, pnum); List tddls = (List) m.get(QCls._LIST_); request.setAttribute("tddls", tddls); String toolbar = QCls.getToolBarZhcn("main.do?method=getStudInfoList" + "&xm=" + URLEncoder.encode(xm, "utf-8") + "&rxsj=" + rxsj + "&yx=" + yx + "&zy=" + zy + "&sf=" + sf + "&mz=" + mz + "&xb=" + xb + "&pagenum=" + pagenum + "&pxfield=" + pxfield + "&px=" + px, "curpage", ((Integer) m.get(QCls._COUNT_)).intValue(), cpage, pnum); request.setAttribute("toolbar", toolbar); // 条件过滤数据,传送到页面 request.setAttribute("xm", xm); request.setAttribute("rxsj", rxsj); request.setAttribute("yx", yx); request.setAttribute("zy", zy); request.setAttribute("sf", sf); request.setAttribute("mz", mz); request.setAttribute("xb", xb); request.setAttribute("pagenum", pagenum); request.setAttribute("pxfield", pxfield); request.setAttribute("px", px); return mapping.findForward("");
【文件预览】:
Server.java
QCls.java