CN113190550B - Organization structure authority distribution method based on tree structure - Google Patents

Organization structure authority distribution method based on tree structure Download PDF

Info

Publication number
CN113190550B
CN113190550B CN202110346156.5A CN202110346156A CN113190550B CN 113190550 B CN113190550 B CN 113190550B CN 202110346156 A CN202110346156 A CN 202110346156A CN 113190550 B CN113190550 B CN 113190550B
Authority
CN
China
Prior art keywords
organization
treenote
node
authority
nodes
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110346156.5A
Other languages
Chinese (zh)
Other versions
CN113190550A (en
Inventor
孙豪
梁琦
任建琴
王超
江淋
王平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhengzhou Xinda Jiean Information Technology Co Ltd
Original Assignee
Zhengzhou Xinda Jiean Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengzhou Xinda Jiean Information Technology Co Ltd filed Critical Zhengzhou Xinda Jiean Information Technology Co Ltd
Priority to CN202110346156.5A priority Critical patent/CN113190550B/en
Publication of CN113190550A publication Critical patent/CN113190550A/en
Application granted granted Critical
Publication of CN113190550B publication Critical patent/CN113190550B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2246Trees, e.g. B+trees
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides an organization structure authority distribution method based on a tree structure, which comprises the following steps: determining a class structure of an organization structure tree and acquiring class structure information of all organization nodes; traversing the class structure information of all the organization nodes and putting the class structure information into a treeNoteHashMap; during the process, whether the organization node has the authority is judged according to the Hash authority value in the class structure of each organization node, whether the father node exists is inquired in the treeNoteHashMap based on the father node, and if the father node does not exist, the organization node is added into the NoParentdataHashMap at the same time; sequentially traversing all organization nodes in the NoParentdataHashMap, and inquiring in the treeNoteHashMap to obtain corresponding father nodes based on father nodes in the class structure of each organization node; and forming an organizational structure tree diagram based on the treeNoteHashMap.

Description

Organization structure authority distribution method based on tree structure
Technical Field
The invention relates to the field of authority management and control, in particular to an organization structure authority distribution method based on a tree structure.
Background
With the rapid development of internet technology, the requirements for rapidly changing personnel permissions, interactively displaying permissions and storing permission data are higher and higher, but the original permission system cannot meet the increasing business in efficiency. The invention solves the problem that the execution efficiency is improved by combining different storage structures, different storage media and different query modes so as to meet the increased business requirements.
Disclosure of Invention
In order to solve the above problem, it is necessary to provide an organization structure authority assignment method based on a tree structure.
The invention provides a method for distributing organizational structure authority based on a tree structure, which comprises the following steps:
step 1, determining a class structure Treenote of an organization structure tree, wherein the class structure Treenote comprises an ID (identity), a Hash authority value, a parent node parentID and child node sets childrenroots, and acquiring class structure Treenote information of all organization nodes;
step 2, sequentially traversing the Treenote information of the class structures of all the organization nodes, and putting each organization node into a treeNoteHashMap; in the traversal process, whether authority exists is judged according to hash authority values in class structures Treenote of all organization nodes, when class structure Treenote information of a certain organization node is polled, whether a father node exists is inquired in a treeNoteHashMap based on parentID of the father node, and if the father node does not exist, the organization node is added into a noparentadaHashMap at the same time;
step 3, sequentially traversing all organization nodes in the nonparentadatahashmap, and inquiring in the treentheshmap to obtain a corresponding father node based on the parentID of the father node in the class structure Treenote of each organization node in the traversing process;
and 4, forming an organization structure tree diagram based on the treeNoteHashMap.
Further, the step 2 specifically includes:
step 2-1, summarizing Treenote information of all organization nodes into treeNoteList;
step 2-2, traversing the treeNoteList, obtaining a first treeNote, and putting the first treeNote into a treeNoteHashMap;
step 2-3, judging whether the id of the first treeNote is 0, if so, setting the TreeRoot as a root node, and returning to the step 2-2; if not, entering the step 2-4;
step 2-4, acquiring parent node parentID of the first treeNote, acquiring a corresponding parent node in the treeNoteHashMap according to the parentID, judging whether the authority set contains the organization node or not based on HashAuthority value in the first treeNote, if yes, changing the HashAuthority from initial value false to true, otherwise, keeping the initial value false unchanged;
step 2-5, judging whether the corresponding father node is successfully acquired, if so, entering step 2-6, and if not, entering step 2-7;
step 2-6, acquiring child node sets child nodes in parent nodes parentnoties, adding the first treeNote into the child node sets child nodes, and then polling the next treeNote;
step 2-7, put the first treeNote into NoParentdataHashMap, then poll the next treeNote.
Further, the step 3 specifically includes:
step 3-1, judging whether the noparentadatahashmap is empty, if so, directly ending, and if not, entering step 3-2;
and 3-2, acquiring a first treeNote in the NoParentdataHashMap, inquiring in the treeNoteHashMap according to the parentID of the parent node of the first treeNote to obtain a corresponding parent node, adding the first treeNote into child nodes of the parent node, and then polling the next treeNote.
Further, step 1 specifically includes:
adding a node set PersonNotes field in the class structure Treenote, and adding a personnel authority table, wherein the personnel authority table comprises a plurality of PersonNotes, and each PersonNote at least comprises ID, name, hashAuthority and personId.
Further, after the step 4, the method further includes:
judging whether the user of the personnel authority list personnatuhList under the corresponding organization node has authority, setting the authority value with the authority as true, and setting the authority value without the authority as false;
putting the personnel nodes into the node sets Personnotes of the corresponding organization nodes, and assembling the Personnotes into PersonNotemap based on the node sets Personnotes of all the organization nodes;
and adding personnel rights in the original organization structure tree diagram based on PersonNotemap.
In the best case, all the organization authorities and the organization node sequences can be perfected only by circulating the total number of the organization information once, and even in the worst case, all the organization authorities and the organization node sequences can be perfected by circulating the total number of the organization information twice at most. The search parent-level organization of one level is carried out in a traditional recursion cycle mode, the tree diagram of the organization structure can be quickly established, and the efficiency of authority distribution of the organization structure is effectively improved.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 illustrates a storage structure diagram of an organization node of the present invention.
FIG. 2 illustrates a structural tree diagram of various organizational nodes of the present invention.
FIG. 3 illustrates a class structure diagram of the modified organizational structure tree of the present invention.
FIG. 4 shows a flow diagram of a first traversal cycle of the present invention.
FIG. 5 illustrates a flow chart of a second traversal cycle of the present invention.
FIG. 6 illustrates an organizational tree with organizational node authority identification according to the present invention.
FIG. 7 illustrates another type of structure diagram and PersonNote field structure diagram of the organizational structure tree of the present invention.
Fig. 8 shows a flow chart of the invention for assembling PersonNoteMap.
FIG. 9 illustrates a structural tree diagram with organization nodes and personnel authority identification in accordance with the present invention.
Detailed Description
In order that the above objects, features and advantages of the present invention can be more clearly understood, a more particular description of the invention will be rendered by reference to the appended drawings. It should be noted that the embodiments and features of the embodiments of the present application may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, however, the present invention may be practiced in other ways than those specifically described herein, and therefore the scope of the present invention is not limited by the specific embodiments disclosed below.
The invention adopts the model of RBAC1 in BRAC authority design, and adds parent field to express its parent relation in organization, and aims to realize high speed and high efficiency by increasing necessary space expenditure. The physical storage adopts a mainstream relational database, and the required storage structure is shown in fig. 1.
The organization table is a core and records information of each organization, and the authority of each organization is different when people are under different organizations. The organization table itself can be converted into an organization structure tree, but the tree only has a child-parent relationship and lacks in sequence, so that the attribute corresponding to the setting cannot be quickly searched by using a search method in the tree. The tree is shown in figure 2.
The original processing method is to use recursive loop to search parent organization in one level, that is, to search from child to parent, which results in multiple child organizations repeatedly acquiring a same organization path, such as a-C1 and a-C2, which may affect performance and thus overall response time. Recursive nested loops are avoided to improve performance. The class structure of the organizational structure tree is first modified as shown in FIG. 3.
Adding a List < TreeNote > type attribute childrenNotes to store the child node set of the current node, wherein the hashAuthority is defaulted to false and is set to true when the privilege exists, and the situation that a child has the privilege and a parent does not have the privilege is that the whole tree needs to be displayed.
At this time, the search sequence becomes a child as long as finding its parent level by one level, even if its parent level is not found in one loop, then in the next set uninitiammap loop where the parent level is not found for the second time, all the rest of the tree is completed. Before initializing the tree, all organization information is taken, the organization to which the login user belongs, the organization Map, the uninitialized organization Map and the root treetroot of the returning object TreeNote class are registered.
The storage mode of the treeNoteHashMap is treeNoteHashMap < id, treeNote >, the storage mode of the NoParentdataHashMap is NoParentdataHashMap < id, treeNote >, namely, the corresponding relation between id and treeNote is established, and when the id is known, the corresponding treeNote can be inquired on the treeNoteHashMap or the NoParentdataHashMap.
The invention provides an organization structure authority distribution method based on a tree structure, which comprises the following steps:
step 1, determining a class structure Treenote of an organization structure tree, wherein the class structure Treenote comprises an ID (identity), a Hash authority value, a parent node parentID and child node sets childrenroots, and acquiring class structure Treenote information of all organization nodes;
step 2, sequentially traversing the Treenote information of the class structures of all the organization nodes, and putting each organization node into a treeNoteHashMap; in the traversal process, whether authority exists is judged according to hash authority values in class structures Treenote of all organization nodes, when class structure Treenote information of a certain organization node is polled, whether a father node exists is inquired in a treeNoteHashMap based on parentID of the father node, and if the father node does not exist, the organization node is added into a noparentadaHashMap at the same time;
step 3, sequentially traversing all organization nodes in the nonparentadatahashmap, and inquiring in the treentheshmap to obtain a corresponding father node based on the parentID of the father node in the class structure Treenote of each organization node in the traversing process;
and 4, forming an organization structure tree diagram based on the treeNoteHashMap.
As shown in fig. 4, the step 2 specifically includes:
sequentially traversing the Treenote information of the class structures of all the organization nodes, and putting all the organization nodes into a treeNoteHashMap; in the traversal process, whether authority exists is judged according to hash authority values in class structures Treenote of all organization nodes, when class structure Treenote information of a certain organization node is polled, whether a father node exists is inquired in a treeNoteHashMap based on parentID of the father node, and if the father node does not exist, the organization node is added into a noparentadaHashMap at the same time;
step 2-1, summarizing Treenote information of all organization nodes into treeNoteList;
step 2-2, traversing the treeNoteList, obtaining a first treeNote, and putting the first treeNote into a treeNoteHashMap;
step 2-3, judging whether the id of the first treeNote is 0, if so, setting the TreeRoot as a root node, and returning to the step 2-2; if not, entering the step 2-4;
step 2-4, acquiring parent node parentID of the first treeNote, acquiring a corresponding parent node in the treeNoteHashMap according to the parentID, judging whether the authority set contains the organization node or not based on HashAuthority value in the first treeNote, if yes, changing the HashAuthority from initial value false to true, otherwise, keeping the initial value false unchanged;
step 2-5, judging whether the corresponding father node is successfully acquired, if so, entering step 2-6, and if not, entering step 2-7;
step 2-6, acquiring child node sets child nodes in parent nodes parentnoties, adding the first treeNote into the child node sets child nodes, and then polling the next treeNote;
step 2-7, put the first treeNote into NoParentdataHashMap, then poll the next treeNote.
Further, the step 3 specifically includes:
step 3-1, judging whether the noparentadatahashmap is empty, if so, directly ending, and if not, entering step 3-2;
and 3-2, acquiring a first treeNote in the NoParentdataHashMap, inquiring in the treeNoteHashMap according to the parentID of the parent node of the first treeNote to obtain a corresponding parent node, adding the first treeNote into child nodes of the parent node, and then polling the next treeNote.
It can be understood that the treeNoteList is traversed for the first time, the noparentadataHashMap is traversed for the second time in a circulating manner, whether the noparentadataHashMap is empty or not needs to be judged, and the non-arbontaTaHashMap does not need to be traversed if the noparentadataHashMap is empty; if the node is not empty, acquiring a first treeNote from the noparentadahhMap, and acquiring a parent node parenNote from the treeNoteHahMap according to the parentId. The flow chart of the second cycle is shown in fig. 5.
It can be understood that, for the treeNoteHashMap and the nopentdataHashMap, in fact, when the treeNoteList is traversed for the first time, all organization nodes are sequentially added into the treeNoteHashMap, and in the traversing process of subsequent organization nodes, if a parent node can be found from the treeNoteHashMap, the current organization node is added into the child node of the parent node, and if the parent node cannot be found in the treeNoteHashMap, it is indicated that the corresponding parent node is not yet polled, that is, the parent node is not in the treeNoteHashMap, the organization node can be added into the nopentdataHashMap, so as to facilitate the subsequent second traversal.
Fig. 6 shows an organization structure tree diagram after the above flow conversion.
Further, step 1 specifically includes:
adding a node set PersonNotes field in the class structure Treenote, and adding a personnel authority table, wherein the personnel authority table comprises a plurality of PersonNotes, and each PersonNote at least comprises ID, name, hashAuthority and personId.
Further, after the step 4, the method further includes:
judging whether the user of the personnel authority list personnatuhList under the corresponding organization node has authority, setting the authority value with the authority as true, and setting the authority value without the authority as false;
putting the personnel nodes into the node sets Personnotes of the corresponding organization nodes, and assembling the Personnotes into PersonNotemap based on the node sets Personnotes of all the organization nodes;
and adding personnel rights in the original organization structure tree diagram based on PersonNotemap.
It is understood that if the management authority for different persons under the organization is to be added, one person authority table and PersonNotes field need to be added. As shown in fig. 7.
At this time, only one external loop needs to be added to assemble PersonNoteMap < key, PersonNote >, key is orgId, value is note which is packaged, and the flow shown in fig. 8 is added in the TreeNote authority loop.
The setting of the authority of the organization subordinate personnel can be completed as shown in fig. 9.
Through the mode, all the organization authorities and the organization node sequences can be perfected only by circulating the total number of the organization information once under the best condition, and even under the worst condition, all the organization authorities and the organization node sequences can be perfected by circulating the total number of the organization information twice at most. The search parent-level organization of one level is carried out in a traditional recursion cycle mode, the tree diagram of the organization structure can be quickly established, and the efficiency of authority distribution of the organization structure is effectively improved.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (1)

1. A method for assigning organizational structure authority based on tree structure is characterized in that the method comprises the following steps:
step 1, determining a class structure Treenote of an organization structure tree, wherein the class structure Treenote comprises an ID (identity), a Hash authority value, a parent node parentID and child node sets childrenroots, and acquiring class structure Treenote information of all organization nodes;
step 2, sequentially traversing the Treenote information of the class structures of all the organization nodes, and putting each organization node into a treeNoteHashMap; in the traversal process, whether authority exists is judged according to hash authority values in class structures Treenote of all organization nodes, when class structure Treenote information of a certain organization node is polled, whether a father node exists is inquired in a treeNoteHashMap based on parentID of the father node, and if the father node does not exist, the organization node is added into a noparentadaHashMap at the same time;
step 3, sequentially traversing all organization nodes in the nonparentadatahashmap, and inquiring in the treentheshmap to obtain a corresponding father node based on the parentID of the father node in the class structure Treenote of each organization node in the traversing process;
step 4, forming an organization structure tree diagram based on the treeNoteHashMap;
the step 2 specifically includes:
step 2-1, summarizing Treenote information of all organization nodes into treeNoteList;
step 2-2, traversing the treeNoteList, obtaining a first treeNote, and putting the first treeNote into a treeNoteHashMap;
step 2-3, judging whether the id of the first treeNote is 0, if so, setting the TreeRoot as a root node, and returning to the step 2-2; if not, entering the step 2-4;
step 2-4, acquiring parent node parentID of the first treeNote, acquiring a corresponding parent node in the treeNoteHashMap according to the parentID, judging whether the authority set contains the organization node or not based on HashAuthority value in the first treeNote, if yes, changing the HashAuthority from initial value false to true, otherwise, keeping the initial value false unchanged;
step 2-5, judging whether the corresponding father node is successfully acquired, if so, entering step 2-6, and if not, entering step 2-7;
step 2-6, acquiring child node sets child nodes in parent nodes parentnoties, adding the first treeNote into the child node sets child nodes, and then polling the next treeNote;
step 2-7, putting the first treeNote into the NoParentdataHashMap, and then polling the next treeNote;
the step 3 specifically includes:
step 3-1, judging whether the noparentadatahashmap is empty, if so, directly ending, and if not, entering step 3-2;
step 3-2, acquiring a first treeNote in the NoParentdataHashMap, inquiring in the treeNoteHashMap according to the parentID of the parent node of the first treeNote to obtain a corresponding parent node, adding the first treeNote into child nodes of the parent node, and then polling the next treeNote;
the step 1 specifically further includes:
adding a node set PersonNotes field in a class structure Treenote, and adding a personnel authority table, wherein the personnel authority table comprises a plurality of PersonNotes, and each PersonNote at least comprises ID, name, hashAuthority and personId;
after the step 4, the method further includes:
judging whether the user of the personnel authority list personnatuhList under the corresponding organization node has authority, setting the authority value with the authority as true, and setting the authority value without the authority as false;
putting the personnel nodes into the node sets Personnotes of the corresponding organization nodes, and assembling the Personnotes into PersonNotemap based on the node sets Personnotes of all the organization nodes;
and adding personnel rights in the original organization structure tree diagram based on PersonNotemap.
CN202110346156.5A 2021-03-31 2021-03-31 Organization structure authority distribution method based on tree structure Active CN113190550B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110346156.5A CN113190550B (en) 2021-03-31 2021-03-31 Organization structure authority distribution method based on tree structure

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110346156.5A CN113190550B (en) 2021-03-31 2021-03-31 Organization structure authority distribution method based on tree structure

Publications (2)

Publication Number Publication Date
CN113190550A CN113190550A (en) 2021-07-30
CN113190550B true CN113190550B (en) 2022-03-22

Family

ID=76974575

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110346156.5A Active CN113190550B (en) 2021-03-31 2021-03-31 Organization structure authority distribution method based on tree structure

Country Status (1)

Country Link
CN (1) CN113190550B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101093524A (en) * 2006-06-22 2007-12-26 上海新纳广告传媒有限公司 Authorization process system based on hierarchy
CN102402652A (en) * 2010-09-16 2012-04-04 金蝶软件(中国)有限公司 Method, system and terminal for controlling authority
CN106599218A (en) * 2016-12-16 2017-04-26 北京奇虎科技有限公司 Tree structure processing method and device
WO2019000979A1 (en) * 2017-06-30 2019-01-03 华为技术有限公司 File system access rights configuration method and device
CN109460410A (en) * 2018-11-08 2019-03-12 四川长虹电器股份有限公司 By the json data conversion with set membership at the method for tree structure data

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101093524A (en) * 2006-06-22 2007-12-26 上海新纳广告传媒有限公司 Authorization process system based on hierarchy
CN102402652A (en) * 2010-09-16 2012-04-04 金蝶软件(中国)有限公司 Method, system and terminal for controlling authority
CN106599218A (en) * 2016-12-16 2017-04-26 北京奇虎科技有限公司 Tree structure processing method and device
WO2019000979A1 (en) * 2017-06-30 2019-01-03 华为技术有限公司 File system access rights configuration method and device
CN109460410A (en) * 2018-11-08 2019-03-12 四川长虹电器股份有限公司 By the json data conversion with set membership at the method for tree structure data

Also Published As

Publication number Publication date
CN113190550A (en) 2021-07-30

Similar Documents

Publication Publication Date Title
CN102270232B (en) Semantic data query system with optimized storage
US20090125530A1 (en) Hierarchy Nodes Derived Based on Parent/Child Foreign Key and/or Range Values on Parent Node
CN107247778A (en) System and method for implementing expansible data storage service
CN102129539A (en) Data resource authority management method based on access control list
US20100312785A1 (en) Servicing query with access path security in relational database management system
CN113254451B (en) Data index construction method and device, electronic equipment and storage medium
CN104182435A (en) System and method for searching information based on data missing mark
CN107870949A (en) Data analysis job dependence relation generation method and system
CA2461871A1 (en) An efficient index structure to access hierarchical data in a relational database system
CN115329504A (en) BOM construction method based on complex product structure
CN106777111B (en) Time sequence retrieval index system and method for super-large scale data
CN114168591A (en) Method for searching tree structure data path node
CN110134511A (en) A kind of shared storage optimization method of OpenTSDB
CN116821139B (en) Mixed load method and system for partition table design based on distributed database
CN113190550B (en) Organization structure authority distribution method based on tree structure
US20060004812A1 (en) Method and system for mapping datasources in a metadata model
CN112540987A (en) Big data management system of distribution and utilization electricity based on data mart
CN107276833A (en) A kind of node information management method and device
US12026162B2 (en) Data query method and apparatus, computing device, and storage medium
CN116821359A (en) Knowledge graph-based scene resource relation construction method and device
CN113778991B (en) Method for realizing resource access control of big data
CN117743316A (en) Data processing method and device, storage medium and electronic equipment
CN115270419A (en) Twin method, subscription method and system for real-time event current state
CN114721582A (en) Information sharing method and device and related equipment
CN111339245B (en) Data storage method, device, storage medium and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant