Data query method and device, computer device, and storage medium
Patent Information
- Application Number
- CN202211092583.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-08
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2042-09-08
AI Technical Summary
但是传统方法中,若预置或者硬编码引用的数据丢失或被删除,则无法查询到引用数据,导致数据查询的效率较低
[0054] The aforementioned data query method, apparatus, computer equipment, storage medium, and computer program product acquire filtering conditions for querying test reference data; if no first object satisfying the filtering conditions is found, a first object proxy is created; first attribute values are configured for each attribute of the first object proxy according to the filtering conditions; if the first attribute value includes a second object identifier, a second object is created in a hierarchical chain; a first object is generated based on the second object, and the data of the first object is returned as test reference data. Because the first object can be created based on the second object associated with it even when no first object is found, and can be reconstructed even if it is deleted or tampered with, the problem of not being able to find test reference data is avoided, improving the efficiency of data query. Furthermore, since the data is created hierarchically according to test requirements during unit testing, each data object can be flexibly reused during creation, improving the efficiency of data reuse and ensuring the accuracy of the created data.
Smart Images

Figure CN116303561B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a data query method, apparatus, computer equipment, storage medium, and computer program product. Background Technology
[0002] With the development of computer technology, unit testing is typically performed during software development. Traditional unit testing uses pre-defined data scripts or simple hard-coded methods to retrieve referenced data. However, in traditional methods, if the pre-defined or hard-coded referenced data is lost or deleted, the referenced data cannot be retrieved, resulting in low data retrieval efficiency. Summary of the Invention
[0003] Therefore, it is necessary to provide a data query method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve efficiency in addressing the aforementioned technical problems.
[0004] Firstly, this application provides a data query method. The method includes:
[0005] Get the filter conditions used to query test reference data;
[0006] If no first object that meets the filtering conditions is found, a first object proxy is created.
[0007] Configure first attribute values for each attribute of the first object proxy according to the filtering conditions;
[0008] If the first attribute value includes the second object identifier, the second object is created in a chain-like manner.
[0009] The first object is generated based on the second object, and the data of the first object is returned as the test reference data.
[0010] Secondly, this application also provides a data query device. The device includes:
[0011] The acquisition module is used to obtain the filter conditions for querying test reference data;
[0012] A module is created to create a first object proxy if no first object that meets the filtering conditions is found.
[0013] The configuration module is used to configure first attribute values for each attribute of the first object proxy according to the filtering conditions;
[0014] The creation module is also used to create a second object in a chain-like manner if the first attribute value includes a second object identifier;
[0015] The generation module is used to generate the first object based on the second object, and return the data of the first object as the test reference data.
[0016] In one embodiment, the filtering conditions include basic attribute filtering conditions and dynamic object filtering conditions; the attributes include basic attributes and dynamic object attributes; the configuration module is further configured to:
[0017] Configure a first attribute value that matches the filtering conditions of the first object proxy for the basic attribute;
[0018] Configure a first attribute value that matches the dynamic object filtering conditions for the dynamic object proxy of the first object.
[0019] In one embodiment, the creation module is further configured to:
[0020] If the first attribute value includes the second object identifier, create a second object proxy;
[0021] The filtering conditions are analyzed to obtain sub-filtering conditions;
[0022] Based on the sub-filtering conditions, configure the second attribute values for each attribute of the second object proxy;
[0023] If the second attribute value does not include a lower-level object identifier, return the second object created based on each of the second attribute values;
[0024] If the second attribute value includes the lower-level object identifier, lower-level objects are created in a chain-like manner, and the second object is generated based on the lower-level objects.
[0025] In one embodiment, the creation module is further configured to:
[0026] In the filtering conditions, the target filtering conditions corresponding to each attribute of the second object proxy are selected respectively;
[0027] The target filtering conditions are grouped;
[0028] The target filtering conditions obtained from grouping are used as the sub-filtering conditions.
[0029] In one embodiment, the filtering conditions include a uniqueness condition for uniquely determining the first object, as well as other conditions; the apparatus further includes:
[0030] The judgment module is used to determine whether the third object satisfies the other conditions if a third object that satisfies the uniqueness condition is found.
[0031] The return module is used to return the data of the third object as the test reference data if the condition is met.
[0032] The adjustment module is used to adjust the data of the third object according to the other conditions if no, and return the data of the third object after data adjustment as the test reference data.
[0033] In one embodiment, the adjustment module is further configured to:
[0034] Among the attributes of the third object, determine the target attribute corresponding to the other conditions;
[0035] Adjust the attribute value of the target attribute to match the other conditions.
[0036] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0037] Get the filter conditions used to query test reference data;
[0038] If no first object that meets the filtering conditions is found, a first object proxy is created.
[0039] Configure first attribute values for each attribute of the first object proxy according to the filtering conditions;
[0040] If the first attribute value includes the second object identifier, the second object is created in a chain-like manner.
[0041] The first object is generated based on the second object, and the data of the first object is returned as the test reference data.
[0042] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0043] Get the filter conditions used to query test reference data;
[0044] If no first object that meets the filtering conditions is found, a first object proxy is created.
[0045] Configure first attribute values for each attribute of the first object proxy according to the filtering conditions;
[0046] If the first attribute value includes the second object identifier, the second object is created in a chain-like manner.
[0047] The first object is generated based on the second object, and the data of the first object is returned as the test reference data.
[0048] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0049] Get the filter conditions used to query test reference data;
[0050] If no first object that meets the filtering conditions is found, a first object proxy is created.
[0051] Configure first attribute values for each attribute of the first object proxy according to the filtering conditions;
[0052] If the first attribute value includes the second object identifier, the second object is created in a chain-like manner.
[0053] The first object is generated based on the second object, and the data of the first object is returned as the test reference data.
[0054] The aforementioned data query method, apparatus, computer equipment, storage medium, and computer program product acquire filtering conditions for querying test reference data; if no first object satisfying the filtering conditions is found, a first object proxy is created; first attribute values are configured for each attribute of the first object proxy according to the filtering conditions; if the first attribute value includes a second object identifier, a second object is created in a hierarchical chain; a first object is generated based on the second object, and the data of the first object is returned as test reference data. Because the first object can be created based on the second object associated with it even when no first object is found, and can be reconstructed even if it is deleted or tampered with, the problem of not being able to find test reference data is avoided, improving the efficiency of data query. Furthermore, since the data is created hierarchically according to test requirements during unit testing, each data object can be flexibly reused during creation, improving the efficiency of data reuse and ensuring the accuracy of the created data. Attached Figure Description
[0055] Figure 1 This is a diagram illustrating the application environment of a data query method in one embodiment.
[0056] Figure 2 This is a flowchart illustrating a data query method in one embodiment;
[0057] Figure 3a This is a schematic diagram of a filtering condition proxy in one embodiment;
[0058] Figure 3bThis is a schematic diagram illustrating the relationships between objects in one embodiment;
[0059] Figure 4a This is a schematic diagram of a dynamic object creator in one embodiment;
[0060] Figure 4b This is a schematic diagram of dynamic object proxy in one embodiment;
[0061] Figure 5 This is a schematic diagram illustrating the principle of a chain creation method in one embodiment;
[0062] Figure 6 This is a flowchart illustrating a method for generating a second object in one embodiment;
[0063] Figure 7 This is a schematic diagram illustrating the principle of querying basic bank account information in one embodiment;
[0064] Figure 8 This is a flowchart illustrating the data query method in another embodiment;
[0065] Figure 9 This is a structural block diagram of a data query device in one embodiment;
[0066] Figure 10 This is a structural block diagram of a data query device in one embodiment;
[0067] Figure 11 This is an internal structural diagram of a computer device in one embodiment;
[0068] Figure 12 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0069] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0070] The data query method provided in this application embodiment can be applied to, for example... Figure 1The application environment is shown. The data storage system stores the data that the computer device 102 needs to process. The data storage system can be integrated onto the computer device 102 or placed on the cloud or other network servers. The computer device 102 obtains filtering conditions for querying test reference data; if no first object matching the filtering conditions is found, a first object proxy is created; first attribute values are configured for each attribute of the first object proxy according to the filtering conditions; if the first attribute value includes a second object identifier, a second object is created in a chain-like manner; a first object is generated based on the second object, and the data of the first object is returned as test reference data. The computer device 102 can be a terminal or a server. Terminals can be, but are not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Portable wearable devices can be smartwatches, smart bracelets, head-mounted devices, etc. A server can be a standalone physical server or a server cluster composed of multiple service nodes in a blockchain system. These service nodes form a peer-to-peer (P2P) network. The P2P protocol is an application layer protocol running on top of the Transmission Control Protocol (TCP). Furthermore, a server can also be a server cluster composed of multiple physical servers, and can be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0071] In one embodiment, such as Figure 2 As shown, a data query method is provided, which can be applied to... Figure 1 Taking a computer device as an example, the explanation includes the following steps:
[0072] S202, obtain the filter conditions used to query test reference data.
[0073] Test reference data refers to data referenced during unit testing, including basic information, documents, or files. Unit testing checks and verifies the tested unit in the software, which can be a function, class, or a window, control, or menu in a graphical software. Filtering conditions are used to filter data. For example, a filtering condition might be that object A's identifier is 123; another example is that object A's code is dx456.
[0074] In one embodiment, S202 specifically includes: detecting a query request for the test reference data, and obtaining filtering conditions and metadata information based on the query request. Following S202, the method further includes: querying the database based on the filtering conditions and metadata information. The metadata information describes the test reference data, including its storage location, object creation identifier, or creation time.
[0075] In one embodiment, S202 specifically includes: the computer device obtaining a filter condition proxy based on a query request for test reference data, and obtaining filter conditions based on the filter condition proxy. The filter condition proxy (QFilterProxy) is a component that proxies the filter conditions and is used to parse them. For example, the filter condition proxy can be used to proxy ORM (Object Relational Mapping) filter conditions. The filter condition proxy can be used for multi-level queries, for example, such as... Figure 3a As shown, the filter conditions include four levels of conditions related to objects A, B, C, and D. The filter condition proxy can query each level of objects based on the filter conditions containing these four levels of conditions. For example, the filter condition proxy can parse out the sub-filter conditions related to object B from the filter conditions, and then query object B based on the sub-filter conditions.
[0076] S204 If no first object that meets the filtering conditions is found, create a first object proxy.
[0077] The first object can be any data object that meets the filtering conditions. For example, the first object can be a data object under an ORM framework, and this data object can be a dynamic object. For example, the first object can be basic information, such as basic bank account information. The first object can also be an object associated with multiple dependent lower-level objects; that is, a certain attribute of the first object is a lower-level object, and the value of this attribute is the identifier of the associated lower-level object. For example... Figure 3b As shown, object A is associated with objects B and C, object B is associated with objects D and E, object D is associated with object G, object C is associated with object F, and object F is associated with object H. The first object proxy is a component used to proxy the first object; it can be a dynamic object proxy and is used to configure the various properties of the first object.
[0078] In one embodiment, S204 specifically includes: if no first object satisfying the filtering conditions is found, creating a first object proxy using a dynamic object creator. The dynamic object creator is a component used to create dynamic object proxies. Specifically, as... Figure 4aAs shown, the dynamic object creator parses the input filter conditions, then performs a query based on the parsed filter conditions. If no first object that meets the parsed filter conditions is found, a first object proxy is created.
[0079] S206, Configure the first attribute value for each attribute of the first object proxy according to the filtering conditions.
[0080] In this context, attributes describe the abstract characteristics of the first object. For example, if the first object is an object, attributes could be its color, shape, or size. Similarly, if the first object is a ledger, attributes might include ledger identifier, accounting date, or amount. If the first object is basic bank account information, attributes might include identifier and bank name. If the first object is an invoice, attributes might include identifier, taxpayer identification number, bank name, or item price. The first object proxy shares the same attributes as the first object and configures these attributes. The computer device configures first attribute values for each attribute of the first object proxy based on filtering conditions; specifically, the configured first attribute values satisfy the filtering conditions. For example,... Figure 4b As shown, the first object proxy can parse and reorganize the filter conditions, and then configure first attribute values for each attribute based on the reorganized filter conditions. Then, it creates a first object based on the configured attribute values. For example, if the filter condition is "account opening bank is Bank of China," the computer device will configure the attribute value of the "account opening bank" attribute of the first object proxy to "Bank of China." As another example, if the filter condition is "identifier equals 123," the computer device will configure the attribute value of the "identifier" attribute of the first object proxy to "123."
[0081] S208, If the first attribute value includes the second object identifier, create the second object in a chained manner.
[0082] The second object is the data object associated with the first object. This data object can be a data object within an ORM framework and can be a dynamic object. If the first attribute value includes the identifier of the second object, it indicates that a certain attribute of the first object is a dynamic object, meaning the first object depends on a lower-level dynamic object. For example, if the first object is basic bank account information, and the attribute value of the opening bank attribute in the basic bank account information is Bank of China, then Bank of China is a financial institution basic information source. Only by obtaining the relevant data of the opening bank, Bank of China, can the basic bank account information be created based on that data. In other words, the creation of the basic bank account information depends on the relevant data of Bank of China (financial institution basic information).
[0083] Chained creation involves first creating the child objects that the parent object depends on, and then creating the parent object's data based on the returned child objects. For example, ... Figure 5As shown, object A includes three attributes: A.1, A.2, and A.3. The value of A.2 is the identifier of its child object B (meaning A is associated with object B). Object B needs to be created before A can be generated. Object B includes three attributes: B.1, B.2, and B.3. The value of B.1 is the identifier of object C (meaning object B is associated with object C). Object C needs to be created before B can be generated. When object C is created, it is returned to object B to complete the creation of object B. When object B is created, it is returned to object A to complete the creation of object A. The computer device creates the second object in a chain-like manner. Specifically, if the second object is associated with a child object (e.g., object B), object B is created first, and then the second object is created based on the returned object B. If object B is associated with a child object (e.g., object C), object C is created before object B can be created, and so on.
[0084] S210, Generate a first object based on the second object, and return the data of the first object as test reference data.
[0085] After creating the second object associated with the first object, the computer device generates the first object based on the second object and returns the data of the first object as test reference data.
[0086] In one embodiment, if the first attribute value does not include the second object identifier, then the first object is created based on the first attribute value, and the data of the first object is returned as test reference data.
[0087] In the above embodiments, filtering conditions for querying test reference data are obtained; if no first object satisfying the filtering conditions is found, a first object proxy is created; first attribute values are configured for each attribute of the first object proxy according to the filtering conditions; if the first attribute value includes a second object identifier, a second object is created in a chain-like manner; a first object is generated based on the second object, and the data of the first object is returned as test reference data. Since the first object can be created based on the second object associated with it even when no first object is found, and can be reconstructed even if the first object is deleted or tampered with, the problem of not being able to find test reference data is avoided, improving the efficiency of data querying. Furthermore, since the data is created in a chain-like manner according to test requirements during unit testing, each data object can be flexibly reused during creation, improving the efficiency of data reuse and ensuring the accuracy of the created data.
[0088] In one embodiment, the filtering conditions include basic attribute filtering conditions and dynamic object filtering conditions; the attributes include basic attributes and dynamic object attributes; configuring first attribute values for each attribute of the first object proxy according to the filtering conditions includes: configuring first attribute values that match the basic attribute filtering conditions for the basic attributes of the first object proxy; configuring first attribute values that match the dynamic object filtering conditions for the dynamic object attributes of the first object proxy.
[0089] Basic attributes are those related to the general characteristics of the first object, such as identifier, code, and creation time. Dynamic object attributes are attributes represented by dynamic objects, with the attribute value being the dynamic object identifier. For example, the attributes of basic bank account information include the opening bank; the opening bank is a dynamic object attribute. Basic attribute filtering conditions are used to filter data based on basic attributes. For example, a basic attribute filtering condition could be "creation time is 2022-03-06". Dynamic object filtering conditions are used to filter data based on dynamic object attributes. For example, a dynamic object filtering condition could be "the subordinate object is dynamic object C".
[0090] When the computer device fails to find a first object that meets the filtering criteria, it needs to create one. Therefore, the computer device configures the various attributes of the first object proxy according to the filtering criteria, thereby creating the first object based on these configured attributes. The computer device categorizes the attributes of the first object proxy into dynamic object attributes and basic attributes. For basic attribute filtering criteria, it configures the basic attributes to ensure that the configured first attribute values meet the basic attribute filtering criteria; for dynamic object attributes, it configures the first attribute values to meet the dynamic object filtering criteria.
[0091] In the above embodiments, the computer device configures a first attribute value that matches the basic attribute filtering conditions for the basic attributes of the first object proxy; and configures a first attribute value that matches the dynamic object filtering conditions for the dynamic object attributes of the first object proxy. This allows the creation of a first object based on the configured first attribute value, and also enables flexible creation of the first object even when it is not found, thus improving the flexibility of data creation.
[0092] In one embodiment, such as Figure 6 As shown, S208 specifically includes the following:
[0093] S602, If the first attribute value includes the second object identifier, create a second object proxy.
[0094] The second object proxy is a component used to proxy the second object, and can be a dynamic object proxy, used to configure the various attributes of the second object. In one embodiment, S602 specifically includes: the computer device creates the second object proxy through a dynamic object creator, and passes the filtering conditions to the second object proxy.
[0095] S604, the filtering conditions are analyzed to obtain sub-filtering conditions.
[0096] The sub-filtering conditions are those related to the second object. For example, the first object A includes attributes A.1, A.2, and A.3. The attribute value of A.2 is the object identifier of the second object B. The second object B includes attributes B.1 and B.2. The filtering conditions include: Condition 1: "A.1 = 123"; Condition 2: "A.2 = B"; Condition 3: "A.3 = 456"; Condition 4: "AB1 = 789"; Condition 5: "AB2 = 10". The computer device parses the filtering conditions composed of conditions 1 to 5, obtaining sub-filtering conditions 4 and 5.
[0097] In one embodiment, S604 specifically includes: selecting target filtering conditions corresponding to each attribute of the second object proxy in the filtering conditions; grouping the target filtering conditions; and using each group of target filtering conditions as sub-filtering conditions.
[0098] If the first object is associated with the second object, then some sub-filter conditions in the filter conditions corresponding to the first object are used to limit the attributes of the second object's proxy. The computer device only needs to pass the sub-filter conditions to the second object's proxy so that the second object's proxy can configure each attribute according to the sub-filter conditions. For example, if A is the first object, B is the second object, and C is a subordinate object associated with B, and the filter conditions include A.1, A.2, AB1, AB2, ABC1, ABC2, then AB1, AB2, ABC1, ABC2, and the target filter conditions are AB1, AB2, ABC1, ABC2. After the computer device selects the target filter conditions from the filter conditions, it groups the target filter conditions. For example, the computer device can group the target filter conditions according to the attributes limited by the target filter conditions. For example, target filter conditions that limit basic attributes can be grouped into one group, and target filter conditions that limit dynamic object attributes can be grouped into another group.
[0099] S606, Configure the second attribute value for each attribute of the second object proxy according to the sub-filter conditions.
[0100] The computer device configures second attribute values for each attribute of the second object proxy according to the sub-filtering conditions. For example, the sub-filtering conditions include a first set of sub-filtering conditions for limiting basic attributes and a second set of sub-filtering conditions for limiting dynamic object attributes. The computer device configures second attribute values for the basic attributes of the second object proxy according to the first set of sub-filtering conditions and configures second attribute values for the dynamic object attributes of the second object proxy according to the second set of sub-filtering conditions.
[0101] S608, if the second attribute value does not include the lower-level object identifier, return the second object created based on each second attribute value.
[0102] If the second attribute value does not include a child object identifier, it means that the second object is not associated with a child object. The second object is created based on the second attribute value and returned to the first object proxy so that the first object proxy can create the first object based on the second object.
[0103] S610, if the second attribute value includes a lower-level object identifier, create lower-level objects in a chain-like manner, and generate a second object based on the lower-level objects.
[0104] If the second attribute value includes a child object identifier, it means that the second object has associated child objects. The child objects of the second object must be created before the second object itself is created. The method for creating the child objects of the second object is the same as the method for creating the second object.
[0105] In the above embodiments, if the first attribute value includes a second object identifier, a second object proxy is created. Based on the sub-filtering conditions obtained by parsing the filtering conditions, second attribute values are configured for each attribute of the second object proxy. If the second attribute value includes a lower-level object identifier, lower-level objects are created in a chain-like manner, and a second object is generated based on the lower-level objects. This allows for the creation of objects at all levels associated with the first object through a chain-like creation method, creating dependent data for test reference data layer by layer. Even if the data is tampered with or deleted, it can be recreated, avoiding the problem of not being able to find test reference data and improving the efficiency of data querying.
[0106] In one embodiment, the filtering conditions include a uniqueness condition for uniquely identifying the first object and other conditions; the method further includes: if a third object that satisfies the uniqueness condition is found, determining whether the third object satisfies other conditions; if yes, returning the data of the third object as test reference data; if no, adjusting the data of the third object according to other conditions, and returning the data of the data-adjusted third object as test reference data.
[0107] The uniqueness condition is a filtering condition used to uniquely identify the first object. For example, the uniqueness condition is "identified as 123456". Other conditions are filtering conditions that cannot uniquely identify the first object. When the computer device queries the database for a third object based on the uniqueness condition, to avoid errors due to tampering of the third object's attribute values, the computer device determines whether the third object meets other conditions. If the third object meets other conditions, it means that the data of the third object is not erroneous, and the third object is returned as test reference data. If the third object does not meet other conditions, it means that the data of the third object is erroneous and needs to be corrected. For example, if the uniqueness condition is "identified equals 123", and other conditions include "account opening bank is Bank of China", and the computer device queries for data object A with an identifier equal to 123 based on the uniqueness condition, if the account opening bank for data object A is China Construction Bank, it means that the data of data object A is erroneous. The computer adjusts the data of the third object based on other conditions and returns the adjusted data of the third object as test reference data.
[0108] In one embodiment, the computer device determines the target attribute corresponding to other conditions among the attributes of the third object; and adjusts the attribute value of the target attribute to match the other conditions. The computer device corrects erroneous attribute values by first determining the target attribute corresponding to other conditions besides the uniqueness condition, and then adjusting the attribute value of the target attribute according to the other conditions so that the adjusted attribute value matches the other conditions. For example, if the third object satisfies the uniqueness condition, but does not meet the other condition "the attribute value of attribute B is equal to x", then the attribute value of attribute B of the third object is adjusted so that the attribute value of attribute B is equal to x.
[0109] In the above embodiments, if a third object that meets the uniqueness condition is found, it is determined whether the third object meets other conditions. If yes, the data of the third object is returned as test reference data; if not, the data of the third object is adjusted according to other conditions, and the adjusted data of the third object is returned as test reference data. This allows for flexible correction of the data when errors occur in the retrieved test reference data, ensuring data accuracy.
[0110] In one embodiment, such as Figure 7As shown, the data to be queried is basic bank account information, which is associated with basic financial institution information, and the basic financial institution information is associated with basic bank name and code information. The computer device passes the metadata information and filter conditions to the dynamic object creator. The dynamic object creator queries the database based on the metadata information and filter conditions. If the basic bank account information is found, it is returned to the user. If no basic bank account information matching the filter conditions is found, a first object proxy corresponding to the basic bank account information is created, and the filter conditions are passed to the first object proxy. The first object proxy sets the attribute values of each attribute of the basic bank account information according to the filter conditions in the filter conditions proxy. If the attribute values do not include the second object identifier, it means that the first object does not depend on other lower-level objects, and the first object created based on the attribute values is returned to the user. For the basic bank account information, since its attribute values include basic financial institution information, the basic bank account information is associated with basic financial institution information. The computer device calls the dynamic object creator corresponding to the basic financial institution information, and passes the first sub-filter conditions obtained by parsing the filter conditions to the dynamic object creator. The dynamic object creator queries based on the first sub-filter condition. If the financial institution's basic information is found, it returns the information to the first object proxy. If no information is found, a second object proxy corresponding to the financial institution's basic information is created, and the first sub-filter condition is passed to the second object proxy. The second object proxy sets the attribute values of each attribute of the financial institution's basic information according to the first sub-filter condition. The attribute values of the financial institution's basic information include the bank name and bank number, indicating that the financial institution's basic information is associated with the bank name and bank number. The computer device calls the dynamic object creator corresponding to the bank name and bank number basic information, passing the second sub-filter condition obtained by parsing the first sub-filter condition to the dynamic object creator. The dynamic object creator queries based on the second sub-filter condition. If the bank name and bank number basic information is found, it returns the information to the second object proxy. If no information is found, a third object proxy corresponding to the bank name and bank number is created, and the second sub-filter condition is passed to the third object proxy. The third object agent sets the attribute values of each attribute in the bank name and bank number basic data according to the second sub-filter conditions, and then passes the bank name and bank number basic data created based on the attribute values to the second object agent. The second object agent generates financial institution basic data based on the bank name and bank number basic data, and passes the financial institution basic data to the first object agent. The first object agent generates bank account basic data based on the financial institution basic data, and then returns the bank account basic data to the query terminal.
[0111] In one embodiment, such as Figure 8 As shown, the data query method includes the following steps:
[0112] S802, obtain the filter conditions used to query test reference data; the filter conditions include basic attribute filter conditions and dynamic object filter conditions.
[0113] S804 If no first object that meets the filtering conditions is found, create a first object proxy.
[0114] S806, for the basic properties of the first object proxy, configure the first property value that matches the filtering conditions of the basic properties; for the dynamic object properties of the first object proxy, configure the first property value that matches the filtering conditions of the dynamic objects.
[0115] S808, If the first attribute value includes the second object identifier, create a second object proxy.
[0116] S810, in the filtering conditions, select the target filtering conditions corresponding to each attribute of the second object proxy; group the target filtering conditions, and use each group of target filtering conditions as sub-filtering conditions.
[0117] S812, Configure the second attribute value for each attribute of the second object proxy according to the sub-filtering conditions; if the second attribute value does not include the lower-level object identifier, return the second object created based on each second attribute value.
[0118] S814, if the second attribute value includes a lower-level object identifier, create lower-level objects in a chain-like manner, and generate a second object based on the lower-level objects.
[0119] S816, generate the first object based on the second object, and return the data of the first object as test reference data.
[0120] S818 If a third object that meets the uniqueness condition in the filtering conditions is found, determine whether the third object meets other conditions in the filtering conditions; if so, return the data of the third object as test reference data.
[0121] S820, If not, among the attributes of the third object, determine the target attribute corresponding to the other conditions, and adjust the attribute value of the target attribute to match the other conditions.
[0122] S822 returns the adjusted data of the third object as test reference data.
[0123] The specific content of S802 to S822 can be found in the implementation process described above.
[0124] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0125] Based on the same inventive concept, this application also provides a data query apparatus for implementing the data query method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more data query apparatus embodiments provided below can be found in the limitations of the data query method described above, and will not be repeated here.
[0126] In one embodiment, such as Figure 9 As shown, a data query device is provided, including: an acquisition module 902, a creation module 904, a configuration module 906, and a generation module 908, wherein:
[0127] Module 902 is used to obtain the filter conditions used to query test reference data;
[0128] Create module 904 to create a first object proxy if no first object that meets the filter criteria is found.
[0129] Configuration module 906 is used to configure the first attribute value for each attribute of the first object proxy according to the filtering conditions;
[0130] Module 904 is also used to create a second object in a chained manner if the first attribute value includes a second object identifier;
[0131] The generation module 908 is used to generate a first object based on a second object and return the data of the first object as test reference data.
[0132] In the above embodiments, filtering conditions for querying test reference data are obtained; if no first object satisfying the filtering conditions is found, a first object proxy is created; first attribute values are configured for each attribute of the first object proxy according to the filtering conditions; if the first attribute value includes a second object identifier, a second object is created in a chain-like manner; a first object is generated based on the second object, and the data of the first object is returned as test reference data. Since the first object can be created based on the second object associated with it even when no first object is found, and can be reconstructed even if the first object is deleted or tampered with, the problem of not being able to find test reference data is avoided, improving the efficiency of data querying. Furthermore, since the data is created in a chain-like manner according to test requirements during unit testing, each data object can be flexibly reused during creation, improving the efficiency of data reuse and ensuring the accuracy of the created data.
[0133] In one embodiment, the filtering conditions include basic attribute filtering conditions and dynamic object filtering conditions; the attributes include basic attributes and dynamic object attributes; the configuration module 906 is further configured to:
[0134] Configure the first attribute value that matches the filtering conditions of the first object proxy for the basic attribute;
[0135] Configure the first property value that matches the dynamic object filtering conditions for the dynamic object proxy.
[0136] In one embodiment, module 904 is also used for:
[0137] If the first attribute value includes the second object identifier, create a second object proxy;
[0138] The filtering conditions are analyzed to obtain the sub-filtering conditions;
[0139] Based on the sub-filtering conditions, configure the second attribute values for each attribute of the second object proxy;
[0140] If the second attribute value does not include the identifier of the child object, return the second object created based on each of the second attribute values;
[0141] If the second attribute value includes a child object identifier, child objects are created in a chain-like manner, and a second object is generated based on the child objects.
[0142] In one embodiment, module 904 is also used for:
[0143] In the filtering conditions, select the target filtering conditions corresponding to each attribute of the second object proxy;
[0144] Group the target filtering conditions;
[0145] The target filtering conditions obtained from grouping are used as sub-filtering conditions.
[0146] In one embodiment, the filtering conditions include a uniqueness condition for uniquely identifying the first object, as well as other conditions; such as Figure 10 As shown, the device also includes:
[0147] The judgment module 910 is used to determine whether a third object that meets the uniqueness condition meets other conditions if a third object is found in the query.
[0148] Return module 912 is used to return the data of the third object as test reference data if the condition is met.
[0149] The adjustment module 914 is used to adjust the data of the third object according to other conditions if no, and return the data of the third object after data adjustment as test reference data.
[0150] In one embodiment, the adjustment module 914 is further configured to:
[0151] Among the attributes of the third object, determine the target attributes corresponding to other conditions;
[0152] Adjust the value of the target attribute to match other conditions.
[0153] Each module in the aforementioned data query device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0154] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 11 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores data for data retrieval. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When executed by the processor, the computer program implements a data retrieval method.
[0155] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 12 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 data query method. The display unit of the computer device is used to form a visually visible image. It can be a display screen, a projection device, or a 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.
[0156] Those skilled in the art will understand that Figure 11 , 12 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.
[0157] In one embodiment, a computer device is 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-described method embodiments.
[0158] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.
[0159] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0160] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data shall comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0161] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0162] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0163] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A data query method, characterized in that, The method includes: Get the filter conditions used to query test reference data; If no first object that meets the filtering conditions is found, a first object proxy is created; the first object proxy is used to configure the various attributes of the first object. Configure first attribute values for each attribute of the first object proxy according to the filtering conditions; the first object proxy has the same attributes as the first object; If the first attribute value includes a second object identifier, a second object is created in a chain-like manner, including: if the first attribute value includes a second object identifier, creating a second object proxy; parsing the filtering conditions to obtain sub-filtering conditions; configuring second attribute values for each attribute of the second object proxy according to the sub-filtering conditions; if the second attribute value does not include a lower-level object identifier, returning a second object created based on each of the second attribute values; if the second attribute value includes the lower-level object identifier, creating lower-level objects in a chain-like manner, and generating the second object based on the lower-level objects; the second object is a data object associated with the first object; wherein, the sub-filtering conditions are filtering conditions used to limit the attributes of the second object proxy; The first object is generated based on the second object, and the data of the first object is returned as the test reference data.
2. The method according to claim 1, characterized in that, The filtering conditions include basic attribute filtering conditions and dynamic object filtering conditions; the attributes include basic attributes and dynamic object attributes; configuring first attribute values for each attribute of the first object proxy according to the filtering conditions includes: Configure a first attribute value that matches the filtering conditions of the first object proxy for the basic attribute; Configure a first attribute value that matches the dynamic object filtering conditions for the dynamic object proxy of the first object.
3. The method according to claim 1, characterized in that, The step of parsing the filtering conditions to obtain sub-filtering conditions includes: In the filtering conditions, the target filtering conditions corresponding to each attribute of the second object proxy are selected respectively; The target filtering conditions are grouped; The target filtering conditions obtained from grouping are used as the sub-filtering conditions.
4. The method according to claim 1, characterized in that, The filtering conditions include uniqueness conditions for uniquely identifying the first object, as well as other conditions; the method further includes: If a third object that satisfies the uniqueness condition is found, determine whether the third object satisfies the other conditions; If so, return the data of the third object as the test reference data; If not, adjust the data of the third object according to the other conditions, and return the adjusted data of the third object as the test reference data.
5. The method according to claim 4, characterized in that, The data adjustment of the third object based on the other conditions includes: Among the attributes of the third object, determine the target attribute corresponding to the other conditions; Adjust the attribute value of the target attribute to match the other conditions.
6. A data query device, characterized in that, The device includes: The acquisition module is used to obtain the filter conditions for querying test reference data; A creation module is used to create a first object proxy if no first object satisfying the filtering conditions is found; the first object proxy is used to configure the various attributes of the first object; A configuration module is used to configure first attribute values for each attribute of the first object proxy according to the filtering conditions; the first object proxy has the same attributes as the first object; The creation module is further configured to create a second object in a hierarchical chain if the first attribute value includes a second object identifier, including: if the first attribute value includes a second object identifier, creating a second object proxy; parsing the filtering conditions to obtain sub-filtering conditions; configuring second attribute values for each attribute of the second object proxy according to the sub-filtering conditions; if the second attribute value does not include a lower-level object identifier, returning a second object created based on each of the second attribute values; if the second attribute value includes the lower-level object identifier, creating lower-level objects in a hierarchical chain, and generating the second object based on the lower-level objects; the second object is a data object associated with the first object; wherein, the sub-filtering conditions are filtering conditions used to limit the attributes of the second object proxy; The generation module is used to generate the first object based on the second object, and return the data of the first object as the test reference data.
7. The data query device according to claim 6, characterized in that, The filtering conditions include basic attribute filtering conditions and dynamic object filtering conditions; the attributes include basic attributes and dynamic object attributes; the device further includes: The configuration module is further configured to configure a first attribute value matching the filtering conditions of the basic attributes of the first object proxy; and to configure a first attribute value matching the filtering conditions of the dynamic object attributes of the first object proxy.
8. 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 5.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Loose coupling test method and system for testing logic and server object
CN101398779A
Method and system for filtering of network traffic
CN102474700A
Realization method of universal historical data service based on agency mechanism
CN103281343A
Test data query method and device, computer equipment and storage medium
CN108804548A