Data query method and device, electronic equipment and computer storage medium

By partitioning data by organizational dimension and using bitmap storage, combined with caching and Kryo serialization technology, the data query process of the ERP system is optimized, solving the problems of low query efficiency and waste of hardware resources in existing technologies, and realizing efficient data query and personalized processing.

CN116108010BActive Publication Date: 2026-04-07KINGDEE SOFTWARE(CHINA) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-16
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

In ERP systems, when the organizational structure is complex and the data is massive, the existing technology uses multiple relational tables to maintain the data, which leads to low query efficiency, easy errors, excessive consumption of hardware resources, and complicated operation, making it difficult to meet the query needs of large-scale data.

Method used

The method of partitioning data by organizational dimension is adopted, and bitmap storage is used to store the split data. The relationship between organization and data is recorded through the first data model, which reduces the amount of data in a single table, and the query process is optimized by caching and Kryo serialization technology.

Benefits of technology

It reduces code logic complexity, decreases hardware resource consumption, improves query efficiency, solves slow SQL and memory overflow problems, and meets personalized data processing needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116108010B_ABST
    Figure CN116108010B_ABST
Patent Text Reader

Abstract

The application relates to a data query method and device, electronic equipment and a computer storage medium, and is applied to a system comprising multiple organizations, such as an ERP (Enterprise Resource Planning) system and the like; the method comprises the following steps: acquiring a query request sent by a client, the query request being used for querying data that can be used by a first organization; in response to the query request, determining an index value of the data that can be used by the first organization in a master table according to a first data model; the first data model comprises a first record, the first record recording index information of the data that can be used by the first organization in the master table, the master table recording a plurality of pieces of data and an index value corresponding to any one piece of data in the pieces of data, and the first record being a record corresponding to the first organization in the first data model; and obtaining a query result according to the index value of the data that can be used by the first organization in the master table. The technical scheme reduces the data quantity of a single table and the number of relationship tables that need to be maintained, and improves the query efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a data query method, apparatus, electronic device, and computer storage medium. Background Technology

[0002] Currently, in systems such as ERP (Enterprise Resource Planning), data management is typically maintained using multiple relationship tables (such as a basic data master table, a scope of use table, a usage registration table, and an exclusion table). Different relationship tables can be used to record basic data, record data usage relationships, and record personalized information of the data, respectively.

[0003] When the organizational structure is complex and the data is massive, the amount of data recorded in the table is large, querying the data in the table takes a long time, the operation efficiency is low and it is easy to make mistakes. Summary of the Invention

[0004] Therefore, it is necessary to provide a data query method, apparatus, electronic device, and computer storage medium to address the aforementioned technical problems.

[0005] Firstly, this application provides a data query method, the method comprising:

[0006] Obtain a query request sent by the client. The query request is used to query data that a first organization can use. The first organization is any organization in the business system, and the business system includes multiple organizations.

[0007] In response to the query request, the index value of the data that the first organization can use in the main table is determined according to the first data model; the first data model includes a first record, which records the index information of the data that the first organization can use in the main table, the main table records multiple data and the index value corresponding to any one of the multiple data, and the first record is the record in the first data model corresponding to the first organization;

[0008] The query results are obtained based on the index value of the data available to the first organization in the main table, and the query results are sent to the client.

[0009] In one embodiment, the index information includes bitmap data; determining the index value of the data usable by the first organization in the main table according to the first data model includes:

[0010] Determine whether the cache contains the bitmap data;

[0011] When the bitmap data is included in the cache, the bitmap data is deserialized to obtain the index value of the data that the first organization can use in the main table.

[0012] In some possible implementations, the bitmap data can be deserialized using Kryo to obtain the index value of the data that the first organization can use in the main table.

[0013] In some possible embodiments, the bitmap data can be in RoaringBitmap format. Neither relational databases nor Redis caches support directly storing this data type, so it needs to be serialized before being stored in the database. Kryo can be used for serialization. When querying data, the retrieved serialized data needs to be deserialized into a RoaringBitmap object before it can be used correctly in the program. In one embodiment, the method further includes:

[0014] If the bitmap data is not included in the cache, retrieve it from the database.

[0015] The bitmap data is obtained and saved to a cache.

[0016] The bitmap data is deserialized to obtain the index value of the data that the first organization can use in the main table.

[0017] In one embodiment, the method further includes:

[0018] When the bitmap data is not included in the cache and does not exist in the database, empty bitmap data is generated and saved to the cache.

[0019] The bitmap data is deserialized to obtain the index value of the data that the first organization can use in the main table.

[0020] In one embodiment, the method further includes:

[0021] When the data available to the first organization changes, the bitmap data is updated, the updated bitmap data is processed to obtain serialized bitmap data, and the serialized bitmap data is updated or added to the database.

[0022] In one embodiment, it further includes:

[0023] When the first organization personalizes any usable data to obtain derived data, a record containing the derived data is added to the main table. The derived data record contains the index value of the derived data in the main table and the index value of any data in the main table. The first record is updated according to the index value of the derived data in the derived data record, so that the first record contains the index information of the derived data in the main table but does not contain the index information of any data in the main table.

[0024] When the first organization restores the derived data, it updates the first record according to the index value of any one of the data records in the derived data record, so that the first record records the index information of the any one of the data in the main table, but does not record the index information of the derived data in the main table.

[0025] Secondly, this application also provides a data query device, the device comprising:

[0026] The acquisition module is used to acquire query requests sent by the client, the query requests being used to retrieve data that the first organization can use.

[0027] The first organization is any organization in the business system, and the business system includes multiple organizations;

[0028] A first processing module is configured to respond to the query request and determine the index value of the data that the first organization can use in the main table according to a first data model. The first data model includes a first record, which records the index information of the data that the first organization can use in the main table. The main table records multiple data entries and the index value corresponding to any one of the multiple data entries. The first record is the record in the first data model corresponding to the first organization.

[0029] The second processing module is used to obtain query results based on the index value of the data available to the first organization in the main table, and to send the query results to the client.

[0030] In one embodiment, the index information includes bitmap data; in determining the index value of the data that the first organization can use in the main table according to the first data model, the first processing module is specifically used to determine whether the cache includes the bitmap data; if the cache includes the bitmap data, deserialize the bitmap data to obtain the index value of the data that the first organization can use in the main table.

[0031] In some possible implementations, the bitmap data can be deserialized using Kryo to obtain the index value of the data that the first organization can use in the master table.

[0032] In one embodiment, the first processing module is further configured to, when the bitmap data is not included in the cache, retrieve the bitmap data from the database and save the retrieved bitmap data to the cache; and to, deserialize the bitmap data to obtain the index value of the data that the first organization can use in the main table.

[0033] In one embodiment, the first processing module is further configured to generate empty bitmap data and save the generated empty bitmap data to the cache when the bitmap data is not included in the cache and the bitmap data does not exist in the database; and to deserialize the bitmap data to obtain the index value of the data that the first organization can use in the main table.

[0034] In one embodiment, the apparatus further includes a third processing module, configured to update the bitmap data when the data available to the first organization changes, process the updated bitmap data to obtain serialized bitmap data, and update or add the serialized bitmap data to the database.

[0035] In one embodiment, the first processing module is further configured to: when the first organization performs personalized processing on any usable data to obtain derived data, add a record of the derived data to the main table, record the index value of the derived data in the main table and the index value of the any data in the main table in the derived data record, update the first record according to the index value of the derived data in the derived data record, so that the first record records the index information of the derived data in the main table but does not record the index information of the any data in the main table; when the first organization performs restoration processing on the derived data, update the first record according to the index value of the any data in the derived data record, so that the first record records the index information of the any data in the main table but does not record the index information of the derived data in the main table.

[0036] Thirdly, this application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method described in the first aspect or any possible alternative method of the first aspect.

[0037] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, characterized in that, when the computer program is executed by a processor, it implements the steps of the method described in the first aspect or any possible alternative method of the first aspect.

[0038] Fifthly, this application also provides a computer program product, including a computer program, characterized in that, when executed by a processor, the computer program implements the steps of the method described in the first aspect or any possible manner of the first aspect.

[0039] The aforementioned data query method, apparatus, electronic device, and computer storage medium utilize a first data model and a master table to query data from a system comprising multiple organizations, obtaining data usable by the first organization. This application divides data according to the organizational dimension, and the index information of the data usable by each organization is recorded in the corresponding records of each organization in the first data model. This technical solution reduces the amount of data in a single table and the number of relational tables that need to be maintained, reduces code logic complexity, and improves query efficiency. Furthermore, in this technical solution, the master table splits data according to the organizational dimension, the first data model records the relationship between organizations and the usable data, and a bitmap is used to store the split data. Compared to existing technologies, this technical solution reduces the amount of data in a single table and reduces the consumption of hardware resources. Attached Figure Description

[0040] Figure 1 This is a diagram illustrating the application environment of a data query method in one embodiment.

[0041] Figure 2A This is a flowchart illustrating a data query method in one embodiment;

[0042] Figure 2B This is a schematic diagram illustrating the organizational relationships within the system in one embodiment;

[0043] Figure 3 This is a flowchart illustrating the data query method in another embodiment;

[0044] Figure 4 This is a flowchart illustrating the data query method in another embodiment;

[0045] Figure 5 This is a schematic diagram of the structure of a data query device in one embodiment;

[0046] Figure 6 This is a schematic diagram of the internal structure of a computer device in one embodiment. Detailed Implementation

[0047] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0048] In existing technologies, data management typically uses multiple relational tables for maintenance. For example, a master table records basic data, a range table records organizational data usage relationships, an exclusion table records personalized data, and a register table records all organizational data relationship information. However, existing solutions have at least the following problems:

[0049] 1) Functional issues

[0050] ① There are too many tables to maintain, the code logic is complex, the maintenance cost is high, and the error rate is high.

