• 软件需求---河北省重大需求进度报告06


    今日完成任务

    统计审核写完

    明日完成任务

    分页查询和修改回写

    完成任务截图

    首页

    输入条件

    结果

    输入条件



    统计审核页面

    <%@ page language="java" contentType="text/html; charset=UTF-8"
             pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet">
    
    <script src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js"></script>
    <script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/js/echarts.js"></script>
    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="UTF-8">
        <title>角色管理</title>
        <style>
            td{
                text-align: center;
            }
            #table{
                font-size: 18px;
                font-family: 楷体;
                font-weight: bold;
            }
            .btn-success{
                font-size: 18px;
            }
        </style>
        <script type="text/javascript">
            if (${not empty message}){
                alert("${message}");
            }
    
            function showEcharts(value) {
                if (value=="0"){
                    return;
                }
                $.ajax({
                   url:"${pageContext.request.contextPath}/tjcx/tjtb?value="+value,
                    method:"post",
                    async:true,
                    error:function () {
                        alert("数据请求失败");
                    },
                    success:function (data) {
                       var mydata = new Array(0);
                       for (let i=0;i<data.length;i++){
                           if (data[i]['name']==undefined||data[i]['name']==null||data[i]['name']==""){
                               continue;
                           }
                           if(data[i]['value']==0){
                               continue;
                           }
                           var temp = {};
                           temp['name'] = data[i]['name'];
                           temp['value'] = data[i]['value'];
                           mydata.push(temp);
                       }
                       var option = {
                           //标题
                            title:{
                                text:"饼状图统计数据"
                            },
                           // 鼠标悬停显示数据
                           tooltip:{
                           },
                           //图例
                           legend:{
                                data:data['name']
                           },
                           // 数据
                           series:[
                               {
                                   radius:'55%', //半径
                                   center:['50%','50%'],//圆心位置
                                   data:mydata,
                                   type:'pie',
                                   //南丁格尔图
                                   roseType:'radius'
                               }
                           ]
                       };
                       var myChars = echarts.init(document.getElementById("myCharts"));
                       myChars.setOption(option);
                    },
                    dataType:"json"
                });
    
            }
        </script>
    </head>
    <body>
    <div class="container-fluid">
        <div class="row-fluid">
            <div class="span12">
                <div class="tabbable" id="tabs-451449">
                    <ul class="nav nav-tabs">
                        <li class="active">
                            <a href="#panel-169507" data-toggle="tab">分类检索</a>
                        </li>
                        <li>
                            <a href="#panel-638310" data-toggle="tab">综合检索</a>
                        </li>
                        <li>
                            <a href="#panel-125765" data-toggle="tab">统计图表</a>
                        </li>
                    </ul>
                    <div class="tab-content">
                        <%--分类检索--%>
                        <div class="tab-pane active" id="panel-169507">
                            <form action="${pageContext.request.contextPath}/tjcx/fljs" method="post">
                                <div class="row-fluid">
                                    <div class="span12">
                                        <h4 align="left" >分类检索条件
                                            <select id="jstj" class="form-control" style="height: 40px;display: inline;200px;" name="jstj">
                                                <option value ="0">--请选择--</option>
                                                <option value="o.name">机构全称</option>
                                                <option value="GKGLBM">归口管理单位</option>
                                                <option value="re.name">所在地域</option>
                                                <option value="legal">法人代表</option>
                                                <option value="contact">联系人</option>
                                                <option value="ty.name">机构属性</option>
                                                <option value="name">技术需求名称</option>
                                                <option value="keyWord">关键字</option>
                                                <option value="total">拟投入资金总额</option>
                                                <option value="c.name">技术需求解决方式</option>
                                                <option value="r.name">科技活动类型</option>
                                                <option value="subject">学科分类</option>
                                                <option value="field">需求技术所属领域</option>
                                                <option value="classification">需求技术应用行业</option>
                                                <option value="GLBM">管理处室</option>
                                            </select>
                                            <input type="text" class="form-control" name="value" id="value" style="250px;height: 40px;display: inline">
                                        </h4>
                                        <h4>
                                            检索要求
                                            <select id="jsyq" class="form-control" style=" 200px;height: 40px;display: inline" name="jsyq" onchange="getPermission(this.options[this.options.selectedIndex].value)" >
                                                <option value ="0">模糊查询</option>
                                                <option value="1">精确查询</option>
                                            </select>
    
                                            形式审核通过
                                            <select id="XSSHTG" class="form-control" style=" 200px;height: 40px;display: inline" name="XSSHTG" onchange="getPermission(this.options[this.options.selectedIndex].value)" >
                                                <option value ="0">否</option>
                                                <option value="1">是</option>
                                            </select>
    
                                            部门审核通过
                                            <select id="BMSHTG" class="form-control" style=" 200px;height: 40px;display: inline" name="BMSHTG" onchange="getPermission(this.options[this.options.selectedIndex].value)" >
                                                <option value ="0">否</option>
                                                <option value="1">是</option>
                                            </select>
    
                                            <input type="submit" class="btn btn-success" style=" 200px;height:30px;position: relative;left: 100px" value="查询" onclick="foo()">
                                        </h4>
                                    </div>
                                </div>
                            </form>
    
                                <div class="row-fluid">
                                    <div class="span12">
                                        <table class="table table-bordered table-hover">
                                            <thead>
                                            <tr>
                                                <th>需求名称</th>
                                                <th>学科分类</th>
                                                <th>归口管理单位</th>
                                                <th>机构全称</th>
                                                <th>机构属性</th>
                                                <th>法人代表</th>
                                                <th>联系人</th>
                                                <th>所在地域</th>
                                                <th>科技活动类型</th>
                                                <th>拟投入资金总额</th>
                                                <th>管理处室</th>
                                                <th>操作</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <c:forEach var="m" items="${map}">
                                                <tr>
                                                    <td>${m['name']}</td>
                                                    <td>${m['subject']}</td>
                                                    <td>${m['GKGLBM']}</td>
                                                    <td>${m['orgName']}</td>
                                                    <td>${m['type']}</td>
                                                    <td>${m['legal']}</td>
                                                    <td>${m['contact']}</td>
                                                    <td>${m['diyu']}</td>
                                                    <td>${m['research']}</td>
                                                    <td>${m['total']}</td>
                                                    <td>
                                                        <c:if test="${m['GLBM']!=0}">
                                                            ${management[m['GLBM']-1].name}
                                                        </c:if>
                                                        <c:if test="${empty m['GLBM']||m['GLBM']==0}">
                                                            无
                                                        </c:if>
                                                    </td>
                                                    <td><a href="${pageContext.request.contextPath}/company/findTechnologyById?id=${m['id']}"><button class="btn btn-success">查看</button></a></td>
                                                </tr>
                                            </c:forEach>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                        </div>
                        <%--综合检索--%>
                        <div class="tab-pane" id="panel-638310">
                            <form action="${pageContext.request.contextPath}/tjcx/zhjs" method="post">
                                <div class="row-fluid">
                                    <div class="span12">
                                        <table id="searchTable" style="border-collapse: separate;border-spacing: 12px 12px">
                                            <tr>
                                                <td>
                                                    <div class="div_operate" style=" 250px">
                                                        <input type="button" class="btn btn-warning" style=" 120px;height: 35px" onclick="addRow()" value="添加检索条件">
                                                        <input type="button" class="btn btn-warning" style=" 120px;height: 35px" onclick="delRow()" value="删除检索条件">
                                                    </div>
                                                    <div class="div_relation" style="display:none;140px ">
                                                        <select name="relation" class="form-control" style=" 200px;display: inline">
                                                            <option value="and">并且</option>
                                                            <option value="or">或者</option>
                                                            <option value="not like">不含</option>
                                                        </select>
                                                    </div>
    
                                                </td>
                                                <td>
                                                    <h4>综合检索条件</h4>
                                                </td>
                                                <td>
                                                    <select class="form-control" style="height: 40px;display: inline;200px;" name="zhjs">
                                                        <option value="o.name">机构全称</option>
                                                        <option value="GKGLBM">归口管理单位</option>
                                                        <option value="re.name">所在地域</option>
                                                        <option value="legal">法人代表</option>
                                                        <option value="contact">联系人</option>
                                                        <option value="ty.name">机构属性</option>
                                                        <option value="name">技术需求名称</option>
                                                        <option value="keyWord">关键字</option>
                                                        <option value="total">拟投入资金总额</option>
                                                        <option value="c.name">技术需求解决方式</option>
                                                        <option value="r.name">科技活动类型</option>
                                                        <option value="subject">学科分类</option>
                                                        <option value="field">需求技术所属领域</option>
                                                        <option value="classification">需求技术应用行业</option>
                                                        <option value="GLBM">管理处室</option>
                                                    </select>
                                                </td>
                                                <td>
                                                    <input type="text" class="form-control" name="zhyqz" style="250px;height: 40px;display: inline">
                                                </td>
                                                <td>
                                                    <select id="cxyq" class="form-control" style=" 200px;height: 40px;display: inline" name="cxyq" onchange="getPermission(this.options[this.options.selectedIndex].value)" >
                                                        <option value ="like">模糊查询</option>
                                                        <option value ="=">精确查询</option>
                                                    </select>
                                                </td>
                                            </tr>
                                        </table>
                                        <h4>
                                            形式审核通过
                                            <select id="XSSHTG1" class="form-control" style=" 200px;height: 40px;display: inline" name="XSSHTG1">
                                                <option value ="0">否</option>
                                                <option value="1">是</option>
                                            </select>
                                            部门审核通过
                                            <select id="BMSHTG1" class="form-control" style=" 200px;height: 40px;display: inline" name="BMSHTG1" >
                                                <option value ="0">否</option>
                                                <option value="1">是</option>
                                            </select>
                                            <input type="submit" class="btn btn-success" style=" 200px;height:30px;position: relative;left: 100px" value="查询">
                                        </h4>
                                    </div>
                                </div>
                            </form>
    
                            <div class="row-fluid">
                                <div class="span12">
                                    <table class="table table-bordered table-hover">
                                        <thead>
                                        <tr>
                                            <th>需求名称</th>
                                            <th>学科分类</th>
                                            <th>归口管理单位</th>
                                            <th>机构全称</th>
                                            <th>机构属性</th>
                                            <th>法人代表</th>
                                            <th>联系人</th>
                                            <th>所在地域</th>
                                            <th>科技活动类型</th>
                                            <th>拟投入资金总额</th>
                                            <th>管理处室</th>
                                            <th>操作</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <c:forEach var="m" items="${map2}">
                                            <tr>
                                                <td>${m['name']}</td>
                                                <td>${m['subject']}</td>
                                                <td>${m['GKGLBM']}</td>
                                                <td>${m['orgName']}</td>
                                                <td>${m['type']}</td>
                                                <td>${m['legal']}</td>
                                                <td>${m['contact']}</td>
                                                <td>${m['diyu']}</td>
                                                <td>${m['research']}</td>
                                                <td>${m['total']}</td>
                                                <td>
                                                    <c:if test="${m['GLBM']!=0}">
                                                        ${management[m['GLBM']-1].name}
                                                    </c:if>
                                                    <c:if test="${empty m['GLBM']||m['GLBM']==0}">
                                                        无
                                                    </c:if>
                                                </td>
                                                <td><a href="${pageContext.request.contextPath}/company/findTechnologyById?id=${m['id']}"><button class="btn btn-success">查看</button></a></td>
                                            </tr>
                                        </c:forEach>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <%--统计图表--%>
                        <div class="tab-pane" id="panel-125765">
                            <div class="row-fluid">
                                <div class="span12">
                                    <div class="TJTB">
                                        <select class="form-control" style=" 250px;height: 40px" onchange="showEcharts(this.options[this.options.selectedIndex].value)">
                                            <option value ="0">--请选择--</option>
                                            <option value="GKGLBM">归口管理单位</option>
                                            <option value="re.name">所在地域</option>
                                            <option value="c.name">技术需求解决方式</option>
                                            <option value="r.name">科技活动类型</option>
                                            <option value="subject">学科分类</option>
                                            <option value="field">需求技术所属领域</option>
                                            <option value="classification">需求技术应用行业</option>
                                            <option value="m.name">管理处室</option>
                                        </select>
                                    </div>
                                    <div id="myCharts" style=" 100%;height: 600px;">
    
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </body>
    <script type="text/javascript">
        var table_row = 1;
        //添加一行
        function addRow() {
            if(table_row>15){
                alert("条件已满");
                return;
            }
            var firstRow = document.getElementById("searchTable").rows[0];  //获取table第一行
            var cloneRow = firstRow.cloneNode(firstRow);  // 讲table第一行复制到cloneRow
    
            cloneRow.getElementsByClassName("div_operate")[0].style.display="none"; //设置为不可见
            cloneRow.getElementsByClassName("div_relation")[0].style.display="inline";// 设置为可见
    
            document.getElementById("searchTable").appendChild(cloneRow); // 添加到table
    
            table_row++;
        }
        // 删除一行
        function delRow() {
            if(table_row<=1){
                alert("最少拥有一个条件")
                return;
            }
            document.getElementById("searchTable").deleteRow(table_row-1); // 删除table最后一行
            table_row--;
        }
    </script>
    </html>
    

    统计审核三个servlet

    分类检索

    package xiao.Servlet.tjcx;
    
    import com.google.gson.Gson;
    import xiao.bean.Field;
    import xiao.bean.Management;
    import xiao.dao.dao;
    
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.IOException;
    import java.util.*;
    
    @WebServlet("/tjcx/fljs")
    public class FLJSServlet extends HttpServlet {
        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            response.setCharacterEncoding("UTF-8");
            response.setHeader("content-type", "text/html; charset=utf-8");
            response.setContentType("text/html;charset=utf-8");
            request.setCharacterEncoding("UTF-8");
            String jstj = request.getParameter("jstj");
            String value = request.getParameter("value");
            Integer jsyq = Integer.parseInt(request.getParameter("jsyq"));
            Integer xsshtg = Integer.parseInt(request.getParameter("XSSHTG"));
            Integer bmshtg = Integer.parseInt(request.getParameter("BMSHTG"));
            List<Map<String,Object>> mapList = new ArrayList<>();
            if (jstj.equals("field")){
                List<Integer> list = dao.findLikeField(value);
                String v ="";
                for (Integer integer : list) {
                    v += integer+" ";
                }
                mapList = dao.fljs(jstj,v,jsyq,xsshtg,bmshtg);
            }else if (jstj.equals("0")){
                mapList  = dao.findAllTechnologyWithTJCX();
            }else {
                mapList = dao.fljs(jstj,value,jsyq,xsshtg,bmshtg);
                System.out.println(mapList.size());
            }
            List<Management> allManagement = dao.findAllManagement();
            request.setAttribute("management",allManagement);
            request.setAttribute("map",mapList);
            request.getRequestDispatcher("tjcx.jsp").forward(request,response);
        }
    
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            doPost(request,response);
        }
    }
    

    统计图表

    package xiao.Servlet.tjcx;
    
    import com.google.gson.Gson;
    import xiao.bean.Field;
    import xiao.bean.Management;
    import xiao.dao.dao;
    
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.IOException;
    import java.util.*;
    
    @WebServlet("/tjcx/tjtb")
    public class TJTBServlet extends HttpServlet {
        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            response.setCharacterEncoding("UTF-8");
            response.setHeader("content-type", "text/html; charset=utf-8");
            response.setContentType("text/html;charset=utf-8");
            request.setCharacterEncoding("UTF-8");
            String value = request.getParameter("value");
            List<Map<String,Object>> maps = new ArrayList<>();
            if (value.equals("field")){
                // 获得所有领域且初始化位0
                maps = dao.initField();
                List<String> list = dao.tjcxField();
                for (String s : list) {
                    String[] temp = s.split(" ");
                    for (String s1 : temp) {
                        if (s1==null||s1.equals("")){
                            continue;
                        }
                        Integer num = Integer.parseInt(maps.get(Integer.parseInt(s1)).get("value").toString());
                        maps.get(Integer.parseInt(s1)).put("value",num+1);
                    }
                }
            }else {
                maps = dao.tjtb(value);
            }
            Gson gson = new Gson();
            String s = gson.toJson(maps);
            response.getWriter().write(s);
    
        }
    
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            doPost(request,response);
        }
    }
    

    综合检索

    package xiao.Servlet.tjcx;
    
    import xiao.bean.Management;
    import xiao.dao.dao;
    
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.Map;
    
    @WebServlet("/tjcx/zhjs")
    public class ZHJSServlet extends HttpServlet {
        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            response.setCharacterEncoding("UTF-8");
            response.setHeader("content-type", "text/html; charset=utf-8");
            response.setContentType("text/html;charset=utf-8");
            request.setCharacterEncoding("UTF-8");
            //检索条件
            String[] zhjs = request.getParameterValues("zhjs");
            // 检索值
            String[] value = request.getParameterValues("zhyqz");
            // 模糊还是精确
            String[] symbol = request.getParameterValues("cxyq");
            // 并且、或、不包含
            String[] relations = request.getParameterValues("relation");
            List<Map<String,Object>> mapList = new ArrayList<>();
            Integer xsshtg = Integer.parseInt(request.getParameter("XSSHTG1"));
            Integer bmshtg = Integer.parseInt(request.getParameter("BMSHTG1"));
            String sql = "select t.name,subject,GKGLBM,o.name,ty.name,legal,contact,re.name,r.name,total,GLBM,t.id from technology t join type ty on t.type = ty.id join organization o on t.compId = o.id join coomode c on t.coomode = c.id join research r on t.research = r.id join region re on t.diyu = re.id where (XSSHTG = ? and BMSHTG = ?) and (1 =1 ";
            for (int i=0;i<relations.length;i++){
                //如果某一个输入框的值位空,则不要这一行
                if(value[i].equals("")||value[i]==null){
                    continue;
                }
                String searchValue = value[i];
                if (symbol[i].equals("like")){
                    //%%是对%的转义,%s是站位任意字符串
                    searchValue = String.format("%%%s%%", value[i]);
                }
                //使用String.format将关系、字段、符号、值拼接起来,可读性比+好更多
                //根据关系是否为not like,调换一下拼接顺序
                if (relations[i].equals("not like")){
                    sql += String.format("%s %s %s '%s' ", "and", zhjs[i], relations[i], searchValue);
                }else {
                    sql += String.format("%s %s %s '%s' ", relations[i], zhjs[i], symbol[i], searchValue);
                }
            }
            sql +=")";
            System.out.println(sql);
            mapList = dao.zhjs(sql,xsshtg,bmshtg);
            List<Management> allManagement = dao.findAllManagement();
            request.setAttribute("management",allManagement);
            request.setAttribute("map2",mapList);
            request.getRequestDispatcher("tjcx.jsp").forward(request,response);
        }
    
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            doPost(request,response);
        }
    }
    

    dao层代码

    //分类检索
        public static List<Map<String, Object>> fljs(String jstj, String value,Integer jsyq, Integer xsshtg, Integer bmshtg) {
            Connection conn = null;
            PreparedStatement ps = null;
            ResultSet rs = null;
            List<Map<String, Object>> results = new ArrayList<>();
            try {
                conn = JDBC.getConnection();
                String sql = "select t.name,subject,GKGLBM,o.name,ty.name,legal,contact,re.name,r.name,total,GLBM,t.id from technology t join type ty on t.type = ty.id join organization o on t.compId = o.id join coomode c on t.coomode = c.id join research r on t.research = r.id join region re on t.diyu = re.id where 1 = 1";
                // 模糊查询
                if (jsyq==0) {
                    sql += " and "+jstj+" like ? and XSSHTG = ? and BMSHTG = ?";
                    ps = conn.prepareStatement(sql);
                    String v = "";
                    for (int i=0;i<value.length();i++){
                        v += "%"+value.substring(i,i+1);
                    }
                    ps.setString(1,v+"%");
                    ps.setInt(2,xsshtg);
                    ps.setInt(3,bmshtg);
                }else {
                    sql += " and "+jstj+" = ? and XSSHTG = ? and BMSHTG = ?";
                    ps = conn.prepareStatement(sql);
                    ps.setString(1,value);
                    ps.setInt(2,xsshtg);
                    ps.setInt(3,bmshtg);
                }
                rs = ps.executeQuery();
                while (rs.next()){
                        Map<String,Object> map = new HashMap<String, Object>();
                        map.put("name",rs.getString(1));
                        map.put("subject",rs.getString(2));
                        map.put("GKGLBM",rs.getString(3));
                        map.put("orgName",rs.getString(4));
                        map.put("type",rs.getString(5));
                        map.put("legal",rs.getString(6));
                        map.put("contact",rs.getString(7));
                        map.put("diyu",rs.getString(8));
                        map.put("research",rs.getString(9));
                        map.put("total",rs.getDouble(10));
                        map.put("GLBM",rs.getInt(11));
                        map.put("id",rs.getInt(12));
                        results.add(map);
                }
                return  results;
            } catch (SQLException ex) {
                ex.printStackTrace();
            }finally {
                JDBC.release(conn,ps,rs);
            }
            return null;
        }
        // 模糊查询领域
        public static List<Integer> findLikeField(String value) {
            Connection conn = null;
            PreparedStatement ps = null;
            ResultSet rs = null;
            List<Integer> results = new ArrayList<>();
            try {
                conn = JDBC.getConnection();
                String sql = "select id from field where name like ?";
                ps = conn.prepareStatement(sql);
                String v = "";
                for (int i=0;i<value.length();i++){
                    v += "%"+value.substring(i,i+1);
                }
                ps.setString(1,v+"%");
                rs = ps.executeQuery();
                while (rs.next()){
                   results.add(rs.getInt(1));
                }
                return results;
            } catch (SQLException e) {
                e.printStackTrace();
            }finally {
                JDBC.release(conn,ps,rs);
            }
            return null;
        }
    
        // 综合检索
        public static List<Map<String, Object>> zhjs(String sql,Integer XSSHTG,Integer BMSHTG) {
            Connection conn = null;
            PreparedStatement ps = null;
            ResultSet rs = null;
            List<Map<String, Object>> results = new ArrayList<>();
            try {
                conn = JDBC.getConnection();
                ps = conn.prepareStatement(sql);
                ps.setInt(1,XSSHTG);
                ps.setInt(2,BMSHTG);
                rs = ps.executeQuery();
                while (rs.next()){
                    Map<String,Object> map = new HashMap<String, Object>();
                    map.put("name",rs.getString(1));
                    map.put("subject",rs.getString(2));
                    map.put("GKGLBM",rs.getString(3));
                    map.put("orgName",rs.getString(4));
                    map.put("type",rs.getString(5));
                    map.put("legal",rs.getString(6));
                    map.put("contact",rs.getString(7));
                    map.put("diyu",rs.getString(8));
                    map.put("research",rs.getString(9));
                    map.put("total",rs.getDouble(10));
                    map.put("GLBM",rs.getInt(11));
                    map.put("id",rs.getInt(12));
                    results.add(map);
                }
                return  results;
            } catch (SQLException ex) {
                ex.printStackTrace();
            }finally {
                JDBC.release(conn,ps,rs);
            }
            return null;
        }
    
        // 综合检索查询所有
        public static List<Map<String, Object>> findAllTechnologyWithTJCX() {
            Connection conn = null;
            PreparedStatement ps = null;
            ResultSet rs = null;
            List<Map<String, Object>> results = new ArrayList<>();
            try {
                conn = JDBC.getConnection();
                String sql = "select t.name,subject,GKGLBM,o.name,ty.name,legal,contact,re.name,r.name,total,GLBM,t.id from technology t join type ty on t.type = ty.id join organization o on t.compId = o.id join coomode c on t.coomode = c.id join research r on t.research = r.id join region re on t.diyu = re.id";
                ps = conn.prepareStatement(sql);
                rs = ps.executeQuery();
                while (rs.next()){
                    Map<String,Object> map = new HashMap<String, Object>();
                    map.put("name",rs.getString(1));
                    map.put("subject",rs.getString(2));
                    map.put("GKGLBM",rs.getString(3));
                    map.put("orgName",rs.getString(4));
                    map.put("type",rs.getString(5));
                    map.put("legal",rs.getString(6));
                    map.put("contact",rs.getString(7));
                    map.put("diyu",rs.getString(8));
                    map.put("research",rs.getString(9));
                    map.put("total",rs.getDouble(10));
                    map.put("GLBM",rs.getInt(11));
                    map.put("id",rs.getInt(12));
                    results.add(map);
                }
                return  results;
            } catch (SQLException ex) {
                ex.printStackTrace();
            }finally {
                JDBC.release(conn,ps,rs);
            }
            return null;
        }
        //统计图表
        public static List<Map<String, Object>> tjtb(String value) {
            Connection conn = null;
            PreparedStatement ps = null;
            ResultSet rs = null;
            List<Map<String, Object>> results = new ArrayList<>();
            try {
                conn = JDBC.getConnection();
                String sql = "select "+value+" as name,count("+value+") as num from technology t join type ty on t.type = ty.id join organization o on t.compId = o.id join coomode c on t.coomode = c.id join research r on t.research = r.id join region re on t.diyu = re.id join management m on t.GLBM = m.id where state = 5 group by "+value;
                ps = conn.prepareStatement(sql);
                rs = ps.executeQuery();
                while (rs.next()){
                    Map<String,Object> map = new HashMap<String, Object>();
                    map.put("name",rs.getString(1));
                    map.put("value",rs.getInt(2));
                    results.add(map);
                }
                return  results;
            } catch (SQLException ex) {
                ex.printStackTrace();
            }finally {
                JDBC.release(conn,ps,rs);
            }
            return null;
        }
        // 获得所有领域且初始化他们的数据量为0
        public static List<Map<String,Object>> initField() {
            Connection conn = null;
            PreparedStatement ps = null;
            ResultSet rs = null;
            List<Map<String, Object>> results = new ArrayList<>();
            try {
                conn = JDBC.getConnection();
                String sql = "select name from field";
                ps = conn.prepareStatement(sql);
                rs = ps.executeQuery();
                while (rs.next()){
                    Map<String,Object> map = new HashMap<String, Object>();
                    map.put("name",rs.getString(1));
                    map.put("value",0);
                    results.add(map);
                }
                return  results;
            } catch (SQLException ex) {
                ex.printStackTrace();
            }finally {
                JDBC.release(conn,ps,rs);
            }
            return null;
        }
        // 获得需求中所有领域
        public static List<String> tjcxField() {
            Connection conn = null;
            PreparedStatement ps = null;
            ResultSet rs = null;
            List<String> results = new ArrayList<>();
            try {
                conn = JDBC.getConnection();
                String sql = "select field from technology where state = 5";
                ps = conn.prepareStatement(sql);
                rs = ps.executeQuery();
                while (rs.next()){
                    results.add(rs.getString(1));
                }
                return  results;
            } catch (SQLException ex) {
                ex.printStackTrace();
            }finally {
                JDBC.release(conn,ps,rs);
            }
            return null;
        }
    
  • 相关阅读:
    leetcode算法题基础(三十三)动态规划(一)70. 爬楼梯
    leetcode算法题基础(三十二)trie(四)676. 实现一个魔法字典
    leetcode算法题基础(三十一)trie(三)692. 前K个高频单词
    leetcode算法题基础(三十)trie(二)720. 词典中最长的单词
    leetcode算法题基础(二十九)trie(一)211. 添加与搜索单词
    leetcode算法题基础(二十八)拓扑排序(二)210. 课程表 II
    leetcode算法题基础(二十七)拓扑排序(一)207. 课程表
    leetcode算法题基础(二十六)深度优先(四)721. 账户合并
    leetcode算法题基础(二十五)深度优先(三)200. 岛屿数量
    leetcode算法题基础(二十四)深度优先(二)101. 对称二叉树
  • 原文地址:https://www.cnblogs.com/yangxiao-/p/13875758.html
Copyright © 2020-2023  润新知