Document query method and device, equipment, storage medium and program product
By preconfiguring the logical association scheme between business objects, cross-base connection query is avoided, and the problem of inefficient cross-business object multi-entity data query in the existing technology is solved, and more efficient data query is achieved.
Patent Information
- Application Number
- CN202411693988.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2044-11-22
AI Technical Summary
In the data query scenario of cross-business objects and multiple entities, complex SQL statements need to be edited for cross-library connection query, resulting in low query efficiency.
Provide a document query method to avoid cross-store connection query by preconfiguring the logical association scheme between the source business object and the target business object. The method includes obtaining the association query scheme corresponding to the source document, determining the source document is based on the logical association entity record of the logical association entity, determining the actual association query conditions of the target business object, and querying the data to be displayed from the target database based on the query display entity and data display filter conditions.
By avoiding cross-library connection queries, query efficiency is significantly improved, SQL statement writing is simplified, and query performance bottlenecks are reduced.
Smart Images

Figure CN119807234A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a document query method, device, computer equipment, storage medium and computer program product. Background Art
[0002] With the development of computer technology, business systems in various industries have become more complete, and a large amount of business data has been accumulated to form various databases of a certain scale.
[0003] In business systems, data query scenarios across business objects and multiple entities are very common. In current technical solutions, multi-entity associations are usually performed directly in the form of SQL (Structured Query Language). However, document data of different business objects are usually stored in different databases. Current technical solutions require editing complex SQL statements for cross-database connection queries, which results in low query efficiency. Summary of the invention
[0004] Based on this, it is necessary to provide a document query method, device, computer equipment, computer-readable storage medium and computer program product that can improve query efficiency in response to the above technical problems.
[0005] This application provides a document query method, including:
[0006] In response to an association query request for a source document, an association query solution corresponding to the source document is obtained; the association query solution includes a logical association solution between a source business object and a target business object, and a query display solution for the target business object; the logical association solution includes a logical association field, and logical association entities corresponding to the logical association field in the source business object and the target business object, respectively; the source document belongs to the source business object; and the query display solution includes a query display entity;
[0007] Based on the logical association field, determine the logical association entity record of the source document based on the logical association entity, and based on the logical association entity record, determine the actual association query condition of the target business object based on the logical association entity;
[0008] Determine a data display filtering condition for the target business object based on the query display entity based on the entity association between the query display entity and the logical association entity corresponding to the target business object and the actual association query condition;
[0009] Based on the query display scheme and the data display filtering condition, the data to be displayed is queried from the target database corresponding to the target business object to obtain a query result corresponding to the associated query request.
[0010] The present application also provides a document query device, comprising:
[0011] A scheme query module, for obtaining, in response to an association query request for a source document, an association query scheme corresponding to the source document; the association query scheme includes a logical association scheme between a source business object and a target business object, and a query display scheme for the target business object; the logical association scheme includes a logical association field, and logical association entities corresponding to the logical association field in the source business object and the target business object, respectively; the source document belongs to the source business object; and the query display scheme includes a query display entity;
[0012] A first condition determination module is used to determine the logical association entity record of the source document based on the logical association entity based on the logical association field, and determine the actual association query condition of the target business object based on the logical association entity based on the logical association entity based on the logical association entity record;
[0013] A second condition determination module, configured to determine a data display filtering condition of the target business object based on the query display entity based on the entity association between the query display entity and the logical association entity corresponding to the target business object and the actual association query condition;
[0014] The result display module is used to query the data to be displayed from the target database corresponding to the target business object based on the query display scheme and the data display filtering condition, and obtain the query result corresponding to the associated query request.
[0015] The present application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps described in the above-mentioned document query method when executing the computer program.
[0016] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned document query method are implemented.
[0017] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned document query method when executed by a processor.
[0018] The above-mentioned document query method, device, computer equipment, storage medium and computer program product pre-configure an associated query scheme for the logically associated source business object and target business object, and the associated query scheme includes a logical association scheme between the source business object and the target business object, and a query display scheme for the target business object. The logical association scheme records the logical association relationship between the source business object and the target business object, specifically including logical association fields and logical association entities corresponding to the logical association fields in the source business object and the target business object, respectively. The query display scheme records the display form of the target business object after the source business object initiates an associated query, specifically including a query display entity. By performing an associated query according to the associated query scheme, the data of the source business object and the data of the target business object can be queried in their corresponding databases respectively, avoiding cross-database connection queries, thereby improving query efficiency.
[0019] After initiating an association query request for a source document, obtain the association query scheme corresponding to the source document. The source document belongs to the source business object. Based on the association query scheme, obtain the data to be displayed of the target business object, and obtain the query result corresponding to the association query request. Specifically, determine the logical association entity record based on the logical association entity of the source document according to the logical association field in the logical association scheme. The logical association entity record is the business data related to the logical association entity and the logical association field in the source document. The source business object and the target business object establish an association relationship through the logical association field and the corresponding logical association entity. Based on the logical association entity record based on the logical association entity of the source business object, determine the actual association query condition based on the logical association entity of the target business object, which can avoid cross-database connection query. The actual association query condition is used to query the business data related to the logical association entity in the target business object. Based on the entity association between the query display entity and the logical association entity corresponding to the target business object and the actual association query condition, determine the data display filter condition based on the query display entity of the target business object. The data display filter condition is used to query the business data related to the query display entity in the target business object. Finally, based on the query display scheme and the data display filtering conditions, the data to be displayed is queried from the target database corresponding to the target business object to obtain the query result corresponding to the associated query request. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 An application environment diagram of a document query method in an embodiment;
[0022] Figure 2 A schematic diagram of a process flow of a document query method in one embodiment;
[0023] Figure 3 A schematic diagram of a process for obtaining a logically associated entity record that actually needs to be queried in one embodiment;
[0024] Figure 4 A schematic diagram of a process of calculating entity association query conditions of a target business object based on logically associated entities in one embodiment;
[0025] Figure 5 A schematic diagram of the relationship between entities in a document in one embodiment;
[0026] Figure 6 A schematic diagram of a process of calculating a data display filtering condition of a target business object based on a query display entity in one embodiment;
[0027] Figure 7 A schematic diagram of a process of calculating a data display filtering condition of a target business object based on a query display entity in another embodiment;
[0028] Figure 8 A schematic diagram of a flow chart of displaying a query display solution based on data display filtering conditions in an embodiment;
[0029] Fig. 9 A schematic diagram of designing an association query solution in an embodiment;
[0030] Fig.10 A schematic diagram of a flow chart of a document query method in another embodiment;
[0031] Fig.11 A structural block diagram of a document query device in an embodiment;
[0032] Fig.12 is an internal structure diagram of a computer device in one embodiment;
[0033] Fig.13 FIG. 4 is a diagram showing the internal structure of a computer device in another embodiment. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with 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.
[0035] The document query method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be set up separately, integrated on the server 104, or placed on the cloud or other devices. The terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head-mounted device can be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The server 104 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.
[0036] It is understood that the terminal and the server can be used alone to execute the document query method provided in the embodiment of the present application. The terminal and the server can also be used together to execute the document query method provided in the embodiment of the present application.
[0037] For example, in response to an association query request for a source document, the terminal obtains an association query solution corresponding to the source document. The association query solution includes a logical association solution between a source business object and a target business object, and a query display solution for the target business object. The logical association solution includes a logical association field, and a logical association entity corresponding to the logical association field in the source business object and the target business object, respectively. The source document belongs to the source business object, and the query display solution includes a query display entity. The terminal determines a logical association entity record of the source document based on the logical association entity based on the logical association field, and determines an actual association query condition of the target business object based on the logical association entity based on the logical association entity record. The terminal determines a data display filtering condition of the target business object based on the query display entity based on the entity association between the query display entity and the logical association entity corresponding to the target business object, and the actual association query condition. The terminal queries the target database corresponding to the target business object for the data to be displayed based on the query display solution and the data display filtering condition, and obtains a query result corresponding to the association query request. The terminal can display the query result corresponding to the association query request.
[0038] To facilitate understanding and description, several key concepts of the present application will be briefly described before further describing the embodiments of the present application in detail.
[0039] A dynamic domain model refers to a visual representation of a conceptual class within a domain or an object in the real world. A dynamic domain model can also be called a conceptual model, a domain object model, or an analytical object model. It focuses on analyzing the problem domain itself, discovering important business domain concepts, and establishing relationships between business domain concepts. The dynamic domain model is modeled in a "model-element-attribute" manner so that each element supports different business characteristics. For example, the material field (element layer, basic data field) under a purchase order (model layer, document model) supports obtaining its code field, name field, and associated carrying fields (attribute layer).
[0040] Business objects refer to document models or basic data models in the dynamic domain model. For example, a purchase order is a document model object, a purchase receipt is also a document model object, and a material is a basic data model object.
[0041] An entity refers to a table element in a business object that can be associated with a database physical table or view. Taking the purchase type of an A / P as an example, it usually involves two common business branches. One records what materials and quantities will be purchased for the current A / P, which is called a detail entity. The other records the payment date and associated payment amount of the A / P (such as 50% is expected to be paid when the order is reviewed and confirmed, and then 50% is paid three months later), which is called a payment plan entity. Both entities are related to the current A / P, but there is no association between the rows of records in these two entities. The detail entity records the detailed purchase information of various materials in the A / P, while the payment plan entity records the detailed plan information of the entire payment plan for the A / P. The rows of data under the detail entity and the payment plan entity do not correspond one to one.
[0042] The Cartesian product refers to the set of all possible ordered pairs between two sets. In databases, the Cartesian product is often used for join operations, where the Cartesian product of two tables is used to refer to the generation of all possible combinations. For example, if there are m rows of detail entities of a payable and n rows of payment plan entities, when a join operation is performed directly, since the two entities have no associated logic, m*n rows of query records will be obtained.
[0043] Business association refers to the association between business objects formed according to the common document flow relationship in the business system. For example, if the document flow relationship is purchase application → purchase order → purchase receipt → payable document, then the purchase application document and the purchase order have business associations, the purchase order and the purchase receipt document have business associations, and the purchase receipt document and the payable document have business associations.
[0044] Logical association refers to the association relationship established between business objects through entities and fields. Business objects can establish search relationships based on entities and fields to find business object data that meets the conditions. For example, there is a field for the associated purchase order number in the detailed information of the payable document. When we perform an associated query on the purchase order, we can use the search relationship (the document number of the purchase order = the associated purchase order number of the payable document) to find the corresponding payable document. Different from business association, logical association only refers to the established search relationship and does not pay attention to whether there is a business association. For example, according to the supplier and material of the purchase order, the inspection order of the same supplier and material is searched to understand the historical material inspection status of the same supplier and the same material, rather than just querying the inspection order associated with the current purchase order.
[0045] The source business object refers to the business object associated in the logical association.
[0046] The target business object refers to the business object associated in the logical association.
[0047] The logical association entity refers to the entity with the deepest level in the business object corresponding to the logical association field in the logical association.
[0048] The query display entity refers to the business object associated in the logical association, and is the entity with the deepest level that needs to be displayed.
[0049] The largest common entity refers to the entity with the deepest and equal hierarchy between two entities of the same business object in the entity path from the document header to itself.
[0050] It can be understood that a business object is usually a certain document. In the business system, the document details interface of a document includes multiple document body tabs. Different document body tabs correspond to different entities, and different document body tabs have different uses. For example, the document details interface of an A / P includes a detail tab and a payment plan tab. The detail tab mainly presents details such as materials, quantity, source document type, source document number, etc., and mainly carries data such as upstream supply chain documents and associated downstream purchase invoices. The payment plan tab mainly records payment-related data, and is associated with downstream payment documents and related information related to reverse payment associations. The detail tab corresponds to the detail entity, and the payment plan tab corresponds to the payment plan entity.
[0051] In one embodiment, Figure 2 As shown, a document query method is provided, which is applied to Figure 1 The terminal in is used as an example for explanation. It can be understood that the method can be executed by the terminal or the server itself alone, or can be implemented through interaction between the terminal and the server. Among them:
[0052] Step S202, in response to an association query request for a source document, obtain an association query solution corresponding to the source document; the association query solution includes a logical association solution between a source business object and a target business object, and a query display solution for the target business object; the logical association solution includes logical association fields, and logical association entities corresponding to the logical association fields in the source business object and the target business object, respectively; the source document belongs to the source business object; and the query display solution includes a query display entity.
[0053] Among them, the source document refers to the document that currently triggers the associated query. For example, if purchase document A is selected to trigger the associated query, purchase document A is the source document. The associated query request is used to request a query for the business data of the target business object that is logically associated with the source business object. The associated query request for the source document is used to request a query for the document data of other documents that are logically associated with the source document. For example, the documents that are logically associated with the purchase document include payable documents. If purchase document A is selected to trigger the associated query, it is necessary to query the document data of each payable document that is logically associated with purchase document A.
[0054] In order to facilitate the associated query, an associated query scheme is configured for the source business object and the target business object. The associated query scheme includes a logical association scheme between the source business object and the target business object, and a query display scheme for the target business object. It can be understood that the source business object is a currently displayed business object, the target business object is a business object to be displayed, there is a logical association between the source business object and the target business object, and the associated query is triggered by the source business object to display the relevant business data of the target business object. The logical association scheme is used to indicate the logical association between the source business object and the target business object. The logical association scheme includes a logical association field and a logical association entity corresponding to the logical association field in the source business object and the target business object respectively. The logical association scheme can also be called a logical association query condition. The query display scheme is used to indicate the display form of the target business object for the associated query. The query display scheme includes a query display entity of the target business object. The query display entity is an entity to be queried and displayed in the target business object.
[0055] For example, if you need to query the document data of the A / P based on the document data of the purchase order, you can configure an associated query solution for the purchase order and the A / P. The associated query solution includes the logical association solution between the purchase order and the A / P and the query display solution for the A / P. The logical association solution can include the material field (i.e., the logical association field), the detailed entity of the purchase order (i.e., the entity where the material field is located in the purchase order), and the detailed entity of the A / P (i.e., the entity where the material field is located in the A / P). Query the A / P logically associated with the purchase order through the material field in the detailed information of the purchase order and the material field in the detailed information of the A / P. If you need to display the payment plan of the A / P in the end, the query display solution can include the payment plan entity of the A / P.
[0056] It can be understood that the associated query request for the source document is an associated query request triggered by the source document, and the source document belongs to the source business object. The source business object represents a batch of documents of the same type, and the source document can be any document therein.
[0057] Specifically, the user can trigger an associated query request through the source business object as needed, so as to quickly query the relevant business data of the target business object corresponding to the source business object. The terminal responds to the associated query request for the source document, obtains the associated query solution corresponding to the source document, obtains the business data that needs to be displayed by the target business object based on the associated query solution, and obtains the query result corresponding to the associated query request.
[0058] Step S204, based on the logical association field, determine the logical association entity record of the source document based on the logical association entity, and based on the logical association entity record, determine the actual association query condition of the target business object based on the logical association entity.
[0059] Among them, the logical association entity record of the source document based on the logical association entity refers to the field record corresponding to the logical association field in the source document. For example, if the logical association field is the material field in the document, in the purchase order, the entity where the logical association field is located is the detail entity of the purchase order, then the logical association entity record of the purchase order based on the logical association entity can be the field value of the material field in the detail information of the purchase order. The source business object and the target business object establish a logical association through the logical association fields under their respective logical association entities. After determining the logical association entity record of the source business object based on the logical association entity, the target business object logically associated with the source business object can be queried according to the logical association entity record, that is, the target business object with the same logical association entity record is queried. The actual association query condition of the target business object based on the logical association entity refers to the query condition for the logical association field under the logical association entity corresponding to the target business object. For example, if the logical association field is the material field in the document, in the purchase order, the entity where the logical association field is located is the detail entity of the purchase order, and in the payables, the entity where the logical association field is located is the detail entity of the payables. If the logically associated entity record of purchase order A based on the logically associated entity is the field value AH20 of the material field in the detailed information of purchase order A, then the actual associated query condition of the target business object based on the logically associated entity can be to query the payable documents whose field value of the material field in the detailed information is AH20.
[0060] Specifically, the terminal can determine the logically associated entity records of the source document based on the logically associated entity based on the logically associated entity based on the logically associated field. For example, based on the logically associated field, query the logically associated entity records of the source document based on the logically associated entity from the source database corresponding to the source business object; based on the logically associated field, query the logically associated entity records of the source document based on the logically associated entity from the cached data; based on the logically associated field, query the logically associated entity records of the source document based on the logically associated entity from the currently displayed data; and so on. Furthermore, the terminal determines the actual associated query conditions of the target business object based on the logically associated entity based on the logically associated entity based on the logically associated entity. The actual associated query conditions are used to query the target business object that is logically associated with the source document, specifically, to query the target business object whose field records corresponding to the logically associated field in the target business object are the field records corresponding to the logically associated field in the source document.
[0061] Step S206 , based on the entity association between the query display entity and the logically associated entity corresponding to the target business object and the actual associated query condition, determine the data display filtering condition of the target business object based on the query display entity.
[0062] Among them, the data display filtering condition based on the query display entity of the target business object refers to the query condition for the query display entity corresponding to the target business object. The data display filtering condition based on the query display entity of the target business object can also be called the actual association query condition based on the query display entity of the target business object. The actual association query condition based on the logical association entity of the target business object is used to query the target business object that is logically associated with the source document. For example, the source business object in the association query scheme is a purchase order, and the target business object is a bill payable. If the association query request for purchase order A is triggered, the actual association query condition based on the logical association entity of the target business object is used to query the bill payable that is logically associated with purchase order A. The actual association query condition based on the query display entity of the target business object is used to query the entity data of the query display entity of the target business object that is logically associated with the source document. For example, the actual association query condition based on the logical association entity of the target business object is used to query the bill payable that is logically associated with purchase order A, and the query display entity of the bill payable is a payment plan entity, then the actual association query condition based on the query display entity of the target business object is used to query the payment plan information of the bill payable that is logically associated with purchase order A.
[0063] Specifically, the query display entity of the target business object and the logically associated entity of the target business object can be the same entity or different entities. It can be understood that the target business object has many entities, and the user can select the entity that needs to be displayed as the query display entity as needed. For example, the entity of the payable bill includes a detail entity and a payment plan entity, and the query display entity can be a detail entity or a payment plan entity. If the logically associated entity is a detail entity and the query display entity is a payment plan entity, the query display entity and the logically associated entity are different. If the logically associated entity is a detail entity and the query display entity is a detail entity, the query display entity and the logically associated entity are the same. The terminal can determine the data display filtering condition of the target business object based on the query display entity based on the entity association between the query display entity and the logically associated entity of the target business object, and the actual associated query condition of the target business object based on the logically associated entity. For example, if the query display entity is the same as the logically associated entity, the actual associated query condition of the target business object based on the logically associated entity is used as the data display filtering condition of the target business object based on the query display entity. If the query display entity and the logically associated entity are different, the largest common entity between the query display entity and the logically associated entity is determined, and based on the actual associated query conditions of the logically associated entity, the primary key of the largest common entity is queried from the target database corresponding to the target business object, and the data display filtering conditions of the target business object based on the query display entity are obtained based on the primary key of the largest common entity.
[0064] Step S208: Based on the query display scheme and the data display filtering condition, query the target database corresponding to the target business object for the data to be displayed, and obtain the query result corresponding to the associated query request.
[0065] The target database corresponding to the target business object is a database storing the business data of the target business object. It can be understood that different business objects usually have their own corresponding databases.
[0066] Specifically, the terminal can query the data to be displayed from the target database corresponding to the target business object based on the query display scheme and the data display filtering conditions, and obtain the query result corresponding to the associated query request. For example, the query display scheme includes the query display entity and the query display field of the target business object. The query display entity refers to the entity to be displayed. There are usually multiple fields under one entity, and the query display field refers to the field to be displayed. Based on the query display scheme and the data display filtering conditions, a complete data query statement can be generated, and the data to be displayed can be queried from the target database corresponding to the target business object based on the data query statement. Finally, the terminal can display the data to be displayed on the interface.
[0067] In the above document query method, an associated query scheme is pre-configured for the logically associated source business object and target business object, and the associated query scheme includes a logical association scheme between the source business object and the target business object, and a query display scheme for the target business object. The logical association scheme records the logical association relationship between the source business object and the target business object, specifically including logical association fields and logical association entities corresponding to the logical association fields in the source business object and the target business object, respectively. The query display scheme records the display form of the target business object after the source business object initiates an associated query, specifically including a query display entity. By performing an associated query according to the associated query scheme, the data of the source business object and the data of the target business object can be queried in their corresponding databases respectively, avoiding cross-database connection queries, thereby improving query efficiency.
[0068] After initiating an association query request for a source document, obtain the association query scheme corresponding to the source document. The source document belongs to the source business object. Based on the association query scheme, obtain the data to be displayed of the target business object, and obtain the query result corresponding to the association query request. Specifically, determine the logical association entity record based on the logical association entity of the source document according to the logical association field in the logical association scheme. The logical association entity record is the business data related to the logical association entity and the logical association field in the source document. The source business object and the target business object establish an association relationship through the logical association field and the corresponding logical association entity. Based on the logical association entity record based on the logical association entity of the source business object, determine the actual association query condition based on the logical association entity of the target business object, which can avoid cross-database connection query. The actual association query condition is used to query the business data related to the logical association entity in the target business object. Based on the entity association between the query display entity and the logical association entity corresponding to the target business object and the actual association query condition, determine the data display filter condition based on the query display entity of the target business object. The data display filter condition is used to query the business data related to the query display entity in the target business object. Finally, based on the query display scheme and the data display filtering conditions, the data to be displayed is queried from the target database corresponding to the target business object to obtain the query result corresponding to the associated query request.
[0069] It can be understood that cross-database connection query refers to establishing connections between different databases and performing data query across different databases to obtain the required data. Reference tables in different databases and match data between tables in different databases to achieve cross-database query, thereby obtaining the required data. However, the method of the present application does not require cross-database connection query, and queries the required data from the database corresponding to the source business object and the database corresponding to the target business object respectively, so as to obtain the data that needs to be displayed in the end. Determine the logically associated entity record of the source business object based on the logically associated entity from the database corresponding to the source business object, determine the actual associated query condition of the target business object based on the logically associated entity based on the logically associated entity record, determine the data display filter condition of the target business object based on the query display entity based on the entity association and the actual associated query condition between the query display entity and the logically associated entity corresponding to the target business object, and query the data to be displayed from the target database corresponding to the target business object based on the query display scheme and the data display filter condition, and obtain the query result corresponding to the associated query request.
[0070] In one embodiment, based on the logical association field, determining the logical association entity record of the source document based on the logical association entity includes:
[0071] When the association query request is triggered by selecting the entry line where the source document is located in the document list interface, if the display entity corresponding to the entry line where the source document is located is consistent with the logical association entity corresponding to the source business object, and the entry line where the source document is located contains a logical association field, the field value corresponding to the logical association field is obtained from the entry line where the source document is located to obtain the logical association entity record of the source document based on the logical association entity;
[0072] In the case where the association query request is triggered by selecting the entry line where the source document is located in the document list interface, when the display entity corresponding to the entry line where the source document is located is inconsistent with the logical association entity corresponding to the source business object, or when the display entity corresponding to the entry line where the source document is located is consistent with the logical association entity corresponding to the source business object but the entry line where the source document is located does not contain the logical association field, the field value corresponding to the logical association field is obtained from the cache data to obtain the logical association entity record of the source document based on the logical association entity;
[0073] When the association query request is triggered in the document details interface of the source document, the field value corresponding to the logical association field is obtained from the interface data of the document details interface to obtain the logical association entity record of the source document based on the logical association entity.
[0074] Among them, the document list interface is an interface for displaying a document list. For example, the document list interface can be a purchase order list interface, and the purchase order list interface displays the document data of multiple purchase orders. The document list interface can display different documents through different entry lines. For example, in the document list interface, a row of data corresponds to a purchase order. The entry line where the source document is located refers to the entry line used to display the source document. The display entity corresponding to the entry line where the source document is located refers to the entity currently displayed by the source document in the entry line where the source document is located. It can be understood that since the entry line display area of the document list interface is limited, a document includes multiple entities, and a single entity of the document is usually displayed in the entry line. For example, the purchase order list interface displays the detailed information of multiple purchase orders. In the purchase order list interface, one entry line is used to display the detailed information of a purchase order (that is, the entity information of the detailed entity of the purchase order).
[0075] It can be understood that the logical association scheme between the source business object and the target business object, the logical association fields correspond to the logical association entities in the source business object and the target business object respectively. The logical association entity corresponding to the source business object is the logical association entity corresponding to the logical association field in the source business object. The logical association entity corresponding to the target business object is the logical association entity corresponding to the logical association field in the target business object.
[0076] It can be understood that the document list interface is an interface for displaying multiple documents, while the document details interface is an interface for displaying a single document.
[0077] Specifically, the associated query request for the source document can be triggered in the document list interface or in the document details interface. If the associated query request for the source document is triggered in the document list interface, it can be triggered by selecting the entry line where the source document is located in the document list interface. For example, in the document list interface, first select the entry line where the source document is located, and then click the associated query control to trigger the associated query request for the source document. If the associated query request for the source document is triggered in the document details interface, it can be triggered by clicking the associated query control in the document details interface. In order to avoid accessing the source database corresponding to the source business object and improve query efficiency, the logically associated entity records of the source document based on the logically associated entity can be determined with the help of the data already loaded in the document list interface, the data already loaded in the document details interface, or the cached data.
[0078] If the association query request for the source document is triggered in the document list interface, the display entity corresponding to the entry line where the source document is located and the logical association entity corresponding to the source business object are compared. If the display entity corresponding to the entry line where the source document is located and the logical association entity corresponding to the source business object are consistent, it is further determined whether the entry line where the source document is located contains a logical association field. If the entry line where the source document is located contains a logical association field, the field value corresponding to the logical association field is directly obtained from the entry line where the source document is located to obtain the logical association entity record based on the logical association entity of the source document. If the entry line where the source document is located does not contain a logical association field, the field value corresponding to the logical association field is queried from the cached data. If the query is obtained, the logical association entity record based on the logical association entity of the source document is obtained based on the field value corresponding to the logical association field. Similarly, if the display entity corresponding to the entry line where the source document is located and the logical association entity corresponding to the source business object are inconsistent, the field value corresponding to the logical association field is queried from the cached data. If the query is obtained, the logical association entity record based on the logical association entity of the source document is obtained based on the field value corresponding to the logical association field. It can be understood that in order to display the document list interface, the terminal needs to query the entity data of the display entity from the source database corresponding to the source business object.
[0079] If the association query request for the source document is triggered in the document details interface of the source document, the field value corresponding to the logical association field of the source business object under the logical association entity is directly obtained from the interface data of the document details interface to obtain the logical association entity record of the source document based on the logical association entity.
[0080] In the above embodiment, by using the data already loaded in the document list interface, the data already loaded in the document details interface or the cached records of the document data, it is possible to avoid access to the database where the source business object is located and quickly obtain the logically associated entity records of the source document based on the logically associated entity.
[0081] In a specific application, Figure 3 The specific process of obtaining the logically associated entity records that actually need to be queried. First, determine whether the associated query request is initiated by the document interface (i.e., the document details interface). If the associated query request is initiated by the document interface, then obtain all the row data of the logically associated entity of the source business object according to the interface data of the document interface, determine the field data of the logically associated fields from all the row data, and assemble the field data of each logically associated field to obtain the logically associated entity records that actually need to be queried.
[0082] If the association query request is initiated by the list interface (i.e., the document list interface), then further determine whether the display entity of the list interface is consistent with the logical association entity of the source business object. If they are consistent, then further query in the list interface whether the currently selected row already contains the use field (i.e., the logical association field). If it is contained, then obtain the selected row data according to the list data, determine the field data of the use field from the selected row data, and assemble the field data of each use field to obtain the actual logical association entity record to be queried. If it is not contained, query whether the cache data of the selected row contains the use field from the document data cache. If it exists, determine the field data of the use field from the document data cache, and assemble the field data of each use field to obtain the actual logical association entity record to be queried. If it does not exist, query the complete data of the selected row from the source business object database (i.e., the source database), write the complete data of the selected row into the cache, determine the field data of the use field from the complete data of the selected row, and assemble the field data of each use field to obtain the actual logical association entity record to be queried. If they are inconsistent, query all row data of the logically associated entity under the document corresponding to the selected row from the document data cache. If all row data queried from the document data cache contains the use field, determine the field data of the use field from the document data cache, assemble the field data of each use field to obtain the logically associated entity record actually required to be queried. If all row data queried from the document data cache does not contain the use field, query all row data of the logically associated entity under the document corresponding to the selected row from the source business object database (that is, the source database), write all queried row data into the cache, determine the field data of the use field from all queried row data, assemble the field data of each use field to obtain the logically associated entity record actually required to be queried.
[0083] In one embodiment, based on the logically associated entity record, determining the actual associated query condition of the target business object based on the logically associated entity includes:
[0084] When the number of records of the logically associated entity is less than or equal to a preset threshold, based on the logically associated entity records, an actual associated query condition of the target business object based on the logically associated entity is generated;
[0085] When the number of records of the logically associated entity records is greater than a preset threshold, a physical temporary table is generated based on the logically associated entity records, the physical temporary table is stored in the target database corresponding to the target business object, and the actual associated query conditions of the target business object based on the logically associated entity are generated based on the physical temporary table.
[0086] It can be understood that there can be at least one logically associated field. The source document is based on the logically associated entity record of the logically associated entity, including field records of each logically associated field in the source document.
[0087] A physical temporary table is a special table in the database that is used to store temporary data. This data is valid only during the current session or transaction. When the session or transaction ends, the temporary table and its data are automatically deleted.
[0088] Specifically, the terminal compares the number of records in the logically associated entity record with a preset threshold value. If the number of records in the logically associated entity record is less than or equal to the preset threshold value, the terminal generates the actual associated query condition based on the logically associated entity for the target business object directly based on the logically associated entity record. If the number of records in the logically associated entity record is greater than the preset threshold value, if the actual associated query condition based on the logically associated entity for the target business object is generated directly based on the logically associated entity record, the statement of the actual associated query condition will be too long, which will easily reduce the query performance. Therefore, if the number of records in the logically associated entity record is greater than the preset threshold value, a physical temporary table is created, the logically associated entity record is inserted into the physical temporary table, the physical temporary table is stored in the target database corresponding to the target business object, and the actual associated query condition based on the logically associated entity for the target business object is generated based on the physical temporary table. For example, the actual associated query condition based on the logically associated entity for the target business object is generated based on the table identifier of the physical temporary table.
[0089] In this application, the deletion time of the physical temporary table is consistent with the expiration time of the filter conditions in the cache. For example, in the first query, a physical temporary table is generated, and the actual associated query conditions connected to the physical temporary table are cached. In the second query, the same actual associated query conditions can be returned from the cache, but the premise for the actual associated query conditions to be able to be queried is that the physical temporary table still exists (no need to regenerate).
[0090] In the above embodiment, the physical temporary table can shorten the length of the statement of the actual associated query condition, thereby avoiding the query performance being affected by the excessive length of the statement.
[0091] In one embodiment, the document query method further includes:
[0092] Based on the logical association scheme and the logical association entity records, data query is performed in the cache data for the actual association query condition;
[0093] When the query is successful, the actual associated query condition found is used as the actual associated query condition of the target business object based on the logical associated entity;
[0094] When the query fails, the step of comparing the number of records of the logically associated entity records with a preset threshold is executed, and the generated actual associated query condition is associated with the logically associated scheme and the logically associated entity records and stored in the cache data.
[0095] Specifically, the terminal can first query whether the required actual associated query conditions exist in the cache data. If so, the actual associated query conditions are directly obtained. If not, the actual associated query conditions are generated on demand and stored in the cache data to speed up the query efficiency of subsequent similar associated query requests.
[0096] Based on the logical association scheme and the logical association entity record, the terminal queries whether there is a corresponding actual association query condition in the cache data. If the query is successful, the actual association query condition queried from the cache data is used as the actual association query condition based on the logical association entity of the target business object. If the query fails, the number of records in the logical association entity record is compared with the preset threshold. If the number of records in the logical association entity record is less than or equal to the preset threshold, the actual association query condition based on the logical association entity of the target business object is generated based on the logical association entity record. If the number of records in the logical association entity record is greater than the preset threshold, a physical temporary table is generated based on the logical association entity record, the physical temporary table is stored in the target database corresponding to the target business object, and the actual association query condition based on the logical association entity of the target business object is generated based on the physical temporary table. The generated actual association query condition is associated with the logical association scheme and the logical association entity record and stored in the cache data. Subsequently, if the same batch of source business objects trigger an association query request under the same logical association scheme, the actual association query condition can be directly queried from the cache data, and the queried actual association query condition can be reused without regenerating the actual association query condition.
[0097] In the above embodiment, for the same batch of logically associated entity records of source business objects and the same logical association scheme, the actual associated query conditions finally parsed are consistent, so the query speed can be accelerated by caching the actual associated query conditions.
[0098] In a specific application, Figure 4 The specific process of calculating the actual associated query conditions of the target business object based on the logical associated entity. First, check whether there is a corresponding actual associated query condition in the cache data according to the logical associated condition (i.e., the logical associated query condition, the logical associated scheme) and the actual query record (i.e., the logical associated entity record). If it exists, the corresponding actual associated query condition in the cache data is used as the actual associated query condition of the target business object based on the logical associated entity. If it does not exist, further analyze whether the number of records in the actual query record is too much. If it is not too much, generate the filter conditions of the target business object that can be directly queried based on the actual query record, and obtain the actual associated query conditions of the target business object based on the logical associated entity. If it is too much, generate a physical temporary table with the field data in the actual query record, store the physical temporary table in the target business object database (i.e., the target database), generate the filter conditions of the target business object that can be directly queried based on the physical temporary table, and obtain the actual associated query conditions of the target business object based on the logical associated entity. Subsequently, the generated actual associated query conditions can be stored in the cache, so that if a similar associated query request is triggered later, the actual associated query conditions do not need to be regenerated, and the actual associated query conditions can be directly obtained from the cache data.
[0099] In one embodiment, based on the entity association and the actual association query condition between the query display entity and the logical association entity corresponding to the target business object, determining the data display filtering condition of the target business object based on the query display entity includes:
[0100] Calculate the largest common entity between the logically associated entity corresponding to the target business object and the query display entity;
[0101] When the logically associated entity corresponding to the target business object is consistent with the largest common entity, the actual associated query condition is used as the data display filter condition of the target business object based on the query display entity;
[0102] When the logically associated entity corresponding to the target business object is inconsistent with the largest public entity, based on the actual associated query conditions, the primary key corresponding to the largest public entity is queried from the target database corresponding to the target business object to obtain the data display filter conditions of the target business object based on the query display entity.
[0103] The largest common entity between the logically associated entity and the query display entity of the target business object refers to the entity path from the document header of the target business object to the logically associated entity and the entity path from the document header of the target business object to the query display entity, the entity with the deepest hierarchy and the same level between the two entity paths. Figure 5 , taking C1 and C3 as examples, the entity path of C1 is A-B1-C1, the entity path of C3 is A-B2-C3, and the largest common entity of C1 and C3 is the document header A. Taking C1 and C2 as examples, the entity path of C1 is A-B1-C1, the entity path of C2 is A-B1-C2, and the largest common entity of C1 and C2 is the document body B1. In the database, the primary key corresponding to the largest common entity is used to uniquely identify the entity data of the largest common entity. According to the primary key corresponding to the largest common entity, the entity data of the largest common entity can be queried in the database.
[0104] Specifically, refer to Figure 6 , the terminal calculates the maximum common entity between the logically associated entity and the query display entity of the target business object, and compares the logically associated entity and the maximum common entity of the target business object. If the logically associated entity corresponding to the target business object is consistent with the maximum common entity, it means that the query display entity is located on the entity path where the logically associated entity is located, and the level of the query display entity is equal to or deeper than the logically associated entity, then the entity data of the query display entity can be quickly obtained based on the entity data of the logically associated entity. At this time, the terminal can directly use the actual associated query condition as the data display filtering condition based on the query display entity of the target business object. If the logically associated entity and the maximum common entity corresponding to the target business object are inconsistent, then the entity data of the query display entity cannot be quickly obtained based on the entity data of the logically associated entity. At this time, the terminal can query the primary key corresponding to the maximum common entity from the target database corresponding to the target business object based on the actual associated query condition, and obtain the data display filtering condition based on the query display entity of the target business object based on the primary key corresponding to the maximum common entity.
[0105] refer to Figure 5, if the logically associated entity of the target business object is C1, the query display entity of the target business object is C3, and the largest common entity of C1 and C3 is the document header A. The actual associated query condition is used to filter the target business object. If the actual associated query condition is that the field value of the X field in C1 is X8, it is necessary to query the primary key of the document header A of the target business object whose document data meets the actual associated query condition from the target database corresponding to the target business object, and obtain the data display filtering condition of the target business object based on the query display entity based on the queried primary key of the document header A. The data display filtering condition includes the queried primary key of the document header A and the query display entity C3, which is used to query the document body data of the sub-document body C3 under the document header A identified by the primary key.
[0106] It is understandable that, in the case where the logically associated entity and the query display entity are entities on different entity paths, if data query is performed directly based on the logically associated entity and the query display entity, it is easy to cause a Cartesian product. However, in the present application, a Cartesian product can be avoided by performing a data query based on the largest common entity between the logically associated entity and the query display entity. By querying the primary key of the largest common entity based on the actual associated query condition of the logically associated entity, and querying the entity data of the query display entity through the primary key of the largest common entity, the Cartesian product can be avoided.
[0107] In the above embodiment, the largest common entity between the logically associated entity and the query display entity of the target business object is calculated, and the data display filtering conditions of the target business object based on the query display entity are determined by comparing whether the logically associated entity and the largest common entity of the target business object are consistent. This can eliminate the Cartesian product caused by cross-entity queries, avoid querying useless data, and improve query efficiency and accuracy.
[0108] In one embodiment, based on the entity association and the actual association query condition between the query display entity and the logical association entity corresponding to the target business object, determining the data display filtering condition of the target business object based on the query display entity includes:
[0109] Calculate the largest common entity between the logically associated entity corresponding to the target business object and the query display entity;
[0110] Perform a primary key query for the largest common entity in the cached data;
[0111] When the query is successful, the data display filter condition of the target business object based on the query display entity is obtained based on the primary key queried from the cache data;
[0112] When the query fails, based on the actual associated query conditions, the primary keys corresponding to the logically associated entities and the parent entities of the logically associated entities are queried from the target database corresponding to the target business object, and the primary keys queried from the target database are written into the cached data. The primary key corresponding to the largest common entity is determined from the queried primary keys, and based on the primary key corresponding to the largest common entity, the data display filter conditions of the target business object based on the query display entity are obtained.
[0113] Specifically, refer to Figure 7 , the terminal calculates the maximum common entity between the logically associated entity and the query display entity of the target business object, and can first query whether there is a primary key of the maximum common entity from the cached data. If it exists, the terminal obtains the primary key of the maximum common entity from the cached data, and obtains the data display filtering condition of the target business object based on the query display entity based on the primary key of the maximum common entity. If it does not exist, the terminal queries the primary keys corresponding to the logically associated entity and the parent entity of the logically associated entity from the target database corresponding to the target business object based on the actual associated query condition, and writes the primary keys corresponding to the logically associated entity and the parent entity of the logically associated entity into the cached data, so that when processing other associated query requests later, the primary key of the maximum common entity can be obtained from the cached data. It can be understood that the logically associated entity and the maximum common entity are inconsistent, so the terminal can determine the primary key corresponding to the maximum common entity from the primary key corresponding to the parent entity of the logically associated entity, and then obtain the data display filtering condition of the target business object based on the query display entity based on the primary key corresponding to the maximum common entity.
[0114] It can be understood that the greatest common entity between a logically associated entity and any entity must be the logically associated entity or its parent entity. As long as the primary key of the logically associated entity and its parent entity is queried once, most subsequent queries can directly generate primary key-based filtering conditions based on this query. Moreover, in the database, the query speed of data display filtering conditions generated based on the primary key is faster than that of data display filtering conditions generated based on the entity.
[0115] For example, refer to Figure 5 , if adopted Figure 6 For the first query, the logically associated entity is B1, the query displays the entity B1, and the generated filter condition is the logically associated field = XXX. For the second query, the logically associated entity is B1, the query displays the entity C1, and the generated filter condition is the logically associated field = XXX. For the third query, the logically associated entity is B1, the query displays the entity B2, and it is necessary to query the primary key of A from the target business object database, and the generated filter condition is the primary key of A = XXX.
[0116] If adopted Figure 7For the first query, the logically associated entity is B1, the query displays the entity B1, and the generated filter condition is B1's primary key = XXX. The primary keys of B1 and A are obtained in the first query. For the second query, the logically associated entity is B1, the query displays the entity C1, and the generated filter condition is B1's primary key = XXX. For the third query, the logically associated entity is B1, the query displays the entity B2, and the primary key of A can be directly obtained from the cached data, and the generated filter condition is A's primary key = XXX.
[0117] In the above embodiment, for the same batch of source business objects, under the same logical association scheme, the primary keys of all entities on the path of the logically associated entity of the target business object are cached. In all subsequent short-term queries of the same logical association of the same batch of source business objects, the primary key of the largest common entity does not need to be recalculated and can be directly obtained from the cached data, which can effectively improve query efficiency.
[0118] In one embodiment, based on the query display scheme and the data display filtering condition, the target database corresponding to the target business object is queried for the data to be displayed, and the query result corresponding to the associated query request is obtained, including:
[0119] Based on the query display fields in the query display scheme, a query field statement is obtained;
[0120] Concatenate the query field statement and the data display filter condition to obtain the data query statement;
[0121] Based on the data query statement, query the data to be displayed from the target database corresponding to the target business object to obtain the query result corresponding to the associated query request;
[0122] Display on the terminal based on the query results.
[0123] The query display scheme includes the query display entity and query display field of the target business object. The query display entity refers to the entity to be displayed. The query display entity includes many fields, and some fields can be selected for display. The query display field refers to the field to be displayed.
[0124] Specifically, refer to Figure 8, the terminal generates a complete query field statement based on the query display fields in the query display scheme. The query field statement is used to query the field data of the query display field. The data display filter condition is used to query the entity data of the query display entity of the target business object that is logically associated with the source document. The terminal splices the query field statement and the data display filter condition to obtain a data query statement. The data query statement is used to query the field data of the query display field under the query display entity of the target business object that is logically associated with the source document. Based on the data query statement, the terminal queries the data to be displayed from the target database corresponding to the target business object to obtain the query result corresponding to the associated query request. The query result corresponding to the associated query request includes the specified entity data of the target business object that meets the associated query scheme, and the terminal displays the query result to the user.
[0125] In the above embodiment, based on the query display field in the query display scheme, a query field statement is obtained, and the query field statement and the data display filter condition are spliced to obtain a simple data query statement. Based on the simple data query statement, the query result corresponding to the associated query request can be quickly obtained from the target database corresponding to the target business object.
[0126] In a specific embodiment, the method of the present application can be applied to a data query scenario across multiple business objects and entities in an ERP (Enterprise Resource Planning) system. In an ERP system, data query scenarios across multiple business objects and entities are very common. For example, for an associated query of a purchase order, it is necessary to query both the detailed information of the payables logically associated with the purchase order and the payment plan information of the payables. In traditional technical solutions, complex SQL is usually used to directly associate multiple entities, and cross-database connection queries are performed through complex SQL, resulting in poor query performance. For example, if you want to query the payables logically associated with a purchase order, the purchase order belongs to the supply chain-purchasing management module, while the payables belong to the financial accounting-accounts payable management module. The ERP system usually performs vertical sub-libraries, distributing the procurement module data and the accounts payable module data to different databases. Traditional technology needs to reference tables in different databases, match data between tables in different databases, and implement cross-database queries to obtain the required data. The query efficiency is low and it is easy to make queries wrong.
[0127] In this application, reference is made to Fig. 9, you can pre-design the logical association query conditions (i.e., logical association scheme) between the source business object and the target business object, and involve the query display scheme of the target business object. The logical association scheme and the query display scheme constitute the association query scheme. The logical association scheme includes the logical association fields and the logical association entities corresponding to the logical association fields in the source business object and the target business object respectively. The query display scheme includes the query display entity and the query display field of the target business object.
[0128] For example, a logical association scenario includes the material field (logical association field) between a purchase order (source business object) and an A / P (target business object), where the material field is under the detail entity in the purchase order and the material field is under the detail entity in the A / P. A query display scenario includes the payment detail entity (query display entity) of the A / P (target business object).
[0129] refer to Fig.10 , this application method abstracts the association query task into the following steps through a dynamic domain model:
[0130] 1. Initiate a related query request
[0131] The user initiates an associated query request for a row of detailed records, a document, or a batch of documents.
[0132] 2. Get the logically related entity records that need to be queried
[0133] According to the logically associated entities of the source business object in the logical association scheme, analyze the records to be queried based on the logically associated entities (i.e., logically associated entity records) of the source business object. You can use the data already loaded in the document list interface, the data already loaded in the document details interface, and the document data cache to obtain the logically associated entity records, eliminating access to the database where the source business object is located.
[0134] For example, if a user initiates an associated query request for purchase order A, the field value AH20 of the material field under the detail entity of purchase order A is obtained to obtain a logically associated entity record. The logically associated entity record is material field = AH20.
[0135] 3. Calculate the actual associated query conditions of the target business object based on the logically associated entity
[0136] Based on the logically associated entity records, actual associated query conditions of the target business object based on the logically associated entity are determined.
[0137] For example, the logical association entity record is Material Field = AH20, and the actual association query condition is also Material Field = AH20. The actual association query condition is used to query the A / P documents whose Material Field = AH20 under the detail entity.
[0138] 4. Calculate the data display filter conditions of the target business object based on the query display entity (that is, the actual associated query conditions of the target business object based on the query display entity)
[0139] Solution 1: Calculate the largest common entity between the logically associated entity and the query display entity of the target business object. If the logically associated entity and the largest common entity are consistent, use the actual associated query condition as the data display filter condition. If the logically associated entity and the largest common entity are inconsistent, query the primary key of the largest common entity from the target business object database based on the actual associated query condition, and obtain the data display filter condition based on the primary key of the largest common entity.
[0140] Solution 2: Calculate the largest common entity between the logically associated entity and the query display entity of the target business object. If the primary key of the largest common entity exists in the cache, obtain the data display filter condition based on the primary key of the largest common entity. If the primary key of the largest common entity does not exist in the cache, query the primary key of the logically associated entity and its parent entity from the target business object database based on the actual associated query condition, write the primary key of the logically associated entity and its parent entity into the cache, determine the primary key of the largest common entity from the primary keys of the logically associated entity and its parent entity, and obtain the data display filter condition based on the primary key of the largest common entity.
[0141] For example, the largest common entity between the detail entity (logically associated entity) and the payment plan entity (query display entity) is the document header entity, and the document header primary key of all payable documents with the material field = AH20 under the detail entity is queried. If the document header primary key is represented by 12345, the data display filter condition includes the document header primary key = 12345.
[0142] 5. For query display solutions, display based on data display filter conditions
[0143] The query display fields in the query display scheme are spliced into a query field statement, the query field statement and the data display filter condition are spliced to obtain a data query statement, and the data to be displayed is queried from the target business object database based on the data query statement, and the data to be displayed is displayed.
[0144] In the method of the present application, the SQL generation scheme of the associated query is simplified through specific steps, which solves the problem of reduced database query performance caused by the complexity of SQL. By setting the logical associated query conditions between business objects, the data of the source business object and the data of the target business object are queried in their corresponding databases respectively, avoiding the performance problems of traditional technologies through complex SQL cross-database connection queries, and being able to efficiently calculate the actual associated query conditions of the target business object based on the logically associated entity. In addition, caching the intermediate results calculated in the step process can accelerate the query efficiency of the associated query. Converting the actual associated query conditions into data display filter conditions based on the primary key of the largest common entity can eliminate the Cartesian product caused by cross-entity queries and improve query performance.
[0145] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0146] Based on the same inventive concept, the embodiment of the present application also provides a document query device for implementing the document query method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more document query device embodiments provided below can refer to the limitations on the document query method above, and will not be repeated here.
[0147] In one embodiment, Fig.11 As shown, a document query device is provided, including: a solution query module 1102, a first condition determination module 1104, a second condition determination module 1106 and a result display module 1108, wherein:
[0148] The solution query module 1102 is used to respond to the association query request for the source document and obtain the association query solution corresponding to the source document; the association query solution includes the logical association solution between the source business object and the target business object, and the query display solution of the target business object; the logical association solution includes the logical association fields and the logical association entities corresponding to the logical association fields in the source business object and the target business object respectively; the source document belongs to the source business object; the query display solution includes the query display entity.
[0149] The first condition determination module 1104 is used to determine the logical association entity record of the source document based on the logical association entity based on the logical association field, and determine the actual association query condition of the target business object based on the logical association entity based on the logical association entity record.
[0150] The second condition determination module 1106 is used to determine the data display filtering condition of the target business object based on the query display entity based on the entity association and the actual association query condition between the query display entity and the logical association entity corresponding to the target business object.
[0151] The result display module 1108 is used to query the data to be displayed from the target database corresponding to the target business object based on the query display scheme and the data display filtering condition, and obtain the query result corresponding to the associated query request.
[0152] In one embodiment, the first condition determination module 1104 is further configured to:
[0153] When the association query request is triggered by selecting the entry line where the source document is located in the document list interface, if the display entity corresponding to the entry line where the source document is located is consistent with the logical association entity corresponding to the source business object, and the entry line where the source document is located contains a logical association field, the field value corresponding to the logical association field is obtained from the entry line where the source document is located to obtain the logical association entity record of the source document based on the logical association entity;
[0154] In the case where the association query request is triggered by selecting the entry line where the source document is located in the document list interface, when the display entity corresponding to the entry line where the source document is located is inconsistent with the logical association entity corresponding to the source business object, or when the display entity corresponding to the entry line where the source document is located is consistent with the logical association entity corresponding to the source business object but the entry line where the source document is located does not contain the logical association field, the field value corresponding to the logical association field is obtained from the cache data to obtain the logical association entity record of the source document based on the logical association entity;
[0155] When the association query request is triggered in the document details interface of the source document, the field value corresponding to the logical association field is obtained from the interface data of the document details interface to obtain the logical association entity record of the source document based on the logical association entity.
[0156] In one embodiment, the first condition determination module 1104 is further configured to:
[0157] When the number of records of the logically associated entity is less than or equal to a preset threshold, based on the logically associated entity records, an actual associated query condition of the target business object based on the logically associated entity is generated;
[0158] When the number of records of the logically associated entity records is greater than a preset threshold, a physical temporary table is generated based on the logically associated entity records, the physical temporary table is stored in the target database corresponding to the target business object, and the actual associated query conditions of the target business object based on the logically associated entity are generated based on the physical temporary table.
[0159] In one embodiment, the document query device is further used to:
[0160] Based on the logical association scheme and the logical association entity records, data query is performed in the cache data for the actual association query condition;
[0161] When the query is successful, the actual associated query condition found is used as the actual associated query condition of the target business object based on the logical associated entity;
[0162] When the query fails, the step of comparing the number of records of the logically associated entity records with a preset threshold is executed, and the generated actual associated query condition is associated with the logically associated scheme and the logically associated entity records and stored in the cache data.
[0163] In one embodiment, the second condition determination module 1106 is further configured to:
[0164] Calculate the largest common entity between the logically associated entity corresponding to the target business object and the query display entity;
[0165] When the logically associated entity corresponding to the target business object is consistent with the largest common entity, the actual associated query condition is used as the data display filter condition of the target business object based on the query display entity;
[0166] When the logically associated entity corresponding to the target business object is inconsistent with the largest public entity, based on the actual associated query conditions, the primary key corresponding to the largest public entity is queried from the target database corresponding to the target business object to obtain the data display filter conditions of the target business object based on the query display entity.
[0167] In one embodiment, the second condition determination module 1106 is further configured to:
[0168] Calculate the largest common entity between the logically associated entity corresponding to the target business object and the query display entity;
[0169] Perform a primary key query for the largest common entity in the cached data;
[0170] When the query is successful, the data display filter condition of the target business object based on the query display entity is obtained based on the primary key queried from the cache data;
[0171] When the query fails, based on the actual associated query conditions, the primary keys corresponding to the logically associated entities and the parent entities of the logically associated entities are queried from the target database corresponding to the target business object, and the primary keys queried from the target database are written into the cached data. The primary key corresponding to the largest common entity is determined from the queried primary keys, and based on the primary key corresponding to the largest common entity, the data display filter conditions of the target business object based on the query display entity are obtained.
[0172] In one embodiment, the result display module 1108 is further used to:
[0173] Based on the query display fields in the query display scheme, a query field statement is obtained;
[0174] Concatenate the query field statement and the data display filter condition to obtain the data query statement;
[0175] Based on the data query statement, query the data to be displayed from the target database corresponding to the target business object to obtain the query result corresponding to the associated query request;
[0176] Display on the terminal based on the query results.
[0177] The document query device described above can improve query efficiency.
[0178] Each module in the document query device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0179] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.12 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. 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 data involved in the document query method. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication 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, a document query method is implemented.
[0180] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.13 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. 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 and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a document query method is realized. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0181] Those skilled in the art will understand that Fig.12 , Fig.13 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present 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 a different arrangement of components.
[0182] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0183] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0184] In one embodiment, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0185] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0186] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and 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-mentioned methods. Among them, any reference to the memory, database or other medium 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), magnetoresistive 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. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0187] The technical features of the above embodiments may be arbitrarily combined. 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, they should be considered to be within the scope of this specification.
[0188] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A document query method, characterized in that: The method comprises: In response to an association query request for a source document, an association query solution corresponding to the source document is obtained; the association query solution includes a logical association solution between a source business object and a target business object, and a query display solution for the target business object; the logical association solution includes a logical association field, and logical association entities corresponding to the logical association field in the source business object and the target business object, respectively; the source document belongs to the source business object; and the query display solution includes a query display entity; Based on the logical association field, determine the logical association entity record of the source document based on the logical association entity, and based on the logical association entity record, determine the actual association query condition of the target business object based on the logical association entity; Determine a data display filtering condition for the target business object based on the query display entity based on the entity association between the query display entity and the logical association entity corresponding to the target business object and the actual association query condition; Based on the query display scheme and the data display filtering condition, the data to be displayed is queried from the target database corresponding to the target business object to obtain a query result corresponding to the associated query request.
2. The method according to claim 1, characterized in that The determining, based on the logical association field, a logical association entity record of the source document based on the logical association entity includes: In the case where the association query request is triggered by selecting the entry row where the source document is located in the document list interface, when the display entity corresponding to the entry row where the source document is located is consistent with the logical association entity corresponding to the source business object, and the entry row where the source document is located contains the logical association field, the field value corresponding to the logical association field is obtained from the entry row where the source document is located to obtain a logical association entity record of the source document based on the logical association entity; In the case where the association query request is triggered by selecting the entry row where the source document is located in the document list interface, when the display entity corresponding to the entry row where the source document is located is inconsistent with the logical association entity corresponding to the source business object, or the display entity corresponding to the entry row where the source document is located is consistent with the logical association entity corresponding to the source business object, but the entry row where the source document is located does not contain the logical association field, the field value corresponding to the logical association field is obtained from the cache data to obtain the logical association entity record of the source document based on the logical association entity; When the association query request is triggered in the document details interface of the source document, the field value corresponding to the logical association field is obtained from the interface data of the document details interface to obtain the logical association entity record of the source document based on the logical association entity.
3. The method according to claim 1, characterized in that The determining, based on the logically associated entity record, an actual associated query condition of the target business object based on the logically associated entity includes: When the number of records of the logically associated entity record is less than or equal to a preset threshold, based on the logically associated entity record, generating an actual associated query condition of the target business object based on the logically associated entity; When the number of records of the logically associated entity records is greater than a preset threshold, a physical temporary table is generated based on the logically associated entity records, the physical temporary table is stored in a target database corresponding to the target business object, and actual associated query conditions based on the logically associated entity are generated for the target business object based on the physical temporary table.
4. The method according to claim 3, characterized in that: The method further comprises: Based on the logical association scheme and the logical association entity record, performing data query for actual association query conditions in cache data; When the query is successful, the actual associated query condition found is used as the actual associated query condition of the target business object based on the logical associated entity; When the query fails, the step of comparing the number of records of the logically associated entity records with the preset threshold is executed, and the generated actual associated query condition is associated with the logically associated scheme and the logically associated entity records and stored in the cache data.
5. The method according to claim 1, characterized in that The determining, based on the entity association between the query display entity and the logically associated entity corresponding to the target business object and the actual associated query condition, a data display filtering condition of the target business object based on the query display entity includes: Calculate the largest common entity between the logically associated entity corresponding to the target business object and the query display entity; When the logical association entity corresponding to the target business object is consistent with the largest common entity, the actual association query condition is used as a data display filtering condition for the target business object based on the query display entity; When the logically associated entity corresponding to the target business object is inconsistent with the largest public entity, based on the actual associated query condition, the primary key corresponding to the largest public entity is queried from the target database corresponding to the target business object to obtain the data display filtering condition of the target business object based on the query display entity.
6. The method according to claim 1, characterized in that The determining, based on the entity association between the query display entity and the logically associated entity corresponding to the target business object and the actual associated query condition, a data display filtering condition of the target business object based on the query display entity includes: Calculate the largest common entity between the logically associated entity corresponding to the target business object and the query display entity; Performing a primary key query for the largest common entity in the cached data; When the query is successful, based on the primary key queried from the cache data, a data display filtering condition of the target business object based on the query display entity is obtained; When the query fails, based on the actual associated query conditions, the primary keys corresponding to the logically associated entity and the parent entity of the logically associated entity are queried from the target database corresponding to the target business object, and the primary keys queried from the target database are written into the cache data. The primary key corresponding to the largest public entity is determined from the queried primary keys, and based on the primary key corresponding to the largest public entity, the data display filtering conditions of the target business object based on the query display entity are obtained.
7. The method according to claim 1, characterized in that The querying of the data to be displayed from the target database corresponding to the target business object based on the query display scheme and the data display filtering condition to obtain the query result corresponding to the associated query request includes: Based on the query display fields in the query display scheme, obtaining a query field statement; The query field statement and the data display filter condition are concatenated to obtain a data query statement; Based on the data query statement, query the data to be displayed from the target database corresponding to the target business object to obtain the query result corresponding to the associated query request; Display is performed on the terminal based on the query result.
8. A document query device, characterized in that: The device comprises: A scheme query module, for obtaining, in response to an association query request for a source document, an association query scheme corresponding to the source document; the association query scheme includes a logical association scheme between a source business object and a target business object, and a query display scheme for the target business object; the logical association scheme includes a logical association field, and logical association entities corresponding to the logical association field in the source business object and the target business object, respectively; the source document belongs to the source business object; and the query display scheme includes a query display entity; A first condition determination module is used to determine the logical association entity record of the source document based on the logical association entity based on the logical association field, and determine the actual association query condition of the target business object based on the logical association entity based on the logical association entity based on the logical association entity record; A second condition determination module, configured to determine a data display filtering condition of the target business object based on the query display entity based on the entity association between the query display entity and the logical association entity corresponding to the target business object and the actual association query condition; The result display module is used to query the data to be displayed from the target database corresponding to the target business object based on the query display scheme and the data display filtering condition, and obtain the query result corresponding to the associated query request.
9. A computer device comprising a memory and a processor, wherein 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.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: 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.
11. A computer program product, comprising a computer program, characterized in that 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
Data correlation query method and data correlation query device
CN102521416A
Data table correlation query method and apparatus
CN108509637A
Database query method and device, computer equipment and storage medium
CN110990400A
Data query method and device, equipment and storage medium
CN116383192A
Document query method and device, computer equipment and storage medium
CN117743409A
Cited By
Document tracking method and device based on intelligent condition filtering and medium
CN120973841A
A document tracking method, device, and medium based on intelligent conditional filtering
CN120973841B