• 【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(" "); for (int i=0; i<level; i++) { sbTreeHTML.append("<img src="../images/white.gif">"); sbTreeHTML.append(" "); } //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(" "); sbTreeHTML.append("<img id="im" + rs.getInt("id") + "" src="../images/closedfold.gif">"); sbTreeHTML.append(" "); sbTreeHTML.append("<a href="client_node_crud.jsp?id=" + rs.getInt("id") + "" target="clientDispAreaFrame">" + rs.getString("name") + "</a>"); sbTreeHTML.append(" "); sbTreeHTML.append("<div style="display:none;" id="div" + rs.getInt("id") + "">"); sbTreeHTML.append(" "); readClientTree(conn, rs.getInt("id"), level + 1); sbTreeHTML.append("</div>"); sbTreeHTML.append(" "); }else { sbTreeHTML.append("<img src="../images/minus.gif">"); sbTreeHTML.append(" "); sbTreeHTML.append("<img src="../images/openfold.gif">"); sbTreeHTML.append(" "); //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(" "); } sbTreeHTML.append("</div>"); sbTreeHTML.append(" "); } }finally { DbUtil.close(rs); DbUtil.close(pstmt); } }
  • 相关阅读:
    #2019090700004
    51nod 1191-贪心+并查集
    hdu 5015-矩阵快速幂
    树形DP—依赖背包模板
    HDU 1074—压缩DP
    动态绑定的开销
    动态绑定
    静态绑定(前期绑定)
    继承的一些优点
    多态置换原则初始化基类对象
  • 原文地址:https://www.cnblogs.com/yinweitao/p/5634862.html
Copyright © 2020-2023  润新知