day 8 查询统计 +周总结
一、具体任务
- 分类检索:管理用户登陆到重大技术需求征集管理系统后,可选择按机构全称、归口管理单位、所在地域、法人代表、联系人、机构属性、技术需求名称、关键字、拟投入资金总额、技术需求解决方式、科技活动类型、学科分类、需求技术所属领域、需求技术应用行业、管理处室等字段对技术需求数据进行分类查询检索。还要在条件中增加形式审核是否通过、部门审核是否通过。
- 综合检索:用户根据按机构全称、归口管理单位、所在地域、法人代表、联系人、机构属性、技术需求名称、关键字、拟投入资金总额、技术需求解决方式、科技活动类型、学科分类、需求技术所属领域、需求技术应用行业、管理处室等字段进行综合逻辑检索。还要在条件中增加形式审核是否通过、部门审核是否通过。
- 系统可按照限定的组合指标条件,对相关技术需求条数根据机构属性、科技活动类型、技术需求解决方式字段、归口管理部门、所在地域、学科分类、需求技术应用行业、管理处室中的任何一个进行统计、排序、对比,生成统计图表。(只统计部门审核通过的技术需求)
二、具体实现
1、分类检索实现比较简单,主要是从前台获取到你想要查询的属性、查询的字眼、查询的模式然后转换成相应的sql语句,用的方法比较粗糙
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@page import="java.sql.*" %> <%--导入java.sql包--%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>需求浏览</title> <script type="text/javascript" src="layui/layui.js"></script> <link rel="stylesheet" href="layui/css/layui.css"> <link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.min.css"> <script type="text/javascript" src="bootstrap-3.3.7-dist/js/bootstrap.min.js"></script> <script> layui.use('form', function(){ var form = layui.form; //各种基于事件的操作,下面会有进一步介绍 form.render(); }); </script> </head> <body style="margin-top:15px;margin-left: 10px;"> <div style="text-align: center;"> <h1>分类检索</h1> </div> <form class="layui-form" action="${pageContext.request.contextPath}/GuanServlet?method=searchfen" method="post" > <div class="layui-form-item" > <label class="layui-form-label">标引条件:</label> <div class="layui-input-inline" > <select name="classfen" lay-verify="required" lay-verType="alert" lay-search> <option value="">请选择想检索的条件</option> <option value="机构全称">机构全称</option> <option value="归口管理单位">归口管理单位</option> <option value="所在地域">所在地域</option> <option value="法人代表">法人代表</option> <option value="联系人">联系人</option> <option value="机构属性">机构属性</option> <option value="技术需求名称">技术需求名称</option> <option value="关键字">关键字</option> <option value="拟投入资金总额">拟投入资金总额</option> <option value="技术需求解决方式">技术需求解决方式</option> <option value="科技活动类型">科技活动类型</option> <option value="学科分类">学科分类</option> <option value="需求技术所属领域">需求技术所属领域</option> <option value="需求技术应用行业">需求技术应用行业</option> </select> </div> <div class="layui-input-inline" > <input type="text" name="zhi" placeholder="" autocomplete="off" class="layui-input zhi"> </div> <div class="layui-input-inline" > <select name="sway" id="sway"> <option value="模糊查询">模糊查询</option> <option value="精准查询">精准查询</option> </select> </div> 形式审核: <input type="radio" name="shen1" value="通过" lay-ignore/>通过 <input type="radio" name="shen1" value="未通过" lay-ignore/>未通过 部门审核: <input type="radio" name="shen" value="通过" lay-ignore />通过 <input type="radio" name="shen" value="未通过" lay-ignore/>未通过 <input type="submit" value="检索" align="center" style=" height: 30px;width: 100px;border-color: #FAFAD2;border-radius:10px ;background: #87CEFA;margin-top: 3px;margin-left: 55px;"> <input type="hidden" name="username" value="<%=request.getParameter("username") %>"> <input type="hidden" name="zongway" value="<%=request.getParameter("zongway") %>"> </div> </form> <table class="layui-table" > <thead> <tr> <th>序号</th> <th>需求名称</th> <th>机构名称</th> <th>所在地域</th> <th>归口管理单位</th> <th>机构属性</th> <th>科技活动类型</th> <th>操作</th> </tr> </thead> <tbody> <c:if test="${empty biaos}"> <tr> <td colspan="8">数据库中暂无公文</td> </tr> </c:if> <c:if test="${not empty biaos}"> <c:forEach items="${biaos}" var="biao"> <tr data-id="1"> <td>${biao.id}</td> <td>${biao.demandname}</td> <td>${biao.oname}</td> <td>${biao.saddress}</td> <td>${biao.sub}</td> <td>${biao.attribute}</td> <td>${biao.type}</td> <td class="td-manage"> <a title="查看" href="${pageContext.request.contextPath}/BrowserServlet?method=search&way=look&id=${biao.id}&oname=${biao.oname}"> <i class="layui-icon layui-icon-edit"></i> </a> </td> </tr> </c:forEach> </c:if> </tbody> </table> <nav class="pageDIV" style=" text-align: center;font-size: 21px;"> <ul class="pagination"> <li <c:if test="${!page.hasPreviouse}">class="disabled"</c:if>> <a href="${pageContext.request.contextPath}/GuanServlet?method=searchfen&classfen=${classfen}&zhi=${zhi}&shen=${shen}&shen1=${shen1}&username=${username}&sway=${sway}&page.start=0"> <span>«</span> </a> </li> <li <c:if test="${!page.hasPreviouse}">class="disabled"</c:if>> <a href="${pageContext.request.contextPath}/GuanServlet?method=searchfen&classfen=${classfen}&zhi=${zhi}&shen=${shen}&shen1=${shen1}&username=${username}&sway=${sway}&page.start=${page.start-page.count}"> <span>‹</span> </a> </li> <c:forEach begin="0" end="${page.totalPage-1}" varStatus="status"> <c:if test="${status.count*page.count-page.start<=40 && status.count*page.count-page.start>=-10}"> <li <c:if test="${status.index*page.count==page.start}">class="disabled"</c:if>> <a href="${pageContext.request.contextPath}/GuanServlet?method=searchfen&classfen=${classfen}&zhi=${zhi}&shen=${shen}&shen1=${shen1}&username=${username}&sway=${sway}&page.start=${status.index*page.count}" <c:if test="${status.index*page.count==page.start}">class="current"</c:if> >${status.count}</a> </li> </c:if> </c:forEach> <li <c:if test="${!page.hasNext}">class="disabled"</c:if>> <a href="${pageContext.request.contextPath}/GuanServlet?method=searchfen&classfen=${classfen}&zhi=${zhi}&shen=${shen}&shen1=${shen1}&username=${username}&sway=${sway}&page.start=${page.start+page.count}"> <span>›</span> </a> </li> <li <c:if test="${!page.hasNext}">class="disabled"</c:if>> <a href="${pageContext.request.contextPath}/GuanServlet?method=searchfen&classfen=${classfen}&zhi=${zhi}&shen=${shen}&shen1=${shen1}&username=${username}&sway=${sway}&page.start=${page.last}"> <span>»</span> </a> </li> </ul> </nav> </body> <script type="text/javascript"> </script> </html>
效果:
2、综合查询重点是根据接受到前台的数据拼接sql语句,一开始我也是想用笨办法if-else列出每一种情况,发现完全不行太多了,然后后面加上分页又变的很复杂
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
protected void searchzong(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, SQLException { //用于参数的中转(由管理员浏览所有角色界面传来)传递想要查询的条件 req.setCharacterEncoding("utf-8"); String way=req.getParameter("roleway"); String yeway=req.getParameter("yeway"); // System.out.println(yeway); String[] classzong=req.getParameterValues("classzong"); String[] zhi=req.getParameterValues("zhi"); String shen=req.getParameter("shen"); String shen1=req.getParameter("shen1");//形式审核 String[] sway=req.getParameterValues("sway"); String[] luo=req.getParameterValues("luo"); String username=req.getParameter("username"); String zongway=req.getParameter("zongway"); String classzong1=null; String zhi1=null; String sway1=null; String luo1=null; String sql=null; if(yeway!=null) { if(yeway.equals("second")) { classzong1=req.getParameter("classzong"); zhi1=req.getParameter("zhi"); luo1=req.getParameter("luo"); sway1=req.getParameter("sway"); classzong=classzong1.split(","); zhi=zhi1.split(","); sway=sway1.split(","); luo=luo1.split(","); for(String s:classzong) { System.out.println(s); } System.out.println(sway1); System.out.println(classzong1); System.out.println(zhi1); System.out.println(luo1); } else { classzong=req.getParameterValues("classzong"); zhi=req.getParameterValues("zhi"); sway=req.getParameterValues("sway"); luo=req.getParameterValues("luo"); } } int start = 0; int count = 10; try { start = Integer.parseInt(req.getParameter("page.start")); count = Integer.parseInt(req.getParameter("page.count")); } catch (Exception e) { } //String sql = "select * from Biao where "; System.out.println(way); System.out.println(zongway); System.out.println(username); GuanDao guandao=new GuanDao(); List<BiaoBean> biaos=new ArrayList<BiaoBean>(); int total = 0; Page page = new Page(start, count); if(classzong!=null) { if(classzong[0]!=null&&zhi[0]!=null) { if(classzong[0].equals("")||zhi[0].equals("")) {//如果第一个标引下拉框未选或者是第一个标引输入框为空则显示全部 System.out.println("cheng"); if(username.equals("薛普")) { sql = "select * from Biao"; }else{ sql = "select * from Biao where guan=?"; } biaos=guandao.allfen(sql,page.getStart(),page.getCount()); total = guandao.getTotalfen(sql); }else { if(zongway.equals("bu")) { sql = "select * from Biao where guan='"+username+"' and "; }else{ sql = "select * from Biao where "; } biaos=guandao.onezong(sql,classzong,zhi,sway,luo,shen,shen1,page.getStart(),page.getCount()); total = guandao.getTotalzong(sql,classzong,zhi,sway,luo,shen,shen1); int a=0; for(String s:classzong) { System.out.println(s); if(s.equals("")) { //如果为空就跳出整个循环确定前面有几个不为空就是条件个数 break; } a++; } System.out.println("外部拼接长度为"+a); StringBuffer str1 = new StringBuffer(); for (int i=0;i<a;i++) { if(!classzong[i].equals("")&&i!=0) { str1.append(","); } str1.append(classzong[i]); } classzong1=String.valueOf(str1); StringBuffer str2 = new StringBuffer(); for (int i=0;i<a;i++) { if(!zhi[i].equals("")&&i!=0) { str2.append(","); } str2.append(zhi[i]); } zhi1=String.valueOf(str2); StringBuffer str3 = new StringBuffer(); for (int i=0;i<a;i++) { if(!sway[i].equals("")&&i!=0) { str3.append(","); } str3.append(sway[i]); } sway1=String.valueOf(str3); StringBuffer str4 = new StringBuffer(); for (int i=0;i<a-1;i++) { if(!luo[i].equals("")&&i!=0) { str4.append(","); } str4.append(luo[i]); } luo1=String.valueOf(str4); } } } if(way!=null) { if(way.equals("all")) { if(username.equals("薛普")) { sql = "select * from Biao"; }else{ sql = "select * from Biao where guan=?"; } biaos=guandao.allfen(sql,page.getStart(),page.getCount()); total = guandao.getTotalfen(sql); } } System.out.println("总数:"+total); page.setTotal(total); System.out.println("总页数:"+page.getTotalPage()+"尾页"+page.getLast()); req.setAttribute("biaos",biaos); req.setAttribute("page",page); req.setAttribute("roleway",way); req.setAttribute("classzong",classzong1); req.setAttribute("zhi",zhi1); req.setAttribute("sway",sway1); req.setAttribute("luo",luo1); req.setAttribute("shen",shen); req.setAttribute("shen1",shen1); req.setAttribute("username",username); req.setAttribute("zongway",zongway); req.setAttribute("yeway","second"); req.getRequestDispatcher("/tablezong.jsp").forward(req,resp); }
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@page import="java.sql.*" %> <%--导入java.sql包--%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>需求浏览</title> <script type="text/javascript" src="layui/layui.js"></script> <link rel="stylesheet" href="layui/css/layui.css"> <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.11.1.js"></script> <script src="${pageContext.request.contextPath}/js/jquery-1.9.1.min.js"></script> <link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.min.css"> <script type="text/javascript" src="bootstrap-3.3.7-dist/js/bootstrap.min.js"></script> <script type="text/javascript"> </script> <script> layui.use(['form','laypage'], function(){ var form = layui.form ,laypage = layui.laypage; //各种基于事件的操作,下面会有进一步介绍 laypage.render({ elem: 'test1' //注意,这里的 test1 是 ID,不用加 # 号 ,count: 50 //数据总数,从服务端得到 }); form.render(); }); </script> </head> <body style="margin-top:15px;margin-left: 10px;"> <div style="text-align: center;"> <h1>综合检索</h1> </div> <form class="layui-form" action="${pageContext.request.contextPath}/GuanServlet?method=searchzong" method="post" > <div class="layui-form-item" > <div class="layui-input-inline" > <select name="classzong" lay-verType="alert" lay-search> <option value="">请选择想检索的条件</option> <option value="oname">机构全称</option> <option value="sub">归口管理单位</option> <option value="saddress">所在地域</option> <option value="representative">法人代表</option> <option value="linkman">联系人</option> <option value="attribute">机构属性</option> <option value="demandname">技术需求名称</option> <option value="keyword">关键字</option> <option value="money1">拟投入资金总额</option> <option value="medel">技术需求解决方式</option> <option value="type">科技活动类型</option> <option value="classify">学科分类</option> <option value="field">需求技术所属领域</option> <option value="industry">需求技术应用行业</option> </select> </div> <div class="layui-input-inline" > <input type="text" name="zhi" placeholder="" autocomplete="off" class="layui-input zhi" > </div> <select name="sway" lay-ignore id="sway"> <option value=""></option> <option value="模糊查询">模糊查询</option> <option value="精准查询">精准查询</option> </select> 形式审核: <input type="radio" name="shen1" value="同意" lay-ignore/>通过 <input type="radio" name="shen1" value="不同意" lay-ignore/>未通过 部门审核: <input type="radio" name="shen" value="同意" lay-ignore />通过 <input type="radio" name="shen" value="不同意" lay-ignore/>未通过 <input type="submit" value="检索" align="center" style=" height: 30px;width: 100px;border-color: #FAFAD2;border-radius:10px ;background: #87CEFA;margin-top: 3px;margin-left: 55px;"> <input type="hidden" name="username" value="<%=request.getParameter("username") %>"> <input type="hidden" name="zongway" value="<%=request.getParameter("zongway") %>"> </div> <div class="layui-form-item shu1" > <div class="layui-input-inline" > <select name="classzong" lay-verType="alert" lay-search> <option value="">请选择想检索的条件</option> <option value="oname">机构全称</option> <option value="sub">归口管理单位</option> <option value="saddress">所在地域</option> <option value="representative">法人代表</option> <option value="linkman">联系人</option> <option value="attribute">机构属性</option> <option value="demandname">技术需求名称</option> <option value="keyword">关键字</option> <option value="money1">拟投入资金总额</option> <option value="medel">技术需求解决方式</option> <option value="type">科技活动类型</option> <option value="classify">学科分类</option> <option value="field">需求技术所属领域</option> <option value="industry">需求技术应用行业</option> </select> </div> <select name="luo" lay-ignore id="sway"> <option value=""></option> <option value="并含">并含</option> <option value="或者">或者</option> <option value="非">非</option> </select> <div class="layui-input-inline" > <input type="text" name="zhi" placeholder="" autocomplete="off" class="layui-input zhi" > </div> <select name="sway" lay-ignore id="sway"> <option value=""></option> <option value="模糊查询">模糊查询</option> <option value="精准查询">精准查询</option> </select> </div> <div class="layui-form-item shu2" > <div class="layui-input-inline" > <select name="classzong" lay-verType="alert" lay-search> <option value="">请选择想检索的条件</option> <option value="oname">机构全称</option> <option value="sub">归口管理单位</option> <option value="saddress">所在地域</option> <option value="representative">法人代表</option> <option value="linkman">联系人</option> <option value="attribute">机构属性</option> <option value="demandname">技术需求名称</option> <option value="keyword">关键字</option> <option value="money1">拟投入资金总额</option> <option value="medel">技术需求解决方式</option> <option value="type">科技活动类型</option> <option value="classify">学科分类</option> <option value="field">需求技术所属领域</option> <option value="industry">需求技术应用行业</option> </select> </div> <select name="luo" lay-ignore id="sway"> <option value=""></option> <option value="并含">并含</option> <option value="或者">或者</option> <option value="非">非</option> </select> <div class="layui-input-inline" > <input type="text" name="zhi" placeholder="" autocomplete="off" class="layui-input zhi" > </div> <select name="sway" lay-ignore id="sway"> <option value=""></option> <option value="模糊查询">模糊查询</option> <option value="精准查询">精准查询</option> </select> </div> <div class="layui-form-item shu3" > <div class="layui-input-inline" > <select name="classzong" lay-verType="alert" lay-search> <option value="">请选择想检索的条件</option> <option value="oname">机构全称</option> <option value="sub">归口管理单位</option> <option value="saddress">所在地域</option> <option value="representative">法人代表</option> <option value="linkman">联系人</option> <option value="attribute">机构属性</option> <option value="demandname">技术需求名称</option> <option value="keyword">关键字</option> <option value="money1">拟投入资金总额</option> <option value="medel">技术需求解决方式</option> <option value="type">科技活动类型</option> <option value="classify">学科分类</option> <option value="field">需求技术所属领域</option> <option value="industry">需求技术应用行业</option> </select> </div> <select name="luo" lay-ignore id="sway"> <option value=""></option> <option value="并含">并含</option> <option value="或者">或者</option> <option value="非">非</option> </select> <div class="layui-input-inline" > <input type="text" name="zhi" placeholder="" autocomplete="off" class="layui-input zhi" > </div> <select name="sway" lay-ignore id="sway"> <option value=""></option> <option value="模糊查询">模糊查询</option> <option value="精准查询">精准查询</option> </select> </div> <div class="layui-form-item shu4" > <div class="layui-input-inline" > <select name="classzong" lay-verType="alert" lay-search> <option value="">请选择想检索的条件</option> <option value="oname">机构全称</option> <option value="sub">归口管理单位</option> <option value="saddress">所在地域</option> <option value="representative">法人代表</option> <option value="linkman">联系人</option> <option value="attribute">机构属性</option> <option value="demandname">技术需求名称</option> <option value="keyword">关键字</option> <option value="money1">拟投入资金总额</option> <option value="medel">技术需求解决方式</option> <option value="type">科技活动类型</option> <option value="classify">学科分类</option> <option value="field">需求技术所属领域</option> <option value="industry">需求技术应用行业</option> </select> </div> <select name="luo" lay-ignore id="sway"> <option value=""></option> <option value="并含">并含</option> <option value="或者">或者</option> <option value="非">非</option> </select> <div class="layui-input-inline" > <input type="text" name="zhi" placeholder="" autocomplete="off" class="layui-input zhi" > </div> <select name="sway" lay-ignore id="sway"> <option value=""></option> <option value="模糊查询">模糊查询</option> <option value="精准查询">精准查询</option> </select> </div> <div class="layui-form-item shu5" > <div class="layui-input-inline" > <select name="classzong" lay-verType="alert" lay-search> <option value="">请选择想检索的条件</option> <option value="oname">机构全称</option> <option value="sub">归口管理单位</option> <option value="saddress">所在地域</option> <option value="representative">法人代表</option> <option value="linkman">联系人</option> <option value="attribute">机构属性</option> <option value="demandname">技术需求名称</option> <option value="keyword">关键字</option> <option value="money1">拟投入资金总额</option> <option value="medel">技术需求解决方式</option> <option value="type">科技活动类型</option> <option value="classify">学科分类</option> <option value="field">需求技术所属领域</option> <option value="industry">需求技术应用行业</option> </select> </div> <select name="luo" lay-ignore id="sway"> <option value=""></option> <option value="并含">并含</option> <option value="或者">或者</option> <option value="非">非</option> </select> <div class="layui-input-inline" > <input type="text" name="zhi" placeholder="" autocomplete="off" class="layui-input zhi" > </div> <select name="sway" lay-ignore id="sway"> <option value=""></option> <option value="模糊查询">模糊查询</option> <option value="精准查询">精准查询</option> </select> </div> <div class="layui-form-item shu6" > <div class="layui-input-inline" > <select name="classzong" lay-verType="alert" lay-search> <option value="">请选择想检索的条件</option> <option value="oname">机构全称</option> <option value="sub">归口管理单位</option> <option value="saddress">所在地域</option> <option value="representative">法人代表</option> <option value="linkman">联系人</option> <option value="attribute">机构属性</option> <option value="demandname">技术需求名称</option> <option value="keyword">关键字</option> <option value="money1">拟投入资金总额</option> <option value="medel">技术需求解决方式</option> <option value="type">科技活动类型</option> <option value="classify">学科分类</option> <option value="field">需求技术所属领域</option> <option value="industry">需求技术应用行业</option> </select> </div> <select name="luo" lay-ignore id="sway"> <option value=""></option> <option value="并含">并含</option> <option value="或者">或者</option> <option value="非">非</option> </select> <div class="layui-input-inline" > <input type="text" name="zhi" placeholder="" autocomplete="off" class="layui-input zhi" > </div> <select name="sway" lay-ignore id="sway"> <option value=""></option> <option value="模糊查询">模糊查询</option> <option value="精准查询">精准查询</option> </select> </div> <div class="layui-form-item shu7" > <div class="layui-input-inline" > <select name="classzong" lay-verType="alert" lay-search> <option value="">请选择想检索的条件</option> <option value="oname">机构全称</option> <option value="sub">归口管理单位</option> <option value="saddress">所在地域</option> <option value="representative">法人代表</option> <option value="linkman">联系人</option> <option value="attribute">机构属性</option> <option value="demandname">技术需求名称</option> <option value="keyword">关键字</option> <option value="money1">拟投入资金总额</option> <option value="medel">技术需求解决方式</option> <option value="type">科技活动类型</option> <option value="classify">学科分类</option> <option value="field">需求技术所属领域</option> <option value="industry">需求技术应用行业</option> </select> </div> <select name="luo" lay-ignore id="sway"> <option value=""></option> <option value="并含">并含</option> <option value="或者">或者</option> <option value="非">非</option> </select> <div class="layui-input-inline" > <input type="text" name="zhi" placeholder="" autocomplete="off" class="layui-input zhi" > </div> <select name="sway" lay-ignore id="sway"> <option value=""></option> <option value="模糊查询">模糊查询</option> <option value="精准查询">精准查询</option> </select> </div> <div class="layui-form-item shu8" > <div class="layui-input-inline" > <select name="classzong" lay-verType="alert" lay-search> <option value="">请选择想检索的条件</option> <option value="oname">机构全称</option> <option value="sub">归口管理单位</option> <option value="saddress">所在地域</option> <option value="representative">法人代表</option> <option value="linkman">联系人</option> <option value="attribute">机构属性</option> <option value="demandname">技术需求名称</option> <option value="keyword">关键字</option> <option value="money1">拟投入资金总额</option> <option value="medel">技术需求解决方式</option> <option value="type">科技活动类型</option> <option value="classify">学科分类</option> <option value="field">需求技术所属领域</option> <option value="industry">需求技术应用行业</option> </select> </div> <select name="luo" lay-ignore id="sway"> <option value=""></option> <option value="并含">并含</option> <option value="或者">或者</option> <option value="非">非</option> </select> <div class="layui-input-inline" > <input type="text" name="zhi" placeholder="" autocomplete="off" class="layui-input zhi" > </div> <select name="sway" lay-ignore id="sway"> <option value=""></option> <option value="模糊查询">模糊查询</option> <option value="精准查询">精准查询</option> </select> </div> <div class="layui-form-item shu9" > <div class="layui-input-inline" > <select name="classzong" lay-verType="alert" lay-search> <option value="">请选择想检索的条件</option> <option value="oname">机构全称</option> <option value="sub">归口管理单位</option> <option value="saddress">所在地域</option> <option value="representative">法人代表</option> <option value="linkman">联系人</option> <option value="attribute">机构属性</option> <option value="demandname">技术需求名称</option> <option value="keyword">关键字</option> <option value="money1">拟投入资金总额</option> <option value="medel">技术需求解决方式</option> <option value="type">科技活动类型</option> <option value="classify">学科分类</option> <option value="field">需求技术所属领域</option> <option value="industry">需求技术应用行业</option> </select> </div> <select name="luo" lay-ignore id="sway"> <option value=""></option> <option value="并含">并含</option> <option value="或者">或者</option> <option value="非">非</option> </select> <div class="layui-input-inline" > <input type="text" name="zhi" placeholder="" autocomplete="off" class="layui-input zhi" > </div> <select name="sway" lay-ignore id="sway"> <option value=""></option> <option value="模糊查询">模糊查询</option> <option value="精准查询">精准查询</option> </select> </div> <div class="layui-form-item shu10" > <div class="layui-input-inline" > <select name="classzong" lay-verType="alert" lay-search> <option value="">请选择想检索的条件</option> <option value="oname">机构全称</option> <option value="sub">归口管理单位</option> <option value="saddress">所在地域</option> <option value="representative">法人代表</option> <option value="linkman">联系人</option> <option value="attribute">机构属性</option> <option value="demandname">技术需求名称</option> <option value="keyword">关键字</option> <option value="money1">拟投入资金总额</option> <option value="medel">技术需求解决方式</option> <option value="type">科技活动类型</option> <option value="classify">学科分类</option> <option value="field">需求技术所属领域</option> <option value="industry">需求技术应用行业</option> </select> </div> <select name="luo" lay-ignore id="sway"> <option value=""></option> <option value=""></option> <option value="并含">并含</option> <option value="或者">或者</option> <option value="非">非</option> </select> <div class="layui-input-inline" > <input type="text" name="zhi" placeholder="" autocomplete="off" class="layui-input zhi" > </div> <select name="sway" lay-ignore id="sway"> <option value=""></option> <option value="模糊查询">模糊查询</option> <option value="精准查询">精准查询</option> </select> </div> <div class="layui-form-item shu11" > <div class="layui-input-inline" > <select name="classzong" lay-verType="alert" lay-search> <option value="">请选择想检索的条件</option> <option value="oname">机构全称</option> <option value="sub">归口管理单位</option> <option value="saddress">所在地域</option> <option value="representative">法人代表</option> <option value="linkman">联系人</option> <option value="attribute">机构属性</option> <option value="demandname">技术需求名称</option> <option value="keyword">关键字</option> <option value="money1">拟投入资金总额</option> <option value="medel">技术需求解决方式</option> <option value="type">科技活动类型</option> <option value="classify">学科分类</option> <option value="field">需求技术所属领域</option> <option value="industry">需求技术应用行业</option> </select> </div> <select name="luo" lay-ignore id="sway"> <option value=""></option> <option value="并含">并含</option> <option value="或者">或者</option> <option value="非">非</option> </select> <div class="layui-input-inline" > <input type="text" name="zhi" placeholder="" autocomplete="off" class="layui-input zhi" > </div> <select name="sway" lay-ignore id="sway"> <option value=""></option> <option value="模糊查询">模糊查询</option> <option value="精准查询">精准查询</option> </select> </div> <div class="layui-form-item shu12" > <div class="layui-input-inline" > <select name="classzong" lay-verType="alert" lay-search> <option value="">请选择想检索的条件</option> <option value="oname">机构全称</option> <option value="sub">归口管理单位</option> <option value="saddress">所在地域</option> <option value="representative">法人代表</option> <option value="linkman">联系人</option> <option value="attribute">机构属性</option> <option value="demandname">技术需求名称</option> <option value="keyword">关键字</option> <option value="money1">拟投入资金总额</option> <option value="medel">技术需求解决方式</option> <option value="type">科技活动类型</option> <option value="classify">学科分类</option> <option value="field">需求技术所属领域</option> <option value="industry">需求技术应用行业</option> </select> </div> <select name="luo" lay-ignore id="sway"> <option value=""></option> <option value="并含">并含</option> <option value="或者">或者</option> <option value="非">非</option> </select> <div class="layui-input-inline" > <input type="text" name="zhi" placeholder="" autocomplete="off" class="layui-input zhi" > </div> <select name="sway" lay-ignore id="sway"> <option value=""></option> <option value="模糊查询">模糊查询</option> <option value="精准查询">精准查询</option> </select> </div> </form> <button class="ti" >添加</button> <button class="ji" >消除</button> <table class="layui-table" > <thead> <tr> <th style="width: 20px">序号</th> <th style="width: 120px">需求名称</th> <th style="width: 280px">机构名称</th> <th style="width: 80px">所在地域</th> <th style="width: 80px">归口管理单位</th> <th style="width: 80px">机构属性</th> <th style="width: 80px">学科分类</th> <th style="width: 80px">技术需求解决方式</th> <th style="width: 80px">需求技术应用行业</th> <th style="width: 80px">科技活动类型</th> <th style="width: 20px">操作</th> </tr> </thead> <tbody id="body"> <c:if test="${empty biaos}"> <tr> <td colspan="8">数据库中暂无公文</td> </tr> </c:if> <c:if test="${not empty biaos}"> <c:forEach items="${biaos}" var="biao"> <tr data-id="1"> <td>${biao.id}</td> <td>${biao.demandname}</td> <td>${biao.oname}</td> <td>${biao.saddress}</td> <td>${biao.sub}</td> <td>${biao.attribute}</td> <td>${biao.classify}</td> <td>${biao.medel}</td> <td>${biao.industry}</td> <td>${biao.type}</td> <td class="td-manage"> <a title="查看" href="${pageContext.request.contextPath}/BrowserServlet?method=search&way=look&id=${biao.id}&oname=${biao.oname}"> <i class="layui-icon layui-icon-edit"></i> </a> </td> </tr> </c:forEach> </c:if> </tbody> </table> <nav class="pageDIV" style=" text-align: center;font-size: 21px;"> <ul class="pagination"> <li <c:if test="${!page.hasPreviouse}">class="disabled"</c:if>> <a href="${pageContext.request.contextPath}/GuanServlet?method=searchzong&classzong=${classzong}&zhi=${zhi}&shen=${shen}&shen1=${shen1}&username=${username}&sway=${sway}&roleway=${roleway}&zongway=${zongway}&luo=${luo}&yeway=${yeway}&page.start=0"> <span>«</span> </a> </li> <li <c:if test="${!page.hasPreviouse}">class="disabled"</c:if>> <a href="${pageContext.request.contextPath}/GuanServlet?method=searchzong&classzong=${classzong}&zhi=${zhi}&shen=${shen}&shen1=${shen1}&username=${username}&sway=${sway}&roleway=${roleway}&zongway=${zongway}&luo=${luo}&yeway=${yeway}&page.start=${page.start-page.count}"> <span>‹</span> </a> </li> <c:forEach begin="0" end="${page.totalPage-1}" varStatus="status"> <c:if test="${status.count*page.count-page.start<=40 && status.count*page.count-page.start>=-10}"> <li <c:if test="${status.index*page.count==page.start}">class="disabled"</c:if>> <a href="${pageContext.request.contextPath}/GuanServlet?method=searchzong&classzong=${classzong}&zhi=${zhi}&shen=${shen}&shen1=${shen1}&username=${username}&sway=${sway}&roleway=${roleway}&zongway=${zongway}&luo=${luo}&yeway=${yeway}&page.start=${status.index*page.count}" <c:if test="${status.index*page.count==page.start}">class="current"</c:if> >${status.count}</a> </li> </c:if> </c:forEach> <li <c:if test="${!page.hasNext}">class="disabled"</c:if>> <a href="${pageContext.request.contextPath}/GuanServlet?method=searchzong&classzong=${classzong}&zhi=${zhi}&shen=${shen}&shen1=${shen1}&username=${username}&sway=${sway}&roleway=${roleway}&zongway=${zongway}&luo=${luo}&yeway=${yeway}&page.start=${page.start+page.count}"> <span>›</span> </a> </li> <li <c:if test="${!page.hasNext}">class="disabled"</c:if>> <a href="${pageContext.request.contextPath}/GuanServlet?method=searchzong&classzong=${classzong}&zhi=${zhi}&shen=${shen}&shen1=${shen1}&username=${username}&sway=${sway}&roleway=${roleway}&zongway=${zongway}&luo=${luo}&yeway=${yeway}&page.start=${page.last}"> <span>»</span> </a> </li> </ul> </nav> </body> <script type="text/javascript"> //综合查询框 $(".shu1").hide(); $(".shu2").hide(); $(".shu3").hide(); $(".shu4").hide(); $(".shu5").hide(); $(".shu6").hide(); $(".shu7").hide(); $(".shu8").hide(); $(".shu9").hide(); $(".shu10").hide(); $(".shu11").hide(); $(".shu12").hide(); var a=1; $(".ti").click(function () { if(a<13){ var s=".shu"+a; $(s).show(); a++; }else{ alert("不能在添加!"); } }); $(".ji").click(function () { var s=".shu"+a; $(s).hide(); a--; }); </script> </html>
效果:
三、本周总结
这周主要是完成统计查询模块,遇到了很多的问题。
页面间的传参问题,sql语句的拼接问题,页面的回显问题