Data query method, data query device, electronic equipment and storage medium
By configuring query fields and return format strategies, parsing custom annotations to determine the parameters to be queried and the processing strategy identifiers, the system queries the target field set from the databases of multiple business systems and executes the processing strategy to construct data in a preset data format. This solves the problems of large repetitive workload and quality in enterprise business data statistical analysis, and improves development efficiency and stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING JINGDONG ZHENSHI INFORMATION TECH CO LTD
- Filing Date
- 2022-04-28
- Publication Date
- 2026-06-16
AI Technical Summary
In enterprise business data statistical analysis, existing technologies require writing complex business logic and assembling the returned data format, resulting in a large amount of repetitive work and a high risk of quality problems.
By configuring query fields and return format strategies, custom annotations are parsed to determine the parameters to be queried and the processing strategy identifiers. The target field set is queried from the databases of multiple business systems, and the processing strategy is executed to construct the data into a preset data format.
It simplifies the development workload for business developers, improves the stability of front-end and back-end interactions, and reduces repetitive work and quality deviations during the development process.
Smart Images

Figure CN117009397B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more specifically, to a data query method, a data query device, an electronic device, a readable storage medium, and a computer program product. Background Technology
[0002] As businesses expand, the statistical analysis of business data becomes increasingly important in corporate decision-making. Since business data is typically stored in different business systems, the statistical analysis process usually requires hard-coding to retrieve the relevant business data from each system and then assembling it into the format required by the front end.
[0003] In realizing the concept disclosed herein, the inventors discovered at least the following problems in the related technologies: each data query requires writing a complex but similar set of business logic and assembling the format of the returned data, resulting in a large amount of repetitive work and a high risk of quality problems. Summary of the Invention
[0004] In view of this, the present disclosure provides a data query method, a data query device, an electronic device, a readable storage medium, and a computer program product.
[0005] One aspect of this disclosure provides a data query method, comprising: in response to a data query request, obtaining a target business entity class, wherein the target business entity class is configured with at least one target custom annotation; parsing at least one target custom annotation to determine target query parameters and a target processing strategy identifier; based on the target query parameters, querying a target field set from databases of multiple business systems; extracting a target processing strategy corresponding to the target processing strategy identifier from a strategy container, wherein the strategy container includes multiple processing strategies, the processing strategies being used to construct the field set into data with a preset data format; and executing the target processing strategy to construct the target field set into target data with a target data format.
[0006] According to embodiments of this disclosure, the method further includes: creating an initial entity class; upon receiving a first preset operation, obtaining a first query parameter input by the user and a first processing strategy identifier corresponding to the first processing strategy selected by the user; adding the first query parameter and the first processing strategy identifier to the attributes of at least one initial annotation to obtain at least one custom annotation; and adding the at least one custom annotation to the initial entity class to obtain a business entity class.
[0007] According to embodiments of this disclosure, the method further includes: upon receiving a second preset operation, obtaining the second query parameter input by the user and the processing strategy code input by the user; adding the processing strategy code to an initial strategy class to obtain a second processing strategy, wherein the initial strategy class includes an initial class that inherits from a preset strategy parent class; determining a second processing strategy identifier corresponding to the second processing strategy; and adding the second query parameter and the second processing strategy identifier to the attributes of at least one of the initial annotations to obtain at least one of the custom annotations.
[0008] According to embodiments of this disclosure, the method further includes: upon receiving the first user operation or the second user operation, adding a call identifier to the first processing strategy or the second processing strategy; and in response to a system startup command, loading the first processing strategy or the second processing strategy containing the call identifier into the strategy container.
[0009] According to embodiments of this disclosure, the method further includes: determining a target query dimension from multiple query dimensions configured by the user, wherein the target query dimension has multiple corresponding target business systems; and encapsulating the business code of the multiple target business systems to obtain a target input parameter instance; wherein the above-mentioned querying the target field set from the database of the multiple business systems based on the target query parameter includes: querying the target field set from the database of the multiple target business systems based on the target query parameter and the target input parameter instance.
[0010] According to embodiments of this disclosure, the above-mentioned method of querying a set of target fields from the databases of multiple target business systems based on the target query parameters and the target input parameter instances includes: invoking a mapping generator to generate a target query statement and a mapping interface based on the target query parameters and the target input parameter instances; for each target business system, invoking the mapping interface to access the database of the target business system; executing the target query statement on the database of the target business system to obtain target fields; and combining multiple target fields to obtain the set of target fields.
[0011] According to embodiments of this disclosure, the above-mentioned response to a data query request to obtain the target business entity class includes: in response to the above-mentioned data query request, obtaining the above-mentioned target business entity class through a reflection mechanism.
[0012] Another aspect of this disclosure provides a data query apparatus, comprising: a first acquisition module, configured to acquire a target business entity class in response to a data query request, wherein the target business entity class is configured with at least one target custom annotation; a parsing module, configured to parse at least one target custom annotation to determine target query parameters and a target processing strategy identifier; a query module, configured to query a target field set from databases of multiple business systems based on the target query parameters; a second acquisition module, configured to extract a target processing strategy corresponding to the target processing strategy identifier from a strategy container, wherein the strategy container includes multiple processing strategies, the processing strategies being used to construct the field set into data with a preset data format; and a processing module, configured to execute the target processing strategy to construct the target field set into target data with a target data format.
[0013] Another aspect of this disclosure provides an electronic device, including: one or more processors; and a memory for storing one or more instructions, wherein when the one or more instructions are executed by the one or more processors, the one or more processors cause the one or more processors to perform the method as described above.
[0014] Another aspect of this disclosure provides a computer-readable storage medium storing computer-executable instructions that, when executed, are used to implement the method described above.
[0015] Another aspect of this disclosure provides a computer program product including computer-executable instructions that, when executed, are used to implement the method described above.
[0016] According to embodiments of this disclosure, upon receiving a data query request, the target business entity class can be extracted, and the target custom annotations in the target business entity class can be parsed to obtain the target query parameters and the target processing strategy identifier. Using the target query parameters, a set of target fields can be retrieved from the databases of various business systems. Using the target processing strategy identifier, the corresponding target processing strategy can be extracted from the strategy container. Then, the target processing strategy can be executed to assemble the target field set into target data with the target data format. Through the above technical means, at least partially, the technical problems of large repetitive workload and susceptibility to deviations in the development process of related technologies are overcome, effectively reducing the development workload of business developers, simplifying the development process, and increasing the stability of front-end and back-end interaction. Attached Figure Description
[0017] The above and other objects, features, and advantages of this disclosure will become clearer from the following description of embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0018] Figure 1 The illustration schematically depicts an exemplary system architecture to which data query methods and apparatus can be applied according to embodiments of the present disclosure.
[0019] Figure 2 A flowchart illustrating a data query method according to an embodiment of the present disclosure is shown schematically.
[0020] Figure 3 The diagram illustrates a business entity class configuration process according to an embodiment of the present disclosure.
[0021] Figure 4 A flowchart illustrating a data query method according to another embodiment of this disclosure is shown.
[0022] Figure 5 A block diagram of a data query apparatus according to an embodiment of the present disclosure is shown schematically.
[0023] Figure 6 A block diagram of an electronic device suitable for implementing a data query method according to an embodiment of the present disclosure is shown schematically. Detailed Implementation
[0024] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.
[0025] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0026] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0027] When using expressions such as "at least one of A, B, and C," the expression should generally be interpreted in accordance with the meaning commonly understood by a person skilled in the art (e.g., "a system having at least one of A, B, and C" should include, but is not limited to, systems having A alone, having B alone, having C alone, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.). Similarly, when using expressions such as "at least one of A, B, or C," the expression should generally be interpreted in accordance with the meaning commonly understood by a person skilled in the art (e.g., "a system having at least one of A, B, or C" should include, but is not limited to, systems having A alone, having B alone, having C alone, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.).
[0028] In a company's business systems, most pages display charts of different metrics in the same format, meaning that data queries require the same data format to be returned. For example, a page might need to display bar charts and detailed tables. The bar charts would return date enumerations and attribute lists, while the detailed tables would display the metrics vertically and the business units horizontally.
[0029] In related technologies, the method for adding a new interface to query data typically involves steps such as entity creation, mapper file writing, SQL statement writing, business layer and other layer writing, and assembling the returned query structure. This results in a lot of repetitive work, requiring the writing of a complex but similar set of business logic and the assembly of the returned data format each time a new interface is added. Furthermore, differences in coding habits among different developers can easily lead to discrepancies in the final returned results and format, causing interface quality issues.
[0030] In view of this, embodiments of the present disclosure provide a data query method that, by configuring query fields and return format strategies, enables queries across various business dimensions and returns results in a unified format, simplifying the development workload of business developers and increasing the stability of front-end and back-end interactions.
[0031] Specifically, embodiments of this disclosure provide a data query method, a data query apparatus, an electronic device, a readable storage medium, and a computer program product. The method includes: in response to a data query request, obtaining a target business entity class, wherein the target business entity class is configured with at least one target custom annotation; parsing the at least one target custom annotation to determine target query parameters and a target processing strategy identifier; based on the target query parameters, querying a target field set from databases of multiple business systems; extracting a target processing strategy corresponding to the target processing strategy identifier from a strategy container, wherein the strategy container includes multiple processing strategies, the processing strategies being used to construct the field set into data with a preset data format; and executing the target processing strategy to construct the target field set into target data with a target data format.
[0032] In the technical solution disclosed herein, the acquisition, storage, and application of user personal information comply with the provisions of relevant laws and regulations, necessary confidentiality measures have been taken, and there is no violation of public order and good morals.
[0033] In the technical solution disclosed herein, the user's authorization or consent is obtained before acquiring or collecting the user's personal information.
[0034] Figure 1 This illustration schematically depicts an exemplary system architecture to which data query methods and apparatus can be applied according to embodiments of this disclosure. It should be noted that... Figure 1 The examples shown are merely examples of system architectures that can be applied to the embodiments of this disclosure, in order to help those skilled in the art understand the technical content of this disclosure, but do not mean that the embodiments of this disclosure cannot be used in other devices, systems, environments or scenarios.
[0035] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, and 103, a network 104, and servers 105, 106, and 107.
[0036] Terminal devices 101, 102, and 103 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0037] Various communication client applications can be installed on terminal devices 101, 102, and 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, and / or social platform software.
[0038] Network 104 is a medium used to provide communication links between terminal devices 101, 102, 103 and servers 105, 106, 107. Network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0039] Users can use terminal devices 101, 102, and 103 to interact with servers 105, 106, and 107 via network 104 to receive or send messages, etc.
[0040] Servers 105, 106, and 107 can be servers that provide various services. For example, when a user uses terminal devices 101, 102, and 103 to perform data queries, servers 105, 106, and 107 can be business servers that provide support for the data query request.
[0041] It should be noted that the data query method provided in this embodiment can generally be executed by servers 105, 106, and 107. Correspondingly, the data query device provided in this embodiment can generally be located in servers 105, 106, and 107. The data query method provided in this embodiment can also be executed by a server or server cluster that is different from servers 105, 106, and 107 and capable of communicating with terminal devices 101, 102, and 103 and / or servers 105, 106, and 107. Correspondingly, the data query device provided in this embodiment can also be located in a server or server cluster that is different from servers 105, 106, and 107 and capable of communicating with terminal devices 101, 102, and 103 and / or servers 105, 106, and 107. Alternatively, the data query method provided in this embodiment can also be executed by terminal devices 101, 102, or 103, or by other terminal devices different from terminal devices 101, 102, or 103. Accordingly, the data query device provided in this embodiment of the present disclosure may also be set in terminal device 101, 102 or 103, or in other terminal devices different from terminal device 101, 102 or 103.
[0042] For example, a user can initiate a data query request through any one of terminal devices 101, 102, or 103 (e.g., terminal device 101, but not limited thereto). Terminal device 101 can execute the data query method provided in the embodiments of this disclosure locally, or send the data query request to other terminal devices, servers, or server clusters through network 104, and the other terminal devices, servers, or server clusters that receive the data query request can execute the data query method provided in the embodiments of this disclosure.
[0043] It should be understood that Figure 1The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0044] Figure 2 A flowchart illustrating a data query method according to an embodiment of the present disclosure is shown schematically.
[0045] like Figure 2 As shown, the method includes operations S201 to S205.
[0046] It should be noted that, unless it is explicitly stated that there is a sequential order of execution between different operations, or that there is a sequential order of execution between different operations in terms of technical implementation, the execution order between multiple operations may not be significant, and multiple operations may be executed simultaneously.
[0047] In operation S201, in response to a data query request, the target business entity class is obtained, wherein the target business entity class is configured with at least one target custom annotation.
[0048] In operation S202, at least one target custom annotation is parsed to determine the target query parameters and the target processing strategy identifier.
[0049] In operation S203, based on the target query parameters, the target field set is obtained by querying the databases of multiple business systems.
[0050] In operation S204, the target processing strategy corresponding to the target processing strategy identifier is extracted from the strategy container. The strategy container includes multiple processing strategies, which are used to construct the field set into data with a preset data format.
[0051] In operation S205, the target processing strategy is executed to construct the target field set into target data with the target data format.
[0052] According to embodiments of this disclosure, a data query request may include a request to add a new interface or to use an existing interface to query data.
[0053] According to embodiments of this disclosure, the target business entity class can be determined from multiple classes of the business program through user predefinition, or it can be obtained by parsing the source code of the current business program, or it can be obtained when the current business program is running using any runtime technology, without any limitation.
[0054] According to embodiments of this disclosure, the target business entity class can be, for example, a JavaBean. Annotations can be added to the JavaBean, such as the `@pattern` annotation for return format and the `@back` annotation for return identifier. The attributes of the `@pattern` annotation can be configured with the strategy to be used, i.e., the target processing strategy identifier. The `@back` annotation can be configured with the parameters to be returned, i.e., the target query parameters. It should be noted that the strategy to be used and the parameters to be returned can be configured in different annotations or in the same annotation; this is not limited here.
[0055] According to embodiments of this disclosure, there may be one or more target query parameters and target processing strategy identifiers, which are not limited herein.
[0056] According to embodiments of this disclosure, the parsing of custom annotations can be implemented by hard coding or any existing parser, without limitation.
[0057] According to embodiments of this disclosure, after obtaining the target query parameters, firstly, the target query parameters can be loaded into the inherent business logic, which may include business codes of different business dimensions such as same group and same area, same region and business department; then, a mapper generator can be called to generate basic query SQL statements and mapper interfaces; then, the SQL statements and mapper interfaces can be used to query data from the databases of multiple business systems to obtain the target field set.
[0058] According to embodiments of this disclosure, a processing strategy can be a class that can convert input data into output data with a specific data format. For example, a processing strategy can convert input data of string type ID and NAME into output data of key-value type; as another example, a processing strategy can use input data of numeric type Time and Value as the horizontal and vertical axes respectively to output output data in the form of a bar chart; yet another example is that a processing strategy can also perform statistics on business data with specific business identifiers from multiple business systems and output them in tabular form.
[0059] According to embodiments of this disclosure, the policy container can be a linear list structure, and all processing policies in the policy container inherit from the same policy parent class.
[0060] According to embodiments of this disclosure, the preset data format may include bar chart format, table format, linked list format, etc., and is not limited thereto.
[0061] According to embodiments of this disclosure, upon receiving a data query request, the target business entity class can be extracted, and the target custom annotations in the target business entity class can be parsed to obtain the target query parameters and the target processing strategy identifier. Using the target query parameters, a set of target fields can be retrieved from the databases of various business systems. Using the target processing strategy identifier, the corresponding target processing strategy can be extracted from the strategy container. Then, the target processing strategy can be executed to assemble the target field set into target data with the target data format. Through the above technical means, at least partially, the technical problems of large repetitive workload and susceptibility to deviations in the development process of related technologies are overcome, effectively reducing the development workload of business developers, simplifying the development process, and increasing the stability of front-end and back-end interaction.
[0062] The following is for reference. Figures 3-4 In conjunction with specific embodiments, Figure 2 The method shown will be further explained.
[0063] According to embodiments of this disclosure, operation S201 may include the following operations:
[0064] In response to a data query request, the target business entity class is obtained through reflection.
[0065] According to embodiments of this disclosure, based on the concept of aspect-oriented programming, the target business entity class can be configured with corresponding meta-annotations, so that the custom annotations of the target business entity class can be captured by reflection mechanism at any stage such as the compilation stage or the runtime stage.
[0066] According to embodiments of this disclosure, the business entity class can be configured by the user.
[0067] Figure 3 The diagram illustrates a business entity class configuration process according to an embodiment of the present disclosure.
[0068] like Figure 3 As shown, the business entity class configuration process includes operations S301 to S309.
[0069] In operation S301, create the initial entity class.
[0070] In operation S302, listen to the user's input and obtain the parameters to be queried entered by the user.
[0071] When operating S303, listen for the user's selection operation and obtain the processing strategy selected by the user.
[0072] In operation S304, determine whether the processing policy is empty; if it is determined that the processing policy selected by the user is empty, execute operation S305; if it is determined that the processing policy selected by the user is not empty, execute operation S307.
[0073] When operating S305, listen for user input and obtain the strategy code entered by the user.
[0074] When operating S306, a processing strategy is generated based on the strategy code.
[0075] In operation S307, determine the processing policy identifier corresponding to the processing policy.
[0076] After completing operations S302 and S307, operation S308 is executed.
[0077] In operation S308, the parameters to be queried and the processing strategy identifier are added to the initial annotation to obtain a custom annotation.
[0078] In operation S309, add a custom annotation to the initial entity class to obtain the business entity class.
[0079] According to embodiments of this disclosure, the initial entity class can be configured with multiple fields, and the fields in the initial entity class correspond one-to-one with the fields in the database.
[0080] According to embodiments of this disclosure, the initial entity class can be created according to specific business scenarios, and no limitation is made herein.
[0081] According to embodiments of this disclosure, the list of user-selectable processing strategy options may include options indicating that no corresponding processing strategy exists. If the user selects this option, it can be determined that the selected processing strategy is empty.
[0082] According to embodiments of this disclosure, generating a processing strategy based on strategy code may include: adding strategy code to an initial strategy class to obtain a processing strategy, wherein the initial strategy class may be inherited from a preset strategy parent class, and the name of the preset strategy parent class may be the same as the name of the strategy container.
[0083] According to embodiments of this disclosure, after configuring the business entity class, the return result entity can be configured and logical input parameters can be encapsulated. Then, the query proxy interface can be called, with the business entity class, return result entity, and logical input parameters as input parameters, written into the query proxy to return the query result. The query proxy can implement methods as described in S201–S205.
[0084] According to embodiments of this disclosure, when the query proxy is compiled by a strongly validated programming language such as JAVA, the business entity class, the returned result entity, and the logical input parameters also need to inherit the corresponding parent class to meet the requirements of the strongly validated language for the interface input parameters.
[0085] According to embodiments of this disclosure, during the configuration of business entity classes, user-inputted and selected query parameters and processing strategies can be automatically added to annotations, eliminating the need to repeatedly write a large amount of business code. On the other hand, since the processing strategies are reused, if the returned data format already has a strategy, there is no need to develop a new strategy, simplifying the development process.
[0086] Figure 4 A flowchart illustrating a data query method according to another embodiment of this disclosure is shown.
[0087] like Figure 4 As shown, the method includes operations S401 to S408.
[0088] In operation S401, the processing strategy marked with annotations is loaded into the strategy container.
[0089] In operation S402, obtain the target business entity class.
[0090] In operation S403, parse the custom annotations on the target business entity class.
[0091] When operating S404, encapsulate the business logic input parameters.
[0092] In operation S405, based on the input parameters and the target query parameters, the mapping generator is invoked to generate the target query statement and mapping interface.
[0093] When operating S406, the database of each target business system is accessed through the mapping interface, the target query statement is executed, and the target fields are obtained.
[0094] In operation S407, determine whether the access operation has been completed; if it is determined that the access operation has been completed, execute operation S408; if it is determined that the access operation has not been completed, return to execute operation S406.
[0095] In operation S408, the target processing strategy is executed, which concatenates multiple target fields and constructs the returned result.
[0096] According to the embodiments of this disclosure, the methods of operating S402-S404 and S406-S408 can be implemented by operating S201-S205, and will not be described in detail here.
[0097] According to embodiments of this disclosure, when executing the methods of operations S303 to S307, a call identifier can be added to the processing policy selected or created by the user. At system startup, the processing policy with the call identifier can be loaded into the policy container to reduce the memory footprint of the policy container and improve retrieval efficiency.
[0098] According to embodiments of this disclosure, users can configure multiple query dimensions based on specific business scenarios. These query dimensions include, but are not limited to, querying multiple business systems at the same level or querying multiple business systems at different levels within the same business line.
[0099] According to embodiments of this disclosure, query statements that can be generated by calling the mapping generator include, but are not limited to, Create, Alter, Drop, and other query-based statements.
[0100] Figure 5 A block diagram of a data query apparatus according to an embodiment of the present disclosure is shown schematically.
[0101] like Figure 5 As shown, the data query device 500 includes a first acquisition module 510, a parsing module 520, a query module 530, a second acquisition module 540, and a processing module 550.
[0102] The first acquisition module 510 is used to acquire the target business entity class in response to a data query request, wherein the target business entity class is configured with at least one target custom annotation.
[0103] The parsing module 520 is used to parse at least one target custom annotation to determine the target query parameters and the target processing strategy identifier.
[0104] The query module 530 is used to retrieve a set of target fields from the databases of multiple business systems based on the target query parameters.
[0105] The second acquisition module 540 is used to extract the target processing strategy corresponding to the target processing strategy identifier from the strategy container. The strategy container includes multiple processing strategies, which are used to construct the field set into data with a preset data format.
[0106] Processing module 550 is used to execute the target processing strategy to construct the target field set into target data with the target data format.
[0107] According to embodiments of this disclosure, upon receiving a data query request, the target business entity class can be extracted, and the target custom annotations in the target business entity class can be parsed to obtain the target query parameters and the target processing strategy identifier. Using the target query parameters, a set of target fields can be retrieved from the databases of various business systems. Using the target processing strategy identifier, the corresponding target processing strategy can be extracted from the strategy container. Then, the target processing strategy can be executed to assemble the target field set into target data with the target data format. Through the above technical means, at least partially, the technical problems of large repetitive workload and susceptibility to deviations in the development process of related technologies are overcome, effectively reducing the development workload of business developers, simplifying the development process, and increasing the stability of front-end and back-end interaction.
[0108] According to embodiments of this disclosure, the device 500 further includes a creation module, a third acquisition module, a first addition module, and a second addition module.
[0109] Create a module to create the initial entity class.
[0110] The third acquisition module is used to acquire, upon receiving the first preset operation, the first query parameter input by the user and the first processing strategy identifier corresponding to the first processing strategy selected by the user.
[0111] The first adding module is used to add the first query parameter and the first processing strategy identifier to the attribute of at least one initial annotation to obtain at least one custom annotation.
[0112] The second module is used to add at least one custom annotation to the initial entity class to obtain the business entity class.
[0113] According to embodiments of this disclosure, the device 500 further includes a fourth acquisition module, a third addition module, a first determination module, and a fourth addition module.
[0114] The fourth acquisition module is used to acquire the second query parameter input by the user and the processing strategy code input by the user when the second preset operation is received.
[0115] The third module is used to add the processing strategy code to the initial strategy class to obtain the second processing strategy. The initial strategy class includes an initial class that inherits from the preset strategy parent class.
[0116] The first determining module is used to determine the second processing strategy identifier corresponding to the second processing strategy.
[0117] The fourth module is used to add the second query parameter and the second processing strategy identifier to the attribute of at least one initial annotation to obtain at least one custom annotation.
[0118] According to embodiments of this disclosure, the device 500 further includes a fifth adding module and a loading module.
[0119] The fifth module is used to add a call identifier to the first processing strategy or the second processing strategy when a first user operation or a second user operation is received.
[0120] The loading module is used to load a first processing policy or a second processing policy containing a call identifier into a policy container in response to a system startup command.
[0121] According to embodiments of this disclosure, the device 500 further includes a second determining module and an encapsulation module.
[0122] The second determination module is used to determine the target query dimension from multiple query dimensions configured by the user, wherein the target query dimension has multiple corresponding target business systems.
[0123] The encapsulation module is used to encapsulate the business code of multiple target business systems to obtain target input parameter instances.
[0124] According to embodiments of this disclosure, the query module 530 is further configured to query a set of target fields from the databases of multiple target business systems based on the target query parameters and the target input parameter instance.
[0125] According to embodiments of this disclosure, the query module 530 includes a first query unit, a second query unit, a third query unit, and a fourth query unit.
[0126] The first query unit is used to call the mapping generator to generate the target query statement and mapping interface based on the target query parameters and the target input parameter instance.
[0127] The second query unit is used to call the mapping interface for each target business system to access the database of the target business system.
[0128] The third query unit is used to execute the target query statement against the database of the target business system to obtain the target fields.
[0129] The fourth query unit is used to combine multiple target fields to obtain a target field set.
[0130] According to an embodiment of this disclosure, the first acquisition module 510 includes an acquisition unit.
[0131] The retrieval unit is used to retrieve the target business entity class through reflection in response to a data query request.
[0132] Any one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure, or at least part of the functions of any one or more of them, can be implemented in one module. Any one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure can be implemented by dividing them into multiple modules. Any one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure can be at least partially implemented as hardware circuitry, such as Field Programmable Gate Arrays (FPGAs), Programmable Logic Arrays (PLAs), Systems-on-Chip, Systems-on-Substrate, Systems-on-Package, Application-Specific Integrated Circuits (ASICs), or implemented in hardware or firmware by any other reasonable means of integrating or packaging circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure can be at least partially implemented as computer program modules, which, when run, can perform corresponding functions.
[0133] For example, any plurality of the first acquisition module 510, parsing module 520, query module 530, second acquisition module 540, and processing module 550 can be combined into one module / unit / subunit, or any one of these modules / units / subunits can be split into multiple modules / units / subunits. Alternatively, at least part of the functionality of one or more of these modules / units / subunits can be combined with at least part of the functionality of other modules / units / subunits and implemented in one module / unit / subunit. According to embodiments of this disclosure, at least one of the first acquisition module 510, parsing module 520, query module 530, second acquisition module 540, and processing module 550 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or implemented in hardware or firmware by any other reasonable means of integrating or packaging the circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, at least one of the first acquisition module 510, parsing module 520, query module 530, second acquisition module 540, and processing module 550 may be implemented at least partially as a computer program module, which can perform corresponding functions when the computer program module is run.
[0134] It should be noted that the data query device part in the embodiments of this disclosure corresponds to the data query method part in the embodiments of this disclosure. The specific description of the data query device part is referred to in the data query method part, and will not be repeated here.
[0135] Figure 6 A block diagram of an electronic device suitable for implementing a data query method according to an embodiment of the present disclosure is shown schematically. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0136] like Figure 6 As shown, a computer electronic device 600 according to an embodiment of the present disclosure includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage portion 608 into a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0137] RAM 603 stores various programs and data required for the operation of electronic device 600. Processor 601, ROM 602, and RAM 603 are interconnected via bus 604. Processor 601 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 602 and / or RAM 603. It should be noted that the programs may also be stored in one or more memories other than ROM 602 and RAM 603. Processor 601 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in said one or more memories.
[0138] According to embodiments of this disclosure, the electronic device 600 may further include an input / output (I / O) interface 605, which is also connected to a bus 604. The electronic device 600 may also include one or more of the following components connected to the I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 610 as needed so that computer programs read from it can be installed into the storage section 608 as needed.
[0139] According to embodiments of this disclosure, the method flow according to embodiments of this disclosure can be implemented as a computer software program. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the methods shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by processor 601, it performs the functions defined in the system of embodiments of this disclosure. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0140] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of this disclosure.
[0141] According to embodiments of this disclosure, the computer-readable storage medium can be a non-volatile computer-readable storage medium. Examples include, but are not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0142] For example, according to embodiments of this disclosure, a computer-readable storage medium may include the ROM 602 and / or RAM 603 described above and / or one or more memories other than ROM 602 and RAM 603.
[0143] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods provided in the embodiments of this disclosure. When the computer program product is run on an electronic device, the program code is used to enable the electronic device to implement the data query method provided in the embodiments of this disclosure.
[0144] When the computer program is executed by the processor 601, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0145] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and downloaded and installed via the communication section 609, and / or installed from the removable medium 611. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0146] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0147] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions. Those skilled in the art will understand that the features recited in the various embodiments and / or claims of this disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not expressly described in this disclosure. In particular, the features described in the various embodiments and / or claims of this disclosure may be combined and / or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.
[0148] The embodiments of this disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of this disclosure. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. The scope of this disclosure is defined by the appended claims and their equivalents. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of this disclosure, and all such substitutions and modifications should fall within the scope of this disclosure.
Claims
1. A data query method, comprising: In response to a data query request, the target business entity class is obtained through reflection, wherein the target business entity class is configured with at least one target custom annotation; Parse at least one of the target custom annotations to determine the target query parameters and the target processing strategy identifier; Based on the target query parameters, a set of target fields is obtained by querying the databases of multiple business systems, wherein the databases of the multiple business systems are independent of each other; Extract the target processing strategy corresponding to the target processing strategy identifier from the strategy container, wherein the strategy container includes multiple processing strategies, which are used to construct data with a preset data format from a set of fields, and the multiple processing strategies are configured to be loaded into the strategy container when the system starts; and The target processing strategy is executed to construct the target field set into target data with the target data format.
2. The method according to claim 1, further comprising: Create the initial entity class; Upon receiving a first preset operation, obtain the first query parameter input by the user and the first processing strategy identifier corresponding to the first processing strategy selected by the user; Add the first parameter to be queried and the first processing strategy identifier to the attribute of at least one initial annotation to obtain at least one custom annotation; as well as Add the at least one custom annotation to the initial entity class to obtain the business entity class.
3. The method according to claim 2, further comprising: Upon receiving a second preset operation, the system obtains the second query parameter input by the user and the processing strategy code input by the user. The processing strategy code is added to the initial strategy class to obtain the second processing strategy, wherein the initial strategy class includes an initial class that inherits from the preset strategy parent class; Determine the second processing strategy identifier corresponding to the second processing strategy; as well as The second parameter to be queried and the second processing strategy identifier are added to the attributes of at least one of the initial annotations to obtain at least one of the custom annotations.
4. The method according to claim 3, further comprising: Upon receiving a first preset operation or a second preset operation, a call identifier is added to the first processing strategy or the second processing strategy; as well as In response to a system startup command, the first processing policy or the second processing policy containing the call identifier is loaded into the policy container.
5. The method according to claim 1, further comprising: The target query dimension is determined from multiple user-configured query dimensions, wherein the target query dimension corresponds to multiple target business systems; and The business code of multiple target business systems is encapsulated to obtain target input parameter instances; The step of obtaining the target field set from the databases of multiple business systems based on the target query parameters includes: Based on the target query parameters and the target input parameter instance, the target field set is obtained by querying the databases of multiple target business systems.
6. The method according to claim 5, wherein, The process involves querying a set of target fields from the databases of multiple target business systems based on the target query parameters and the target input parameter instance. These fields include: Invoke the mapping generator to generate the target query statement and mapping interface based on the target query parameter and the target input parameter instance; For each of the target business systems, the mapping interface is invoked to access the database of the target business system; Execute the target query statement on the database of the target business system to obtain the target fields; and The target fields are combined to obtain the target field set.
7. A data query device, comprising: The first acquisition module is used to obtain the target business entity class through reflection mechanism in response to a data query request, wherein the target business entity class is configured with at least one target custom annotation; The parsing module is used to parse at least one of the target custom annotations to determine the target query parameters and the target processing strategy identifier; The query module is used to query a set of target fields from the databases of multiple business systems based on the target query parameters, wherein the databases of the multiple business systems are independent of each other; The second acquisition module is used to extract the target processing strategy corresponding to the target processing strategy identifier from the strategy container, wherein the strategy container includes multiple processing strategies, the processing strategies are used to construct data with a preset data format from a set of fields, and the multiple processing strategies are configured to be loaded into the strategy container when the system starts; and The processing module is used to execute the target processing strategy to construct the target field set into target data with the target data format.
8. An electronic device, comprising: One or more processors; Memory, used to store one or more instructions. When the one or more instructions are executed by the one or more processors, the one or more processors cause the one or more processors to implement the method of any one of claims 1 to 6.
9. A computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the method of any one of claims 1 to 6.
10. A computer program product comprising computer-executable instructions, which, when executed, are used to implement the method of any one of claims 1 to 6.