DRP-动态拼接数
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DRP-动态拼接数相关的知识,希望对你有一定的参考价值。
/** * 递归读取分销商树 * * 第四步: 采用div生成树形结构 * @param conn * @param id * @param level 控制层次 */ private void readClientTree(Connection conn, int id, int level) throws SQLException { String sql = "select * from t_client where pid=?"; PreparedStatement pstmt = null; ResultSet rs = null; try { pstmt = conn.prepareStatement(sql); pstmt.setInt(1, id); rs = pstmt.executeQuery(); while (rs.next()) { sbTreehtml.append("<div>"); sbTreeHTML.append("\\n"); for (int i=0; i<level; i++) { sbTreeHTML.append("<img src=\\"../images/white.gif\\">"); sbTreeHTML.append("\\n"); } //if ("N".equals(rs.getString("is_leaf"))) { if (Constants.NO.equals(rs.getString("is_leaf"))) { sbTreeHTML.append("<img alt=\\"展开\\" style=\\"cursor:hand;\\" onClick=\\"display(‘" + rs.getInt("id") + "‘);\\" id=\\"img" + rs.getInt("id") + "\\" src=\\"../images/plus.gif\\">"); sbTreeHTML.append("\\n"); sbTreeHTML.append("<img id=\\"im" + rs.getInt("id") + "\\" src=\\"../images/closedfold.gif\\">"); sbTreeHTML.append("\\n"); sbTreeHTML.append("<a href=\\"client_node_crud.jsp?id=" + rs.getInt("id") + "\\" target=\\"clientDispAreaFrame\\">" + rs.getString("name") + "</a>"); sbTreeHTML.append("\\n"); sbTreeHTML.append("<div style=\\"display:none;\\" id=\\"div" + rs.getInt("id") + "\\">"); sbTreeHTML.append("\\n"); readClientTree(conn, rs.getInt("id"), level + 1); sbTreeHTML.append("</div>"); sbTreeHTML.append("\\n"); }else { sbTreeHTML.append("<img src=\\"../images/minus.gif\\">"); sbTreeHTML.append("\\n"); sbTreeHTML.append("<img src=\\"../images/openfold.gif\\">"); sbTreeHTML.append("\\n"); //if ("Y1".equals(rs.getString("is_client"))) { if (Constants.YES.equals(rs.getString("is_client"))) { sbTreeHTML.append("<a href=\\"client_crud.jsp?id=" + rs.getInt("id") + "\\" target=\\"clientDispAreaFrame\\">" + rs.getString("name") + "</a>"); }else { sbTreeHTML.append("<a href=\\"client_node_crud.jsp?id=" + rs.getInt("id") + "\\" target=\\"clientDispAreaFrame\\">" + rs.getString("name") + "</a>"); } sbTreeHTML.append("\\n"); } sbTreeHTML.append("</div>"); sbTreeHTML.append("\\n"); } }finally { DbUtil.close(rs); DbUtil.close(pstmt); } }
以上是关于DRP-动态拼接数的主要内容,如果未能解决你的问题,请参考以下文章