- Rongsen.Com.Cn 版权所有 2008-2010 京ICP备08007000号 京公海网安备11010802026356号 朝阳网安编号:110105199号
- 北京黑客防线网安工作室-黑客防线网安服务器维护基地为您提供专业的
服务器维护
,企业网站维护
,网站维护
服务 - (建议采用1024×768分辨率,以达到最佳视觉效果) Powered by 黑客防线网安 ©2009-2010 www.rongsen.com.cn
作者:黑客防线网安SQL维护基地 来源:黑客防线网安SQL维护基地 浏览次数:0 |
文由网友whl供稿,特此感谢!
/**
* Desc: 取栏目树 ,过滤用户权限和无效栏目
* Author: WHL
* Date: 2009-05-31 15:17
*/
/** 1. 取某用户有权限(np_cms_column_security表有记录且t.action_1 = ‘1′)的栏目的树 **/
01.createorreplaceviewV_NP_CTREE_BSas
02.selectB.*from(
03.selectA.*, lag(A.column_id) over(partitionbyA.column_idorderby0 ) RK
04. from(select/*+choose */
05. t.*
06. fromnp_cms_column t
07. wheret.is_active ='1'
08. connectbypriort.column_id = t.parent_id
09. startwitht.column_idin(selectt.column_id
10. fromnp_cms_column_security t
11. wheret.subject_id ='mazj'
12. /*这里添加角色过滤*/
13. andt.action_1 ='1'))A) B
14. wherenotexists
15. (select0
16. from(selectdistinctd.column_id
17. fromnp_cms_column d
18. connectbypriord.column_id = d.parent_id
19. startwithd.column_idin
20. (selectt.column_id
21. fromnp_cms_column_security t
22. wheret.subject_id ='mazj'
23. /* 这里添加角色过滤*/
24. andt.action_1 ='0'
25. /* 排除有权限树下的非授权ID,既 Action_1=0的*/
26. andexists
27. (select0
28. from(selectdistinctd.column_id
29. fromnp_cms_column d
30. connectbypriord.column_id =
31. d.parent_id
32. startwithd.column_idin
33. (selectt.column_id
34. fromnp_cms_column_security t
35. wheret.subject_id =
36. 'mazj'
37. /*这里添加角色过滤*/
38. andt.action_1 ='1')) C1
39. whereC1.column_id = t.column_id))
40. andd.is_active ='1') C
41. whereC.column_id = B.column_idandB.RKisnull)andB.RKisnull
42.unionall
43.selectc.*, 0 RKfromnp_cms_column cwherec.parent_id = 0;
————————————————————————
/** 2.得到栏目的虚拟父亲ID(考虑到把断层的节点接起来)**/
01.createorreplaceviewV_NP_CTREE_PAas
02.selectB.*,
03. (caseB.column_id
04. when1then0elsenvl(B.father, 1)end) VFA
05. from(selectv.*,
06. (selectvv.column_id
07. fromV_NP_CTREE_BS vv
08. wherevv.column_id = v.parent_id) FATHER
09. fromV_NP_CTREE_BS v) B;
————————————————————————
/** 3. 取出门户需要的栏目树 **/
1.--create or replace view V_NP_CTREE_RS as
2.select
3. D.*, LPAD(' ', 2 *level- 1) || SYS_CONNECT_BY_PATH(D.COLUMN_NAME,'/') "Path"
4. from(selectc.*
5. fromV_NP_CTREE_PA c
6. orderbyc.VFA, c.disorderdesc, c.column_iddesc) D
7.connectbypriorD.column_id = D.VFA
8. startwithD.column_id = 1;
我要申请本站:N点 | 黑客防线官网 | |
专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479 |