[0051] ② When the organizational hierarchy exceeds 3 levels, the processing of operations such as allocation, cancellation of allocation, personalization, deletion of personalization, transfer of management rights, and change of strategy becomes complex and duplicate data is prone to occur.

[0052] ③ Existing storage models primarily record organization-data relationships. When the amount of data to be stored is large, the data volume of a single table becomes enormous, leading to excessive consumption of hardware resources. For example, if 10,000 management data entries are distributed to 10,000 organizations, this will generate 100 million organization-data relationships. As business grows, the number of these tables will increase exponentially.

[0053] 2) Performance issues

[0054] ① Operations that change the organization-data relationship can cause significant performance issues. For example, when performing batch operations such as allocation, cancellation, strategy change, and management transfer, the large Cartesian product of the organization and data can lead to slow updates to the relationship table, background save timeouts, and memory overflows.

[0055] ② In terms of data querying, due to the huge amount of data in the relational tables, various slow SQL queries and query timeouts may occur.

[0056] To address this, embodiments of this application provide a data query method. The data query method provided in these embodiments can be applied to, for example... Figure 1In the application environment shown, the first client 101, the second client 102, and the third client 103 can communicate with the server 104 through a communication network. The first client 101 sends a query request to the server 104 to query the data that the first organization can use. The first organization can be any organization in the business system. The business system can include multiple organizations. It should be noted that the personnel in any organization in the business system may come from different administrative organizations (for example, if the purchasing organization corresponding to Project 1 is the first organization, the first organization can be composed of personnel from different administrative departments. In order to complete Project 1, different departments need to purchase various raw materials. The suppliers can be pre-set, which is the data that the first organization can use). After receiving the query request sent by the first client 101, the server 104 responds to the query request by determining the index value of the data that the first organization can use in the main table according to the first data model. The first data model includes a first record, which records the index information of the data that the first organization can use in the main table. The main table records multiple data and the index value corresponding to any one of the multiple data. The first record is the record in the first data model corresponding to the first organization. The server 104 obtains the query result based on the index value of the data that the first organization can use in the main table and sends the query result to the first client 101.

[0057] The first client 101 can be, but is not limited to, a laptop, desktop computer, tablet, mobile phone, IoT device, and portable wearable device. The server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0058] In one embodiment, such as Figure 2A As shown, a data query method is provided, which can be applied to... Figure 1 Taking server 104 as an example, the explanation includes steps 201 to 203.

[0059] 201. Obtain the query request sent by the client. The query request is used to query the data that the first organization can use. The first organization is any organization in the business system, and the business system includes multiple organizations.

[0060] For example, the organizations included in a business system can be such as Figure 2B As shown, the business system includes organization A1. Organization A1's subordinate organizations include organizations A2 and A3. Organization A3's subordinate organizations include organizations A4 and A5. Organization A5's subordinate organization is organization A6. The data available to any organization can differ. For example, organization A3 may have data including D1, D2, D3, and D4, while organization A3 may have data including D1 and D4.

[0061] 202. In response to the query request, determine the index value of the data that the first organization can use in the main table based on the first data model.

[0062] The first data model includes a first record, which records the index information of the data that the first organization can use in the main table. The main table records multiple data entries and the index value corresponding to any one of the multiple data entries. The first record is the record in the first data model that corresponds to the first organization.

[0063] For example, the first data model can be as shown in Table 1. The fields in Table 1 can include: the organization field and the index information field of the data in the main table. The index information field of the data in the main table can include bitmap data. As shown in Table 1, the index information of the data that organization C1 can use in the main table is 110, and the index information of the data that organization C2 can use in the main table is 001. An index information of 1 in the main table indicates that data exists at the corresponding index position in the main table, and the organization can use the specific data corresponding to the data field in the record containing that index. For example, organization C1 can use the data d1 and d2 corresponding to indices 1 and 2 in the main table (Table 2). C2 can use the data d3 corresponding to index 3 in the main table. An index information of 0 in the main table indicates that data does not exist at the corresponding index position in the main table, and the organization cannot use the specific data corresponding to the data field in the record containing that index.

[0064] Table 1

[0065]

[0066] Table 2

[0067]

[0068] 203. Obtain the query results based on the index values ​​in the main table of the data available to the first organization, and send the query results to the client.

[0069] Taking the example in step 202, the data that organization C1 can use has index values ​​of 1 and 2 in the main table. The record with index value 1 corresponds to data d1, and the record with index value 2 corresponds to data d2. Therefore, the data that organization C1 can use is d1 and d2. Similarly, the data for organization C2 has index information 001 in the main table. Therefore, the data that organization C2 can use corresponds to data d3, which is the record with index value 3 in the main table. After obtaining the query results, the query results are sent to the client. For example, if a user triggers a query request when selecting a supplier in a procurement operation, the available suppliers can be displayed on the client in a drop-down list to facilitate the user in selecting the desired supplier.

