Invoice query method and device, equipment, storage medium and program product

By configuring the logical association scheme and query display scheme of the source business object and the target business object, the problem of low efficiency in cross-database join query is solved, and efficient multi-entity data query is realized.

CN119807234BActive Publication Date: 2026-01-02KINGDEE SOFTWARE(CHINA) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411693988.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2026-01-02
Estimated Expiration
2044-11-22

AI Technical Summary

Technical Problem

Existing technologies suffer from low query efficiency in multi-entity data queries across business objects, especially when complex SQL statements need to be edited for cross-database join queries in different databases.

Method used

This paper provides a document query method that pre-configures the logical association scheme and query display scheme between the source business object and the target business object, uses logical association fields and entity records to determine the actual association query conditions, avoids cross-database join queries, and directly retrieves data from their respective databases.

Benefits of technology

It improves the efficiency of data querying, reduces the complexity of cross-database join queries, and increases the speed of obtaining query results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807234B_ABST
    Figure CN119807234B_ABST
Patent Text Reader

Abstract

The application relates to a bill query method and device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: acquiring an associated query scheme corresponding to a source bill according to an associated query request for the source bill; the associated query scheme comprises a logical association scheme between a source business object and a target business object, and a query display scheme of the target business object; determining a logical association entity record of the source bill based on a logical association field, determining an actual associated query condition of the target business object based on the logical association entity record, and determining a data display filtering condition of the target business object based on a query display entity, the logical association entity and the actual associated query condition; and querying data from a target business object database based on the query display scheme and the data display filtering condition to obtain a query result corresponding to the associated query request. In this way, the query efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computers, and in particular to a bill query method and device, computer equipment, a storage medium, and a computer program product. BACKGROUND

[0002] With the development of computer technology, business systems in various industries tend to be perfect, and a large amount of business data is accumulated to form various databases of a certain scale.

[0003] In a business system, data query scenarios across multiple entities of business objects are very common. In the current technical solution, multiple entity associations are usually directly performed in the form of SQL (Structured Query Language). However, bill data of different business objects is usually stored in different databases, and the current technical solution needs to edit complex SQL statements for cross-database connection queries, which has the problem of low query efficiency. SUMMARY

[0004] Therefore, it is necessary to provide a bill query method, device, computer equipment, computer readable storage medium, and computer program product that can improve query efficiency.

[0005] The present application provides a bill query method, comprising:

[0006] In response to an association query request for a source bill, an association query scheme corresponding to the source bill is obtained; the association query scheme comprises a logical association scheme between a source business object and a target business object, a query display scheme of the target business object; the logical association scheme comprises 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 bill belongs to the source business object; the query display scheme comprises a query display entity;

[0007] Based on the logical association field, a logical association entity record of the source bill based on logical association entities is determined, and based on the logical association entity record, an actual association query condition of the target business object based on logical association entities is determined;

[0008] 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, a data display filtering condition of the target business object based on the query display entity is determined;

[0009] Based on the query display scheme and the data display filtering condition, to-be-displayed data is queried from a target database corresponding to the target business object, and a query result corresponding to the association query request is obtained.

[0010] The application further provides a bill query device, comprising:

[0011] A scheme query module is configured to acquire an associated query scheme corresponding to a source bill in response to an associated query request for the source bill; the associated query scheme comprises a logical association scheme between a source business object and a target business object, and a query display scheme of the target business object; the logical association scheme comprises 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 bill belongs to the source business object; and the query display scheme comprises a query display entity.

[0012] A first condition determination module is configured to determine a logical association entity record of the source bill based on the logical association field, and determine an actual associated query condition of the target business object based on the logical association entity record.

[0013] A second condition determination module is configured to determine a data display filtering condition of the target business object based on a query display entity and an entity association between the logical association entities corresponding to the target business object and the actual associated query condition.

[0014] A result display module is configured to query to-be-displayed data from a target database corresponding to the target business object based on the query display scheme and the data display filtering condition, and obtain a query result corresponding to the associated query request.

[0015] The application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the bill query method when executing the computer program.

[0016] The application further provides a computer readable storage medium, which stores a computer program, and the computer program implements the steps of the bill query method when executed by a processor.

[0017] The application further provides a computer program product comprising a computer program, and the computer program implements the steps of the bill query method when executed by a processor.

[0018] The bill query method, device, computer device, storage medium and computer program product preconfigure an associated query scheme for a source business object and a target business object that are logically associated, the associated query scheme including a logical association scheme between the source business object and the target business object and a query display scheme of the target business object. The logical association scheme records a logical association relationship between the source business object and the target business object, and specifically 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. The query display scheme records a display form of the target business object after the source business object initiates an associated query, and specifically includes a query display entity. 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 the corresponding databases respectively, so that cross-database connection query is avoided, and the query efficiency is improved.

[0019] After initiating the associated query request for the source bill, the associated query scheme corresponding to the source bill is obtained, the source bill belongs to a source business object, the data to be displayed of the target business object is obtained based on the associated query scheme, and a query result corresponding to the associated query request is obtained. The logical association entity record of the source bill based on the logical association entity is determined according to the logical association field in the logical association scheme, and the logical association entity record is the business data of the source bill related to the logical association entity and the logical association field. The source business object and the target business object establish an association relationship through the logical association field and the corresponding logical association entity, the actual associated query condition of the target business object based on the logical association entity is determined based on the logical association entity record of the source business object based on the logical association entity, cross-database connection query can be avoided, and the actual associated query condition is used to query the business data of the target business object related to the logical association entity. The data display filtering condition of the target business object based on the query display entity is determined based on the entity association between the query display entity and the logical association entity corresponding to the target business object and the actual associated query condition, and the data display filtering condition is used to query the business data of the target business object related to the query display entity. Finally, the data to be displayed is queried from the target database corresponding to the target business object based on the query display scheme and the data display filtering condition, and the query result corresponding to the associated query request is obtained. BRIEF DESCRIPTION OF DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the following will briefly introduce the drawings needed to be used in the embodiments or the related art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.

[0021] Figure 1 A diagram of an application environment of a bill query method in an embodiment;

[0022] Figure 2 a flowchart of a bill query method in an embodiment;

[0023] Figure 3 a flowchart of obtaining logically associated entity records actually required for query in an embodiment;

[0024] Figure 4 a flowchart of calculating entity association query conditions of a target business object based on logically associated entities in an embodiment;

[0025] Figure 5 a schematic diagram of relationships between entities in a bill in an embodiment;

[0026] Figure 6 a flowchart of calculating data display filtering conditions of a target business object based on query display entities in an embodiment;

[0027] Figure 7 a flowchart of calculating data display filtering conditions of a target business object based on query display entities in another embodiment;

[0028] Figure 8 a flowchart of displaying based on data display filtering conditions for a query display scheme in an embodiment;

[0029] Figure 9 a schematic diagram of designing an associated query scheme in an embodiment;

[0030] Figure 10 a flowchart of a bill query method in another embodiment;

[0031] Figure 11 a structural block diagram of a bill query apparatus in an embodiment;

[0032] Figure 12 an internal structure diagram of a computer device in an embodiment;

[0033] Figure 13 an internal structure diagram of a computer device in another embodiment. DETAILED DESCRIPTION

[0034] In order to make the objects, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and should not be used to limit the present application.

[0035] The bill query method provided by the embodiments of the present application can be applied to, for example, Figure 1The application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data required by the server 104 to process. The data storage system can be set up separately, can be integrated on the server 104, or can be placed on the cloud or other devices. The terminal 102 can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, Internet of Things devices, and portable wearable devices. The Internet of Things device can be a smart speaker, a smart TV, a smart air conditioner, a smart vehicle device, a projection device, etc. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, 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 a standalone physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0036] It can be understood that the terminal and the server can be used alone to execute the invoice query method provided in the embodiments of the present application. The terminal and the server can also be used cooperatively to execute the invoice query method provided in the embodiments of the present application.

[0037] For example, the terminal acquires an associated query scheme corresponding to the source invoice in response to an associated query request for the source invoice. The associated query scheme includes a logical association scheme between the source business object and the target business object, and a query display scheme of 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 invoice belongs to the source business object. The query display scheme includes a query display entity. The terminal determines a logical association entity record of the source invoice based on the logical association field and the logical association entities, determines an actual associated query condition of the target business object based on the logical association entity record, determines a data display filtering condition of the target business object based on the query display entity and the entity association between the logical association entities corresponding to the target business object, and queries the data to be displayed from a target database corresponding to the target business object based on the query display scheme and the data display filtering condition, to obtain a query result corresponding to the associated query request. The terminal can display the query result corresponding to the associated query request.

[0038] For ease of understanding and description, before the embodiments of the present application are further described in detail, a plurality of key concepts of the present application will be briefly described.

[0039] Dynamic domain model refers to the visualized representation of concept classes or objects in the real world within a domain. Dynamic domain model can also be called concept model, domain object model, analysis object model. It focuses on analyzing the problem domain itself, exploring important business domain concepts, and establishing the relationship between business domain concepts. Dynamic domain model models in the form of "model-element-attribute", so that each element supports different business characteristics. For example, the material field (element layer, basic information field) under the purchase order (model layer, document model) supports obtaining its code field, name field and associated carrying field (attribute layer).

[0040] Business object refers to the document model or basic information model in the dynamic domain model. For example, the purchase order is a document model object, the purchase warehouse-in single is also a document model object, and the material is a basic information model object.

[0041] 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 the payable single as an example, two common business branches are usually involved, one of which records the information such as what material the current payable single will purchase and how many quantities, which is called the detail entity, and the other records the information such as the payment date and the associated payment amount (such as 50% payment when the order is confirmed and 50% payment after three months) of the payable single, which is called the payment plan entity. The two entities are related to the current payable single, but the records in the two entities are not associated. The detail entity records the detailed purchase information of various materials in the payable single, and the payment plan entity records the detailed plan information of the entire payment plan of the corresponding payable single. The rows of data under the detail entity and the payment plan entity are not one-to-one.

[0042] Cartesian product refers to the set of all possible ordered pairs between two sets. In a database, Cartesian product is usually used in join operation, where the Cartesian product of two tables is used to represent all possible combinations. For example, the m rows of the detail entity of the payable single and the n rows of the payment plan entity, when directly joined, will result in m*n rows of query records due to the lack of association logic between the two entities.

[0043] Business association refers to the association between business objects according to the common document flow relationship in the business system. For example, the document flow relationship is purchase application→purchase order→purchase warehouse-in single→payable single, so there is a business association between the purchase application single and the purchase order, between the purchase order and the purchase warehouse-in single, and between the purchase warehouse-in single and the payable single.

[0044] Logical association refers to the association relationship between business objects established through entities and fields. Business objects can establish a lookup relationship based on entities and fields to find business object data that meets the conditions. For example, there is a field for associated purchase order number on the detail information of the payable single. When we perform an associated query on the purchase order, we can use the lookup relationship (purchase order document number = associated purchase order number of payable single) to find the corresponding payable single. Unlike business association, logical association only refers to the established lookup relationship and does not concern whether the business is associated, for example, according to the supplier and material of the purchase order, find the inspection single of the same supplier and material to understand the historical material detection situation of the same supplier and the same material, rather than only query the inspection single associated with the current purchase order.

[0045] Source business object refers to the associated business object in the logical association.

[0046] Target business object refers to the associated business object in the logical association.

[0047] Logical association entity refers to the deepest entity in the business object corresponding to the logical association field in the logical association.

[0048] Query display entity refers to the deepest entity that needs to be displayed in the associated business object in the logical association.

[0049] Maximum common entity refers to the deepest and equal entity between the two paths from the document header to the entity itself in the two entities of the same business object.

[0050] It can be understood that a business object is usually a certain single, and in a business system, the single detail interface of a single includes multiple single body tabs, different single body tabs correspond to different entities, and different single body tabs have different purposes. For example, the single detail interface of the payable single includes a detail tab and a payment plan tab. The detail tab mainly presents detailed content such as material, quantity, source single type, source single number, etc., and mainly carries upstream supply chain single and associated downstream purchase invoice data. The payment plan tab mainly records related data of payment, and is associated with downstream payment single and related information associated with reverse writing payment. The detail tab corresponds to the detail entity, and the payment plan tab corresponds to the payment plan entity.

[0051] In an embodiment, as shown in Figure 2 , a single query method is provided, which is applied to a terminal in Figure 1 for example. It can be understood that the method can be executed by the terminal or the server itself alone, or can be realized through the interaction between the terminal and the server. Among them:

[0052] In step S202, in response to the associated query request for the source document, an associated query scheme corresponding to the source document is acquired; the associated query scheme comprises a logical association scheme between the source business object and the target business object, a query display scheme of the target business object; the logical association scheme comprises 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 comprises a query display entity.

[0053] The source document refers to a document that triggers the associated query. For example, if the purchase document A is selected to trigger the associated query, the purchase document A is the source document. The associated query request is used to request the business data of the target business object that has a logical association with the source business object. The associated query request for the source document is used to request the document data of other documents that have a logical association with the source document. For example, the documents that have a logical association with the purchase document include the payable document. If the purchase document A is selected to trigger the associated query, the document data of each payable document that has a logical association with the purchase document A needs to be queried.

[0054] In order to facilitate the associated query, the associated query scheme is configured for the source business object and the target business object. The associated query scheme comprises a logical association scheme between the source business object and the target business object, and a query display scheme of the target business object. It can be understood that the source business object is the currently displayed business object, the target business object is the 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 through 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 comprises 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 logical association scheme can also be referred to as 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 comprises 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 it is required to query the invoice data of the payable order based on the invoice data of the purchase order, the associated query scheme can be configured for the purchase order and the payable order. The associated query scheme includes a logical association scheme between the purchase order and the payable order, and a query display scheme of the payable order. The logical association scheme can include a material field (i.e., a logical association field), a detail entity of the purchase order (i.e., an entity in which the material field is located in the purchase order), and a detail entity of the payable order (i.e., an entity in which the material field is located in the payable order). The payable order logically associated with the purchase order is queried through the material field in the detail information of the purchase order and the material field in the detail information of the payable order. If it is finally required to display the payment plan of the payable order, the query display scheme can include a payment plan entity of the payable order.

[0056] It can be understood that the associated query request for the source invoice is an associated query request triggered by the source invoice, and the source invoice belongs to a source business object. The source business object represents a batch of invoices of the same type, and the source invoice can be any invoice in the batch.

[0057] Specifically, a user can trigger an associated query request through a source business object as needed, so as to quickly query relevant business data of a target business object corresponding to the source business object. The terminal obtains an associated query scheme corresponding to a source invoice in response to an associated query request for the source invoice, obtains business data required to be displayed by the target business object based on the associated query scheme, and obtains a query result corresponding to the associated query request.

[0058] In step S204, a logical association entity record of the source invoice based on a logical association entity is determined based on a logical association field, and an actual associated query condition of the target business object based on the logical association entity is determined based on the logical association entity record.

[0059] The logical association entity record of the source document based on the logical association entity refers to a field record of the logical association field in the source document. For example, if the logical association field is a material field in a document, and the entity where the logical association field is located in a purchase order is a detail entity of the purchase order, the logical association entity record of the purchase order based on the logical association entity can be a field value of the material field in the detail information of the purchase order. The source business object and the target business object are logically associated through the logical association field under the respective logical association entity. 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 having 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 a 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 a material field in a document, and the entity where the logical association field is located in a purchase order is a detail entity of the purchase order, and the entity where the logical association field is located in a payable order is a detail entity of the payable order. If the logical association entity record of the purchase order A based on the logical association entity is a field value AH20 of the material field in the detail information of the purchase order A, the actual association query condition of the target business object based on the logical association entity can be a payable order in which the field value of the material field in the detail information is AH20.

[0060] Specifically, the terminal can determine the logical association entity record of the source document based on the logical association field. For example, based on the logical association field, the logical association entity record of the source document based on the logical association entity is queried from the source database corresponding to the source business object; based on the logical association field, the logical association entity record of the source document based on the logical association entity is queried from the cache data; based on the logical association field, the logical association entity record of the source document based on the logical association entity is queried from the current displayed data; and the like. Further, the terminal determines the actual association query condition of the target business object based on the logical association entity record. The actual association query condition is used to query the target business object logically associated with the source document, specifically, to query the target business object in which the field record corresponding to the logical association field is the field record corresponding to the logical association field in the source document.

[0061] In step S206, the data display filtering condition of the target business object based on the query display entity is determined 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.

[0062] The data display filtering condition of the target business object based on the query display entity refers to a query condition of the target business object corresponding to the query display entity. The data display filtering condition of the target business object based on the query display entity can also be referred to as an actual associated query condition of the target business object based on the query display entity. The actual associated query condition of the target business object based on the logical association entity is used to query the target business object logically associated with the source document. For example, the source business object in the associated query scheme is a purchase order, and the target business object is a payable single. If an associated query request for the purchase order A is triggered, the actual associated query condition of the target business object based on the logical association entity is used to query the payable single logically associated with the purchase order A. The actual associated query condition of the target business object based on the query display entity is used to query the entity data of the target business object logically associated with the source document in the query display entity. For example, the actual associated query condition of the target business object based on the logical association entity is used to query the payable single logically associated with the purchase order A, and the query display entity of the payable single is a payment plan entity. The actual associated query condition of the target business object based on the query display entity is used to query the payment plan information of the payable single logically associated with the purchase order A.

[0063] Specifically, the query display entity of the target business object and the logical association 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 finally needed to be displayed as the query display entity according to needs. For example, the entities of the payable single include a detail entity and a payment plan entity. The query display entity can be the detail entity or the payment plan entity. If the logical association entity is the detail entity and the query display entity is the payment plan entity, the query display entity and the logical association entity are different. If the logical association entity is the detail entity and the query display entity is the detail entity, the query display entity and the logical association 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 logical association entity of the target business object and the actual associated query condition of the target business object based on the logical association entity. For example, if the query display entity and the logical association entity are the same, the actual associated query condition of the target business object based on the logical association 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 logical association entity are different, the maximum common entity between the query display entity and the logical association entity is determined, the primary key of the maximum common entity is queried from the target database corresponding to the target business object based on the actual associated query condition of the logical association entity, and the data display filtering condition of the target business object based on the query display entity is obtained based on the primary key of the maximum common entity.

[0064] At step S208, based on the query display scheme and the data display filtering condition, the terminal queries the to-be-displayed data from the target database corresponding to the target business object, and obtains a query result corresponding to the associated query request.

[0065] The target database corresponding to the target business object is a database storing business data of the target business object. It can be understood that different business objects usually have respective corresponding databases.

[0066] Specifically, the terminal can query the to-be-displayed data from the target database corresponding to the target business object based on the query display scheme and the data display filtering condition, and obtain a query result corresponding to the associated query request. For example, the query display scheme includes a query display entity and a query display field of the target business object, the query display entity refers to an entity to be displayed, and there are usually multiple fields under an entity, and the query display field refers to a field to be displayed. Based on the query display scheme and the data display filtering condition, a complete data query statement can be generated, and the to-be-displayed data is queried from the target database corresponding to the target business object based on the data query statement. Finally, the terminal can display the to-be-displayed data on the interface.

[0067] In the above bill query method, the associated query scheme is configured in advance for the logically associated 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 of the target business object. The logical association scheme records the logical association relationship between the source business object and the target business object, and specifically 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. The query display scheme records the display form of the target business object after the source business object initiates the associated query, and specifically includes a query display entity. 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 the respective databases, avoiding cross-database connection query, thereby improving the query efficiency.

[0068] After initiating the associated query request for the source document, the associated query scheme corresponding to the source document is obtained, the source document belongs to a source business object, the to-be-displayed data of a target business object is obtained based on the associated query scheme, and a query result corresponding to the associated query request is obtained. The logical association entity record of the source document based on the logical association entity is determined according to the logical association field in the logical association scheme, and 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, the actual association query condition of the target business object based on the logical association entity is determined based on the logical association entity record of the source business object based on the logical association entity, cross-database connection query can be avoided, and 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, the data display filtering condition of the target business object based on the query display entity is determined, and the data display filtering 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 condition, the to-be-displayed data is queried from the target database corresponding to the target business object, and the query result corresponding to the associated query request is obtained.

[0069] It can be understood that the cross-database connection query refers to establishing a connection between different databases, querying data across different databases to obtain required data. Tables in different databases are referenced, and tables in different databases are matched to realize cross-database query and obtain required data. However, the method of the present application does not need cross-database connection query, and required data is queried 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 finally required to be displayed. The logical association entity record of the source business object based on the logical association entity is determined from the database corresponding to the source business object, the actual association query condition of the target business object based on the logical association entity is determined based on the logical association entity record, the data display filtering condition of the target business object based on the query display entity is determined 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 to-be-displayed data is queried from the target database corresponding to the target business object based on the query display scheme and the data display filtering condition, and the query result corresponding to the associated query request is obtained.

[0070] In one embodiment, based on the logical association field, the logical association entity record of the source document based on the logical association entity is determined, comprising:

[0071] In a case where the association query request is triggered by selecting the source document in the document list interface, when the display entity corresponding to the source document in the document list interface and the logical association entity corresponding to the source business object are consistent, and the source document in the document list interface contains the logical association field, the field value corresponding to the logical association field is obtained from the source document in the document list interface, to obtain the logical association entity record of the source document based on the logical association entity.

[0072] In a case where the association query request is triggered by selecting the source document in the document list interface, when the display entity corresponding to the source document in the document list interface and the logical association entity corresponding to the source business object are inconsistent, or the display entity corresponding to the source document in the document list interface and the logical association entity corresponding to the source business object are consistent, but the source document in the document list interface 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] In a case where the association query request is triggered in the document detail interface of the source document, the field value corresponding to the logical association field is obtained from the interface data of the document detail interface, to obtain the logical association entity record of the source document based on the logical association entity.

[0074] The document list interface is an interface for displaying a list of documents. For example, the document list interface can be a purchase order list interface, and the purchase order list interface displays the document data of each purchase order. The document list interface can display different documents through different journal lines. For example, in the document list interface, one row of data corresponds to one purchase order. The source document in the journal line refers to the journal line for displaying the source document. The display entity corresponding to the source document in the journal line refers to the entity currently displayed in the source document in the journal line. It can be understood that, due to the limited display area of the journal line of the document list interface, a document includes multiple entities, and usually only one entity of the document is displayed in the journal line. For example, the purchase order list interface displays the detail information of multiple purchase orders, and in the purchase order list interface, one journal line is used to display the detail information of one purchase order (i.e., the entity information of the detail 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, and the logical association entity corresponding to the logical association field in the source business object and the target business object. 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 list interface of the document is an interface for displaying a plurality of documents, and the detail interface of the document is an interface for displaying a single document.

[0077] Specifically, the association query request for the source document can be triggered in the list interface of the document, or triggered in the detail interface of the document. If the association query request for the source document is triggered in the list interface of the document, it can be triggered by selecting the account entry row where the source document is located in the list interface of the document. For example, in the list interface of the document, first select the account entry row where the source document is located, and then click the association query control to trigger the association query request for the source document. If the association query request for the source document is triggered in the detail interface of the document, it can be triggered by clicking the association query control in the detail interface of the document. In order to avoid accessing the source database corresponding to the source business object and improve the query efficiency, the logical association entity record of the source document based on the logical association entity can be determined by means of the data already loaded by the list interface of the document, the data already loaded by the detail interface of the document or the cached data.

[0078] If the association query request for the source document is triggered in the list interface of the document, the display entity corresponding to the account entry row 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 account entry row where the source document is located and the logical association entity corresponding to the source business object are consistent, and it is further judged whether the account entry row where the source document is located contains the logical association field. If the account entry row where the source document is located contains the logical association field, the field value corresponding to the logical association field is directly obtained from the account entry row where the source document is located to obtain the logical association entity record of the source document based on the logical association entity. If the account 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 queried from the cached data, and if the query is obtained, the logical association entity record of the source document based on the logical association entity is obtained based on the field value corresponding to the logical association field. Similarly, if the display entity corresponding to the account entry row 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, and if the query is obtained, the logical association entity record of the source document based on the logical association entity is obtained based on the field value corresponding to the logical association field. It can be understood that in order to display the list interface of the document, 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 detail interface of the document 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 detail interface to obtain the logical association entity record of the source document based on the logical association entity.

[0080] In the above embodiments, the data loaded by the bill list interface, the data loaded by the bill detail interface, or the cache record of the bill data can avoid accessing the database where the source business object is located, and quickly obtain the logical association entity record of the source bill based on the logical association entity.

[0081] In one specific application, Figure 3 To obtain the specific process of the logical association entity record actually required for query. First, it is judged whether the association query request is initiated by the bill interface (i.e., the bill detail interface). If the association query request is initiated by the bill interface, the field data of the logical association field is determined from all row data of the logical association entity of the source business object according to the interface data of the bill interface, and the logical association entity record actually required for query is assembled from the field data of each logical association field.

[0082] If the association query request is initiated by the list interface (i.e., the bill list interface), it is further judged whether the display entity of the list interface and the logical association entity of the source business object are consistent. If they are consistent, it is further judged whether the current selected row contains the use field (i.e., the logical association field) in the list interface. If it contains, the field data of the use field is determined from the selected row data according to the list data, and the logical association entity record actually required for query is assembled from the field data of each use field. If it does not contain, it is judged whether the use field exists in the cache data of the selected row in the bill data cache. If it exists, the field data of the use field is determined from the bill data cache, and the logical association entity record actually required for query is assembled from the field data of each use field. If it does not exist, the complete data of the selected row is queried from the source business object database (i.e., the source database), the complete data of the selected row is written into the cache, the field data of the use field is determined from the complete data of the selected row, and the logical association entity record actually required for query is assembled from the field data of each use field. If they are not consistent, all row data of the logical association entity under the selected row corresponding to the bill is queried from the bill data cache. If all row data queried from the bill data cache contains the use field, the field data of the use field is determined from the bill data cache, and the logical association entity record actually required for query is assembled from the field data of each use field. If all row data queried from the bill data cache does not contain the use field, all row data of the logical association entity under the selected row corresponding to the bill is queried from the source business object database (i.e., the source database), the queried all row data is written into the cache, the field data of the use field is determined from the queried all row data, and the logical association entity record actually required for query is assembled from the field data of each use field.

[0083] In an embodiment, based on the logical association entity record, the actual association query condition of the target business object based on the logical association entity is determined, including:

[0084] When the number of records of the logical association entity record is less than or equal to the preset threshold, the actual association query condition of the target business object based on the logical association entity is generated based on the logical association entity record;

[0085] When the number of records of 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 of the target business object based on the logical association entity is generated based on the physical temporary table.

[0086] It can be understood that there can be at least one logical association field. The logical association entity record of the source document based on the logical association entity includes field records of each logical association field in the source document.

[0087] The physical temporary table is a special table in the database, which is used to store temporary data. These data are only valid during the current session or transaction. When the session or transaction ends, the temporary table and its data will be automatically deleted.

[0088] Specifically, the terminal compares the number of records of the logical association entity record with the preset threshold. If the number of records of the logical association entity record is less than or equal to the preset threshold, the actual association query condition of the target business object based on the logical association entity is directly generated based on the logical association entity record. If the number of records of the logical association entity record is greater than the preset threshold, if the actual association query condition of the target business object based on the logical association entity is directly generated based on the logical association entity record, it will result in that the statement of the actual association query condition is too long, which can easily reduce the query performance. Therefore, if the number of records of the logical association entity record is greater than the preset threshold, a physical temporary table is created, the logical association 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 association query condition of the target business object based on the logical association entity is generated based on the physical temporary table. For example, the actual association query condition of the target business object based on the logical association entity is generated based on the table identifier of the physical temporary table.

[0089] In the present application, the deletion time of the physical temporary table is consistent with the expiration time of the filter condition in the cache. For example, in the first query, the physical temporary table is generated, and the actual association query condition connected with the physical temporary table is cached. In the second query, the same actual association query condition can be returned from the cache, but the premise of this actual association query condition is that the physical temporary table still exists (without re-generation).

[0090] In the above embodiment, the physical temporary table can shorten the length of the actual association query condition, thereby avoiding the influence of the query performance caused by the long statement.

[0091] In one embodiment, the bill query method further comprises:

[0092] Based on the logical association scheme and the logical association entity record, the data query for the actual association query condition is performed in the cache data;

[0093] When the query is successful, the actual association query condition obtained is used as the actual association query condition of the target business object based on the logical association entity.

[0094] When the query fails, the number of records of the logical association entity record is compared with the preset threshold, the generated actual association query condition is stored in the cache data in association with the logical association scheme and the logical association entity record.

[0095] Specifically, the terminal can first query whether the required actual association query condition exists in the cache data, if the actual association query condition exists, the actual association query condition is directly obtained, if the actual association query condition does not exist, the actual association query condition is generated as needed, and the generated actual association query condition is stored in the cache data, so as to accelerate the query efficiency of subsequent similar association query requests.

[0096] The terminal queries whether the corresponding actual association query condition exists in the cache data based on the logical association scheme and the logical association entity record, if the query is successful, the actual association query condition obtained from the cache data is used as the actual association query condition of the target business object based on the logical association entity. If the query fails, the number of records of the logical association entity record is compared with the preset threshold. If the number of records of the logical association entity record is less than or equal to the preset threshold, the actual association query condition of the target business object based on the logical association entity is generated based on the logical association entity record. If the number of records of the logical association entity record is greater than the preset threshold, the 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, the actual association query condition of the target business object based on the logical association entity is generated based on the physical temporary table. The generated actual association query condition is stored in the cache data in association with the logical association scheme and the logical association entity record. Subsequently, if the same batch of source business objects trigger the association query request under the same logical association scheme, the actual association query condition can be directly obtained from the cache data, the obtained actual association query condition is reused, and the actual association query condition does not need to be generated again.

[0097] In the above embodiments, the actual association query conditions obtained by the final analysis of the logical association entity records and the same logical association scheme of the same batch of source business objects are consistent, and thus the actual association query conditions can be cached to accelerate the query speed.

[0098] In one specific application, Figure 4 The specific process for calculating the actual association query condition of the target business object based on the logical association entity is as follows. First, it is checked whether the corresponding actual association query condition exists in the cache data according to the logical association condition (i.e., the logical association query condition and the logical association scheme) and the actual query record (i.e., the logical association entity record). If the corresponding actual association query condition exists in the cache data, the actual association query condition is taken as the actual association query condition of the target business object based on the logical association entity. If the corresponding actual association query condition does not exist in the cache data, it is further analyzed whether the number of the actual query records is excessive. If the number of the actual query records is not excessive, the filter condition of the target business object that can be directly queried is generated based on the actual query record, and the actual association query condition of the target business object based on the logical association entity is obtained. If the number of the actual query records is excessive, the field data in the actual query record is used to generate a physical temporary table, the physical temporary table is stored in the target business object database (i.e., the target database), the filter condition of the target business object that can be directly queried is generated based on the physical temporary table, and the actual association query condition of the target business object based on the logical association entity is obtained. Subsequently, the generated actual association query condition can be stored in the cache, so that if a similar association query request is triggered subsequently, the actual association query condition does not need to be regenerated and can be directly obtained from the cache data.

[0099] In one embodiment, 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 data display filter condition of the target business object based on the query display entity is determined, including:

[0100] The maximum common entity between the logical association entity corresponding to the target business object and the query display entity is calculated.

[0101] When the logical association entity corresponding to the target business object is consistent with the maximum common entity, the actual association query condition is taken as the data display filter condition of the target business object based on the query display entity.

[0102] When the logical association entity corresponding to the target business object is inconsistent with the maximum common entity, the primary key corresponding to the maximum common entity is queried from the target database corresponding to the target business object based on the actual association query condition, and the data display filter condition of the target business object based on the query display entity is obtained.

[0103] The maximum common entity between the logical association entity of the target business object and the query display entity is an entity that is deepest in level and equal in level between an entity path from a document header of the target business object to the logical association entity and an entity path from the document header of the target business object to the query display entity. Refer to Figure 5 For example, C1 and C3, the entity path of C1 is A-B1-C1, and the entity path of C3 is A-B2-C3. The maximum common entity of C1 and C3 is the document header A. For example, C1 and C2, the entity path of C1 is A-B1-C1, and the entity path of C2 is A-B1-C2. The maximum common entity of C1 and C2 is the document body B1. In the database, the primary key corresponding to the maximum common entity is used to uniquely identify the entity data of the maximum common entity. According to the primary key corresponding to the maximum common entity, the entity data of the maximum common entity can be queried in the database.

[0104] Specifically, referring to Figure 6 , the terminal calculates the maximum common entity between the logical association entity of the target business object and the query display entity, and compares the logical association entity of the target business object and the maximum common entity. If the logical association entity corresponding to the target business object and the maximum common entity are consistent, it means that the query display entity is located on the entity path where the logical association entity is located, and the level of the query display entity is equal to or deeper than the logical association entity. Therefore, the entity data of the query display entity can be quickly obtained according to the entity data of the logical association entity. At this time, the terminal can directly use the actual association query condition as the data display filtering condition of the target business object based on the query display entity. If the logical association entity corresponding to the target business object and the maximum common entity are inconsistent, the entity data of the query display entity cannot be quickly obtained according to the entity data of the logical association entity. At this time, the terminal can query the primary key corresponding to the maximum common entity from the target database of the target business object based on the actual association query condition, and 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.

[0105] Referring to Figure 5If the logical association entity of the target business object is C1 and the query display entity of the target business object is C3, the maximum common entity of C1 and C3 is a document header A. The actual association query condition is used to filter the target business object. If the actual association query condition is that the field value of the X field in C1 is X8, the primary key of the document header A of the target business object that meets the actual association query condition is queried from the target database corresponding to the target business object, and based on the primary key of the document header A that is queried, the data display filtering condition of the target business object based on the query display entity is obtained. The data display filtering condition includes the primary key of the document header A that is queried and the query display entity C3, and 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 can be understood that in the case that the logical association entity and the query display entity are entities on different entity paths, if data is directly queried based on the logical association entity and the query display entity, Cartesian product is likely to be caused. However, in the present application, data is queried based on the maximum common entity between the logical association entity and the query display entity, which can avoid Cartesian product. By querying the primary key of the maximum common entity based on the actual association query condition of the logical association entity, and querying the entity data of the query display entity based on the primary key of the maximum common entity, Cartesian product can be avoided.

[0107] In the above embodiment, the maximum common entity between the logical association entity of the target business object and the query display entity is calculated, and whether the logical association entity of the target business object is consistent with the maximum common entity is compared to determine the data display filtering condition of the target business object based on the query display entity, which can eliminate Cartesian product caused by cross-entity query, avoid querying useless data, and improve query efficiency and accuracy.

[0108] In one embodiment, the data display filtering condition of the target business object based on the query display entity is determined 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, and includes:

[0109] The maximum common entity between the logical association entity corresponding to the target business object and the query display entity is calculated.

[0110] The primary key of the maximum common entity is queried in the cache data.

[0111] When the query is successful, the data display filtering condition of the target business object based on the query display entity is obtained based on the primary key that is queried from the cache data.

[0112] When the query fails, based on the actual association query condition, the primary keys corresponding to the logical association entity and the parent entity of the logical association entity are queried from the target database corresponding to the target business object, each primary key queried from the target database is written into the cache data, the primary key corresponding to the maximum common entity is determined from the queried primary keys, and the data display filtering condition of the target business object based on the query display entity is obtained based on the primary key corresponding to the maximum common entity.

[0113] Specifically, referring to Figure 7 , the terminal calculates the maximum common entity between the logical association entity and the query display entity of the target business object. The terminal can first query whether the primary key of the maximum common entity exists in the cache data. If it exists, the terminal obtains the primary key of the maximum common entity from the cache 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 logical association entity and the parent entity of the logical association entity from the target database corresponding to the target business object based on the actual association query condition, writes the primary keys corresponding to the logical association entity and the parent entity of the logical association entity into the cache data, so that the primary key of the maximum common entity can be obtained from the cache data in subsequent processing of other association query requests. It can be understood that the logical association entity and the maximum common entity are not consistent, and therefore the terminal can determine the primary key corresponding to the maximum common entity from the primary keys corresponding to the parent entity of the logical association 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 maximum common entity of the logical association entity and any entity is the logical association entity or its parent entity. As long as the primary keys of the logical association entity and its parent entity are queried once, most subsequent queries can directly generate primary key-based filtering conditions based on this query. Moreover, in the database, the data display filtering condition generated based on the primary key has a faster query speed than the data display filtering condition generated based on the entity.

[0115] For example, referring to Figure 5 , if the method of Figure 6 is used, for the first query, the logical association entity is B1, the query display entity is B1, and the generated filtering condition is logical association field = XXX. For the second query, the logical association entity is B1, the query display entity is C1, and the generated filtering condition is logical association field = XXX. For the third query, the logical association entity is B1, the query display entity is B2, the primary key of A needs to be queried from the target business object database, and the generated filtering condition is the primary key of A = XXX.

[0116] If the method of Figure 7The method is as follows: for the first query, the logical association entity is B1, the query display entity is B1, and the generated filter condition is the primary key of B1 = XXX. The primary keys of B1 and A are obtained through the first query. For the second query, the logical association entity is B1, the query display entity is C1, and the generated filter condition is the primary key of B1 = XXX. For the third query, the logical association entity is B1, the query display entity is B2, and the primary key of A can be directly obtained from the cached data. The generated filter condition is the primary key of A = 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 logical association entity of the target business object are cached. In subsequent short-term queries of the same batch of source business objects under the same logical association, the primary keys of the maximum common entities do not need to be recalculated and can be directly obtained from the cached data, which can effectively improve the query efficiency.

[0118] In one embodiment, based on the query display scheme and the data display filter condition, the to-be-displayed data is queried from the target database corresponding to the target business object to obtain the query result corresponding to the association query request, including:

[0119] Based on the query display field in the query display scheme, a query field statement is obtained;

[0120] The query field statement and the data display filter condition are spliced to obtain a data query statement;

[0121] Based on the data query statement, the to-be-displayed data is queried from the target database corresponding to the target business object to obtain the query result corresponding to the association query request;

[0122] Based on the query result, the display is performed on the terminal.

[0123] 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. The query display entity includes many fields, from which some fields can be selected for display. The query display field refers to the field to be displayed.

[0124] Specifically, refer to Figure 8The terminal generates a complete query field statement based on the query display field 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 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 logically associated with the source document. The terminal queries the data to be displayed from the target database corresponding to the target business object based on the data query statement to obtain the query result corresponding to the association query request. The query result corresponding to the association query request includes the specified entity data of the target business object that meets the association query scheme, and the terminal displays the query result to the user.

[0125] In the above embodiment, the query field statement is obtained based on the query display field in the query display scheme, 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 association query request can be quickly obtained from the target database corresponding to the target business object.

[0126] In one specific embodiment, the method of the present application can be applied to the data query scenario across multiple entities of business objects in an ERP (Enterprise Resource Planning) system. In the ERP system, the data query scenario across multiple entities of business objects is very common. For example, for the association query of a purchase order, not only the detail information of a payable invoice logically associated with the purchase order needs to be queried, but also the payment plan information of the payable invoice needs to be queried. In the traditional technical scheme, multiple entity associations are usually directly performed by complex SQL, and cross-database connection queries are performed by complex SQL, which has poor query performance. For example, if the payable invoice logically associated with the purchase order needs to be queried, the purchase order belongs to the supply chain-purchase management module, and the payable invoice belongs to the financial accounting-payable management module. The ERP system usually performs vertical database distribution, and distributes the purchase module data and the payable module data to different databases. The traditional technology needs to reference tables in different databases, and performs data matching on the tables in different databases to realize cross-database query and obtain the required data, which has low query efficiency and is prone to query errors.

[0127] In the present application, reference is made to Figure 9The logical association query condition (i.e., a logical association scheme) between the source business object and the target business object can be designed in advance, and a query display scheme involving the target business object is involved. The logical association scheme and the query display scheme constitute an association query scheme. 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 query display scheme includes a query display entity and a query display field of the target business object.

[0128] For example, the logical association scheme includes a material field (a logical association field) between a purchase order (a source business object) and a payable order (a target business object), the material field is under a detail entity in the purchase order, and the material field is under a detail entity in the payable order. The query display scheme includes a payment detail entity (a query display entity) of the payable order (a target business object).

[0129] With reference to Figure 10 The method of the present application abstracts the association query task into the following steps through a dynamic domain model:

[0130] 1. Initiating an association query request

[0131] A user initiates an association query request for a certain line of detail records, a certain sheet of documents, or a certain batch of documents.

[0132] 2. Obtaining a logical association entity record actually required for query

[0133] According to the logical association entity of the source business object in the logical association scheme, analyze the to-be-queried record (i.e., a logical association entity record) of the source business object based on the logical association entity. The logical association entity record can be obtained by means of data already loaded by a document list interface, data already loaded by a document detail interface, and document data caching, so as to eliminate access to a database where the source business object is located.

[0134] For example, if the user initiates an association query request for a purchase order A, the field value AH20 of the material field under the detail entity of the purchase order A is obtained, and a logical association entity record is obtained. The logical association entity record is material field = AH20.

[0135] 3. Calculating an actual association query condition of a target business object based on a logical association entity

[0136] Based on the logical association entity record, determine an actual association query condition of the target business object based on the logical association entity.

[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 payable order of the material field = AH20 under the detail entity.

[0138] 4. Calculate the data display filtering condition of the target business object based on the query display entity (i.e. the actual association query condition of the target business object based on the query display entity)

[0139] Solution one: Calculate the maximum common entity between the logical association entity of the target business object and the query display entity, if the logical association entity and the maximum common entity are consistent, then the actual association query condition is used as the data display filtering condition; if the logical association entity and the maximum common entity are not consistent, then the primary key of the maximum common entity is queried from the target business object database based on the actual association query condition, and the data display filtering condition is obtained based on the primary key of the maximum common entity.

[0140] Solution two: Calculate the maximum common entity between the logical association entity of the target business object and the query display entity, if the primary key of the maximum common entity exists in the cache, then the data display filtering condition is obtained based on the primary key of the maximum common entity; if the primary key of the maximum common entity does not exist in the cache, then the primary keys of the logical association entity and its parent entity are queried from the target business object database based on the actual association query condition, the primary keys of the logical association entity and its parent entity are written into the cache, the primary key of the maximum common entity is determined from the primary keys of the logical association entity and its parent entity, and the data display filtering condition is obtained based on the primary key of the maximum common entity.

[0141] For example, the maximum common entity between the detail entity (logical association entity) and the payment plan entity (query display entity) is the document header entity, and the document header primary key of all payable documents under the material field = AH20 of the detail entity is queried. If the document header primary key is represented by 12345, then the data display filtering condition includes the document header primary key = 12345.

[0142] 5. For the query display scheme, display based on the data display filtering condition

[0143] Splice each query display field in the query display scheme into a query field statement, splice the query field statement and the data display filtering condition, obtain a data query statement, query the data to be displayed from the target business object database based on the data query statement, and display the data to be displayed.

[0144] In the method, the SQL generation scheme of the associated query is simplified through specific steps, and the problem of reduced database query performance caused by complex SQL is solved. By setting a logical associated query condition between business objects, data of a source business object and data of a target business object are respectively queried in corresponding databases, the performance problem of cross-database connection query through complex SQL in the traditional technology is avoided, and the actual associated query condition of the target business object based on a logical associated entity can be efficiently calculated. Moreover, the intermediate result calculated in the step process is cached, which can accelerate the query efficiency of the associated query. The actual associated query condition is converted into a data display filtering condition based on the primary key of the maximum common entity, which can eliminate the Cartesian product caused by cross-entity query and improve the query performance.

[0145] It should be understood that, although each step in the flowchart involved in each embodiment as described above is displayed in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, at least part of the steps in the flowchart involved in each embodiment as described above can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or steps or stages in other steps.

[0146] Based on the same inventive concept, the embodiments of the present application also provide a bill query device for implementing the bill query method as described above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, and therefore the specific limitations in one or more bill query device embodiments provided below can refer to the limitations of the bill query method described above, which will not be described here again.

[0147] In one embodiment, as shown in Figure 11 a bill query device is provided, which includes a scheme query module 1102, a first condition determination module 1104, a second condition determination module 1106, and a result display module 1108, wherein:

[0148] The scheme query module 1102 is configured to acquire an associated query scheme corresponding to a source bill in response to an associated query request for the source bill; the associated query scheme includes a logical association scheme between a source business object and a target business object, and a query display scheme of 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 bill belongs to the source business object; and the query display scheme includes a query display entity.

[0149] The first condition determining module 1104 is configured to determine, based on the logical association field, a logical association entity record of the source document based on the logical association entity, and determine, based on the logical association entity record, an actual association query condition of the target business object based on the logical association entity.

[0150] The second condition determining module 1106 is configured to determine, 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, a data display filtering condition of the target business object based on the query display entity.

[0151] The result presenting module 1108 is configured to query, based on the query display scheme and the data display filtering condition, to-be-presented data from a target database corresponding to the target business object, to obtain a query result corresponding to the association query request.

[0152] In an embodiment, the first condition determining module 1104 is further configured to:

[0153] In a case where the association query request is triggered by selecting the account entry row where the source document is located in the account list interface, when the display entity corresponding to the account entry row where the source document is located is consistent with the logical association entity corresponding to the source business object, and the account 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 account entry row 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 a case where the association query request is triggered by selecting the account entry row where the source document is located in the account list interface, when the display entity corresponding to the account 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 account entry row where the source document is located is consistent with the logical association entity corresponding to the source business object but the account 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.

[0155] In a case where the association query request is triggered in the document detail interface of the source document, the field value corresponding to the logical association field is obtained from the interface data of the document detail interface, to obtain the logical association entity record of the source document based on the logical association entity.

[0156] In an embodiment, the first condition determining module 1104 is further configured to:

[0157] When the number of records in the logical association entity record is less than or equal to a preset threshold, the actual association query condition of the target business object based on the logical association entity is generated based on the logical association entity record.

[0158] When the record quantity of 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 a target database corresponding to the target business object, and an actual association query condition of the target business object based on the logical association entity is generated based on the physical temporary table.

[0159] In one embodiment, the document query device is further configured to:

[0160] perform a data query for the actual association query condition in the cache data based on the logical association scheme and the logical association entity record;

[0161] when the query is successful, the queried actual association query condition is used as the actual association query condition of the target business object based on the logical association entity;

[0162] when the query fails, a step of comparing the record quantity of the logical association entity record with the preset threshold is performed, and the generated actual association query condition is stored in the cache data in association with the logical association scheme and the logical association entity record.

[0163] In one embodiment, the second condition determination module 1106 is further configured to:

[0164] calculate a maximum common entity between the logical association entity corresponding to the target business object and the query display entity;

[0165] when the logical association entity corresponding to the target business object and the maximum common entity are consistent, the actual association query condition is used as a data display filtering condition of the target business object based on the query display entity;

[0166] when the logical association entity corresponding to the target business object and the maximum common entity are inconsistent, based on the actual association query condition, a primary key corresponding to the maximum common entity is queried from a target database corresponding to the target business object, and a data display filtering condition of the target business object based on the query display entity is obtained.

[0167] In one embodiment, the second condition determination module 1106 is further configured to:

[0168] calculate a maximum common entity between the logical association entity corresponding to the target business object and the query display entity;

[0169] perform a primary key query for the maximum common entity in the cache data;

[0170] 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;

[0171] When the query fails, based on the actual association query condition, the primary keys corresponding to the logical association entity and the parent entity of the logical association entity are queried from the target database corresponding to the target business object, each primary key queried from the target database is written into the cache data, the primary key corresponding to the maximum common entity is determined from the queried primary keys, and the data display filtering condition of the target business object based on the query display entity is obtained based on the primary key corresponding to the maximum common entity.

[0172] In an embodiment, the result display module 1108 is further configured to:

[0173] obtain a query field statement based on the query display field in the query display scheme;

[0174] splice the query field statement and the data display filtering condition to obtain a data query statement;

[0175] query the data to be displayed from the target database corresponding to the target business object based on the data query statement to obtain a query result corresponding to the association query request;

[0176] display the query result on the terminal.

[0177] The above-mentioned document query device can improve the query efficiency.

[0178] Each module in the above-mentioned document query device can be implemented wholly or partially by software, hardware, and combinations thereof. Each module described above can be embedded in or independent of a processor in a computer device in hardware form, or can be stored in a memory in a computer device in software form, so as to be called and executed by a processor to perform the operations corresponding to each module.

[0179] In an embodiment, a computer device is provided, which can be a server, and an internal structure diagram of the computer device can be as shown in Figure 12 The computer device includes a processor, a memory, an input / output interface (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 configured 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 operating system and the computer program in the non-volatile storage medium to run. The database of the computer device is configured to store data related to the document query method. The input / output interface of the computer device is configured to exchange information between the processor and external devices. The communication interface of the computer device is configured to communicate with external terminals through a network connection. The computer program is executed by the processor to implement a document query method.

[0180] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 13 As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a document retrieval method. The display unit is used to form a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

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

[0182] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0183] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0184] In one embodiment, a computer program product is provided, the computer program product including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0185] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant regulations.

[0186] It can be understood by those skilled in the art that all or part of the processes in the above-mentioned embodiment methods can be completed by a computer program instructing related hardware. 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 above-mentioned embodiments. Any reference to memory, database or other medium used in the embodiments provided by the present 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 storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric 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 but not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided by the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided by the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.

[0187] The technical features of the above embodiments can be combined in any way. To make the description concise, not all possible combinations of the technical features in the above embodiments are described, but as long as the combinations of the technical features do not exist contradictions, they should be considered as the scope of the present disclosure.

[0188] The above-described embodiments are merely illustrative of several embodiments of the present application, and the description is relatively specific and detailed, but should not be understood as a limitation on the scope of the patent. It should be noted that for those skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the scope of the present application. Therefore, the scope of protection of the present application should be subject to the appended claims.

Claims

1. A document query method, characterized in that, The method includes: In response to a related query request for a source document, the system obtains the related query scheme corresponding to the source document. The related 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 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. The query display scheme 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 conditions of the target business object based on the logical association entity. Based on the entity association between the query display entity and the logically related entity corresponding to the target business object, and the actual association query conditions, the data display filtering conditions for the target business object based on the query display entity are determined, including: calculating the largest common entity between the logically related entity corresponding to the target business object and the query display entity; when the logically related entity corresponding to the target business object and the largest common entity are consistent, the actual association query conditions are used as the data display filtering conditions for the target business object based on the query display entity; when the logically related entity corresponding to the target business object and the largest common entity are inconsistent, based on the actual association query conditions, the primary key corresponding to the largest common entity is queried from the target database corresponding to the target business object to obtain the data display filtering conditions for the target business object based on the query display entity. 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, and the query results corresponding to the related query request are obtained.

2. The method according to claim 1, characterized in that, The step of determining the logically related entity record of the source document based on the logically related entity, based on the logically related field, includes: When the related query request is triggered by selecting the entry row of the source document in the document list interface, if the displayed entity corresponding to the entry row of the source document is consistent with the logical related entity corresponding to the source business object, and the entry row of the source document contains the logical related field, the field value corresponding to the logical related field is obtained from the entry row of the source document to obtain the logical related entity record of the source document based on the logical related entity; When the related query request is triggered by selecting the entry row of the source document in the document list interface, if the displayed entity corresponding to the entry row of the source document is inconsistent with the logical associated entity corresponding to the source business object, or if the displayed entity corresponding to the entry row of the source document is consistent with the logical associated entity corresponding to the source business object, but the entry row of the source document does not contain the logical associated field, the field value corresponding to the logical associated field is obtained from the cached data to obtain the logical associated entity record of the source document based on the logical associated entity; When the related query request is triggered in the document details interface of the source document, the field value corresponding to the logical related field is obtained from the interface data of the document details interface to obtain the logical related entity record of the source document based on the logical related entity.

3. The method according to claim 1, characterized in that, The step of determining the actual association query conditions of the target business object based on the logically associated entity records includes: When the number of records of the logically associated entity is less than or equal to a preset threshold, the actual association query conditions of the target business object based on the logically associated entity are generated based on the logically associated entity records. When the number of records of the logically associated entity records exceeds a preset threshold, a physical temporary table is generated based on the logically associated entity records, and the physical temporary table is stored in the target database corresponding to the target business object. Based on the physical temporary table, the actual association query conditions of the target business object based on the logically associated entities are generated.

4. The method according to claim 3, characterized in that, The method further includes: Based on the logical association scheme and the logical association entity record, data queries are performed in the cached data for the actual association query conditions. When the query is successful, the actual related query conditions found will be used as the actual related query conditions of the target business object based on the logical related entities. When a query fails, the process proceeds to the step of comparing the number of records of the logically associated entity with the preset threshold, and then storing the generated actual association query conditions, the logical association scheme, and the logically associated entity records in the cached data.

5. The method according to claim 1, characterized in that, The step of determining the data display filtering conditions for the target business object based on the entity association between the query display entity and the logically related entity corresponding to the target business object, and the actual association query conditions, further includes: Calculate the largest common entity between the logically related entity corresponding to the target business object and the query display entity; Perform a primary key query for the largest common entity in the cached data; Upon successful query, based on the primary key retrieved from the cached data, the data display filtering conditions for the target business object based on the query display entity are obtained; When a 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. The primary keys retrieved from the target database are written into the cached data. The primary key corresponding to the largest common entity is determined from the retrieved primary keys. Based on the primary key corresponding to the largest common entity, the data display filtering conditions of the target business object based on the query display entity are obtained.

6. The method according to claim 1, characterized in that, The step of querying 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 obtaining the query results corresponding to the related query request, includes: Based on the query display fields in the aforementioned query display scheme, the query field statement is obtained; The query field statement and the data display filter conditions are concatenated to obtain the data query statement; Based on the data query statement, 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 related query request; The query results are displayed on the terminal.

7. A document query device, characterized in that, The device includes: The scheme query module is used to respond to a related query request for a source document and obtain the related query scheme corresponding to the source document. The related 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 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. The query display scheme includes a query display entity. The first condition determination module is used to determine the logically associated entity record of the source document based on the logically associated entity based on the logically associated field, and to determine the actual association 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 record. The second condition determination module is used to determine the data display filtering conditions for the target business object based on the entity association between the logically related entity corresponding to the query display entity and the target business object, and the actual association query conditions. This includes: calculating the largest common entity between the logically related entity corresponding to the target business object and the query display entity; when the logically related entity corresponding to the target business object and the largest common entity are consistent, using the actual association query conditions as the data display filtering conditions for the target business object based on the query display entity; when the logically related entity corresponding to the target business object and the largest common entity are inconsistent, querying the primary key corresponding to the largest common entity from the target database corresponding to the target business object based on the actual association query conditions to obtain the data display filtering conditions for the target business object based on the query display entity. The results 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 conditions, and obtain the query results corresponding to the related query request.

8. The apparatus according to claim 7, characterized in that, In determining the data display filtering conditions for the target business object based on the entity association between the query display entity and the logically related entity corresponding to the target business object, and the actual association query conditions, the second condition determination module is further configured to: Calculate the largest common entity between the logically related entity corresponding to the target business object and the query display entity; Perform a primary key query for the largest common entity in the cached data; Upon successful query, based on the primary key retrieved from the cached data, the data display filtering conditions for the target business object based on the query display entity are obtained; When a 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. The primary keys retrieved from the target database are written into the cached data. The primary key corresponding to the largest common entity is determined from the retrieved primary keys. Based on the primary key corresponding to the largest common entity, the data display filtering conditions of the target business object based on the query display entity are obtained.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

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

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

Citation Information

Patent Citations

  • Data table correlation query method and apparatus

    CN108509637A

  • Data association query method and apparatus, and device and storage medium

    WO2021259217A1