<%--
  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 pinpai_s = pub.trimNull(request.getParameter("pinpai"));
    String zc_id_s = pub.trimNull(request.getParameter("zc_id"));
    String old_ly_user_s = pub.trimNull(request.getParameter("old_ly_user"));
    String new_ly_user_s = pub.trimNull(request.getParameter("new_ly_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 t1.zc_id,zc_name,pinpai,gg_type,t1.bg_id,old_ly_user,new_ly_user,bg_time,t1.add_time from zc_bg 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(pinpai_s)){
            sb.append(" and t2.pinpai like ?");
            list_s.add("%"+pinpai_s+"%");
        }if(!"".equals(zc_id_s)){
            sb.append(" and t2.zc_id like ?");
            list_s.add("%"+zc_id_s+"%");
        }if(!"".equals(old_ly_user_s)){
            sb.append(" and t1.old_ly_user like ?");
            list_s.add("%"+old_ly_user_s+"%");
        }if(!"".equals(new_ly_user_s)){
            sb.append(" and t1.new_ly_user like ?");
            list_s.add("%"+new_ly_user_s+"%");
        }if(!"".equals(b_time)){
            sb.append(" and t1.bg_time >= ?");
            list_s.add(b_time);
        }if(!"".equals(e_time)){
            sb.append(" and t1.bg_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>
            <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 bg_id = pub.trimNull((String) ht.get("bg_id"));
                    String zc_id = pub.trimNull((String) ht.get("zc_id"));
                    String zc_name = pub.trimNull((String) ht.get("zc_name"));
                    String gg_type = pub.trimNull((String) ht.get("gg_type"));
                    String pinpai = pub.trimNull((String) ht.get("pinpai"));
                    String old_ly_user = pub.trimNull((String) ht.get("old_ly_user"));
                    String new_ly_user = pub.trimNull((String) ht.get("new_ly_user"));
                    String bg_time = pub.trimNull((String) ht.get("bg_time"));
        %>
        <tr <%if(i%2==0){%>id="tr_doub"<%}else{%>id="tr_single"<%}%> class="text-c">
            <td><%=zc_id%>
            </td>
            <td><%=zc_name%>
            </td>
            <td><%=gg_type%>
            </td>
            <td><%=pinpai%>
            </td>
            <td><%=old_ly_user%>
            </td>
            <td><%=new_ly_user%>
            </td>
            <td><%=bg_time%>
            </td>
            <td>
                <a title="详情" href="javascript:void(0);" onclick="updateById('<%=bg_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) {
            }
        }
    }
%>