[0070] This embodiment divides data according to organizational dimensions. The data usable by each organization is indexed in the main table and recorded in the corresponding records of each organization in the first data model. This technical solution reduces the amount of data in a single table and the number of relational tables that need to be maintained, reduces code logic complexity, and improves query efficiency. Because the main table in this technical solution splits data according to organizational dimensions, the first data model records the relationship between organizations and the data they can use, and uses a bitmap to store the split data. Compared with existing technologies, this technical solution reduces the amount of data in a single table and reduces the consumption of hardware resources.

[0071] In one embodiment, if the data available to an organization changes, updates can be synchronized to the database, such as... Figure 3 As shown, a data query method is provided, which can be applied to... Figure 1 Taking server 104 as an example, the explanation includes steps 301 to 303.

[0072] 301. Obtain the query request sent by the client. The query request is used to query the data that the first organization can use. The first organization is any organization in the business system, and the business system includes multiple organizations.

[0073] For example, the organizations included in a business system can be such as Figure 2B As shown, the business system includes organization A1. Organization A1's subordinate organizations include organizations A2 and A3. Organization A3's subordinate organizations include organizations A4 and A5. Organization A5's subordinate organization is organization A6. The data available to any organization can differ. For example, organization A3 may have data including D1, D2, D3, and D4, while organization A3 may have data including D1 and D4.

[0074] 302. In response to the query request, determine the index value of the data that the first organization can use in the main table based on the first data model.

[0075] The first data model includes a first record, which records the index information of the data that the first organization can use in the main table. The main table records multiple data entries and the index value corresponding to any one of the multiple data entries. The first record is the record in the first data model that corresponds to the first organization.

[0076] For example, the first data model can be as shown in Table 1. The fields in Table 1 can include: the organization field and the index information field of the data in the main table. The index information field of the data in the main table can include bitmap data. As shown in Table 1, the index information of the data that organization C1 can use in the main table is 110, and the index information of the data that organization C2 can use in the main table is 001. An index information of 1 in the main table indicates that data exists at the corresponding index position in the main table, and the organization can use the specific data corresponding to the data field in the record containing that index. For example, organization C1 can use the data d1 and d2 corresponding to indices 1 and 2 in the main table (Table 2). C2 can use the data d3 corresponding to index 3 in the main table. An index information of 0 in the main table indicates that data does not exist at the corresponding index position in the main table, and the organization cannot use the specific data corresponding to the data field in the record containing that index.

[0077] In this embodiment, the index information of the data in the main table includes the information shown in Table 1. Bitmap data. The positions in the bitmap data correspond to the index values ​​of the data in the main table. For example, the first 1 on the left corresponds to the record with index value 1 in the main table, the second 1 on the left corresponds to the record with index value 2, and the 0 on the right corresponds to the record with index value 3. The values ​​1 and 0 in the bitmap data indicate whether the data corresponding to the corresponding index value in the main table is available to the organization.

[0078] In some possible implementations, index information can also be recorded in other ways, such as using a step-size container. Specifically, the step size can be used to compress storage space. For example, if the index values ​​of the data that Organization A can use correspond to in the main table are 11, 12, 13, 14, 15, 27, 28, and 29, then in some possible implementations, the index values ​​can be compressed and set to 11, 4 and 27, 2, which means that 11 is followed by 4 consecutively increasing values ​​and 27 is followed by 2 consecutively increasing values. Before the transformation, 16 bytes of storage space are required, and after the transformation, the number of values ​​to be recorded is reduced by half, requiring only 8 bytes, saving a lot of space.

[0079] Understandably, in addition to using a stroke step container, other methods can be used to optimize the storage of index information, and this application does not limit the specific implementation.

[0080] In some possible implementations, when the index information includes bitmap data, determining the index value of the data that the first organization can use in the main table according to the first data model may include: determining whether the cache includes bitmap data; if the cache includes bitmap data, using Kryo to deserialize the bitmap data to obtain the index value of the data that the first organization can use in the main table.

[0081] In some possible implementations, if bitmap data is not included in the cache, bitmap data is retrieved from the database and saved to the cache; then, the bitmap data is deserialized using Kryo to obtain the index value of the data that the first organization can use in the main table.

[0082] In some possible implementations, when bitmap data is not included in the cache and does not exist in the database, empty bitmap data is generated and saved in the cache; the bitmap data is deserialized using Kryo to obtain the index value of the data that the first organization can use in the main table.

[0083] 303. Obtain the query results based on the index values ​​in the main table of the data available to the first organization, and send the query results to the client.

[0084] Taking the example in step 202, the data that organization C1 can use has index values ​​of 1 and 2 in the main table. The record with index value 1 corresponds to data d1, and the record with index value 2 corresponds to data d2. Therefore, the data that organization C1 can use is d1 and d2. Similarly, the data for organization C2 has index information 001 in the main table. Therefore, the data that organization C2 can use corresponds to data d3, which is the record with index value 3 in the main table. After obtaining the query results, the query results are sent to the client. For example, if a user triggers a query request when selecting a supplier in a procurement operation, the available suppliers can be displayed on the client in a drop-down list to facilitate the user in selecting the desired supplier.

