An interface-based custom query export extension method, device and medium
Patent Information
- Application Number
- CN202311386140.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-24
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2043-10-24
AI Technical Summary
[0003]本申请实施例提供了一种基于接口的自定义查询导出扩展方法、设备及介质,用于解决如下技术问题:现有的数字化查询平台的数据耦合性较高,扩展能力较差,无法满足复杂的个性化导出需求
[0051] This invention discloses a custom query export extension method, device, and medium. It involves creating an extended export interface within an existing digital query platform and then developing an interface implementation class based on this interface to customize personalized export logic. An extension switch is set and extension information is configured within the digital query platform. During data export, the interface implementation class is dynamically loaded based on the extension switch and extension information to meet different export requirements. Compared to existing technologies, this solution can dynamically load custom export implementation classes within the digital query platform, quickly responding to various user export needs and improving the scalability of the digital query platform's export functionality.
Smart Images

Figure CN117435269B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information technology, and in particular to an interface-based custom query export extension method, device, and medium. Background Technology
[0002] Due to varying business needs, the data export requirements within a digital query platform will differ. Current digital query platforms can satisfy most personalized export needs, such as exporting by value, by text, and paginated export. However, for complex scenarios, such as exporting data to Excel, some clients require exporting to one Excel file and inserting it into different sheets, while others need to rename the sheets; some require exporting to different Excel files; some require packaged export; and some want to export documents based on data columns. Current digital query platforms suffer from overly tight data coupling in their export functions, resulting in poor adaptability and scalability, and thus cannot meet these complex personalized needs. Summary of the Invention
[0003] This application provides an interface-based custom query export extension method, device, and medium to solve the following technical problem: existing digital query platforms have high data coupling and poor scalability, and cannot meet complex personalized export needs.
[0004] The embodiments of this application adopt the following technical solutions:
[0005] On the one hand, embodiments of this application provide a custom query export extension method, which includes: creating a corresponding extended export interface in a digital query platform according to the user's export requirements;
[0006] In the digital query platform, secondary development is carried out on the interface implementation class based on the extended export interface;
[0007] Configure extended information and set an extension switch in the digital query platform;
[0008] Based on the extended information and the extended switch, the interface implementation class is dynamically loaded when exporting data to fulfill the user's export requirements.
[0009] In one feasible implementation, the step of creating a corresponding extended export interface in the digital query platform according to the user's export requirements specifically includes:
[0010] Based on the user's export requirements, determine the necessary interface parameters;
[0011] Based on the interface parameters, create a corresponding extended export interface in the digital query platform and grant public permissions to the extended export interface.
[0012] The extended export interface provides a standard structure for secondary development implementation classes.
[0013] In one feasible implementation, within the digital query platform, secondary development of an interface implementation class based on the extended export interface specifically includes:
[0014] Secondary development is carried out on the digital query platform to create an interface implementation class for the extended export interface;
[0015] Based on the user's export requirements, customize the corresponding personalized export logic and configure the export data acquisition parameters in the personalized export logic;
[0016] The personalized export logic is compiled to generate a DLL file.
[0017] In one feasible implementation, the personalized export logic is configured with export data acquisition parameters, specifically including:
[0018] Configure the data export address in the export data parameter serverPagingPubQueryClient of the extended export interface so as to obtain the export data required by the user through the export data parameter;
[0019] Configure the start page and end page in the start page parameter startPageNo and end page parameter endPageNo of the extended export interface to obtain the number of data pages that the user needs to export.
[0020] In one feasible implementation, configuring extended information and setting an extension switch in the digital query platform specifically includes:
[0021] Add a JSON-based extended configuration file to the digital query platform;
[0022] The DLL file containing the interface implementation class and the class information are configured as extended information in the extended configuration file; wherein, the class information includes at least the class name and namespace;
[0023] Based on the extended information, an extended switch is configured in the extended configuration file.
[0024] In one feasible implementation, based on the extended information and the extended switch, the interface implementation class is dynamically loaded during data export to fulfill the user's export requirements, specifically including:
[0025] Add an extended branch to the digital query platform;
[0026] Determine whether to execute the extension branch based on the extension switch configured in the extension configuration file;
[0027] If an extension branch is executed, the assembly in the extension configuration file is dynamically loaded through the System.Reflection.CreateInstance reflection mechanism;
[0028] When exporting data, an instance of the interface implementation class is created using the system activator to obtain the personalized export logic in the interface implementation class;
[0029] Based on the personalized export logic, the program assembly is executed to fulfill the user's export requirements.
[0030] In one feasible implementation, determining whether to execute an extension branch based on the extension switch configured in the extension configuration file specifically includes:
[0031] Retrieve the switch configuration parameter exportExtendValue from the extended configuration file;
[0032] If the value of the switch configuration parameter is true, then the extended branch is executed; wherein the instruction of the extended branch is: export multiple Excel files page by page;
[0033] If the value of the switch configuration parameter is false, the default branch is executed.
[0034] In one feasible implementation, based on the personalized export logic, the assembly is executed to fulfill the user's export requirements, specifically including:
[0035] The extension configuration file is loaded by loading a JSON file, and each parameter in the extension configuration file is parsed.
[0036] Load the extended information and parsed parameters from the extended configuration file into the assembly;
[0037] Based on the data export address and data page number in the personalized export logic, the program assembly is executed to export the required data.
[0038] On the other hand, embodiments of this application also provide a custom query export extension device, including: at least one processor; and,
[0039] A memory communicatively connected to the at least one processor; wherein,
[0040] The memory stores instructions that can be executed by the at least one processor, enabling the at least one processor to perform the following:
[0041] Based on users' export requirements, create corresponding extended export interfaces in the digital query platform;
[0042] In the digital query platform, secondary development is carried out on the interface implementation class based on the extended export interface;
[0043] Configure extended information and set an extension switch in the digital query platform;
[0044] Based on the extended information and the extended switch, the interface implementation class is dynamically loaded when exporting data to fulfill the user's export requirements.
[0045] Finally, this application embodiment also provides a computer storage medium, which is a non-volatile computer-readable storage medium storing at least one program, each program including instructions, which, when executed by a terminal, cause the terminal to perform:
[0046] Based on users' export requirements, create corresponding extended export interfaces in the digital query platform;
[0047] In the digital query platform, secondary development is carried out on the interface implementation class based on the extended export interface;
[0048] Configure extended information and set an extension switch in the digital query platform;
[0049] Based on the extended information and the extended switch, the interface implementation class is dynamically loaded when exporting data to fulfill the user's export requirements.
[0050] Compared with the prior art, the custom query export extension method, device and medium provided in this application have the following beneficial effects:
[0051] This invention discloses a custom query export extension method, device, and medium. It involves creating an extended export interface within an existing digital query platform and then developing an interface implementation class based on this interface to customize personalized export logic. An extension switch is set and extension information is configured within the digital query platform. During data export, the interface implementation class is dynamically loaded based on the extension switch and extension information to meet different export requirements. Compared to existing technologies, this solution can dynamically load custom export implementation classes within the digital query platform, quickly responding to various user export needs and improving the scalability of the digital query platform's export functionality. Attached Figure Description
[0052] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings:
[0053] Figure 1 A flowchart of a custom query export extension method provided in this application embodiment;
[0054] Figure 2 This is a schematic diagram of the structure of a custom query export extension device provided in an embodiment of this application. Detailed Implementation
[0055] To enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this application.
[0056] This application provides a custom query export extension method, such as... Figure 1 As shown, the custom query export extension method specifically includes steps S101-S104:
[0057] S101. Based on the user's export requirements, create a corresponding extended export interface in the digital query platform.
[0058] Specifically, based on the export requirements submitted by different users, the necessary interface parameters are extracted. Then, based on these interface parameters, corresponding extended export interfaces are developed in the digital query platform. These extended export interfaces are granted public access. The extended export interfaces provide a standard structure for secondary development implementation classes.
[0059] As a feasible implementation method, based on the constraints and open mechanism of the interface, an extended export interface is developed in the digital query platform. The extended export interface provides a standard structure that secondary development implementation classes should follow, so that the classes or structures that implement the interface are consistent in form, and provide common processing services for unrelated classes.
[0060] As a feasible implementation method, the code for developing the export interface is as follows:
[0061] (1) Determine the parameters required in the user's export requirements (e.g., client, backgroundWorker, startPageNo, and endPageNo are all required parameters).
[0062] (2) Create an extended export interface (e.g., IPubQueryExportExtend here):
[0063]
[0064] S102. In the digital query platform, secondary development is carried out on the interface implementation class based on the extended export interface.
[0065] Specifically, secondary development is carried out on the digital query platform to create an interface implementation class that extends the export interface.
[0066] Furthermore, based on the user's export requirements, a customized export logic is created, and the parameters for obtaining exported data are configured within this logic. Finally, the customized export logic is compiled into a DLL file.
[0067] As a feasible implementation, the data export address is configured in the export data parameter `serverPagingPubQueryClient` of the extended export interface to obtain the data required by the user. The start page and end page are configured in the start page parameter `startPageNo` and end page parameter `endPageNo` of the extended export interface to obtain the number of data pages the user needs to export.
[0068] The secondary developers create the interface implementation class, retrieve data through the interface, and write customized export logic according to customer requirements. During this process, the secondary developers only need to focus on the customized export logic.
[0069] As a feasible implementation method, the code for the secondary development interface implementation class and the custom export logic is as follows:
[0070] (1) Define a business class (e.g., PubQueryExportExtend here) that implements the interface PubQueryExportExtend:
[0071] public class PubQueryExportExtend:IPubQueryExportExtend;
[0072] (2) Implement your own export logic in the business class, obtain the exported data through the parameter serverPagingPubQueryClient in the interface, and obtain the data page number through the start page startPageNo and end page endPageNo:
[0073]
[0074] S103. Configure extended information and set the extended switch in the digital query platform.
[0075] Specifically, a JSON-based extension configuration file is added to the digital query platform. The DLL file containing the interface implementation class and class information are configured as extension information in the extension configuration file; the class information includes at least the class name and namespace.
[0076] Furthermore, based on the extended information, an extended switch is configured in the extended configuration file.
[0077] As a feasible implementation method, the following code describes how to add a configuration file to the query platform to set configuration switches and extended class information:
[0078]
[0079] Setting exportExtend to true will trigger the extended interface;
[0080] assembly: The DLL containing the extended class;
[0081] className: Extended class name, including the namespace.
[0082] S104. Based on the extended information and extended switches, dynamically load the interface implementation class when exporting data to meet the user's export requirements.
[0083] Specifically, an extension branch is added to the digital query platform. Whether to execute the extension branch is determined by the extension switch configured in the extension configuration file. If the extension branch is executed, the assembly in the extension configuration file is dynamically loaded using the System.Reflection.CreateInstance reflection mechanism.
[0084] Furthermore, during data export, an instance of the interface implementation class is created using the system activator to obtain the personalized export logic within that class. Based on this personalized export logic, the assembly is executed to fulfill the user's export requirements.
[0085] As one feasible implementation, the switch configuration parameter `exportExtendValue` is retrieved from the extended configuration file. If the value of the switch configuration parameter is `true`, the extended branch is executed; the instruction of the extended branch is: export multiple Excel files page by page. If the value of the switch configuration parameter is `false`, the default branch is executed.
[0086] Specifically, the extended configuration file is loaded via a JSON file, and each parameter in the extended configuration file is parsed. The extended information from the configuration file and the parsed parameters are then loaded into the assembly. Based on the data export address and data page number in the personalized export logic, the assembly is executed to export the required data.
[0087] As a feasible implementation, an extension branch is added to the query platform. Whether to use the extension branch is determined by a configuration switch in the configuration file. The System.Reflection.CreateInstance mechanism is used to dynamically load the assembly in the extension configuration file and create an instance of the secondary interface implementation class using the system activator, thereby obtaining the personalized export logic at runtime. The application identifies whether to use the extension branch at runtime through the configuration file, and the extension branch automatically invokes the personalized export logic.
[0088] As a feasible implementation, the code in the digital query platform that determines whether to follow the extended branch based on a configuration switch, and dynamically generates objects via reflection in the extended branch, is as follows:
[0089]
[0090]
[0091]
[0092] In addition, this application embodiment also provides a custom query export extension device, such as... Figure 2 As shown, the custom query export extended devices specifically include:
[0093] At least one processor; and a memory communicatively connected to the at least one processor; wherein,
[0094] The memory stores instructions that can be executed by at least one processor, so that at least one processor can perform the following:
[0095] Based on users' export requirements, create corresponding extended export interfaces in the digital query platform;
[0096] In the digital query platform, secondary development is carried out on the interface implementation class based on the extended export interface;
[0097] Configure extended information and set an extension switch in the digital query platform;
[0098] Based on the extended information and the extended switch, the interface implementation class is dynamically loaded when exporting data to fulfill the user's export requirements.
[0099] Finally, this application embodiment also provides a computer storage medium, characterized in that the computer storage medium is a non-volatile computer-readable storage medium, the non-volatile computer-readable storage medium stores at least one program, each program including instructions, the instructions, when executed by a terminal, cause the terminal to execute:
[0100] Based on users' export requirements, create corresponding extended export interfaces in the digital query platform;
[0101] In the digital query platform, secondary development is carried out on the interface implementation class based on the extended export interface;
[0102] Configure extended information and set an extension switch in the digital query platform;
[0103] Based on the extended information and the extended switch, the interface implementation class is dynamically loaded when exporting data to fulfill the user's export requirements.
[0104] This invention discloses an interface-based method for custom query export extension. The implementation steps are as follows: First, an export interface is opened in an existing query platform. Second, an interface implementation class is created based on the interface, defining customized export logic. Third, an extension switch is set and extension information is configured in the query platform. During export, the second-developed implementation class is dynamically loaded at runtime according to the extension switch and extension information to meet different export requirements. Compared with existing technologies, this interface-based method for custom query export extension can dynamically load customized export implementation classes at runtime, quickly responding to various user export needs and improving the scalability of the query platform. It can meet the personalized needs of all customers, enhance export scalability, satisfy various export requirements, reduce data coupling, and improve the adaptability of the digital query platform.
[0105] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0106] For ease of description, the above devices are described in terms of function, divided into various units. Of course, in implementing this specification, the functions of each unit can be implemented in one or more software and / or hardware.
[0107] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, the embodiments of this specification can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the embodiments of this specification can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0108] This specification is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this specification. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0109] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0110] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0111] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0112] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0113] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0114] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0115] This specification can be described in the general context of computer-executable instructions that are executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This specification can also be practiced in distributed computing environments, where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0116] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, devices, and non-volatile computer storage media are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0117] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0118] The above description is merely one or more embodiments of this specification and is not intended to limit this specification. Various modifications and variations can be made to the one or more embodiments of this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of one or more embodiments of this specification should be included within the scope of the claims of this specification.
Claims
1. A custom query export extension method, characterized in that, The method includes: Based on users' export requirements, create corresponding extended export interfaces in the digital query platform; In the digital query platform, secondary development based on the extended export interface implementation class specifically includes: performing secondary development in the digital query platform to create the interface implementation class of the extended export interface; customizing the corresponding personalized export logic according to the user's export requirements, and configuring the export data acquisition parameters in the personalized export logic; and compiling the personalized export logic to generate a DLL file. Configuring extended information and setting extended switches in the digital query platform specifically includes: adding a JSON-based extended configuration file to the digital query platform; configuring the DLL file containing the interface implementation class and class information as extended information in the extended configuration file; wherein, the class information includes at least the class name and namespace; and configuring extended switches in the extended configuration file based on the extended information. Based on the extended information and the extended switch, the interface implementation class is dynamically loaded during data export to fulfill the user's export requirements, specifically including: An extension branch is added to the digital query platform; the extension switch configured in the extension configuration file is used to determine whether to execute the extension branch; if the extension branch is executed, the assembly in the extension configuration file is dynamically loaded through the System.Reflection.CreateInstance reflection mechanism; when exporting data, an instance of the interface implementation class is created using the system activator to obtain the personalized export logic in the interface implementation class; Based on the personalized export logic, the program assembly is executed to fulfill the user's export requirements, specifically including: The extended configuration file is loaded by loading a JSON file, and each parameter in the extended configuration file is parsed; the extended information in the extended configuration file and the parsed parameters are loaded into the assembly; based on the data export address and data page number in the personalized export logic, the assembly is executed to export the required data.
2. The custom query export extension method according to claim 1, characterized in that, The step of creating corresponding extended export interfaces in the digital query platform based on the user's export requirements specifically includes: Based on the user's export requirements, determine the necessary interface parameters; Based on the interface parameters, create a corresponding extended export interface in the digital query platform and grant public permissions to the extended export interface. The extended export interface provides a standard structure for secondary development implementation classes.
3. The custom query export extension method according to claim 1, characterized in that, The personalized export logic configures the export data retrieval parameters, specifically including: Configure the data export address in the export data parameter serverPagingPubQueryClient of the extended export interface so as to obtain the export data required by the user through the export data parameter; Configure the start page and end page in the start page parameter startPageNo and end page parameter endPageNo of the extended export interface to obtain the number of data pages that the user needs to export.
4. The custom query export extension method according to claim 1, characterized in that, Based on the extension switch configured in the extension configuration file, determine whether to execute the extension branch, specifically including: Retrieve the switch configuration parameter exportExtendValue from the extended configuration file; If the value of the switch configuration parameter is true, then the extended branch is executed; wherein the instruction of the extended branch is: export multiple Excel files page by page; If the value of the switch configuration parameter is false, the default branch is executed.
5. A custom query export extension device, characterized in that, The device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor to enable the at least one processor to execute a custom query export extension method according to any one of claims 1-4.
6. A computer storage medium, characterized in that, The computer storage medium is a non-volatile computer-readable storage medium that stores at least one program, each program including instructions that, when executed by a terminal, cause the terminal to perform the custom query export extension method according to any one of claims 1-4.
Citation Information
Patent Citations
Dynamic and extensible grid switch estimation rule engine
CN103618379A
General database data operation model and construction method thereof
CN115544006A