<%--
  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" %>
<%
    ConnectionFactory cf = new ConnectionFactory();
    Pub pub = new Pub();
    Connection conn = null;
    Vector v_list = null;
    String page_number = pub.trimNull(request.getParameter("page_number"));
    String s_role_name = pub.trimNull(request.getParameter("s_role_name"));
    if ("".equals(page_number)) page_number = "1";
    String page_size = pub.trimNull(request.getParameter("page_size"));
    if ("".equals(page_size)) page_size = "10";
    try {
        conn = com.censoft.db.DBUtil.getConnection();
        String sql = "select * from t_book_role where role_name like ? order by add_time desc";
        v_list = cf.doPageQueryWithCount(conn, sql, page_number, page_size, null, new Object[]{"%"+s_role_name+"%"});
        if (v_list == null) {
            out.println("查询角色出错");
            return;
        }
    } catch (Exception e) {
        out.println("查询角色信息异常" + e);
        return;
    } finally {
        if (conn != null) {
            try {
                conn.close();
            } catch (Exception e) {
            }
        }
    }
    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"));
%>
<table class="table table-border table-bordered table-hover table-bg table-sort">
    <thead>
    <tr class="text-c">
        <th width="25">序号</th>
        <th width="150">角色名称</th>
        <th width="">备注</th>
        <th width="130">添加时间</th>
        <th width="250">操作</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 role_name = pub.trimNull((String) ht.get("role_name"));
                String login_id = pub.trimNull((String) ht.get("login_id"));
                String add_time = pub.trimNull((String) ht.get("add_time"));
                String status = pub.trimNull((String) ht.get("status"));
                String bz = pub.trimNull((String) ht.get("bz"));
                String id = pub.trimNull((String) ht.get("id"));
    %>
    <tr class="text-c">
        <td><%=i%>
        </td>
        <td><%=role_name%></td>
        <td><%=bz%></td>
        <td><%=add_time%>
        </td>
        <td class="td-manage">
            <a title="菜单授权" href="javascript:;" name="shouquan" onclick="member_role('<%=id%>')" class="ml-5"
               style="text-decoration:none"><i
                    class="Hui-iconfont">菜单/按钮授权</i></a>
            <a
                title="编辑" href="javascript:;" name="updatejs" onclick="member_edit('编辑','./role_add-t.jsp?action=toupdate&id=<%=id%>','800','','500')"
                class="layui-btn layui-btn-xs" style="text-decoration:none"><i class="Hui-iconfont">编辑</i></a>
            <a title="删除" name="deletejs" href="javascript:;" onclick="member_del(this,'<%=id%>')" class="ml-5"
               style="text-decoration:none"><i
                    class="Hui-iconfont">删除</i></a>
        </td>
    </tr>
    <%
            }
        }
    %>
    </tbody>
</table>
<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>