<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Vector" %>

<%
    ConnectionFactory cf = new ConnectionFactory();
    Pub pub = new Pub();
    Connection conn = null;
    Vector v_list = null;
    String json = "";
    StringBuffer sql = new StringBuffer();
    List list = new ArrayList();
    try {
        conn = com.censoft.db.DBUtil.getConnection();
        sql.append("select id,p_id as pid,zd_name as name,zd_order from zc_zd ");
        sql.append(" order by zd_order asc");
        v_list = cf.doQuery(conn, sql.toString(), null, list.toArray());
        if (v_list == null) {
            out.println("查询用户出错");
            return;
        }
        if(v_list != null && v_list.size() > 0){
            json = JSONArray.toJSON(v_list).toString();
        }
    } catch (Exception e) {
        out.println("查询用户信息异常" + e);
        return;
    } finally {
        if (conn != null) {
            try {
                conn.close();
            } catch (Exception e) {
            }
        }
    }
    response.setContentType("application/json;charset=utf-8");
    response.getWriter().write(json.replace("pid","pId"));
%>