javaweb程序设计_项目库_项目案例_企业进销存管理系统设计文档内容摘要:

s以外的其他参数 private String andor。 //查询的与 /或条件 private String sdate。 //查询起始时间,即从什么日期开始查询 private String edate。 //查询结束时间,即到什么日期结束 private String orderby。 //排序条件,即按什么排序 private String paixu。 //排序方法,即升序或降序 public QuestString(){ //构造方法,用来设置 db为一个 DBResult()对象 db=new DBResult()。 } public int getCurPage() { return curPage。 } public void setCurPage(int curPage) { = curPage。 } //省略了对 Bean中其他属性设置的部分代码 „„ /** * 通过参数传递来设置 Bean中的属性 */ public void setQuerySql(String file,String pages,String strCount){ =pages。 //将表单提交过来的参数 pages(第几页 )的值传递给变量nowPage保存 =file。 //用来动态设置处理表单请求的 JSP文件 =strCount。 //用来设置执行 select count(*)„„的 SQL语 句 try{ querySql(countSql)。 //调用 querySql方法,并将参数 countSql传递到该方法中 }catch(Exception e){ ()。 – 10 – } } /** * 执行 SQL语句,获得分页显示时的各个属性 */ public void querySql(String countSql) throws SQLException{ //在 setQuerySql方法中已经设置了 nowPage的值,其值就是 pages if(==null){ //如果 nowPage的值为空,也就是传递 pages的值为空 =1。 //那么就将当前页的值设为 1; } else{ =()。 if(1){ //如果当前页小于 1,那么就将当前页的值设为 1 = 1。 } } ResultSet rsCount=(countSql)。 //执行 SQL语句获得记录总数 if(()){ =(1)。 //获取记录总数,即所要查询记录的总行数 } //获取总页数,即如果当总记录数除以每页显示的记录的余数为 0时,总页数就等于两数整除的结 果 //如果余数不等于 0,那么总页数就等于两数整除的结果加 1 =(%==0)?():(axRowCount/+1)。 if(){ //如果当前页大于总页数,则当前页等于总页数 =。 //那么当前页就是最大页 } ()。 //关闭总记录数的结果集 } /** * 一个字符串,用来动态的给出一个表单 * 该表单用来进行分页和统计页面间的跳转 */ public String pageFooter() { //创建一个表单 String str = form action= + + name=formBean methord=post。 int prev = 1。 //向前翻页,即当前页减 1 int next = +1。 //向后翻页,即当前页加 1 – 11 – str = str + font style=39。 fontsize: 10pt39。 总计 font color=39。 red39。 + () + /font条记录 , + 【共 font color=39。 red39。 + ()+ /font页】。 str = str + 【 font color=39。 red39。 + + /font条 /页】 当前第 font color=39。 red39。 + () + /font页。 if( 1) str = str + A href= + + ?pages=1 + str_parameter + 首页 /A。 else str = str + 首页。 if( 1) str = str + A href= + + ?pages= + prev + str_parameter + 上一页 /A。 else str = str + 上一页。 if( ) str = str + A href= + + ?pages= + next + str_parameter + 下一页 /A。 else str = str + 下一页。 if( 1 amp。 amp。 != ) str = str + A href= + + ?pages= + + str_parameter + 尾页 /A。 else str = str + 尾页 /font。 //在页面跳转间设置隐藏表单,来保存不同的请求 str = str + 转到 input type =39。 text39。 name=39。 pages39。 size=39。 239。 页 + input type=39。 hidden39。 name=39。 ccif39。 value=39。 ++ 39。 input type =39。 hidden39。 name=39。 cif39。 value=39。 ++ 39。 input type =39。 hidden39。 name=39。 qvalue39。 value=39。 ++ 39。 input type =39。 hidden39。 name=39。 andor39。 value=39。 ++ 39。 input type =39。 hidden39。 name=39。 sdate39。 value=39。 ++ 39。 input type =39。 hidden39。 name=39。 edate39。 value=39。 ++ 39。 input type =39。 hidden39。 name=39。 orderby39。 value=39。 ++ 39。 input type =39。 hidden39。 name=39。 paixu39。 value=39。 ++ 39。 input type=39。 submit39。 name=39。 sumbmit39。 value=39。 go39。 /form。 return str。 } /** * 根据不同条件来获取不同的查询前 N条的 SQL语句 */ – 12 – public String getString(String table){ if((=)) { String strSql=select top +*+ * from +table+ where+ +cif+=+39。 +qvalue+39。 return strSql。 } else if((LIKE)) { String strSql=select top +*+ * from +table+ where+ +cif+ +like+ +39。 %+qvalue+%39。 return strSql。 } else if((ALL)) { String strSql=select top +*+ * from +table。 return strSql。 } else if(()) { String strSql=select top +*+ * from +table+ where +cif+ 39。 +qvalue+39。 return strSql。 } return null。 } /** * 根据不同条件来获得不同的计算记录总数的 SQL语句 */ public String getCount(String table){ if((=)) { String strSql=select count(*) from +table+ where+ +cif+=+39。 +qvalue+39。 return strSql。 } else if((LIKE)) { String strSql=select count(*) from +table+ where+ +cif+ +like+ +39。 %+qvalue+%39。 return strSql。 } – 13 – else if((ALL)) { String strSql=select count(*) from +table。 return strSql。 } else if(()) { String strSql=select count(*) from +table+ where +cif+ 39。 +qvalue+39。 return strSql。 } return null。 } /** * 根据不同条件和不同的起始日期和结束日期来获得不同的计算记录总数的 SQL语句 */ public String getDateCount(String table){ if((=)) //在 sdate到 edate时间段中进行精确查询 { String strSql=select count(*) from +table+ where +cif+ = 39。 +qvalue+39。 + andor+ xsdate between 39。 +sdate+39。 and 39。 +edate+39。 return strSql。 } else if((LIKE)) //在 sdate到 edate时间段中进行模糊查询 { String strSql=select count(*) from +table+ where +cif+ like 39。 %+qvalue+%39。 + andor+ xsdate between 39。 +sdate+39。 and 39。 +edate+39。 return strSql。 } else if((ALL)) //取出表中所有记录 { String strSql=select count(*) from +table。 return strSql。 } return null。 } /** * 根据不同条件和不同的起始日期和结束日期来获得不同的查询 ,前 N。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。