国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
使用dTree生成部門目錄樹

在action中使用sql按目錄的方式查詢出部門記錄,其中包括部門名稱,部門ID,部門父ID。頂頭的記錄的部門父ID必須為-1,查詢語句如:
select dept_id,dept_name,parent_id from info_dept connect by prior dept_id = parent_id start with dept_id=?

把獲得的list記錄set到request中,在頁面中顯示出來。
頁面代碼如下:

< link  href ="<%=request.getContextPath()%>/gdnumweb/css/dtree.css"  rel ="stylesheet"  type ="text/css" >
< body >
< script  type ="text/javascript"  src ="<%=request.getContextPath()%>/gdnumweb/js/dtree.js" ></ script >

< div  class ="dtree" >
< p >< href ="javascript: tree.openAll();" > 展開所有 </ a >  |  < href ="javascript: tree.closeAll();" > 關閉所有 </ a ></ p >
< script  language ="javascript"  type ="text/javascript" >
tree 
=   new  dTree(‘tree‘);
< logic:iterate id = " dept "  name = " list " >
  tree.add(
" <bean:write name= " dept "  property= " dept_id " /> " , " <bean:write name= " dept "  property= " parent_id " /> " , " <bean:write name= " dept "  property= " dept_name " /> " ,‘ <%= path %>/ gdnumUserDept. do ? method = getDeptUserInfo & deptNo =< bean:write name = " dept "  property = " dept_id " /> ‘,‘‘,‘mainframe‘);
</ logic:iterate >
document.write(tree);
</ script >

在組合框中輸出樹形目錄
獲取列表的java方法
//提取當前用戶的部門下拉
  public List getSourceDept(String deptNo) {
    List list 
= null;
    Connection con 
= CommonUtils.currentSession().connection();
    ResultSet rs 
= null;
    ResultSetMetaData rsmd 
= null;
    java.sql.PreparedStatement ps 
= null;
    String sql 
= "select deptno,(tools.buildTree(level)||deptname) deptname from sys_dept "
        
+ "connect by parent_deptno=prior deptno "
        
+ "start with deptno=?";
    HashMap map 
= null;
    
try {
      ps 
= con.prepareStatement(sql);
      ps.setString(
1, deptNo);
      rs 
= ps.executeQuery();
      
//System.out.println("rs.size:" + rs.getFetchSize());
      rsmd = rs.getMetaData();
      list 
= new ArrayList();
      
while (rs.next()) {
        map 
= new HashMap();
        
for (int i = 1; i <= rsmd.getColumnCount(); i++) {
          map.put(rsmd.getColumnName(i).toLowerCase(), rs.getString(i));
        }
        list.add(map);
      }
      rs.close();
    }
    
catch (Exception ex) {
      log.error(
"提取當前用戶的部門下拉出錯com.unicom.gzmas.reports.bo.getSourceDept:" + ex);
    }
    
finally {
      CommonUtils.closeSession();
    }
    
return list;
  }

頁面輸出的代碼
    <select id="mbackdept"> <!-- 部門 -->
          
<option value="all">-----全部----</option>
          
<logic:iterate id="l" name="target">
          
<option value="<bean:write name="l" property="deptno"/>"><bean:write name="l" property="deptname"/></option>
          
</logic:iterate>
    
</select>
構造樹的存儲過程
  /*構造樹*/
    
Function Buildtree(In_Level In NumberReturn Varchar2 As
        Result 
Varchar2(4000);
    
Begin
        
If In_Level = 1 Then
            
Return Null;
        
End If;
        
Return | || Incstring(‘-­, (In_Level - 1* 2);
    
End;
本站僅提供存儲服務,所有內容均由用戶發(fā)布,如發(fā)現有害或侵權內容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
PLSQL循序漸進全面學習教程(全)
表的復雜查詢 --多表的查詢
ORACLE數據庫習題
jdbc關聯模型查詢-多表查詢返回結果集
mysql練習(含答案)
ORACLE 統計各個部門 工資級別為小于2000,2000
更多類似文章 >>
生活服務
分享 收藏 導長圖 關注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點擊這里聯系客服!

聯系客服