[0085] 304. When the data available to the first organization changes, update the bitmap data, use Kryo to process the updated bitmap data to obtain serialized bitmap data, and update or add the serialized bitmap data to the database.

[0086] Kryo is a high-performance serialization / deserialization tool. Due to its variable-length storage characteristics and the use of bytecode generation mechanisms, it boasts high running speed and small size.

[0087] In this embodiment, data is divided according to the organizational dimension. The data that each organization can use is recorded in the index information of the main table in the corresponding records of each organization in the first data model. This technical solution reduces storage space and improves query efficiency.

[0088] In one embodiment, an organization allocated usable data can modify the allocated data to obtain derived data to meet its usage needs. In this case, the data available to the organization in the main table also needs to be modified accordingly. It should be noted that organizations with derived data typically store the usable derived data in the main table. To identify which allocated data the derived data was derived from, the index value field of the original data can be set in the main table to record the index value corresponding to the data before the change. For example... Figure 4 As shown, a data query method is provided, which can be applied to... Figure 1 Taking server 104 as an example, the explanation includes steps 401 to 403.

[0089] 401. Obtain the query request sent by the client. The query request is used to query the data that the first organization can use. The first organization is any organization in the business system, and the business system includes multiple organizations.

[0090] 402. In response to the query request, determine the index value of the data that the first organization can use in the main table based on the first data model.

[0091] The first data model includes a first record, which records the index information of the data that the first organization can use in the main table. The main table records multiple data entries and the index value corresponding to any one of the multiple data entries. The first record is the record in the first data model that corresponds to the first organization.

[0092] For example, the first data model can be as shown in Table 1. The fields in Table 1 can include: the organization field and the index information field of the data in the main table. The index information field of the data in the main table can include bitmap data. As shown in Table 1, the index information of the data that organization C1 can use in the main table is 110, and the index information of the data that organization C2 can use in the main table is 001. An index information of 1 in the main table indicates that data exists at the corresponding index position in the main table, and the organization can use the specific data corresponding to the data field in the record containing that index. For example, organization C1 can use the data d1 and d2 corresponding to indices 1 and 2 in the main table (Table 2). C2 can use the data d3 corresponding to index 3 in the main table. An index information of 0 in the main table indicates that data does not exist at the corresponding index position in the main table, and the organization cannot use the specific data corresponding to the data field in the record containing that index.

[0093] 403. Obtain the query results based on the index values ​​in the main table of the data available to the first organization, and send the query results to the client.

[0094] Taking the example in step 202, the data that organization C1 can use has index values ​​of 1 and 2 in the main table. The record with index value 1 corresponds to data d1, and the record with index value 2 corresponds to data d2. Therefore, the data that organization C1 can use is d1 and d2. Similarly, the data for organization C2 has index information 001 in the main table. Therefore, the data that organization C2 can use corresponds to data d3, which is the record with index value 3 in the main table. After obtaining the query results, the query results are sent to the client. For example, if a user triggers a query request when selecting a supplier in a procurement operation, the available suppliers can be displayed on the client in a drop-down list to facilitate the user in selecting the desired supplier.

[0095] 404. When the data available to the first organization changes, update the bitmap data, use Kryo to process the updated bitmap data to obtain serialized bitmap data, and update or add the serialized bitmap data to the database.

[0096] Kryo is a high-performance serialization / deserialization tool. Due to its variable-length storage characteristics and the use of bytecode generation mechanisms, it has high running speed and requires less storage space.

[0097] 405. When the first organization performs personalized processing on any usable data to obtain derived data, a record recording the derived data is added to the main table. The derived data record records the index value of the derived data in the main table, as well as the index value of any data in the main table. The first record is updated according to the index value of the derived data in the derived data record, so that the first record records the index information of the derived data in the main table but does not record the index information of any data in the main table. When the first organization performs restoration processing on the derived data, the first record is updated according to the index value of any data in the derived data record, so that the first record records the index information of any data in the main table but does not record the index information of the derived data in the main table.

[0098] As shown in the main table (Table 3), in order to record derived data and original data, as well as the index values ​​corresponding to the derived data and the index values ​​of the original data, the main table can include the following fields: data, original data, creation organization, index of data, and index of original data.

[0099] Table 3

[0100]

[0101] In this scenario, organization C3 modifies the data d1 allocated by C1, resulting in r_d1. The creator of r_d1 is C3, the original data is d1, and the index value of r_d1 is 4. The index value of the original data d1 is 1. Correspondingly, the first data model also needs adaptive modification, as shown in Table 4. The index information for the data corresponding to organization C1 in the main table is 1100, the index information for the data corresponding to organization C2 is 0010, and the index information for the data corresponding to organization C3 is 0001. When querying the data that C3 can use, based on the index information 0001 recorded in Table 4 in the main table, Table 3 is consulted to obtain the data that C3 can use, including r_d1.

[0102] Table 4

[0103]

