Method, electronic device, and readable storage medium for generating an organizational structure tree
By building an organizational relationship dictionary and using it to quickly match department information and employee information, the problem of inefficient data acquisition when generating organizational structure trees in the existing technology is solved, and the ability to quickly generate organizational structure trees is realized.
Patent Information
- Application Number
- CN202210617475.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-01
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2042-06-01
AI Technical Summary
When generating an organizational structure tree, the existing technology needs to traverse the database to obtain departmental information and employee information, resulting in low data acquisition efficiency and inability to quickly generate organizational structure tree.
By building an organizational relationship dictionary, including the first department relationship dictionary and the first department employee relationship dictionary, using department numbers and employee numbers as keys, quickly match and store department information and employee information into an alternative structure tree.
No need to traverse the database to determine the node child node information in the alternative structure tree, which significantly improves data acquisition efficiency and realizes the ability to quickly generate organizational structure trees.
Smart Images

Figure CN114996272B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information retrieval technology, and for example, relates to a method, an electronic device, and a readable storage medium for generating an organizational structure tree. Background Art
[0002] In order to enable employees to more intuitively understand the enterprise organizational structure, it is necessary to obtain the organizational structure tree of the enterprise. The existing method for generating the organizational structure tree is to store the department information corresponding to the preset department number in the database as the root node in the alternative organizational structure tree. Then, using the department numbers corresponding to the nodes in the alternative organizational structure tree, all department information in the database is traversed. When the department number of the department to which the department information in the database belongs is the same as the department number corresponding to the node, the department information with the department number of the department to which the department belongs being the department number corresponding to the node is stored as the child node of the node in the alternative organizational structure tree. At the same time, using the department numbers corresponding to the nodes in the alternative organizational structure tree, all employee information in the database also needs to be traversed. When the department number of the employee to which the employee information in the database belongs is the same as the department number corresponding to the node, the employee information with the department number of the employee to which the employee belongs being the department number corresponding to the node is stored as the child node of the node in the alternative organizational structure tree. Until all department information and employee information in the database have been stored in the alternative structure tree, the organizational structure tree of the enterprise is obtained.
[0003] In the process of implementing the embodiments of the present disclosure, it is found that there are at least the following problems in the related art:
[0004] In this way, for each determination of the child nodes under a node, it is necessary to traverse the database to obtain the corresponding department information and / or employee information. In this case, the larger the amount of data stored in the database, the longer the time required for recursive traversal, and the lower the efficiency of data acquisition, thus making it impossible to quickly generate the organizational structure tree. Summary of the Invention
[0005] To provide a basic understanding of some aspects of the disclosed embodiments, a simple summary is given below. This summary is not a comprehensive review, nor is it intended to identify key / important constituent elements or delineate the protection scope of these embodiments. Instead, it serves as a preamble to the subsequent detailed description.
[0006] The embodiments of the present disclosure provide a method, an electronic device, and a readable storage medium for generating an organizational structure tree, so as to be able to quickly generate the organizational structure tree.
[0007] In some embodiments, the method for generating an organizational structure tree includes: obtaining department information and employee information of an enterprise from a preset database; constructing an organizational relationship dictionary by using the department information and employee information of the enterprise; the organizational relationship dictionary includes a first department relationship dictionary and a first department-employee relationship dictionary; the first department relationship dictionary stores data with the number of a second department as the key and the set of department information of the first department corresponding to the second department as the value, and the first department-employee relationship dictionary stores data with the number of a third department as the key and the set of employee information of the employees corresponding to the third department as the value; in response to an instruction to generate an organizational structure tree, storing the second department or the third department corresponding to a preset number in the organizational relationship dictionary as the root node into an alternative structure tree; performing a child node determination operation on the nodes in the alternative structure tree until there is no value corresponding to the number of the department corresponding to the last-level node in the alternative structure tree in the first department relationship dictionary and the first department-employee relationship dictionary, thereby obtaining an organizational structure tree.
[0008] In some embodiments, the electronic device includes a processor and a memory storing program instructions, and the processor is configured to execute the above method for generating an organizational structure tree when running the program instructions.
[0009] In some embodiments, the readable storage medium stores executable instructions, and the executable instructions execute the above method for generating an organizational structure tree when running.
[0010] The method, device, electronic device, and readable storage medium for generating an organizational structure tree provided by the embodiments of the present disclosure can achieve the following technical effects: By using the pre-constructed organizational relationship dictionary to construct the organizational structure tree, since the organizational relationship dictionary stores data with the number of a second department as the key and the set of department information of the first department corresponding to the second department as the value, and data with the number of a third department as the key and the set of employee information of the employees corresponding to the third department as the value. In this way, when generating the organizational structure tree, the number of the department corresponding to the node in the alternative structure tree can be used as the key to quickly match its corresponding value in the organizational relationship dictionary. And the matched value is stored as the child node of the node in the alternative structure tree into the alternative organizational structure tree. Furthermore, it is not necessary to traverse the database to determine the department information and / or employee information corresponding to the child nodes of the nodes in the alternative structure tree, so that the organizational structure tree can be generated more quickly.
[0011] The above general description and the following description are only exemplary and explanatory, and are not used to limit this application. Description of the Drawings
[0012] One or more embodiments are exemplarily illustrated by corresponding drawings. These exemplary illustrations and the drawings do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are shown as similar elements. The drawings do not constitute a scale limitation, and wherein:
[0013] Figure 1 is a schematic diagram of a method for generating an organizational structure tree provided by an embodiment of the present disclosure;
[0014] Figure 2 is a schematic diagram of another method for generating an organizational structure tree provided by an embodiment of the present disclosure;
[0015] Figure 3 is a schematic diagram of another method for generating an organizational structure tree provided by an embodiment of the present disclosure;
[0016] Figure 4 is a schematic diagram of another method for generating an organizational structure tree provided by an embodiment of the present disclosure;
[0017] Figure 5 is a schematic diagram of another method for generating an organizational structure tree provided by an embodiment of the present disclosure;
[0018] Figure 6 is a schematic diagram of another method for generating an organizational structure tree provided by an embodiment of the present disclosure;
[0019] Figure 7 is a schematic diagram of another method for generating an organizational structure tree provided by an embodiment of the present disclosure;
[0020] Figure 8 is a schematic diagram of an electronic device provided by an embodiment of the present disclosure. Detailed implementation manners
[0021] In order to be able to understand the features and technical content of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure will be described in detail below with reference to the drawings. The attached drawings are for reference and illustration only and are not used to limit the embodiments of the present disclosure. In the following technical description, for the sake of explanation, a sufficient understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, well-known structures and devices can be shown in a simplified manner.
[0022] In the description, claims, and above-mentioned drawings of the embodiments of the present disclosure, terms such as "first" and "second" are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances so as to implement the embodiments of the present disclosure described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion.
[0023] In the embodiments of the present disclosure, the character " / " indicates that the objects before and after are in an "or" relationship. For example, A / B means: A or B.
[0024] The term "and / or" is an associative relationship describing an object and indicates that three relationships can exist. For example, A and / or B means: A or B, or, the three relationships of A and B.
[0025] The term "corresponding" may refer to an associative relationship or a binding relationship. That A corresponds to B means that there is an associative relationship or a binding relationship between A and B.
[0026] In order to enable employees to more intuitively understand the enterprise organizational structure, it is necessary to obtain the organizational structure tree of the enterprise. The existing method for generating the organizational structure tree is to store the department information corresponding to the preset department number in the database as the root node in the alternative organizational structure tree. Then, using the department numbers corresponding to the nodes in the alternative organizational structure tree, traverse all the department information in the database. When the department number of the department to which the department information exists in the database is the same as the department number corresponding to the node, store the department information with the department number of the department to which the department belongs being the department number corresponding to the node as the child node of the node in the alternative organizational structure tree. At the same time, using the department numbers corresponding to the nodes in the alternative organizational structure tree, it is also necessary to traverse all the employee information in the database. When the department number of the employee to which the employee information exists in the database is the same as the department number corresponding to the node, store the employee information with the department number of the employee to which the employee belongs being the department number corresponding to the node as the child node of the node in the alternative organizational structure tree. In this way, for each determination of the child nodes under a node, it is necessary to traverse the database to obtain the corresponding department information and / or employee information. Thus, in the case where the amount of data stored in the database is larger, the time required for recursive traversal is longer, and the efficiency of data acquisition is lower, resulting in the inability to quickly generate the organizational structure tree. However, in this application, an organizational relationship structure tree is constructed by using the first department relationship dictionary and the first department-employee relationship dictionary in the organizational relationship dictionary. By using the department number corresponding to the node in the alternative structure tree as the key, the corresponding value is quickly matched in the organizational relationship dictionary. And store the matched value as the child node of the node in the alternative organizational structure tree. That is, all the department information and all the employee information belonging to this department can be quickly obtained, and all the department information and all the employee information belonging to this department are stored as the child nodes of the corresponding node of this department in the alternative organizational structure tree. Thus, it is not necessary to traverse the database to determine the child nodes of the nodes in the alternative structure tree, which improves the data acquisition efficiency and can thus generate the organizational structure tree more quickly.
[0027] In the embodiments of the present disclosure, the electronic device is a computer, a mobile phone or a tablet computer. The organizational relationship dictionary includes a first department relationship dictionary and a first department-employee relationship dictionary; the first department relationship dictionary includes data stored with the number of the second department as the key and the set of department information of the first department corresponding to the second department as the value, and the first department-employee relationship dictionary includes data stored with the number of the third department as the key and the set of employee information of the employees corresponding to the third department as the value; wherein, the first department corresponding to the second department is the department subordinate to the second department; the employees corresponding to the third department are the employees subordinate to the third department.
[0028] Combined with Figure 1As shown in the figure, an embodiment of the present disclosure provides a method for generating an organizational structure tree, including:
[0029] Step S101, the electronic device obtains the department information and employee information of the enterprise from a preset database.
[0030] Step S102, the electronic device constructs an organizational relationship dictionary by using the department information and employee information of the enterprise.
[0031] Step S103, in response to an instruction to generate an organizational structure tree, the electronic device stores the second department or the third department corresponding to a preset number in the organizational relationship dictionary as the root node in the alternative structure tree.
[0032] Step S104, the electronic device performs a child node determination operation on the nodes in the alternative structure tree until there is no value corresponding to the department number corresponding to the node in the last level of the alternative structure tree in the first department relationship dictionary and the first department-employee relationship dictionary, and obtains the organizational structure tree. Among them, the child node determination operation includes: in the first department relationship dictionary and the first department-employee relationship dictionary, determining the value corresponding to the department number corresponding to the node in the alternative structure tree as the target child node. Storing the target child node as the child node of the node in the alternative structure tree in the alternative structure tree.
[0033] By using the pre-constructed organizational relationship dictionary to construct the organizational structure tree according to the method for generating an organizational structure tree provided by the embodiment of the present disclosure, since the organizational relationship dictionary stores data with the number of the second department as the key and the set of department information of the first department corresponding to the second department as the value, and data with the number of the third department as the key and the set of employee information of the employees corresponding to the third department as the value. In this way, when generating the organizational structure tree, the number of the department corresponding to the node in the alternative structure tree can be used as the key to quickly match the corresponding value in the organizational relationship dictionary. And storing the matched value as the child node of the node in the alternative structure tree in the alternative organizational structure tree. That is, all department information and all employee information subordinate to the department can be quickly obtained, and all department information and all employee information subordinate to the department are stored as the child nodes of the corresponding node of the department in the alternative organizational structure tree. Thus, it is not necessary to traverse the database to determine the department information and / or employee information corresponding to the child nodes of the nodes in the alternative structure tree, which improves the data acquisition efficiency and can generate the organizational structure tree more quickly.
[0034] Further, after constructing the organizational relationship dictionary by using the department information and employee information of the enterprise, it further includes: caching the organizational relationship dictionary.
[0035] Optionally, in response to an instruction to generate an organizational structure tree, the second department or the third department corresponding to a preset number in the organizational relationship dictionary is stored as the root node in the alternative structure tree, including: in response to the instruction to generate the organizational structure tree, obtaining the second department or the third department corresponding to the preset number from the cached organizational relationship dictionary, and storing the second department or the third department corresponding to the preset number as the root node in the alternative structure tree. In this way, when generating the organizational structure tree, the department information and employee information are directly obtained by using the cached organizational relationship dictionary. There is no need to call the interface of the electronic device to obtain the department information and employee information from the database, realizing query optimization. The time for calling the interface of the electronic device is reduced, and thus the organizational structure tree can be generated more quickly.
[0036] Further, after constructing the organizational relationship dictionary by using the department information and employee information of the enterprise, it further includes: obtaining the department information and employee information of the enterprise again from a preset database at preset time intervals, constructing an alternative organizational relationship dictionary by using the re-obtained department information and employee information of the enterprise, and using the alternative organizational relationship dictionary to overwrite the cached organizational relationship dictionary. Since directly updating the cached organizational relationship dictionary by using the data in the database takes a lot of time to reconstruct the organizational relationship dictionary, and the data in the cached organizational relationship dictionary is incomplete before the reconstruction of the organizational relationship dictionary is completed. In order to reduce the time of data incompleteness in the process of updating the cached organizational relationship dictionary, the embodiments of the present disclosure first construct an alternative organizational relationship dictionary by using the data in the database, and then use the alternative organizational relationship dictionary to overwrite the organizational relationship dictionary in the cache. Since the time taken to overwrite the organizational relationship dictionary in the cache by using the alternative organizational relationship dictionary is less than the time taken to reconstruct the organizational relationship dictionary by using the data in the database. Therefore, the time of data incompleteness in the process of updating the organizational relationship dictionary in the cache can be shortened.
[0037] Optionally, the organizational relationship dictionary further includes a second department relationship dictionary and a second department-employee relationship dictionary. The second department relationship dictionary stores data with the number of the first department as the key and the number of the second department corresponding to the first department as the value. The second department-employee relationship dictionary stores data with the employee number as the key and the number of the third department corresponding to the employee as the value. In this way, in the case of department information change and / or employee information change, it is possible to quickly determine whether the department to which the department and / or employee belongs has changed through the second department relationship dictionary and the second department-employee relationship dictionary. Thus, it is possible to quickly update the first department relationship dictionary by using the changed department information, and / or quickly update the first department-employee relationship dictionary by using the changed employee information.
[0038] Optionally, after constructing an organizational relationship dictionary using the department information and employee information of an enterprise, it further includes: when receiving new department information sent by the database, obtaining the department information of the new department. The department information of the new department includes the number of the new department, the name of the new department, and the number of the department to which the new department belongs. Determine the number of the department to which the new department belongs as the first target number. Use the number of the new department as the key and the first target number as the value corresponding to the number of the new department and store it in the second department relationship dictionary. Determine whether the key in the first department relationship dictionary includes the first target number. If so, add the department information of the new department to the value corresponding to the first target number in the first department relationship dictionary; otherwise, use the first target number as the key and the department information of the new department as the value corresponding to the first target number and store it in the first department relationship dictionary. In this way, when receiving new department information sent by the database, storing the department information of the new department in the first department relationship dictionary and the second department relationship dictionary can ensure that the data stored in the organizational relationship dictionary is the same as the data stored in the database.
[0039] Combined with Figure 2 As shown, an embodiment of the present disclosure provides a method for generating an organizational structure tree, including:
[0040] Step S201, the electronic device constructs an organizational relationship dictionary using the department information and employee information of the enterprise.
[0041] Step S202, when the electronic device receives new department information sent by the database, obtain the department information of the new department. The department information of the new department includes the number of the new department, the name of the new department, and the number of the department to which the new department belongs. Determine the number of the department to which the new department belongs as the first target number.
[0042] Step S203, the electronic device uses the number of the new department as the key and the first target number as the value corresponding to the number of the new department and stores it in the second department relationship dictionary.
[0043] Step S204, the electronic device determines whether the key in the first department relationship dictionary includes the first target number; if so, execute step S205; otherwise, execute step S206.
[0044] Step S205, the electronic device adds the department information of the new department to the value corresponding to the first target number in the first department relationship dictionary. Obtain the updated first department relationship dictionary and the updated organizational relationship dictionary.
[0045] Step S206: The electronic device uses the first target number as the key and stores the department information of the newly added department as the value corresponding to the first target number in the first department relationship dictionary. An updated first department relationship dictionary and an updated organizational relationship dictionary are obtained.
[0046] Step S207: In response to an instruction to generate an organizational structure tree, the electronic device stores the second department or the third department corresponding to the preset number in the updated organizational relationship dictionary as the root node in the alternative structure tree.
[0047] Step S208: The electronic device performs a child node determination operation on the nodes in the alternative structure tree until there is no value corresponding to the department number corresponding to the node in the last level of the alternative structure tree in the updated first department relationship dictionary and the first department-employee relationship dictionary, and an organizational structure tree is obtained.
[0048] By using the method for generating an organizational structure tree provided in the embodiments of the present disclosure, when receiving the newly added department information sent by the database, the department information of the newly added department is stored in the first department relationship dictionary and the second department relationship dictionary, so that the data stored in the organizational relationship dictionary can be updated. Then, an organizational structure tree is generated by using the updated organizational relationship dictionary, so that the organizational structure tree can truly display the organizational structure of the enterprise.
[0049] Optionally, after constructing an organizational relationship dictionary using the department information and employee information of an enterprise, it further includes: when receiving a first notification message sent by a database, obtaining the changed department information from the first notification message. The first notification message is used to represent the name of the changed department and / or the department to which the changed department belongs. The changed department information includes the department number after the department information change, the department name after the department information change, and the number of the department to which the department information change belongs. Obtain the value corresponding to the department number after the department information change in the second department relationship dictionary, and determine it as the second target number. Determine whether the second target number is the same as the number of the department to which the department information change belongs. In the case where the second target number is not the same as the number of the department to which the department information change belongs, delete the department information of the first department corresponding to the department number after the department information change from the value corresponding to the second target number in the first department relationship dictionary. Determine the number of the department to which the department information change belongs as the third target number, use the department number after the department information change as the key, and store the third target number as the value corresponding to the department number after the department information change in the second department relationship dictionary. Determine whether the keys in the first department relationship dictionary include the third target number. If so, add the changed department information to the value corresponding to the third target number in the first department relationship dictionary. Otherwise, use the third target number as the key and store the department information after the department information change as the value corresponding to the third target number in the first department relationship dictionary. In this way, by determining whether the second target number is the same as the number of the department to which the department information change belongs, it is possible to quickly determine whether the department to which the department belongs has changed, and in the case where the department to which the department belongs has changed, delete the department information of the first department corresponding to the department number after the department information change from the set of department information of the first department corresponding to the second target number in the first department relationship dictionary. That is, delete the key-value relationship between the changed department information and the number of the department to which the department information belonged before the change in the first department relationship dictionary. At the same time, add the key-value relationship between the department number after the department information change and the number of the department to which the department information change belongs in the second department relationship dictionary. In addition, when the keys in the first department relationship dictionary do not include the third target number, add the key-value relationship between the number of the department to which the department information change belongs and the department number after the department information change in the first department relationship dictionary. Thus, it can be ensured that the data stored in the organizational relationship dictionary is the same as the data stored in the database.
[0050] Optionally, after determining whether the second target number is the same as the number of the department to which the department belongs after the department information is changed, it further includes: when the second target number is the same as the number of the department to which the department belongs after the department information is changed, using the changed department information to overwrite the first target information in the value corresponding to the second target number in the first department relationship dictionary, where the first target information is the department information corresponding to the department number after the department information is changed in the value corresponding to the second target number in the first department relationship dictionary. In this way, when the second target number is the same as the number of the department to which the department belongs after the department information is changed, it can be quickly determined that the department to which the department belongs has not changed. At the same time, since the first notification message is used to represent the name of the changed department and / or the department to which the changed department belongs, it can be determined that the name of the department has changed. Therefore, using the changed department information to update the first department information stored in the first department relationship can ensure that the data stored in the organizational relationship dictionary is the same as the data stored in the database.
[0051] Combined with Figure 3 As shown, an embodiment of the present disclosure provides a method for generating an organizational structure tree, including:
[0052] Step S301, the electronic device constructs an organizational relationship dictionary using the department information and employee information of the enterprise.
[0053] Step S302, when the electronic device receives the first notification message sent by the database, it obtains the changed department information from the first notification message; the first notification message is used to represent the name of the changed department and / or the department to which the changed department belongs; the changed department information includes the department number after the department information is changed, the department name after the department information is changed, and the number of the department to which the department belongs after the department information is changed.
[0054] Step S303, the electronic device obtains the value corresponding to the department number after the department information is changed in the second department relationship dictionary and determines it as the second target number.
[0055] Step S304, the electronic device determines whether the second target number is the same as the number of the department to which the department belongs after the department information is changed; if so, execute step 310; otherwise, execute step S305.
[0056] Step S305, in the value corresponding to the second target number in the first department relationship dictionary, the electronic device deletes the department information of the first department corresponding to the department number after the department information is changed. Then execute step S306.
[0057] Step S306, the electronic device determines the number of the department to which the department belongs after the department information is changed as the third target number, and stores it in the second department relationship dictionary with the department number after the department information is changed as the key and the third target number as the value corresponding to the department number after the department information is changed. Then step S307 is executed.
[0058] Step S307, the electronic device determines whether the third target number is included in the keys of the first department relationship dictionary; if so, step S308 is executed; otherwise, step S309 is executed.
[0059] Step S308, the electronic device adds the changed department information to the value corresponding to the third target number in the first department relationship dictionary. An updated first department relationship dictionary and an updated organizational relationship dictionary are obtained.
[0060] Step S309, the electronic device stores the department information after the department information is changed in the first department relationship dictionary with the third target number as the key and the department information after the department information is changed as the value corresponding to the third target number. An updated first department relationship dictionary and an updated organizational relationship dictionary are obtained.
[0061] Step S310, the electronic device uses the changed department information to overwrite the first target information in the value corresponding to the second target number in the first department relationship dictionary. The first target information is the department information corresponding to the department number after the department information is changed in the value corresponding to the second target number in the first department relationship dictionary. An updated first department relationship dictionary and an updated organizational relationship dictionary are obtained.
[0062] Step S311, in response to an instruction to generate an organizational structure tree, the electronic device stores the second department or the third department corresponding to the preset number in the updated organizational relationship dictionary as the root node in the alternative structure tree.
[0063] Step S312, the electronic device performs a child node determination operation on the nodes in the alternative structure tree until there is no value corresponding to the department number corresponding to the node in the last level of the alternative structure tree in the updated first department relationship dictionary and the first department-employee relationship dictionary, and an organizational structure tree is obtained.
[0064] By using the method for generating an organizational structure tree provided in the embodiments of the present disclosure, it is possible to quickly determine whether the name of a department and / or the department to which the department belongs has changed through the second department relationship dictionary. And in the case where the department to which the department belongs has changed, the first department relationship dictionary and the second department relationship dictionary are updated using the changed department information. And in the case where the name of the department has changed, the first department relationship dictionary is updated using the changed department information. Thus, the data stored in the organizational relationship dictionary can be updated. Then, an organizational structure tree is generated using the updated organizational relationship dictionary, so that the organizational structure tree can truly display the organizational structure of the enterprise.
[0065] Optionally, after constructing an organizational relationship dictionary using the department information and employee information of an enterprise, it further includes: when receiving the department information deletion sent by the database, obtaining the department number of the department to be deleted. Obtaining the value corresponding to the department number of the department to be deleted in the second department relationship dictionary, and determining it as the fourth target number. Deleting the department information of the first department corresponding to the department number of the department to be deleted among the values corresponding to the fourth target number in the first department relationship dictionary. In this way, in the first department relationship, the department information corresponding to the department number of the department to be deleted can be deleted. Thus, it is ensured that the data stored in the organizational relationship dictionary is the same as the data stored in the database.
[0066] Combined Figure 4 As shown, the embodiments of the present disclosure provide a method for generating an organizational structure tree, including:
[0067] Step S401, the electronic device constructs an organizational relationship dictionary using the department information and employee information of the enterprise.
[0068] Step S402, when the electronic device receives the department information deletion sent by the database, it obtains the department number of the department to be deleted.
[0069] Step S403, the electronic device obtains the value corresponding to the department number of the department to be deleted in the second department relationship dictionary, and determines it as the fourth target number.
[0070] Step S404, the electronic device deletes the department information of the first department corresponding to the department number of the department to be deleted among the values corresponding to the fourth target number in the first department relationship dictionary. An updated first department relationship dictionary and an updated organizational relationship dictionary are obtained.
[0071] Step S405, in response to the instruction to generate an organizational structure tree, the electronic device stores the second department or the third department corresponding to the preset number in the updated organizational relationship dictionary as the root node in the alternative structure tree.
[0072] Step S406, the electronic device performs a child node determination operation on the nodes in the alternative structure tree until there is no value corresponding to the department number of the department corresponding to the last-level node in the alternative structure tree in the updated first department relationship dictionary and the first department-employee relationship dictionary, and an organizational structure tree is obtained.
[0073] By using the data update method provided in the embodiments of the present disclosure, when receiving the department deletion information sent by the database, the first department information corresponding to the department number of the deleted department can be deleted in the first department relationship dictionary. Thus, the data stored in the organizational relationship dictionary can be updated. Then, an organizational structure tree is generated by using the updated organizational relationship dictionary, so that the organizational structure tree can truly display the organizational structure of the enterprise.
[0074] Optionally, after constructing the organizational relationship dictionary by using the department information and employee information of the enterprise, it further includes: when receiving the new employee information sent by the database, obtaining the new employee information. The new employee information includes the number of the new employee, the name of the new employee, and the number of the department to which the new employee belongs. The number of the department to which the new employee belongs is determined as the fifth target number. The number of the new employee is used as the key, and the fifth target number is stored as the value corresponding to the number of the new employee in the second department-employee relationship dictionary. It is judged whether the key in the first department-employee relationship dictionary includes the fifth target number. If so, the new employee information is added to the value corresponding to the fifth target number in the first department-employee relationship dictionary. Otherwise, the fifth target number is used as the key, and the new employee information is stored as the value corresponding to the fifth target number in the first department-employee relationship dictionary. In this way, when receiving the new employee information sent by the database, the employee information of the new employee can be stored in the first department-employee relationship dictionary and the second department-employee relationship dictionary, so as to ensure that the data stored in the organizational relationship dictionary is the same as the data stored in the database.
[0075] Combined Figure 5 As shown, the embodiments of the present disclosure provide a method for generating an organizational structure tree, including:
[0076] Step S501, the electronic device constructs an organizational relationship dictionary by using the department information and employee information of the enterprise.
[0077] Step S502, when the electronic device receives the new employee information sent by the database, it obtains the new employee information. The new employee information includes the number of the new employee, the name of the new employee, and the number of the department to which the new employee belongs. The number of the department to which the new employee belongs is determined as the fifth target number.
[0078] Step S503: The electronic device stores the ID of the newly added employee as the key and the fifth target ID as the value corresponding to the ID of the newly added employee in the second department's employee relationship dictionary.
[0079] Step S504: The electronic device determines whether the keys in the first department's employee relationship dictionary include the fifth target ID. If so, step S505 is executed. Otherwise, step S506 is executed.
[0080] Step S505: The electronic device adds the newly added employee information to the value corresponding to the fifth target ID in the first department's employee relationship dictionary. The updated first department relationship dictionary and the updated organizational relationship dictionary are obtained.
[0081] Step S506: The electronic device stores the fifth target ID as the key and the newly added employee information as the value corresponding to the fifth target ID in the first department's employee relationship dictionary. The updated first department relationship dictionary and the updated organizational relationship dictionary are obtained.
[0082] Step S507: In response to the instruction to generate the organizational structure tree, the electronic device stores the second department or the third department corresponding to the preset ID in the updated organizational relationship dictionary as the root node in the alternative structure tree.
[0083] Step S508: The electronic device performs an operation to determine the child nodes of the nodes in the alternative structure tree until there is no value corresponding to the ID of the department corresponding to the last-level node in the alternative structure tree in the updated first department relationship dictionary and the first department's employee relationship dictionary, and the organizational structure tree is obtained.
[0084] By using the method for generating the organizational structure tree provided in the embodiments of the present disclosure, when receiving the newly added employee information sent by the database, the employee information of the newly added employee is stored in the first department's employee relationship dictionary and the second department's employee relationship dictionary, so that the data stored in the organizational relationship dictionary can be updated. Then, the updated organizational relationship dictionary is used to generate the organizational structure tree, enabling the organizational structure tree to truly display the organizational structure of the enterprise.
[0085] Optionally, after constructing the organizational relationship dictionary using the enterprise's department information and employee information, it further includes: when receiving the second notification message sent by the database, obtaining the changed employee information from the second notification message. The second notification message is used to represent the changed name of the employee and / or the department to which the changed employee belongs. The changed employee information includes the employee number after the change of the employee information, the employee name after the change of the employee information, and the department number of the department to which the employee belongs after the change of the employee information. Obtain the value corresponding to the employee number after the change of the employee information in the second department-employee relationship dictionary and determine it as the sixth target number. Determine whether the sixth target number is the same as the department number of the department to which the employee belongs after the change of the employee information. When the sixth target number is not the same as the department number of the department to which the employee belongs after the change of the employee information, delete the employee information corresponding to the employee number after the change of the employee information from the value corresponding to the sixth target number in the first department-employee relationship dictionary. Determine the department number of the department to which the employee belongs after the change of the employee information as the seventh target number. Store the employee number after the change of the employee information as the key and the seventh target number as the value corresponding to the employee number after the change of the employee information in the second department-employee relationship dictionary. Determine whether the keys in the first department-employee relationship dictionary include the seventh target number. If so, add the changed employee information to the value corresponding to the seventh target number in the first department-employee relationship dictionary. Otherwise, store the seventh target number as the key and the employee number after the change of the employee information as the value corresponding to the seventh target number in the first department-employee relationship dictionary. In this way, by determining whether the sixth target number is the same as the department number of the department to which the employee belongs after the change of the employee department information, it is possible to quickly determine whether the department to which the employee belongs has changed. And when the department to which the employee belongs has changed, delete the employee information corresponding to the employee number after the change of the employee information from the set of employee information of the employee corresponding to the sixth target number in the first department-employee relationship dictionary. That is, delete the key-value relationship between the changed employee information and the department number of the department to which the employee belonged before the change of the employee information in the first department-employee relationship dictionary. At the same time, add the key-value relationship between the employee number after the change of the employee information and the department number of the department to which the employee belongs after the change of the employee information in the second department-employee relationship dictionary. In addition, when the seventh target number is not included in the keys of the first department-employee relationship dictionary, add the key-value relationship between the department number of the department to which the employee belongs after the change of the employee information and the employee number after the change of the employee information in the first department-employee relationship dictionary. Thus, it can be ensured that the data stored in the organizational relationship dictionary is the same as the data stored in the database.
[0086] Optionally, after determining whether the sixth target number is the same as the number of the department to which the employee belongs after the employee information is changed, it further includes: when the sixth target number is the same as the number of the department to which the employee belongs after the employee information is changed, using the changed employee information to overwrite the second target information in the value corresponding to the seventh target number in the first department employee relationship dictionary; the second target information is the employee information corresponding to the employee number after the employee information is changed in the value corresponding to the seventh target number in the first department employee relationship dictionary. In this way, when the sixth target number is the same as the number of the department to which the employee belongs after the employee information is changed, it can be quickly determined that the department to which the employee belongs has not changed. At the same time, since the second notification message is used to represent the change of the employee's name and / or the change of the department to which the employee belongs, it can be determined that the name of the employee has changed. Therefore, updating the employee information stored in the first department employee relationship dictionary with the changed employee information can ensure that the data stored in the organizational relationship dictionary is the same as the data stored in the database.
[0087] Combined Figure 6 As shown, an embodiment of the present disclosure provides a method for generating an organizational structure tree, including:
[0088] Step S601, the electronic device constructs an organizational relationship dictionary using the department information and employee information of the enterprise.
[0089] Step S602, when the electronic device receives the second notification message sent by the database, it obtains the changed employee information from the second notification message. The second notification message is used to represent the change of the employee's name and / or the change of the department to which the employee belongs; the changed employee information includes the employee number after the employee information is changed, the employee name after the employee information is changed, and the number of the department to which the employee belongs after the employee information is changed.
[0090] Step S603, the electronic device obtains the value corresponding to the employee number after the employee information is changed in the second department employee relationship dictionary and determines it as the sixth target number.
[0091] Step S604, the electronic device determines whether the sixth target number is the same as the number of the department to which the employee belongs after the employee information is changed. If so, execute step S610. Otherwise, execute step S605.
[0092] Step S605, the electronic device deletes the employee information corresponding to the employee number after the employee information is changed in the value corresponding to the sixth target number in the first department employee relationship dictionary. Then execute step S606.
[0093] Step S606: The electronic device determines the department number of the employee's department after the employee information change as the seventh target number, uses the employee number after the employee information change as the key, and stores the seventh target number as the value corresponding to the employee number after the employee information change in the second department-employee relationship dictionary. Then, step S607 is executed.
[0094] Step S607: The electronic device determines whether the keys in the first department-employee relationship dictionary include the seventh target number; if so, step S608 is executed. Otherwise, step S609 is executed.
[0095] Step S608: The electronic device adds the changed employee information to the value corresponding to the seventh target number in the first department-employee relationship dictionary. The updated first department relationship dictionary and the updated organizational relationship dictionary are obtained.
[0096] Step S609: The electronic device uses the seventh target number as the key and stores the employee number after the employee information change as the value corresponding to the seventh target number in the first department-employee relationship dictionary. The updated first department relationship dictionary and the updated organizational relationship dictionary are obtained.
[0097] Step S610: The electronic device uses the changed employee information to overwrite the second target information in the value corresponding to the seventh target number in the first department-employee relationship dictionary; the second target information is the employee information corresponding to the employee number after the employee information change in the value corresponding to the seventh target number in the first department-employee relationship dictionary. The updated first department relationship dictionary and the updated organizational relationship dictionary are obtained.
[0098] Step S611: In response to the instruction to generate an organizational structure tree, the electronic device stores the second department or the third department corresponding to the preset number in the updated organizational relationship dictionary as the root node in the alternative structure tree.
[0099] Step S612: The electronic device performs a child node determination operation on the nodes in the alternative structure tree until there is no value corresponding to the department number corresponding to the node in the last level of the alternative structure tree in the updated first department relationship dictionary and the first department-employee relationship dictionary, and an organizational structure tree is obtained.
[0100] By using the method for generating an organizational structure tree provided in the embodiments of the present disclosure, since the employee number does not change, the employee number after the employee information change can be used to quickly determine in the second department relationship dictionary whether the name of the employee and / or the department to which the employee belongs has changed. And in the case where the department to which the employee belongs has changed, the changed employee information is used to update the first department-employee relationship dictionary and the second department-employee relationship dictionary. And in the case where the name of the employee has changed, the changed employee information is used to update the first department-employee relationship dictionary. Thus, the data stored in the organizational relationship dictionary can be updated. Then, the updated organizational relationship dictionary is used to generate an organizational structure tree, so that the organizational structure tree can truly display the organizational structure of the enterprise.
[0101] Optionally, after constructing the organizational relationship dictionary by using the department information and employee information of the enterprise, it further includes: in the case of receiving the employee departure information sent by the database, obtaining the employee number of the departing employee from the employee departure information. Obtaining the value corresponding to the employee number of the departing employee in the second department-employee relationship dictionary, and determining it as the eighth target number. Deleting the employee information corresponding to the employee number of the departing employee from the value corresponding to the eighth target number in the first department-employee relationship dictionary. In this way, in the case of receiving the employee departure information sent by the database, in the first department relationship, the employee information corresponding to the employee number of the departing employee can be deleted. Thus, it is ensured that the data stored in the organizational relationship dictionary is the same as the data stored in the database.
[0102] Combined Figure 7 As shown, the embodiments of the present disclosure provide a method for generating an organizational structure tree, including:
[0103] Step S701, the electronic device constructs an organizational relationship dictionary by using the department information and employee information of the enterprise.
[0104] Step S702, when the electronic device receives the employee departure information sent by the database, the electronic device obtains the employee number of the departing employee from the employee departure information.
[0105] Step S703, the electronic device obtains the value corresponding to the employee number of the departing employee in the second department-employee relationship dictionary, and determines it as the eighth target number.
[0106] Step S704, the electronic device deletes the employee information corresponding to the employee number of the departing employee from the value corresponding to the eighth target number in the first department-employee relationship dictionary. An updated first department relationship dictionary and an updated organizational relationship dictionary are obtained.
[0107] Step S705: In response to the instruction to generate the organizational structure tree, the electronic device stores the second or third department corresponding to the preset number in the updated organizational relationship dictionary as the root node in the alternative structure tree.
[0108] Step S706: The electronic device performs an operation to determine the child nodes of the nodes in the alternative structure tree until there is no value corresponding to the department number corresponding to the node in the last level of the alternative structure tree in the updated first department relationship dictionary and the first department employee relationship dictionary, and obtains the organizational structure tree.
[0109] By using the method for generating the organizational structure tree provided in the embodiments of the present disclosure, when receiving the employee departure information sent by the database, the employee information corresponding to the employee number of the departing employee can be deleted in the first department relationship. Thus, the data stored in the organizational relationship dictionary can be updated. Then, the updated organizational relationship dictionary is used to generate the organizational structure tree, so that the organizational structure tree can truly display the organizational structure of the enterprise.
[0110] Combined with Figure 8 As shown in the figure, the embodiments of the present disclosure provide an electronic device, including a processor 800 and a memory 801. Optionally, the device may further include a communication interface 802 and a bus 803. Among them, the processor 800, the communication interface 802, and the memory 801 can complete mutual communication through the bus 803. The communication interface 802 can be used for information transmission. The processor 800 can call the logical instructions in the memory 801 to execute the method for generating the organizational structure tree in the above embodiments.
[0111] By using the electronic device provided in the embodiments of the present disclosure, the organizational relationship structure tree is constructed by using the first department relationship dictionary and the first department employee relationship dictionary in the organizational relationship dictionary. By using the department number corresponding to the node in the alternative structure tree as the key, the corresponding value can be quickly matched in the organizational relationship dictionary. And the matched value is stored as the child node of the node in the alternative structure tree in the alternative organizational structure tree. That is, all department information and all employee information belonging to the department can be quickly obtained, and all department information and all employee information belonging to the department are stored as the child nodes of the corresponding node of the department in the alternative organizational structure tree. Thus, it is not necessary to traverse the database to determine the child nodes of the nodes in the alternative structure tree, which improves the data acquisition efficiency and can generate the organizational structure tree more quickly.
[0112] In addition, when the logical instructions in the above-mentioned memory 801 are implemented in the form of software function units and sold or used as an independent product, they can be stored in a computer-readable storage medium.
[0113] The memory 801, being a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as the program instructions / modules corresponding to the methods in the embodiments of the present disclosure. The processor 800 executes functional applications and data processing by running the program instructions / modules stored in the memory 801, that is, implements the method for generating an organizational structure tree in the above embodiments.
[0114] The memory 801 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created according to the use of the terminal device, etc. In addition, the memory 801 may include high-speed random access memory and may also include non-volatile memory.
[0115] The embodiments of the present disclosure provide a readable storage medium storing executable instructions, and the executable instructions execute the above method for generating an organizational structure tree when running.
[0116] The embodiments of the present disclosure provide a computer program product. The computer program product includes a computer program stored on a computer-readable storage medium. The computer program includes program instructions, and when the program instructions are executed by a computer, the computer is made to execute the above method for generating an organizational structure tree.
[0117] The above computer-readable storage medium may be a transient computer-readable storage medium or a non-transient computer-readable storage medium.
[0118] The technical solution of the embodiments of the present disclosure can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes one or more instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the embodiments of the present disclosure. The foregoing storage medium may be a non-transient storage medium, including: various media that can store program codes such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs, or may also be a transient storage medium.
[0119] The above description and the accompanying drawings fully illustrate the embodiments of the present disclosure, enabling those skilled in the art to practice them. Other embodiments may include structural, logical, electrical, process, and other changes. Embodiments only represent possible variations. Unless explicitly required, individual components and functions are optional, and the order of operations may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. Moreover, the terms used in this application are only for describing the embodiments and do not limit the claims. As used in the description of the embodiments and the claims, unless the context clearly indicates otherwise, the singular forms "a", "an", and "the" are intended to also include the plural forms. Similarly, as used in this application, the term "and / or" refers to any and all possible combinations of one or more of the associated listed items. Additionally, when used in this application, the term "comprise" and its variants "comprises" and / or "comprising" etc. mean the presence of the stated features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or groups thereof. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, or apparatus that includes the element. Herein, each embodiment may focus on the differences from other embodiments, and the same or similar parts among the embodiments may be referred to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method parts disclosed in the embodiments, the relevant parts may refer to the description of the method parts.
[0120] Those skilled in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner may depend on the specific application and design constraints of the technical solution. The technician can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of the embodiments of the present disclosure. The technician can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.
[0121] In the embodiments disclosed in this article, the disclosed methods, products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units can be merely a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Additionally, the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect coupling or communication connection of devices or units can be in electrical, mechanical, or other forms. The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to implement this embodiment. Additionally, in the embodiments of the present disclosure, the various functional units can be integrated in one processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit.
[0122] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions marked in the block can occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and sometimes they can also be executed in the reverse order, which can depend on the functions involved. In the descriptions corresponding to the flowcharts and block diagrams in the accompanying drawings, the operations or steps corresponding to different blocks can also occur in a different order than that disclosed in the description. Sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and sometimes they can also be executed in the reverse order, which can depend on the functions involved. Each block in the block diagram and / or flowchart, as well as the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
Claims
1. A method for generating an organizational structure tree, characterized in that, it includes: Obtaining department information and employee information of an enterprise from a preset database; Constructing an organizational relationship dictionary by using the department information and employee information of the enterprise; The organizational relationship dictionary includes a first department relationship dictionary and a first department-employee relationship dictionary; The first department relationship dictionary stores data with the number of a second department as the key and the set of department information of the first department corresponding to the second department as the value. The first department-employee relationship dictionary stores data with the number of a third department as the key and the set of employee information of the employees corresponding to the third department as the value. Wherein, the first department corresponding to the second department is the department subordinate to the second department, and the employees corresponding to the third department are the employees subordinate to the third department; In response to an instruction to generate an organizational structure tree, storing the second department or the third department corresponding to a preset number in the organizational relationship dictionary as the root node into an alternative structure tree; Performing a child node determination operation on the nodes in the alternative structure tree until there is no value corresponding to the number of the department corresponding to the last-level node in the alternative structure tree in the first department relationship dictionary and the first department-employee relationship dictionary, to obtain an organizational structure tree; The organizational relationship dictionary further includes a second department relationship dictionary and a second department-employee relationship dictionary. The second department relationship dictionary stores data with the number of the first department as the key and the number of the second department corresponding to the first department as the value. The second department-employee relationship dictionary stores data with the number of an employee as the key and the number of the third department corresponding to the employee as the value.
2. The method according to claim 1, characterized in that, after constructing the organizational relationship dictionary by using the department information and employee information of the enterprise, it further includes: When receiving new department information sent by the database, obtaining the department information of the new department. The department information of the new department includes the number of the new department, the name of the new department, and the number of the department to which the new department belongs, and determining the number of the department to which the new department belongs as the first target number; Using the number of the new department as the key and the first target number as the value corresponding to the number of the new department and storing it into the second department relationship dictionary; Judging whether the key in the first department relationship dictionary includes the first target number; If so, adding the department information of the new department to the value corresponding to the first target number in the first department relationship dictionary; otherwise, using the first target number as the key and the department information of the new department as the value corresponding to the first target number and storing it into the first department relationship dictionary.
3. The method according to claim 1, characterized in that, after constructing the organizational relationship dictionary by using the department information and employee information of the enterprise, it further includes: In the case of receiving a first notification message sent by the database, obtain the changed department information from the first notification message; the first notification message is used to represent the name of the changed department and / or the department to which the changed department belongs; the changed department information includes the department number after the department information change, the department name after the department information change, and the number of the department to which the department information change belongs. Obtain the value corresponding to the department number after the department information change in the second department relationship dictionary, and determine it as the second target number. Determine whether the second target number is the same as the number of the department to which the department information change belongs. In the case where the second target number is not the same as the number of the department to which the department information change belongs, delete the department information corresponding to the department number after the department information change from the value corresponding to the second target number in the first department relationship dictionary. Determine the number of the department to which the department information change belongs as the third target number, and store it in the second department relationship dictionary with the department number after the department information change as the key and the third target number as the value corresponding to the department number after the department information change. Determine whether the keys in the first department relationship dictionary include the third target number. If so, add the changed department information to the value corresponding to the third target number in the first department relationship dictionary; otherwise, store it in the first department relationship dictionary with the third target number as the key and the department information after the department information change as the value corresponding to the third target number.
4. The method according to claim 3, characterized in that, after determining whether the second target number is the same as the number of the department to which the department information change belongs, it further includes: In the case where the second target number is the same as the number of the department to which the department information change belongs, overwrite the first target information in the value corresponding to the second target number in the first department relationship dictionary with the changed department information, where the first target information is the department information corresponding to the department number after the department information change in the value corresponding to the second target number in the first department relationship dictionary.
5. The method according to claim 1, characterized in that, after constructing an organizational relationship dictionary using the department information and employee information of the enterprise, it further includes: In the case of receiving the deletion of department information sent by the database, obtain the department number of the department to be deleted. Obtain the value corresponding to the department number of the department to be deleted in the second department relationship dictionary, and determine it as the fourth target number. Delete the department information of the first department corresponding to the department number of the department to be deleted from the value corresponding to the fourth target number in the first department relationship dictionary.
6. The method according to claim 1, characterized in that, after constructing an organizational relationship dictionary using the department information and employee information of the enterprise, it further includes: When receiving the newly added employee information sent by the database, obtain the newly added employee information; the newly added employee information includes the number of the newly added employee, the name of the newly added employee, and the number of the department to which the newly added employee belongs, and determine the number of the department to which the newly added employee belongs as the fifth target number; Use the number of the newly added employee as the key, and use the fifth target number as the value corresponding to the number of the newly added employee and store it in the second department-employee relationship dictionary; Judge whether the keys in the first department-employee relationship dictionary include the fifth target number; If so, add the newly added employee information to the value corresponding to the fifth target number in the first department-employee relationship dictionary; otherwise, use the fifth target number as the key, and use the newly added employee information as the value corresponding to the fifth target number and store it in the first department-employee relationship dictionary.
7. The method according to claim 1, characterized in that, after constructing the organizational relationship dictionary using the department information and employee information of the enterprise, it further includes: When receiving the second notification message sent by the database, obtain the changed employee information from the second notification message; the second notification message is used to represent the changed name of the employee and / or the department to which the changed employee belongs; the changed employee information includes the employee number after the employee information is changed, the employee name after the employee information is changed, and the number of the department to which the employee belongs after the employee information is changed; Obtain the value corresponding to the employee number after the employee information is changed in the second department-employee relationship dictionary, and determine it as the sixth target number; Judge whether the sixth target number is the same as the number of the department to which the employee belongs after the employee information is changed; When the sixth target number is not the same as the number of the department to which the employee belongs after the employee information is changed, delete the employee information corresponding to the employee number after the employee information is changed from the value corresponding to the sixth target number in the first department-employee relationship dictionary; Determine the number of the department to which the employee belongs after the employee information is changed as the seventh target number; use the employee number after the employee information is changed as the key, and use the seventh target number as the value corresponding to the employee number after the employee information is changed and store it in the second department-employee relationship dictionary; Judge whether the keys in the first department-employee relationship dictionary include the seventh target number; If so, add the changed employee information to the value corresponding to the seventh target number in the first department-employee relationship dictionary; otherwise, use the seventh target number as the key, and use the employee number after the employee information is changed as the value corresponding to the seventh target number and store it in the first department-employee relationship dictionary.
8. The method according to claim 7, characterized in that, after judging whether the sixth target number is the same as the number of the department to which the employee belongs after the employee information is changed, it further includes: When the sixth target number is the same as the number of the department to which the employee belongs after the employee information is changed, the second target information in the value corresponding to the seventh target number in the first department employee relationship dictionary is overwritten with the changed employee information; the second target information is the employee information corresponding to the employee number of the employee after the employee information is changed in the value corresponding to the seventh target number in the first department employee relationship dictionary.
9. The method according to claim 1, wherein, after constructing an organizational relationship dictionary using the department information and employee information of the enterprise, it further includes: when receiving employee departure information sent by the database, obtaining the employee number of the departing employee from the employee departure information; obtaining the value corresponding to the employee number of the departing employee in the second department employee relationship dictionary and determining it as the eighth target number; deleting the employee information corresponding to the employee number of the departing employee in the value corresponding to the eighth target number in the first department employee relationship dictionary.
10. An electronic device, comprising a processor and a memory storing program instructions, wherein, the processor is configured to execute the method for generating an organizational structure tree according to any one of claims 1 to 9 when running the program instructions.
11. A readable storage medium storing executable instructions, wherein, the executable instructions execute the method for generating an organizational structure tree according to any one of claims 1 to 9 when running.
Citation Information
Patent Citations
Multi-tree structure database design method and device
CN104408067A
Right control method, device, electronic device and storage medium
CN109242420A
Directory tree-based information acquisition method and device
CN110619066A