Organization Structure Data Processing Method, Device, Computer Equipment and Storage Medium
By storing the organizational information table and the personnel information table separately in the organizational structure data processing method, and building a memory architecture tree in the memory space, the problem of large memory resource occupancy in the existing technology is solved, and more efficient query performance is achieved.
Patent Information
- Application Number
- CN202010171159.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-12
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2040-03-12
AI Technical Summary
The existing technology has a large memory resource usage during organizational structure data query, resulting in poor query performance.
By writing organization information tables and personnel information tables to disk space separately, and using the connection pointers between memory blocks in the memory space to build a memory architecture tree, reducing the usage of memory resources.
It effectively reduces the memory resource usage during data query and improves the query performance of organizational structure data.
Smart Images

Figure CN113391916B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technologies, and particularly to a method and apparatus for processing organizational structure data, a computer device, and a storage medium. Background Art
[0002] With the rapid development of the social economy, for enterprises or organizations with a clear hierarchical structure of attributes, organizational structure management has become an important personnel management method. The organizational structure has the characteristics of large scale, flexibility, and complexity. Therefore, storing and managing the organizational structure data of large enterprises or organizations is a relatively important link. To achieve the management of the organizational structure, in the prior art, an adjacency list or a string key is used to record the complete path of the organizational structure hierarchy, such as the form of " / root department / technology department / development group", to store and manage the organizational structure data.
[0003] However, when storing data in the form of an adjacency list, during the process of querying organizational structure data, the query database needs to be called multiple times; for the technical method of saving the complete path, large-scale organizational structures consume a lot of storage space, and the overhead of moving nodes during querying is relatively large. These two storage methods of organizational structure data both lead to a large memory resource occupation problem during the query process. Summary of the Invention
[0004] Based on this, in view of the technical problem of large memory resource occupation during the query process, it is necessary to provide a method and apparatus for processing organizational structure data, a computer device, and a storage medium that can reduce the memory resource occupation during data querying.
[0005] A method for processing organizational structure data, the method includes:
[0006] In response to an organizational structure data writing request, write the organizational information table and the personnel information table carried in the writing request into the disk space respectively; the organizational information table includes the organizational identifier of the organization and the organizational identifier of the superior organization to which the organization belongs; the personnel information table includes the basic information of the personnel and the organizational identifier of the organization to which the personnel belongs;
[0007] Mark the organizational identifier of the organization to which the personnel belongs in the personnel information table as the index information of the basic information of the personnel, and load the organizational identifiers of the respective organizations in the organizational information table from the disk space into the corresponding memory blocks in the memory space;
[0008] Mark the connection pointers between the respective memory blocks according to the superior organization to which each organization belongs;
[0009] Construct a memory architecture tree based on the memory blocks carrying the connection pointers to obtain the organizational structure data writing result.
[0010] An apparatus for processing organizational structure data, the apparatus includes:
[0011] A write request response module, which is used to respond to the organizational structure data write request and write the organizational information table and the personnel information table carried in the write request into the disk space respectively; the organizational information table includes the organizational identifier of the organization and the organizational identifier of the superior organization to which the organization belongs; the personnel information table includes the basic information of the personnel and the organizational identifier of the organization to which the personnel belongs.
[0012] An information table processing module, which is used to mark the organizational identifier of the organization to which the personnel belongs in the personnel information table as the index information of the basic information of the personnel, and load the organizational identifiers of each organization in the organizational information table from the disk space into the corresponding memory blocks in the memory space respectively.
[0013] A connection pointer determination module, which is used to mark the connection pointers between each memory block according to the superior organization to which each organization belongs.
[0014] An architecture tree construction module, which is used to construct a memory architecture tree according to the memory blocks carrying connection pointers to obtain the organizational structure data write result.
[0015] A computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0016] Respond to the organizational structure data write request, and write the organizational information table and the personnel information table carried in the write request into the disk space respectively; the organizational information table includes the organizational identifier of the organization and the organizational identifier of the superior organization to which the organization belongs; the personnel information table includes the basic information of the personnel and the organizational identifier of the organization to which the personnel belongs.
[0017] Mark the organizational identifier of the organization to which the personnel belongs in the personnel information table as the index information of the basic information of the personnel, and load the organizational identifiers of each organization in the organizational information table from the disk space into the corresponding memory blocks in the memory space respectively.
[0018] Mark the connection pointers between each memory block according to the superior organization to which each organization belongs.
[0019] Construct a memory architecture tree according to the memory blocks carrying connection pointers to obtain the organizational structure data write result.
[0020] A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0021] Respond to the organizational structure data write request, and write the organizational information table and the personnel information table carried in the write request into the disk space respectively; the organizational information table includes the organizational identifier of the organization and the organizational identifier of the superior organization to which the organization belongs; the personnel information table includes the basic information of the personnel and the organizational identifier of the organization to which the personnel belongs.
[0022] Mark the organization identifier of the organization to which the person belongs in the personnel information table as the index information of the person's basic information, and load the organization identifiers of each organization in the organization information table from the disk space into the corresponding memory blocks in the memory space;
[0023] Mark the connection pointers between the memory blocks according to the superior organizations to which the organizations belong;
[0024] Construct a memory architecture tree based on the memory blocks carrying connection pointers to obtain the organization architecture data writing result.
[0025] The above organization architecture data processing method, device, computer device and storage medium write organization architecture data in the form of separation of the organization information table and the personnel information table. By storing the organization information table in the disk space and using the connection pointers between memory blocks in the memory space to construct a memory architecture tree corresponding to the organization information table, storing the data in the personnel information table in the disk space, and using the organization identifier of the organization to which the person belongs as the index of the person's basic information, the organization architecture data writing method of the memory architecture tree in the memory space and the personnel information table with indexes in the disk space facilitates reducing the resource occupancy of the memory space in subsequent organization architecture queries and improving the query performance. Description of the Drawings
[0026] Figure 1 It is an application environment diagram of the organization architecture data processing method in an embodiment;
[0027] Figure 2 It is a flowchart of the organization architecture data processing method in an embodiment;
[0028] Figure 3(a) is a schematic diagram of the organization information table in the organization architecture data processing method in an embodiment;
[0029] Figure 3(b) is a schematic diagram of the personnel information table in the organization architecture data processing method in an embodiment;
[0030] Figure 4 It is a schematic diagram of the division of memory blocks in the organization architecture data processing method in an embodiment;
[0031] Figure 5 It is a flowchart of the organization architecture data processing method in another embodiment;
[0032] Figure 6 It is a flowchart of the organization architecture data processing method in still another embodiment;
[0033] Figure 7 It is a schematic diagram of the memory architecture tree in the organization architecture data processing method in an embodiment;
[0034] Figure 8 It is a schematic flowchart of an organizational structure data processing method in another embodiment;
[0035] Figure 9 It is a schematic flowchart of an organizational structure data processing method in yet another embodiment;
[0036] Figure 10 It is a schematic diagram of a terminal interface of an organizational structure data processing method in an embodiment;
[0037] Figure 11 It is a schematic flowchart of an organizational structure data processing method in one of the embodiments;
[0038] Figure 12 It is a structural block diagram of an organizational structure data processing device in an embodiment;
[0039] Figure 13 It is an internal structure diagram of a computer device in an embodiment. Detailed implementation manners
[0040] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0041] The organizational structure data processing method provided by the present application can be applied to an application environment as Figure 1 shown. Among them, the terminal 102 communicates with the server 104 through a network. The server 104 responds to the organizational structure data writing request of the terminal 102, and writes the organization information table and the personnel information table carried in the writing request into the disk space respectively; the organization information table includes the organization identifier of the organization and the organization identifier of the superior organization to which the organization belongs; the personnel information table includes the basic information of the personnel and the organization identifier of the organization to which the personnel belongs; the server 104 marks the organization identifier of the organization to which the personnel belongs in the personnel information table as the index information of the basic information of the personnel, and loads the organization identifiers of each organization in the organization information table from the disk space into the corresponding memory blocks in the memory space respectively; according to the superior organization to which each organization belongs, marks the connection pointers between the memory blocks; constructs a memory architecture tree according to the memory blocks carrying the connection pointers, obtains the organizational structure data writing result, and feeds it back to the terminal 102. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers.
[0042] In one embodiment, as Figure 2 shown, a method for processing organizational structure data is provided, and this method is applied toFigure 1 Taking the server in
[0043] Step 210: In response to the organizational structure data writing request, write the organizational information table and the personnel information table carried in the writing request into the disk space respectively.
[0044] The organizational structure is the overall structure of an organization, which is the most basic structural basis for the organization's process operation, department setting, and function planning, etc. The organizational structure data includes information such as organizations at all levels in an enterprise or organization and the personnel belonging to each organization. The organizational structure data writing request can be sent by a terminal. For example, after a user selects the organizational structure data of a certain organization on the terminal and sends a request, by writing the organizational structure data into the server, it is convenient for other personnel with query permissions to directly access the server and query the complete or partial organizational structure data. The organizational information table includes the organizational identifier of the organization and the organizational identifier of the superior organization to which the organization belongs. The personnel information table includes the basic information of the personnel and the organizational identifier of the organization to which the personnel belongs.
[0045] For example, as shown in FIGS. 3(a) and 3(b), an organization has 6 departments. The department table shown in FIG. 3(a) is the organizational information table, and the organizational identifiers of these 6 departments are Department 1, Department 2, Department 3, Department 4, Department 5, and Department 6 respectively. Among them, Department 1 is the root department with the highest level, Department 2 and Department 3 are sub-departments belonging to Department 1, Department 4 is a sub-department belonging to Department 2, and Department 5 and Department 6 are sub-departments belonging to Department 3. The employee table shown in FIG. 3(b) is an example of the personnel information table, including the identity identifiers of all employees in the organization and the department to which each employee belongs. The basic information of the employees includes the employee identifier. For example, the employee IDs are Employee 1, Employee 2, and Employee 3 respectively. The organizational identifiers of the organizations to which each person belongs can be specifically shown in FIG. 3(b). The organizational identifiers of the organizations to which Employee 1 and Employee 2 belong are Department 1, and the organizational identifier of the organization to which Employee 3 belongs is Department 5, etc. In most enterprise organizational structures, the amount of employee data is much larger than the number of departments, and no further examples will be given here.
[0046] The disk space refers to the external memory of a computer, which has the characteristic that the stored information is not affected by power failure. By writing the organizational information table and the personnel information table into the disk space respectively, the effective storage of the organizational structure data can be realized.
[0047] Step 220: Mark the organizational identifier of the organization to which the personnel belongs in the personnel information table as the index information of the basic information of the personnel, and load the organizational identifiers of each organization in the organizational information table from the disk space into the corresponding memory blocks in the memory space respectively.
[0048] An index is a decentralized storage structure created to accelerate the retrieval of data rows in a table. An index is built for a table and consists of index pages outside the data pages. Each row in an index page contains logical pointers to facilitate the accelerated retrieval of physical data. In a relational database, an index is a separate, physical storage structure that sorts the values of one or more columns in a database table. It is a collection of the values of one or more columns in a table and a list of logical pointers corresponding to the data pages in the table that physically identify these values. When there are a large number of records in a table and a query is to be performed on the table, by creating an index in the table and then finding the index value that meets the query conditions in the index, the corresponding records in the table can be quickly found. By marking the organization identifier of the organization to which a person belongs in the personnel information table as the index information of the person's basic information, it is convenient to find the corresponding person's basic information according to the index information and achieve fast querying.
[0049] In one embodiment, the basic information of the personnel in the personnel information table is saved in the form of an LSM Tree in disk space. The disk space files are organized and managed in a multi-layer structure. According to the index information, the corresponding basic information such as the data records of the personnel can be quickly queried. In addition, using the organization identifier of the organization to which the person belongs, that is, the parent node ID (department ID), as an index and saving it in the LSM Tree, the corresponding list of personnel can be queried according to the department ID, and further the corresponding basic information of the personnel can be queried.
[0050] The memory of a computer is divided into two categories: internal memory and external memory. The internal memory has the characteristics of fast storage information, but all the stored content will be lost after power failure. The external memory mainly includes disk space, and its stored information is not affected by power failure, but the storage speed is relatively slow compared with the internal memory. When the computer is running, since the CPU operation speed is very fast, data is usually loaded from disk space to memory space. The CPU reads data from the memory space, and the processed data is then transferred from the memory space to disk space for storage, which can greatly accelerate the speed of the CPU reading data. That is to say, the CPU does not directly access disk space, but reads data from the memory space. If the data stored in the memory space is relatively small, the CPU has to frequently access the memory and continuously transfer the data from disk space to memory space, resulting in a large occupation of the computer's memory resources and a slow processing speed.
[0051] The process of allocating memory blocks is as follows: First, a pre-allocated memory pool is established in the storage, and then the allocated memory space is internally divided into multiple memory blocks, such as Figure 4As shown, memory blocks 1 - 6 can be partitioned, and two linked lists are used to record the allocated memory blocks and free memory blocks respectively. Each memory block corresponds to a node in the memory architecture tree. Based on the allocated memory blocks, the organization identifiers of each organization in the organization information table are loaded from the disk space into the allocated memory blocks respectively, realizing the loading of data from the disk space to the memory space.
[0052] Step 230: Mark the connection pointers between each memory block according to the superior organization to which each organization belongs.
[0053] After loading the organization identifiers of each organization in the organization information table from the disk space into the corresponding memory blocks in the memory space, each memory block corresponds to each organization in the organization information table. Since there is no clear connection relationship between each memory block, when querying the organizational structure data, it is impossible to quickly and accurately perform downward recursive query according to the organizational structure. By the superior organization to which each organization belongs, mark the superior-subordinate relationship between each organization, and construct the connection pointers between the memory blocks. Among them, the connection pointers between the memory blocks are used to represent the superior-subordinate relationship of the organization. For example, taking the organization loaded into memory block 1 as Department 2, based on the organization information table, the superior organization to which Department 2 belongs is Department 1, then a connection pointer is established between Department 2 and Department 1. In one embodiment, the connection pointer between the memory blocks can be from the parent department to the child department. In another embodiment, the connection pointers between the memory blocks can be divided into the first type of pointers from the parent department to the child department and the second type of pointers from the child department to the parent department, which are used to distinguish the superior-subordinate relationship between two memory blocks connected by the connection pointer and realize two-way data query. Each memory block is a node, and each node has connection pointers pointing to the parent node and the child node, so it is convenient to query the node upward or downward, greatly improving the performance of recursive query.
[0054] Step 240: Construct a memory architecture tree based on the memory blocks carrying connection pointers to obtain the write result of the organizational structure data.
[0055] The memory architecture tree refers to an architecture tree constructed in the memory space to represent the hierarchical relationship between each organization of an organization or enterprise. Based on the connection pointers between each memory block, construct an architecture tree from the root organization downward. Since only the information of each organization is loaded in the memory block, the memory architecture tree does not contain personnel information. As the leaf nodes of the organizational structure, when querying the personnel information included in the organization, since the personnel information itself does not contain structural hierarchy information, it is not necessary to maintain the information of its parent node, that is, the organization to which the personnel belongs, in the memory space, but to index its parent node in the disk space.
[0056] Based on each node in the memory architecture tree, downward recursive query of the organizational structure can be realized. By storing the personnel information table in the disk space and preloading the organizational information table into the memory space, the separation of personnel information and organizational information is achieved. When querying the organizational structure data, the query of the organizational hierarchy can be directly based on the data preloaded into the memory space. Then, based on the index information of the personnel information table in the disk space, the basic information of the personnel can be obtained. In the embodiment, in the memory space, with each enterprise or organization as a dimension and each department in the enterprise or organization as a node, a corresponding memory architecture tree is constructed. Each memory architecture tree corresponds to the enterprise or organization. Specifically, the memory architecture tree can be marked with the name of the enterprise or organization or other forms of ID as a label for easy distinction, so as to realize the management of multiple enterprises or organizations by the server.
[0057] Compared with the prior art, in the prior art, the data is stored in the form of an adjacency list. Each node only has the information of the parent node. In the business scenario where recursive downward query is required, the query database needs to be called multiple times, and the query performance is poor, which cannot meet the performance requirements of large-scale tree-shaped organizational structures. In the prior art, the technical method of saving the complete path has better performance in recursive downward query, but there are more redundant node information. For large-scale organizational structures, it consumes a lot of storage space, and the overhead of moving nodes is relatively large. All child nodes' keys need to be updated, and the write performance is poor, which cannot meet the needs of enterprises to flexibly modify the organizational structure. This solution is based on the organizational structure tree solution that separates departments and employees. The departments and employees are saved in two separate tables. The database constructs a department tree in the memory space, which greatly improves the recursive query performance. Separating employees and departments can reduce the resource occupancy of the memory space. When moving a department, only the parent department identifier of the node needs to be changed, and the modification operation is lightweight and fast, improving the usage experience of the enterprise organizational structure.
[0058] The above organizational structure data processing method writes the organizational structure data in the form of separating the organizational information table and the personnel information table. By storing the organizational information table in the disk space and using the connection pointers between memory blocks in the memory space to construct a memory architecture tree corresponding to the organizational information table, and storing the data in the personnel information table in the disk space. By using the organizational identifier of the organization to which the personnel belong as the index of the basic information of the personnel, and the way of writing the organizational structure data of the memory architecture tree in the memory space and the personnel information table with indexes in the disk space, it is convenient to reduce the resource occupancy of the memory space and improve the query performance in subsequent organizational structure queries.
[0059] In one embodiment, as Figure 5 shown, the organizational structure data processing method further includes an organizational structure query process, which specifically includes steps 510 to 530.
[0060] Step 510: In response to the organizational structure query request, extract the root organization identifier corresponding to the organizational structure query request.
[0061] Step 520: Read the memory block corresponding to the root organization identifier from the memory space, and recursively query the sub-organizations of the root organization downward according to the memory architecture tree where the memory block is located.
[0062] Step 530: Using the organizational identifier of the sub-organization as an index, query the basic information of the personnel corresponding to the sub-organization from the disk space to obtain the query result of the organizational structure data.
[0063] Based on the written organizational structure data, the server can generate an organizational structure diagram including organizations and personnel and send it to the terminal. The organizational structure query request refers to a data query request sent by the terminal to the server. In one embodiment, an organizational structure query interface is displayed on the GUI interface of the terminal. For example, by clicking "Address Book" in the interface menu bar, the organizational structure data of the organization can be obtained, and the basic information of the object to be queried can be obtained.
[0064] The root organization refers to the department with the highest level in the organization. The root organization identifier corresponding to the organizational structure query request refers to the organizational identifier of the organization with the highest level in the organization corresponding to the organizational structure query request. Specifically, when the server receives a user's organizational structure query request carrying an ID identifier sent to the server by triggering the query interface of the terminal, the ID identifier can specifically be an organization name, an organization code, etc., such as the name of an enterprise. Through the ID identifier, the memory block corresponding to the root organization is determined in the memory space, the corresponding memory architecture tree is obtained, and based on the hierarchical structure of the memory architecture tree, the sub-organizations of the root organization are recursively queried downward.
[0065] Specifically, the process of recursively querying downward includes: taking the root node as the query starting point, according to the connection pointers between the memory blocks of the memory architecture tree, querying the sub-organizations directly associated with the root organization through the connection pointers, and then taking this sub-organization as the parent organization, and in the same way, obtaining all the sub-organizations of this parent organization, so as to obtain the sub-organizations directly or indirectly managed by the root organization.
[0066] Through the memory architecture tree, the organizational identifiers of all the sub-organizations of the root organization can be obtained. The complete organizational structure, in addition to the hierarchical relationship between organizations, also includes the personnel belonging to each organization. After querying each sub-organization of the root organization, using the organizational identifier of this sub-organization as an index, query the basic information of the personnel corresponding to this sub-organization from the disk space, and based on the personnel information of each sub-organization, obtain the complete query result of the organizational structure data.
[0067] In one embodiment, such as Figure 6As shown, in step 520, read the memory block corresponding to the root organization identifier from the memory space, and recursively query the sub-organizations of the root organization downward according to the memory architecture tree where the memory block is located, including steps 610 to 620.
[0068] Step 610, read the memory block corresponding to the root organization identifier from the memory space, and obtain the snapshot data of the memory architecture tree where the memory block is located.
[0069] Step 620, recursively query the sub-organizations of the root organization downward according to the snapshot data of the memory architecture tree where the memory block is located.
[0070] A snapshot refers to a fully available copy of a specified data set, which includes the image of the corresponding data at a certain point in time (the time point when the copy starts). A snapshot can be a copy of the data it represents or a replica of the data. Through snapshot processing, another data access channel is provided for storage users. When the original data is being processed online, users can access the snapshot data. As Figure 7 shown, the complete organizational structure tree of the enterprise is saved in the memory space. Each node of the architecture tree maintains a serial number 1, 2, 3, 4, which increases within the enterprise. The user of the terminal, as the caller, can apply for a snapshot at a certain point in time, such as when sending a query request to the server. At this time, the storage records the serial number of the snapshot time point and the reference count of the caller, and returns the snapshot ID of the applied snapshot to the caller. So that the caller can obtain the data information in the snapshot data based on the snapshot ID, where the reference count of the caller refers to the number of callers.
[0071] Through snapshot processing, after the snapshot time point, modification operations (update and delete operations) on the architecture tree will additionally copy the data of the node to the snapshot data set and update the serial number of the data. When the caller reads the data with the snapshot ID, the storage will query the data set corresponding to the snapshot. This snapshot data set is the data at the time when the snapshot is generated, including the unchanged data and the records subsequently copied to the snapshot data set due to changes. The storage merges these two parts of data and returns it to the caller to ensure that the data obtained by the caller is not affected by the update and delete operations after the snapshot time and ensure the accuracy of the data.
[0072] In one embodiment, as Figure 8 shown, before recursively querying the sub-organizations of the root organization downward according to the snapshot data of the memory architecture tree where the memory block is located, it further includes steps 810 and 820.
[0073] Step 810, obtain the query parameters.
[0074] Step 820, based on the query parameters, divide the snapshot data into multiple sub-snapshot data.
[0075] Step 620, according to the snapshot data of the memory architecture tree where the memory block is located, recursively query downward the sub-organizations of the root organization, including:
[0076] Step 830, according to each sub-snapshot data, recursively query downward the sub-organizations of the root organization, and collect the sub-organizations obtained by querying based on each sub-snapshot data.
[0077] Among them, the query parameter includes any one of the batch query parameter and the segmented concurrent query parameter. For the case of a large organizational structure, the organizational structure tree can be obtained by means of batch pulling or segmented concurrent pulling. The batch query parameter can be the amount of data pulled each time when the organizational structure data is pulled in multiple times successively. The segmented concurrent query parameter can be the amount of data pulled each time when the organizational structure data is pulled in multiple segments synchronously. Based on the query parameter, the snapshot data can be divided into multiple sub-snapshot data, and by means of batch pulling or segmented concurrent pulling, the data processing pressure in the memory space can be reduced and the data processing efficiency can be improved. Based on the snapshot data, there is no need to consider the impact of the modification operation on the memory architecture tree. By collecting the sub-organizations obtained by querying the sub-snapshot data, the sub-organizations corresponding to the root organization can be quickly and accurately obtained, and then the organizational structure data can be obtained by indexing the personnel information table in the disk space.
[0078] In one embodiment, while obtaining the snapshot data of the memory architecture tree where the memory block is located, it also includes recording the retention duration of the snapshot data. When all sub-snapshot data queries are completed or the retention duration of the snapshot data reaches the preset duration threshold, the memory space occupied by the snapshot data is released.
[0079] By recording the retention duration of the snapshot data, after the caller no longer uses the snapshot data, it notifies the storage to release the snapshot. The caller no longer using the snapshot data can specifically be that all sub-snapshot data queries are completed or the retention duration of the snapshot data reaches the preset duration threshold. At this time, the snapshot list in the memory space and the additional snapshot nodes copied due to modification are cleared, and their memory space is released. By restricting the retention time of the snapshot, the expansion of the snapshot data set occupying more memory space is avoided, and the resource occupation of the memory space is reduced.
[0080] In a typical organizational structure query process, read the organizational structure department tree in the memory space, recursively traverse downward all sub-department IDs of the specified department, and then query the corresponding basic personnel information in the LSM Tree in the disk space with these department IDs to complete a recursive query.
[0081] In one embodiment, as Figure 9 shown, the organizational structure data processing method further includes an organizational structure modification process, specifically including Step 910 to Step 920.
[0082] Step 910: In response to the organizational structure modification request, update the modification data corresponding to the organizational structure modification request to the disk space.
[0083] Step 920: When the modification data in the disk space includes the updated organizational information table, update the corresponding memory architecture tree in the memory space according to the updated organizational information table.
[0084] For the modification operation of the organizational structure applied by the terminal, first, the server extracts the modification data carried in the organizational structure modification request based on the organizational structure modification request sent by the terminal. The modification data can specifically be to specify replacing data A with data B, or it can be a complete replacement of the entire personnel information table or organizational information table. Based on the modification data, a batch write operation is generated to the disk space. If the submission write is successful, the modification data is updated to the disk space. When the original written data is replaced, based on the modified written data in the disk space, when the modification data in the disk space includes the updated organizational information table, the memory architecture tree is modified to ensure that the memory architecture tree loaded and constructed in the disk space and the memory space is consistent. When the modification data in the disk space includes the updated organizational information table, for example, when only the personnel information table is modified, directly modifying the written data in the disk space can complete the organizational structure modification. The modification operation is lightweight and convenient, improving the usage experience of the enterprise organizational structure.
[0085] In one embodiment, the updated organizational information table includes the superior organization to which the target organization belongs. Updating the corresponding memory architecture tree in the memory space according to the updated organizational information table includes: searching for the first target memory block corresponding to the target organization, the second target memory block corresponding to the initial superior organization of the target organization, and the third target memory block corresponding to the updated superior organization of the target organization in the memory space; discarding the connection pointer between the first target memory block and the second target memory block, and establishing a connection pointer between the first target memory block and the third target memory block to obtain the updated memory architecture tree.
[0086] Specifically, in an enterprise organizational structure, operations such as moving departments often occur, that is, moving a department under another department. Only the parent node identifier of the department stored in the disk space needs to be modified, and the memory architecture tree is modified to complete an operation of moving a department. Correspondingly, the modification of the memory architecture tree is specifically the modification of the connection pointer. First, based on the data before modification, the original connection pointer is determined and discarded, and then based on the data after modification, the newly added connection pointer is established to complete the update of the connection pointer.
[0087] The present application also provides an application scenario that applies the above organizational structure data processing method. Taking the enterprise WeChat as an example of the application scenario, specifically, the application of the organizational structure data processing method in this application scenario is as follows:
[0088] The administrator of Company A can view and manage the enterprise address book of Company A through the management terminal of WeCom. As Figure 10 shown, Company A includes departments such as the R & D department, the sales department, and the marketing department. The administrator can enter the department ID of the root department in the corresponding interface of the address book menu of WeCom. For example, the company name: Company A. Then, taking Company A as the root department, write the sub - departments and department members of Company A in the department management interface. The specific writing method can be to batch - import each sub - department of the root department and the members of each sub - department through a data table, or to manually add a single sub - department by department level for individual settings. For example, select a certain department, add department members, set the superior department to which the department belongs, delete the department, add sub - departments, and modify the department name, etc. Batch - importing data is the most efficient and fast processing method. The administrator inputs the department table and the member table through the terminal, writes the department table and the member table into the disk space for storage, then saves the member table in the disk space in the form of an LSM Tree, and loads the department IDs in the department table in the disk space into each memory block in the memory space. Based on the superior departments of each department, set the connection pointers between each memory block, thus constructing a memory architecture tree, and set the department ID to which each member in the member table in the disk space belongs as the index information of the member, realizing the writing of the organizational structure data. After the writing of the organizational structure information is completed, in the terminal of WeCom, through the trigger operation of the address book, the department IDs of the sub - departments under the root department can be correspondingly displayed. By triggering the displayed sub - departments, based on the connection pointers between each memory block of the memory architecture tree in the memory space, find each sub - department with this sub - department as the parent department, and use the department ID of this sub - department as the index information to find the member information of this sub - department in the disk space, and feedback the department IDs of the sub - departments and the member information to the terminal and display them on the terminal interface, thus realizing the downward recursive query of the organizational structure of each department of Company A.
[0089] In the embodiment, when the server responds to the trigger operation of the address book by the user through the terminal, it generates snapshot data at that moment. For subsequent further recursive queries, the data search object in the memory space is this snapshot data, thus avoiding data errors caused by the update of the organizational structure data by people with address book update permissions such as administrators during the query process, and ensuring that the query object is the complete organizational structure data during each query operation. When this snapshot data is no longer used, release this snapshot data, clean up the snapshot list and the additional snapshot nodes copied due to the modification operations of the architecture tree after the snapshot time point, release its memory space, limit the retention time of the snapshot data, and avoid the snapshot data from expanding and occupying more memory space.
[0090] Specifically, in the organizational structure query process, the organizational structure department tree in the memory space is read, and all the sub-department IDs of the specified department are recursively traversed downward. Then, the corresponding employee records are queried in the LSM Tree using these department IDs to complete a recursive query.
[0091] In addition, for the modification operation of the organizational structure, first, a batch write request is generated based on the modification operation. If the batch write is successful in the disk space, the in-memory architecture tree is modified according to the modification content to ensure that the disk space and the in-memory architecture tree are consistent. In particular, in enterprise organizational structures, the operation of moving a department often occurs, that is, moving a department under another department. Only the parent node ID of the department in the storage needs to be modified, and the in-memory architecture tree is modified to complete an operation of moving a department.
[0092] In most enterprise organizational structures, the amount of employee data is much larger than the number of departments. Based on the solution of the enterprise organizational structure tree with separation of departments and employees, it not only ensures excellent storage read and write performance but also saves the occupancy of the running memory space, strongly supporting the service operation of large-scale organizational structures.
[0093] In other embodiments, the method can also be applied to scenarios with attribute hierarchy such as the home-school address book. In the home-school address book, the organization information table can specifically be schools like School A, grades like Grade X, classes like Class Y, etc., and the personnel information table can specifically be the basic information of each student in each class. The processing process is the same as the application in the enterprise described above and will not be elaborated here.
[0094] In one embodiment, a method for processing organizational structure data is provided, as Figure 11 shown, specifically including the following steps from step 1102 to step 1126.
[0095] Step 1102, in response to an organizational structure data write request, write the organization information table and the personnel information table carried in the write request into the disk space respectively.
[0096] Step 1104, mark the organization identifier of the organization to which the personnel in the personnel information table belongs as the index information of the basic information of the personnel, and load the organization identifiers of each organization in the organization information table from the disk space into the corresponding memory blocks in the memory space respectively.
[0097] Step 1106, mark the connection pointers between the memory blocks according to the superior organization to which each organization belongs.
[0098] Step 1108, construct an in-memory architecture tree based on the memory blocks with connection pointers to obtain the result of writing organizational structure data.
[0099] Step 1110, in response to an organizational structure query request, extract the root organization identifier corresponding to the organizational structure query request.
[0100] Step 1112, read the memory block corresponding to the root organization identifier from the memory space, obtain the snapshot data of the memory architecture tree where the memory block is located, and record the retention time of the snapshot data.
[0101] Step 1114: obtain query parameters, and divide the snapshot data into a plurality of sub-snapshot data based on the query parameters.
[0102] Step 1116, based on each sub-snapshot data, recursively query the sub-organizations of the root organization downward, and aggregate the sub-organizations obtained based on the query of each sub-snapshot data.
[0103] Step 1118, using the organization ID of the sub-organization as an index, query the disk space for basic information of the personnel corresponding to the sub-organization to obtain the organizational structure data query result.
[0104] Step 1120: when the query of each sub-snapshot data is completed or the retention time of the snapshot data reaches a preset time threshold, the memory space occupied by the snapshot data is released.
[0105] Step 1122, responding to the organizational structure modification request, updating the modification data corresponding to the organizational structure modification request to the disk space.
[0106] Step 1124, when the modified data in the disk space includes updating the parent organization of the target organization, search the memory space for the first target memory block corresponding to the target organization, the second target memory block corresponding to the initial parent organization of the target organization, and the third target memory block corresponding to the updated parent organization of the target organization.
[0107] Step 1126, discard the connection pointer between the first target memory block and the second target memory block, and establish a connection pointer between the first target memory block and the third target memory block to obtain an updated memory architecture tree.
[0108] It should be understood that although Figure 2 , Figures 5 - 6 , Figures 8 - 9 as well as Figure 11 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 , Figures 5 - 6 , Figures 8 - 9 as well as Figure 11At least a part of the steps therein may include multiple steps or multiple phases, and these steps or phases do not necessarily need to be executed and completed at the same moment, but can be executed at different moments, and the execution order of these steps or phases does not necessarily need to be sequential, but can be executed alternately or in turn with at least a part of other steps or steps or phases in other steps.
[0109] In one embodiment, as Figure 12 shown, an organizational structure data processing device 1200 is provided. This device can be a software module, a hardware module, or a combination of both to form a part of a computer device. Specifically, the device includes: a write request response module 1210, an information table processing module 1220, a connection pointer determination module 1230, and an architecture tree construction module 1240, where:
[0110] The write request response module 1210 is configured to respond to an organizational structure data write request and write the organizational information table and the personnel information table carried in the write request into the disk space respectively; the organizational information table includes the organizational identifier of the organization and the organizational identifier of the superior organization to which the organization belongs; the personnel information table includes the basic information of the personnel and the organizational identifier of the organization to which the personnel belongs.
[0111] The information table processing module 1220 is configured to mark the organizational identifier of the organization to which the personnel belongs in the personnel information table as the index information of the basic information of the personnel, and load the organizational identifiers of each organization in the organizational information table from the disk space into the corresponding memory blocks in the memory space respectively.
[0112] The connection pointer determination module 1230 is configured to mark the connection pointers between each memory block according to the superior organization to which each organization belongs.
[0113] The architecture tree construction module 1240 is configured to construct a memory architecture tree based on the memory blocks carrying connection pointers to obtain the result of writing the organizational structure data.
[0114] In one of the embodiments, the organizational structure data processing device further includes an organizational structure query module. The organizational structure query module is configured to respond to an organizational structure query request, extract the root organizational identifier corresponding to the organizational structure query request; read the memory block corresponding to the root organizational identifier from the memory space, and recursively query the sub-organizations of the root organization downward according to the memory architecture tree where the memory block is located; use the organizational identifier of the sub-organization as an index to query the basic information of the personnel corresponding to the sub-organization from the disk space to obtain the result of querying the organizational structure data.
[0115] In one embodiment, the organizational structure query module is further configured to read a memory block corresponding to the root organization identifier from the memory space, and obtain snapshot data of the memory architecture tree where the memory block is located; according to the snapshot data of the memory architecture tree where the memory block is located, recursively query the sub-organizations of the root organization downward.
[0116] In one embodiment, the organizational structure query module is further configured to obtain query parameters, where the query parameters include any one of batch query parameters and segmented concurrent query parameters; based on the query parameters, divide the snapshot data into multiple sub-snapshot data; according to each sub-snapshot data, recursively query the sub-organizations of the root organization downward, and collect the sub-organizations obtained by querying based on each sub-snapshot data.
[0117] In one embodiment, the organizational structure query module is further configured to record the retention duration of the snapshot data; when the query of each sub-snapshot data is completed or the retention duration of the snapshot data reaches a preset duration threshold, release the memory space occupied by the snapshot data.
[0118] In one embodiment, the organizational structure data processing device further includes an organizational structure modification module, and the organizational structure modification module is configured to respond to an organizational structure modification request, and update the modification data corresponding to the organizational structure modification request to the disk space; when the modification data in the disk space includes an updated organizational information table, update the corresponding memory architecture tree in the memory space according to the updated organizational information table.
[0119] In one embodiment, the organizational structure modification module is further configured to find a first target memory block corresponding to the target organization, a second target memory block corresponding to the initial superior organization of the target organization, and a third target memory block corresponding to the updated superior organization of the target organization in the memory space; discard the connection pointer between the first target memory block and the second target memory block, and establish a connection pointer between the first target memory block and the third target memory block to obtain an updated memory architecture tree.
[0120] The above organizational structure data processing device writes organizational structure data in the form of separation of the organizational information table and the personnel information table. By storing the organizational information table in the disk space, using the connection pointers between memory blocks in the memory space to construct a memory architecture tree corresponding to the organizational information table, storing the data in the personnel information table in the disk space, and using the organizational identifier of the organization to which the personnel belong as the basic information index of the personnel, the organizational structure data writing method of the memory architecture tree in the memory space and the personnel information table with indexes in the disk space facilitates reducing the memory resource occupation in subsequent organizational structure queries and improving the query performance.
[0121] For the specific limitations of the organizational structure data processing device, reference can be made to the limitations of the organizational structure data processing method in the foregoing text, which will not be elaborated here. Each module in the above organizational structure data processing device can be implemented in whole or in part by software, hardware, and their combination. Each of the above modules can be embedded in the processor of the computer device in hardware form or be independent of it, or be stored in the memory of the computer device in software form, so as to facilitate the processor to call and execute the operations corresponding to each of the above modules.
[0122] In one embodiment, a computer device is provided. The computer device can be a server, and its internal structure diagram can be as Figure 13 shown. The computer device includes a processor, a memory, and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store organizational structure data processing data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements an organizational structure data processing method.
[0123] Those skilled in the art can understand that Figure 13 the structure shown in
[0124] is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0125] In one embodiment, a computer device is further provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in each of the above method embodiments are implemented.
[0126] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above various methods. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0127] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0128] The above embodiments only represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.
Claims
1. A method for processing organizational structure data, the method comprises: Responding to an organizational structure data writing request, and respectively writing the organizational information table and the personnel information table carried in the writing request into a disk space. The organizational information table includes the organizational identifier of an organization and the organizational identifier of the superior organization to which the organization belongs. The personnel information table includes the basic information of a person and the organizational identifier of the organization to which the person belongs; The basic information of the persons in the personnel information table is stored in the form of an LSM Tree in the disk space; Marking the organizational identifier of the organization to which the persons in the personnel information table belong as the index information of the basic information of the persons and storing it in the LSM Tree, and respectively loading the organizational identifiers of the organizations in the organizational information table from the disk space into corresponding memory blocks in the memory space; Marking the connection pointers between the memory blocks according to the superior organizations to which the organizations belong; Constructing a memory architecture tree based on the memory blocks with connection pointers to obtain the result of writing the organizational structure data.
2. The method according to claim 1, wherein, the method further comprises: Responding to an organizational structure query request, and extracting the root organizational identifier corresponding to the organizational structure query request; Reading the memory block corresponding to the root organizational identifier from the memory space, and recursively querying the sub-organizations of the root organization downward according to the memory architecture tree where the memory block is located; Querying the basic information of the persons corresponding to the sub-organizations from the disk space with the organizational identifiers of the sub-organizations as indexes to obtain the result of querying the organizational structure data.
3. The method according to claim 2, wherein, the step of reading the memory block corresponding to the root organizational identifier from the memory space and recursively querying the sub-organizations of the root organization downward according to the memory architecture tree where the memory block is located includes: Reading the memory block corresponding to the root organizational identifier from the memory space, and obtaining the snapshot data of the memory architecture tree where the memory block is located; Recursively querying the sub-organizations of the root organization downward according to the snapshot data of the memory architecture tree where the memory block is located.
4. The method according to claim 3, wherein, before the step of recursively querying the sub-organizations of the root organization downward according to the snapshot data of the memory architecture tree where the memory block is located, it further comprises: Obtaining query parameters, where the query parameters include any one of batch query parameters and segmented concurrent query parameters; Dividing the snapshot data into multiple sub-snapshot data based on the query parameters; The step of recursively querying the sub-organizations of the root organization downward according to the snapshot data of the memory architecture tree where the memory block is located includes: Recursively querying the sub-organizations of the root organization downward according to each of the sub-snapshot data, and collecting the sub-organizations queried based on each of the sub-snapshot data.
5. The method according to claim 4, wherein, while obtaining the snapshot data of the memory architecture tree where the memory block is located, it further includes: Recording the retention duration of the snapshot data; Releasing the memory space occupied by the snapshot data when all the sub-snapshot data have been queried or the retention duration of the snapshot data reaches a preset duration threshold.
6. The method according to claim 1, It is characterized in that The method further includes: In response to an organizational structure modification request, updating the modification data corresponding to the organizational structure modification request to the disk space; When the modification data in the disk space includes an updated organizational information table, updating the corresponding memory architecture tree in the memory space according to the updated organizational information table.
7. The method according to claim 6, It is characterized in that The updated organizational information table includes the superior organization to which the updated target organization belongs; The updating the corresponding memory architecture tree in the memory space according to the updated organizational information table includes: Searching in the memory space for a first target memory block corresponding to the target organization, a second target memory block corresponding to the initial superior organization of the target organization, and a third target memory block corresponding to the updated superior organization of the target organization; Discarding the connection pointer between the first target memory block and the second target memory block, and establishing a connection pointer between the first target memory block and the third target memory block to obtain an updated memory architecture tree.
8. An organizational structure data processing device, It is characterized in that The device includes: A write request response module, configured to respond to an organizational structure data write request, and write the organizational information table and the personnel information table carried in the write request into the disk space respectively; the organizational information table includes the organizational identifier of the organization and the organizational identifier of the superior organization to which the organization belongs; the personnel information table includes the basic information of the personnel and the organizational identifier of the organization to which the personnel belongs; the basic information of the personnel in the personnel information table is stored in the form of an LSM Tree in the disk space; An information table processing module, configured to mark the organizational identifier of the organization to which the personnel belongs in the personnel information table as the index information of the basic information of the personnel and store it in the LSM Tree, and load the organizational identifiers of the respective organizations in the organizational information table from the disk space into the corresponding memory blocks in the memory space; A connection pointer determination module, configured to mark the connection pointers between the respective memory blocks according to the superior organizations to which the respective organizations belong; An architecture tree construction module, configured to construct a memory architecture tree according to the memory blocks carrying connection pointers to obtain an organizational structure data write result.
9. The device according to claim 8, It is characterized in that The organizational structure data processing device further includes an organizational structure query module, and the organizational structure query module is configured to respond to an organizational structure query request and extract the root organizational identifier corresponding to the organizational structure query request; Reading the memory block corresponding to the root organizational identifier from the memory space, and recursively querying the sub-organizations of the root organization downward according to the memory architecture tree where the memory block is located; using the organizational identifier of the sub-organization as an index, querying the basic information of the personnel corresponding to the sub-organization from the disk space to obtain an organizational structure data query result.
10. The device according to claim 9, It is characterized in that The organizational structure query module is further configured to read a memory block corresponding to the root organization identifier from the memory space, and obtain snapshot data of the memory architecture tree where the memory block is located; and recursively query the sub-organizations of the root organization downward according to the snapshot data of the memory architecture tree where the memory block is located.
11. The apparatus according to claim 10, wherein, the organizational structure query module is further configured to obtain query parameters, where the query parameters include any one of batch query parameters and segmented concurrent query parameters; based on the query parameters, divide the snapshot data into multiple sub-snapshot data; and recursively query the sub-organizations of the root organization downward according to each of the sub-snapshot data, and collect the sub-organizations obtained by querying based on each of the sub-snapshot data.
12. The apparatus according to claim 11, wherein, the organizational structure query module is further configured to record the retention duration of the snapshot data; when the query of each of the sub-snapshot data is completed or the retention duration of the snapshot data reaches a preset duration threshold, release the memory space occupied by the snapshot data.
13. The apparatus according to claim 8, wherein, the organizational structure data processing apparatus further includes an organizational structure modification module, and the organizational structure modification module is configured to respond to an organizational structure modification request, and update the modification data corresponding to the organizational structure modification request to the disk space; when the modification data in the disk space includes an updated organizational information table, update the corresponding memory architecture tree in the memory space according to the updated organizational information table.
14. The apparatus according to claim 13, wherein, the organizational structure modification module is further configured to find a first target memory block corresponding to a target organization, a second target memory block corresponding to an initial superior organization of the target organization, and a third target memory block corresponding to an updated superior organization of the target organization in the memory space; discard the connection pointer between the first target memory block and the second target memory block, and establish a connection pointer between the first target memory block and the third target memory block to obtain an updated memory architecture tree.
15. A computer device, including a memory and a processor, where the memory stores a computer program, wherein, when the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
16. A computer-readable storage medium, storing a computer program, wherein, when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Web imaging showing organization structure
CN102750321A
Organizational structure data processing method and device, computer equipment and storage medium
CN109656921A
Organization architecture diagram generation method and device, computer equipment and storage medium
CN110442752A