<%--
  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" %>·
<%!
    Pub pub = new Pub();
    String p_id="";
    String menu_name="";
    public String getAllDeptName(ConnectionFactory cf,Connection conn,String menu_id){
        String sql="select p_id,menu_name from t_book_menu where id=? ";
        Vector list =cf.doQuery(conn,sql,null,
                new Object[]{menu_id});
        if(list!=null && list.size()>0){
            Hashtable ht=(Hashtable)list.get(0);
            p_id = pub.trimNull((String)ht.get("p_id"));
            menu_name = pub.trimNull((String)ht.get("menu_name"));
            return p_id+","+menu_name;
        }else{
            return "";
        }
    }
%>
<%
    ConnectionFactory cf_common = new ConnectionFactory();
    Connection conn_common = null;
    String menu_name="";
    try {
        conn_common = com.censoft.db.DBUtil.getConnection();
        String menu_id = request.getParameter("menu_id");
        String data=getAllDeptName(cf_common,conn_common,menu_id);
        String allDeptName="";
        while (true){
            if(data.length()>0){
                String DeptName = data.substring(data.indexOf(",")+1,data.length());
                if(!"".equals(allDeptName)){
                    allDeptName=DeptName+"<span class='c-gray en'>&gt;</span>"+allDeptName;
                }else{
                    allDeptName=DeptName;
                }
                menu_id=data.substring(0,data.indexOf(","));
                data=getAllDeptName(cf_common,conn_common,menu_id);
            }else{
                break;
            }
        }
        menu_name=allDeptName;
    } catch (Exception e) {
        out.println("查询信息异常" + e);
        return;
    } finally {
        if (conn_common != null) {
            try {
                conn_common.close();
            } catch (Exception e) {
            }
        }
    }
%>