[0104] Based on this, if organization C3 no longer needs the personalized data r_d1, then data r_d1 can be restored. In this case, the first data model is modified according to the index of the original data in the record containing data r_d1 in Table 3. Specifically, the index information of organization C3 is changed from 0001 to 1000, so that the data usable by organization C3 is restored from r_d1 to d1. In addition, the record containing data r_d1 in Table 3 can be retained, deleted, or subjected to other operations.

[0105] The embodiments of this application have at least the following technical effects:

[0106] 1) It solves the functional problems in the control strategy, eliminates the need to maintain multiple relationship tables, reduces code logic complexity, and lowers the later program maintenance cost and data maintenance cost.

[0107] 2) The embodiments of this application mainly record the relationship between organization and data. Data is split according to the dimension of organization, and then the split data is stored using a data model (such as a bitmap-based data model), which greatly reduces the amount of data in a single table and reduces the consumption of hardware resources.

[0108] 3) Regarding performance issues, because the amount of data maintained by a single table is reduced, and caching is introduced, the performance of related operations and queries is greatly improved by making reasonable use of bitmap AND, OR, XOR and other operations, and the problems of slow SQL and memory overflow are also solved.

[0109] 4) Improved query efficiency and increased response speed to the client.

[0110] 5) It can satisfy the organization's need for personalized processing of the allocated original data, as well as the need for restoration of the personalized data.

[0111] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0112] Based on the same inventive concept, this application also provides a data query apparatus for implementing the data query method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more data query apparatus embodiments provided below can be found in the limitations of the data query method described above, and will not be repeated here.

[0113] In one embodiment, such as Figure 5 As shown, a data query device 500 is provided, including: an acquisition module 501, a first processing module 502, and a second processing module 503. The acquisition module 501 is used to acquire a query request sent by a client. The query request is for querying data that a first organization can use. The first organization is any organization in a business system, and the business system includes multiple organizations. The first processing module 502 is used to respond to the query request by determining the index value of the data that the first organization can use in a main table according to a first data model. The first data model includes a first record, which records the index information of the data that the first organization can use in the main table. The main table records multiple data entries and the index value corresponding to any one of the multiple data entries. The first record is the record in the first data model corresponding to the first organization. The second processing module 503 is used to obtain the query result based on the index value of the data that the first organization can use in the main table and send the query result to the client.

[0114] In some possible implementations, the index information includes bitmap data; in determining the index value of the data that the first organization can use in the main table according to the first data model, the first processing module is specifically used to determine whether the cache includes bitmap data; if the cache includes bitmap data, the bitmap data is deserialized using Kryo to obtain the index value of the data that the first organization can use in the main table.

[0115] In some possible implementations, the first processing module is further configured to: retrieve bitmap data from the database and save the retrieved bitmap data to the cache when the bitmap data is not included in the cache; and to deserialize the bitmap data using Kryo to obtain the index value of the data that the first organization can use in the main table.

[0116] In some possible implementations, the first processing module is further configured to generate empty bitmap data and save the generated empty bitmap data to the cache when the bitmap data is not included in the cache and the bitmap data does not exist in the database; and to deserialize the bitmap data using Kryo to obtain the index value of the data that the first organization can use in the main table.

[0117] In some possible implementations, the apparatus further includes a third processing module for updating bitmap data when the data available to the first organization changes, processing the updated bitmap data using Kryo to obtain serialized bitmap data, and updating or adding the serialized bitmap data to the database.

[0118] In some possible implementations, the first processing module is further configured to, when the first organization performs personalized processing on any usable data to obtain derived data, add a record containing the derived data to the main table, record the index value of the derived data in the main table and the index value of any data in the main table in the derived data record, update the first record according to the index value of the derived data in the derived data record, so that the first record records the index information of the derived data in the main table but does not record the index information of any data in the main table; when the first organization performs restoration processing on the derived data, update the first record according to the index value of any data in the derived data record, so that the first record records the index information of any data in the main table but does not record the index information of the derived data in the main table.

[0119] Each module in the aforementioned data query device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0120] In one embodiment, a computer device is provided, which may be a terminal such as a server, and its internal structure diagram may be as follows: Figure 6As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used to communicate with an external server, and the communication method can be mobile cellular networks or other technologies. When the computer program is executed by the processor, it implements a method for updating small components. The display screen can be an LCD screen or an e-ink display screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0121] In one embodiment, a computer device is provided, which may be an electronic device such as a server, and its internal structure diagram may be as follows: Figure 6 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores historical user operation records. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a data query method.

[0122] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0123] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to perform the following steps: receiving a query request sent by a client, the query request being used to query data that a first organization can use, the first organization being any organization in a business system, and the business system including multiple organizations; responding to the query request, determining the index value of the data that the first organization can use in a master table according to a first data model; the first data model includes a first record, the first record recording the index information of the data that the first organization can use in the master table, the master table recording multiple data entries and the index value corresponding to any one of the multiple data entries, the first record being the record in the first data model corresponding to the first organization; obtaining a query result based on the index value of the data that the first organization can use in the master table, and sending the query result to the client.

