<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/9/11
  Time: 12:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.*" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="org.omg.CosCollection.IteratorInBetween" %>
<%!
    Pub pub = new Pub();
    public int getCounts(ConnectionFactory cf,Connection conn,String id){
        Vector list = cf.doQuery(conn,"select * from zc_register where zc_status='0' and reg_id=?",null,new Object[]{id});
        if(list==null){
            System.out.println("查询出错"+cf.getMsg());
        }
        return list.size();
    }
%>
<%
    ConnectionFactory cf = new ConnectionFactory();
    Pub pub = new Pub();
    Connection conn = null;
    Vector v_list = null;
    String page_number = pub.trimNull(request.getParameter("page_number"));
    if ("".equals(page_number)) page_number = "1";
    String page_size = pub.trimNull(request.getParameter("page_size"));
    String zc_name_s = pub.trimNull(request.getParameter("zc_name"));
    String wx_id_s = pub.trimNull(request.getParameter("wx_id"));
    String sb_user_s = pub.trimNull(request.getParameter("sb_user"));
    String wx_user_s = pub.trimNull(request.getParameter("wx_user"));
    String b_time = pub.trimNull(request.getParameter("b_time"));
    String e_time = pub.trimNull(request.getParameter("e_time"));
    if ("".equals(page_size)) page_size = "10";
    List list_s = new ArrayList();
    try {
        StringBuffer sb = new StringBuffer();
        sb.append("select t2.zc_id,zc_name,t1.wx_id,sb_user,wx_user,wx_time,t1.add_time from zc_wx t1 join zc_register t2 on t1.zc_id=t2.zc_id where 1=1 ");
        if(!"".equals(zc_name_s)){
            sb.append(" and t2.zc_name like ?");
            list_s.add("%"+zc_name_s+"%");
        }if(!"".equals(wx_id_s)){
            sb.append(" and t1.wx_id like ?");
            list_s.add("%"+wx_id_s+"%");
        }if(!"".equals(sb_user_s)){
            sb.append(" and t1.sb_user like ?");
            list_s.add("%"+sb_user_s+"%");
        }if(!"".equals(wx_user_s)){
            sb.append(" and t1.wx_user like ?");
            list_s.add("%"+wx_user_s+"%");
        }if(!"".equals(b_time)){
            sb.append(" and t1.wx_time >= ?");
            list_s.add(b_time);
        }if(!"".equals(e_time)){
            sb.append(" and t1.wx_time <= ?");
            list_s.add(e_time);
        }
        sb.append(" order by t1.add_time desc");
        conn = com.censoft.db.DBUtil.getConnection();
        v_list = cf.doPageQueryWithCount(conn, sb.toString(), page_number, page_size, null, list_s.toArray());
        if (v_list == null) {
            out.println("查询出错" + cf.getMsg());
            return;
        }

        Hashtable ht_row = (Hashtable) v_list.get(0);
        String rowCnt = pub.trimNull((String) ht_row.get("ROWCOUNT"));
        String pageCnt = pub.trimNull((String) ht_row.get("PAGECOUNT"));
        String telSegmentUrl="./list_add-t.jsp";
%>
<div class="table-list">
    <table class="table  table-hover table-bg">
        <thead>
        <tr class="text-c">
            <th width="50px">维修编号</th>
            <th width="50px">资产名称</th>
            <th width="50px">申报人</th>
            <th width="50px">维修人</th>
            <th width="50px">维修时间</th>
            <th width="50px">操作</th>
        </tr>
        </thead>
        <tbody>
        <%
            if (v_list != null && v_list.size() > 0) {
                for (int i = 1; i < v_list.size(); i++) {
                    Hashtable ht = (Hashtable) v_list.get(i);
                    String wx_id = pub.trimNull((String) ht.get("wx_id"));
                    String zc_name = pub.trimNull((String) ht.get("zc_name"));
                    String sb_user = pub.trimNull((String) ht.get("sb_user"));
                    String wx_user = pub.trimNull((String) ht.get("wx_user"));
                    String wx_time = pub.trimNull((String) ht.get("wx_time"));
        %>
        <tr <%if(i%2==0){%>id="tr_doub"<%}else{%>id="tr_single"<%}%> class="text-c">
            <td><%=wx_id%>
            </td>
            <td><%=zc_name%>
            </td>
            <td><%=sb_user%>
            </td>
            <td><%=wx_user%>
            </td>
            <td><%=wx_time%>
            </td>
            <td>
                <a title="详情" href="javascript:void(0);" onclick="updateById('详情','./info-t.jsp?update_id=<%=wx_id%>');" class="ml-5" >
                    <i class="Hui-iconfont">详情</i>
                </a>
            </td>
        </tr>
        <%
                }
            }
        %>
        </tbody>
    </table>
</div>
<jsp:include page="/common/page_ajax.jsp" >
    <jsp:param name="page_number" value="<%=page_number%>" />
    <jsp:param name="rowCnt" value="<%=rowCnt%>" />
    <jsp:param name="page_size" value="<%=page_size%>" />
</jsp:include>
<%
    } catch (Exception e) {
        out.println("查询异常" + e);
        return;
    } finally {
        if (conn != null) {
            try {
                conn.close();
            } catch (Exception e) {
            }
        }
    }
%>