欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

权限管理--权限资源管理

程序员文章站 2022-04-26 13:30:55
...

一:界面展示

1:主界面

主界面时用的easyUi的treeGrid进行展示的

权限管理--权限资源管理
2:新增界面

权限管理--权限资源管理
3:修改界面

权限管理--权限资源管理

二:难点解析

1:treeGrid 的数据展示
treegrid 的疏解格式有两种格式

(1)基本的数据类型
[{  
    "id":1,  
    "name":"C",  
    "size":"",  
    "date":"02/19/2010",  
    "children":[{  
        "id":2,  
        "name":"Program Files",  
        "size":"120 MB",  
        "date":"03/20/2010",  
        "children":[{  
            "id":21,  
            "name":"Java",  
            "size":"",  
            "date":"01/13/2010",  
            "state":"closed",  
            "children":[{  
                "id":211,  
                "name":"java.exe",  
                "size":"142 KB",  
                "date":"01/13/2010"  
            },{  
                "id":212,  
                "name":"jawt.dll",  
                "size":"5 KB",  
                "date":"01/13/2010"  
            }]  
        },{  
            "id":22,  
            "name":"MySQL",  
            "size":"",  
            "date":"01/13/2010",  
            "state":"closed",  
            "children":[{  
                "id":221,  
                "name":"my.ini",  
                "size":"10 KB",  
                "date":"02/26/2009"  
            },{  
                "id":222,  
                "name":"my-huge.ini",  
                "size":"5 KB",  
                "date":"02/26/2009"  
            },{  
                "id":223,  
                "name":"my-large.ini",  
                "size":"5 KB",  
                "date":"02/26/2009"  
            }]  
        }]  
    },{  
        "id":3,  
        "name":"eclipse",  
        "size":"",  
        "date":"01/20/2010",  
        "children":[{  
            "id":31,  
            "name":"eclipse.exe",  
            "size":"56 KB",  
            "date":"05/19/2009"  
        },{  
            "id":32,  
            "name":"eclipse.ini",  
            "size":"1 KB",  
            "date":"04/20/2010"  
        },{  
            "id":33,  
            "name":"notice.html",  
            "size":"7 KB",  
            "date":"03/17/2005"  
        }]  
    }]  
}]  

(2)简单的数据类型

{"total":7,"rows":[  
    {"id":1,"name":"All Tasks","begin":"3/4/2010","end":"3/20/2010","progress":60,"iconCls":"icon-ok"},  
    {"id":2,"name":"Designing","begin":"3/4/2010","end":"3/10/2010","progress":100,"_parentId":1,"state":"closed"},  
    {"id":21,"name":"Database","persons":2,"begin":"3/4/2010","end":"3/6/2010","progress":100,"_parentId":2},  
    {"id":22,"name":"UML","persons":1,"begin":"3/7/2010","end":"3/8/2010","progress":100,"_parentId":2},  
    {"id":23,"name":"Export Document","persons":1,"begin":"3/9/2010","end":"3/10/2010","progress":100,"_parentId":2},  
    {"id":3,"name":"Coding","persons":2,"begin":"3/11/2010","end":"3/18/2010","progress":80},  
    {"id":4,"name":"Testing","persons":1,"begin":"3/19/2010","end":"3/20/2010","progress":20}  
],"footer":[  
    {"name":"Total Persons:","persons":7,"iconCls":"icon-sum"}  
]}  

基本的数据类型的话和之前加载tree组件的数据类型是一样的,在此就不在多说。
简单的数据类型的有一个小的坑么就是上级父节点的关键字必须为“_parentId”,把握住这一点,结合下面的一篇文章就能够轻轻松松解决。
2:删除时根据父节点时删除其下所有关联节点 ---connect by prior 递归算法 
当用户删除权限时,需要把其下的所有权限都删掉。倘若父级权限不存在,再多的下级权限也变的无意义。
sql如下
delete from sys_res_info
 where res_id in (SELECT res_id
                    FROM sys_res_info
                  CONNECT BY PRIOR res_id = res_parent_id
                   start WITH res_id = #{resId})