[0124] In one embodiment, the index information includes bitmap data; determining the index value of the data that the first organization can use in the main table according to the first data model includes: determining whether the cache includes bitmap data; if the cache includes bitmap data, deserializing the bitmap data to obtain the index value of the data that the first organization can use in the main table.

[0125] In one embodiment, when the processor executes the computer program, it further performs the following steps: when the server determines that the layout and implemented business functions displayed in the display area of ​​the target widget in the terminal have changed, it updates the layout and implemented business functions created and displayed in the display area of ​​the target widget.

[0126] In one embodiment, when the processor executes the computer program, it further performs the following steps: when bitmap data is not included in the cache, it retrieves bitmap data from the database and saves the retrieved bitmap data to the cache; it deserializes the bitmap data to obtain the index value of the data that the first organization can use in the main table.

[0127] In one embodiment, when the processor executes the computer program, it further performs the following steps: when bitmap data is not included in the cache and bitmap data does not exist in the database, generating empty bitmap data and saving the generated empty bitmap data to the cache; deserializing the bitmap data to obtain the index value of the data that the first organization can use in the main table.

[0128] In one embodiment, when the processor executes the computer program, it further performs the following steps: when the data available to the first organization changes, updating the bitmap data, processing the updated bitmap data to obtain serialized bitmap data, and updating or adding the serialized bitmap data to the database.

[0129] In one embodiment, when the first organization processes any usable data to obtain derived data, the data usable by the first organization includes the derived data but excludes any data; a record is added to the main table to record the creation of the derived data by the first organization. This record records the index value of the derived data in the main table, as well as the index value of any data in the main table; the information recorded in the first record includes the information corresponding to the index value of the derived data in the main table, but excludes the information of the index value of any data in the main table; when the derived data is deleted from the data usable by the first organization, the data usable by the first organization includes any data; the record in the main table recording the creation of the derived data by the first organization is deleted; the information recorded in the first record excludes the information corresponding to the index value of the derived data in the main table, but includes the information of the index value of any data in the main table.

[0130] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon. When executed by a processor, the computer program performs the following steps: receiving a query request sent by a client, the query request being used to query data that a first organization can use, the first organization being any organization in a business system, the business system including multiple organizations; responding to the query request, determining the index value of the data that the first organization can use in a master table according to a first data model; the first data model including a first record, the first record recording the index information of the data that the first organization can use in the master table, the master table recording multiple data records and the index value corresponding to any one of the multiple data records, the first record being the record in the first data model corresponding to the first organization; obtaining the query result based on the index value of the data that the first organization can use in the master table, and sending the query result to the client.

[0131] In one embodiment, the index information includes bitmap data; determining the index value of the data that the first organization can use in the main table according to the first data model includes: determining whether the cache includes bitmap data; if the cache includes bitmap data, deserializing the bitmap data to obtain the index value of the data that the first organization can use in the main table.

[0132] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: when the server determines that the layout and implemented business functions displayed in the display area of ​​the target widget in the terminal have changed, it updates the layout and implemented business functions created and displayed in the display area of ​​the target widget.

[0133] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: when bitmap data is not included in the cache, retrieve bitmap data from the database and save the retrieved bitmap data to the cache; deserialize the bitmap data to obtain the index value of the data that the first organization can use in the main table.

[0134] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: when bitmap data is not included in the cache and bitmap data does not exist in the database, generating empty bitmap data and saving the generated empty bitmap data to the cache; deserializing the bitmap data to obtain the index value of the data that the first organization can use in the main table.

[0135] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: when the data available to the first organization changes, updating the bitmap data, processing the updated bitmap data to obtain serialized bitmap data, and updating or adding the serialized bitmap data to the database.

[0136] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: when the first organization personalizes any usable data to obtain derived data, it adds a record to the main table to record the derived data, and records the index value of the derived data in the main table and the index value of any data in the main table in the derived data record; it updates the first record according to the index value of the derived data in the derived data record, so that the first record records the index information of the derived data in the main table but does not record the index information of any data in the main table; when the first organization restores the derived data, it updates the first record according to the index value of any data in the derived data record, so that the first record records the index information of any data in the main table but does not record the index information of the derived data in the main table.

[0137] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps: receiving a query request sent by a client, the query request being used to query data that a first organization can use, the first organization being any organization in the system; responding to the query request, determining the index value of the data that the first organization can use in a main table according to a first data model; the first data model includes a first record, the first record recording the index information of the data that the first organization can use in the main table, the main table recording multiple data entries and the index value corresponding to any one of the multiple data entries, the first record being the record in the first data model corresponding to the first organization; obtaining a query result based on the index value of the data that the first organization can use in the main table, and sending the query result to the client.

[0138] In one embodiment, the index information includes bitmap data; when the computer program is executed by the processor, it further performs the following steps: determining the index value of the data that the first organization can use in the main table according to the first data model, including: determining whether the cache includes bitmap data; if the cache includes bitmap data, deserializing the bitmap data to obtain the index value of the data that the first organization can use in the main table.

[0139] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: when the server determines that the layout and implemented business functions displayed in the display area of ​​the target widget in the terminal have changed, it updates the layout and implemented business functions created and displayed in the display area of ​​the target widget.

[0140] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: when bitmap data is not included in the cache, retrieve bitmap data from the database and save the retrieved bitmap data to the cache; deserialize the bitmap data to obtain the index value of the data that the first organization can use in the main table.

[0141] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: when bitmap data is not included in the cache and bitmap data does not exist in the database, generating empty bitmap data and saving the generated empty bitmap data to the cache; deserializing the bitmap data to obtain the index value of the data that the first organization can use in the main table.

[0142] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: when the data available to the first organization changes, updating the bitmap data, processing the updated bitmap data to obtain serialized bitmap data, and updating or adding the serialized bitmap data to the database.

[0143] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: when the first organization personalizes any usable data to obtain derived data, it adds a record to the main table to record the derived data, and records the index value of the derived data in the main table and the index value of any data in the main table in the derived data record; it updates the first record according to the index value of the derived data in the derived data record, so that the first record records the index information of the derived data in the main table but does not record the index information of any data in the main table; when the first organization restores the derived data, it updates the first record according to the index value of any data in the derived data record, so that the first record records the index information of any data in the main table but does not record the index information of the derived data in the main table.

[0144] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0145] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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, they should be considered to be within the scope of this specification.

[0146] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A data query method, characterized in that, The method includes: Obtain a query request sent by the client. The query request is used to query data that a first organization can use. The first organization is any organization in the business system, and the business system includes multiple organizations. In response to the query request, the index value of the data that the first organization can use in the main table is determined according to the first data model; the first data model includes a first record, which records the index information of the data that the first organization can use in the main table, the main table records multiple data and the index value corresponding to any one of the multiple data, and the first record is the record in the first data model corresponding to the first organization; The query results are obtained based on the index value of the data available to the first organization in the main table, and the query results are sent to the client. When the first organization personalizes any usable data to obtain derived data, a record containing the derived data is added to the main table. The derived data record contains the index value of the derived data in the main table and the index value of any data in the main table. The first record is updated according to the index value of the derived data in the derived data record, so that the first record contains the index information of the derived data in the main table but does not contain the index information of any data in the main table. When the first organization restores the derived data, it updates the first record according to the index value of any one of the data records in the derived data record, so that the first record records the index information of the any one of the data in the main table, but does not record the index information of the derived data in the main table.

2. The method according to claim 1, characterized in that, The index information includes bitmap data; determining the index value of the data usable by the first organization in the main table according to the first data model includes: Determine whether the cache contains the bitmap data; When the bitmap data is included in the cache, the bitmap data is deserialized to obtain the index value of the data that the first organization can use in the main table.

3. The method according to claim 2, characterized in that, The method further includes: If the bitmap data is not included in the cache, the bitmap data is retrieved from the database and saved to the cache. The bitmap data is deserialized to obtain the index value of the data that the first organization can use in the main table.

4. The method according to claim 3, characterized in that, The method further includes: When the bitmap data is not included in the cache and does not exist in the database, empty bitmap data is generated and saved to the cache. The bitmap data is deserialized to obtain the index value of the data that the first organization can use in the main table.

5. The method according to claim 2, characterized in that, The method further includes: When the data available to the first organization changes, the bitmap data is updated, the updated bitmap data is processed to obtain serialized bitmap data, and the serialized bitmap data is updated or added to the database.

6. A data query device, characterized in that, The device includes: The acquisition module is used to acquire query requests sent by the client. The query requests are used to query data that a first organization can use. The first organization is any organization in the business system, and the business system includes multiple organizations. A first processing module is configured to respond to the query request and determine the index value of the data that the first organization can use in the main table according to a first data model. The first data model includes a first record, which records the index information of the data that the first organization can use in the main table. The main table records multiple data entries and the index value corresponding to any one of the multiple data entries. The first record is the record in the first data model corresponding to the first organization. The second processing module is used to obtain query results based on the index value of the data available to the first organization in the main table, and send the query results to the client. The first processing module is further configured to, when the first organization performs personalized processing on any usable data to obtain derived data, add a record to the main table to record the derived data, record the index value of the derived data in the main table and the index value of any data in the main table in the derived data record, update the first record according to the index value of the derived data in the derived data record, so that the first record records the index information of the derived data in the main table but does not record the index information of any data in the main table; when the first organization performs restoration processing on the derived data, update the first record according to the index value of any data in the derived data record, so that the first record records the index information of any data in the main table but does not record the index information of the derived data in the main table.

7. The apparatus according to claim 6, characterized in that, The index information includes bitmap data; the first processing module is used to determine whether the cache includes the bitmap data; when the cache includes the bitmap data, the bitmap data is deserialized to obtain the index value of the data that the first organization can use in the main table.

8. An electronic device, characterized in that, The method includes a memory and a processor, the memory storing a computer program, characterized in that the processor executes the computer program to implement the steps of the method according to any one of claims 1 to 5.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Authority information acquisition method and device, computer equipment and storage medium

    CN114244595A