Business query method, device and equipment and storage medium
By establishing a preset field mapping table and a grouping query strategy, the problem that hard-coded query methods cannot adapt to diverse business scenarios has been solved, and flexible and efficient business data query has been achieved.
Patent Information
- Application Number
- CN202311103493.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-29
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2043-08-29
AI Technical Summary
The existing hard-coded business query methods cannot adapt to the increasingly diverse business usage scenarios, resulting in a single query method that cannot meet the differentiated needs of different users.
By establishing a preset field mapping table, the target business query information is grouped based on the correspondence between business fields, database fields, and scenario information, the business query strategy is determined, and the target business data is queried using the query field grouping information and business serial number.
It enables flexible business queries in multiple scenarios, adapting to the differentiated needs of different users and improving query accuracy and efficiency.
Smart Images

Figure CN117149830B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a business query method, apparatus, device, and storage medium. Background Technology
[0002] With the development of network technology, users can typically perform business queries in application software or application platforms. For a single business query scenario, the query can usually be achieved through hard-coded query methods. However, as business usage scenarios become increasingly diverse and different users' query needs vary, the existing hard-coded query methods are far from meeting the needs of users.
[0003] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention
[0004] The main objective of this invention is to provide a business query method, apparatus, device, and storage medium, which aims to solve the technical problem that the existing hard-coded business query method is not applicable to increasingly diverse business usage scenarios.
[0005] To achieve the above objectives, the present invention provides a business query method, the business query method comprising:
[0006] Upon receiving a business query request, the target business query information corresponding to the target business is obtained according to the business query request;
[0007] The target business query information is grouped based on a preset field mapping table to obtain query field grouping information. The preset field mapping table stores the correspondence between business fields, database fields and scenario information.
[0008] Determine the business query strategy corresponding to the target business, and obtain the target business serial number corresponding to the target business based on the business query strategy;
[0009] Based on the grouping information of the query field and the target business serial number, query the target business data corresponding to the target business.
[0010] Optionally, before the step of obtaining the target business query information corresponding to the target business according to the business query request upon receiving the business query request, the method further includes:
[0011] Establish a preset field mapping table based on business fields, database fields, and scenario information;
[0012] Upon completion, the registration business query requires the table information objects;
[0013] Upon completion of registration, the target query interface is invoked to receive business query requests.
[0014] Optionally, the step of determining the business query strategy corresponding to the target business includes:
[0015] Based on the grouping information of the query fields, obtain the target query table corresponding to the target business query information;
[0016] Determine the number of query tables in the target query table, and compare the number of query tables with a preset query table number threshold;
[0017] The sorting and pagination method corresponding to the target business query information is determined based on the comparison results;
[0018] The business query strategy corresponding to the target business is determined based on the sorting and pagination method.
[0019] Optionally, the sorting and pagination method includes: a database sorting and pagination method; the step of determining the sorting and pagination method corresponding to the target business query information based on the comparison result includes:
[0020] Based on the comparison results, the sorting and pagination method corresponding to the target business query information is determined as the database sorting and pagination method;
[0021] The step of determining the business query strategy corresponding to the target business based on the sorting and pagination method includes:
[0022] Based on the database sorting and pagination method, the business query strategy corresponding to the target business is determined to be a join query.
[0023] Optionally, the sorting and pagination method includes: a memory-based sorting and pagination method; the step of determining the sorting and pagination method corresponding to the target business query information based on the comparison result includes:
[0024] Based on the comparison results, the sorting and pagination method corresponding to the target business query information is determined to be the memory sorting and pagination method;
[0025] The step of determining the business query strategy corresponding to the target business based on the sorting and pagination method includes:
[0026] Based on the memory sorting and pagination method, the business query strategy corresponding to the target business is determined to be a single-table query.
[0027] Optionally, the step of querying the target business data corresponding to the target business based on the query field grouping information and the target business serial number includes:
[0028] Based on the grouping information of the query fields and the target business serial number, the corresponding business data is sequentially retrieved from the target query table;
[0029] The business data is integrated by the table relationships in the table information object to obtain the target business data.
[0030] Optionally, the step of obtaining target business query information corresponding to the target business according to the business query request when a business query request is received includes:
[0031] Upon receiving a business query request, obtain the business query information corresponding to the target business based on the business query request;
[0032] The business query information is filtered according to preset filtering rules to obtain the filtered target business query information.
[0033] Furthermore, to achieve the above objectives, the present invention also proposes a business query device, the device comprising:
[0034] The information acquisition module is used to acquire target business query information corresponding to the target business based on the business query request when a business query request is received.
[0035] The information grouping module is used to group the target business query information based on a preset field mapping table to obtain query field grouping information. The preset field mapping table stores the correspondence between business fields, database fields and scenario information.
[0036] The strategy determination module is used to determine the business query strategy corresponding to the target business, and obtain the target business serial number corresponding to the target business based on the business query strategy;
[0037] The business query module is used to query the target business data corresponding to the target business based on the grouping information of the query field and the target business serial number.
[0038] In addition, to achieve the above objectives, the present invention also proposes a business query device, the device comprising: a memory, a processor, and a business query program stored in the memory and executable on the processor, the business query program being configured to implement the steps of the business query method described above.
[0039] In addition, to achieve the above objectives, the present invention also proposes a storage medium storing a business query program, which, when executed by a processor, implements the steps of the business query method described above.
[0040] This invention discloses a method for obtaining target business query information corresponding to a target business upon receiving a business query request; grouping the target business query information based on a preset field mapping table to obtain query field grouping information, wherein the preset field mapping table stores the correspondence between business fields, database fields, and scenario information; determining the business query strategy corresponding to the target business and obtaining the target business serial number corresponding to the target business based on the business query strategy; and querying the target business data corresponding to the target business based on the query field grouping information and the target business serial number. Compared to the hardware-encoded query method in the prior art, which typically only performs business queries for a single query scenario, this invention solves the technical problem that the hardware-encoded business query method in the prior art cannot be applied to increasingly diverse business usage scenarios because it groups the target business query information corresponding to the target business based on a preset field mapping table to obtain query field grouping information and queries the business data of the target business based on the field grouping information and the target business serial number corresponding to the target business. Attached Figure Description
[0041] Figure 1 This is a schematic diagram of the structure of the business query device in the hardware operating environment involved in the embodiments of the present invention;
[0042] Figure 2 This is a flowchart illustrating the first embodiment of the business query method of the present invention;
[0043] Figure 3 This is a flowchart illustrating the second embodiment of the business query method of the present invention;
[0044] Figure 4 This is a structural block diagram of the first embodiment of the business query device of the present invention.
[0045] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0046] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.
[0047] Reference Figure 1 , Figure 1 This is a schematic diagram of the business query device structure in the hardware operating environment involved in the embodiments of the present invention.
[0048] like Figure 1As shown, the service query device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen and an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wireless-Fidelity (Wi-Fi) interface). The memory 1005 may be high-speed random access memory (RAM) or stable non-volatile memory (NVM), such as a disk storage device. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0049] Those skilled in the art will understand that Figure 1 The structure shown does not constitute a limitation on the business query device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0050] like Figure 1 As shown, the memory 1005, which serves as a storage medium, may include an operating system, a network communication module, a user interface module, and a business query program.
[0051] exist Figure 1 In the business query device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the business query device of the present invention can be set in the business query device, and the business query device calls the business query program stored in the memory 1005 through the processor 1001 and executes the business query method provided in the embodiment of the present invention.
[0052] This invention provides a business query method, referring to... Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of the business query method of the present invention.
[0053] In this embodiment, the business query method includes the following steps:
[0054] Step S10: Upon receiving a business query request, obtain the target business query information corresponding to the target business based on the business query request.
[0055] It should be noted that the execution subject of the method in this embodiment can be a business query device that performs business queries in a single scenario or multiple scenarios, or other business query systems that can achieve the same or similar functions and include such a business query device. Here, the business query system (hereinafter referred to as the system) is used to specifically describe the business query methods provided in this embodiment and the following embodiments.
[0056] It should be understood that the above-mentioned business query request can be a request to instruct the system to perform a business query. In this embodiment, the business query request may carry query information, query conditions, sorting fields and pagination information of the business to be queried, etc., and this embodiment does not limit this.
[0057] It is understandable that the target business mentioned above is the business to be queried. The target business can correspond to a single business scenario or multiple business scenarios.
[0058] It should be understood that the target business query information mentioned above can be the query information of the business to be queried. In this embodiment, the user's age, employment information, etc. can be queried, and this embodiment does not limit this.
[0059] Furthermore, in order to improve the accuracy of business queries, step S10 includes: upon receiving a business query request, obtaining business query information corresponding to the target business according to the business query request; filtering the business query information according to a preset filtering rule to obtain the filtered target business query information.
[0060] It should be noted that the aforementioned preset filtering rules can be pre-defined requests to filter data in business query information. In practical applications, since different business scenarios have different requirements for query information, this embodiment can set different filtering rules according to different business scenarios. Specifically, if a field in a certain business scenario must be empty, then filtering rules for that business scenario can be set to make that field discarded.
[0061] In practical implementation, if a query for a target business is needed, a business query request can be sent to the system through the Application Programming Interface (API). The business query request can carry query information for the target business, query conditions, sorting fields, and pagination information. Upon receiving the business query request, the system can parse it to obtain the corresponding business query information. At this point, the system can examine the business query information and filter out data that does not meet the requirements of the business scenario using preset filtering rules, thus obtaining the filtered target business query information.
[0062] Step S20: Group the target business query information based on a preset field mapping table to obtain query field grouping information. The preset field mapping table stores the correspondence between business fields, database fields, and scenario information.
[0063] It should be understood that the aforementioned preset field mapping table can be a table storing the correspondence between business fields, database fields, scenario information, query types, and other necessary information about the fields. Specifically, business fields can be fields defined according to business requirements; database fields can be fields defined in the database; and scenario information can be the query scenario corresponding to the target business, such as user, educational background, etc. In practical applications, if the business field corresponding to the user name is "username," its corresponding database field can be a predefined field name in the database; this embodiment does not restrict its specific name.
[0064] It is understood that this embodiment can complete the configuration of a query scenario through script configuration and coding, thereby achieving support for multi-scenario queries.
[0065] It should be understood that business query scenarios may involve different tables. For example, user scenarios may involve basic user information, employment information, and other additional information (such as social security and salary cards). This information is usually stored in different tables. In this case, after grouping the target business query information based on the preset field mapping table, the target business query information can be mapped to different tables. Thus, the query field grouping information can be obtained based on the mapping relationship between this information and the corresponding tables. That is, the above query field grouping information can be the information that stores the correspondence between different information in the business query information and its mapped tables.
[0066] Furthermore, in order to support multi-scenario queries for business, before step S10, the method further includes: establishing a preset field mapping table based on business fields, database fields, and scenario information; registering the table information object required for business queries upon completion of establishment; and calling the target query interface upon completion of registration to receive business query requests through the target query interface.
[0067] It should be noted that the business query methods in this solution can be developed based on the Spring open-source framework. At the same time, the business needs to implement the necessary SQL wrappers and register them in the bean container for the framework to use. The SQL wrappers are mainly used for translating special fields and extending some scenarios to meet the personalized queries of the business.
[0068] It should be understood that the above-mentioned table information object can be the table information required for business queries, such as: table name, table applicable scenarios, key field information, table relationships and other framework-required information. This embodiment does not limit this.
[0069] It is understandable that the aforementioned target query interface can be an interface used to receive business query information.
[0070] In the specific implementation, a preset field mapping table can be established first, and commonly used business fields can be initialized. This field mapping table stores the correspondence between business fields, database fields, scenario information, query types, and other necessary field information. After establishing the preset field mapping table, the table object information required for business queries can be registered, including: table name, applicable scenarios, key field information, table relationships, and other information required by the framework. Upon registration, the query interface can be called, passing in query information, query conditions, sorting fields, and pagination information to perform the business query. Subsequently, when performing a business query, the target business query information can be grouped based on the preset field mapping table, mapping the target business query information to several corresponding tables, thereby obtaining query field grouping information that stores the mapping relationship between each business query information and its mapped tables.
[0071] Step S30: Determine the business query strategy corresponding to the target business, and obtain the target business serial number corresponding to the target business based on the business query strategy.
[0072] It should be noted that the above-mentioned business query strategy can be a method of performing business queries. In this embodiment, the business query strategy can include single-table queries and join queries. Furthermore, in this embodiment, the business query strategy corresponding to the target business can be determined by the number of tables corresponding to the business query information.
[0073] It should be understood that the aforementioned target business serial number can be an identifier used to characterize the target business, where each business has its own unique corresponding business serial number.
[0074] Step S40: Query the target business data corresponding to the target business based on the grouping information of the query field and the target business serial number.
[0075] It is understandable that the aforementioned target business data can be data that meets the query conditions corresponding to the target business. In practical applications, the tables mapping each business query information can be determined based on the grouping information of the query fields, and the data that meets the conditions can be retrieved sequentially from the tables mapping each business query information according to the target business serial number.
[0076] Further, step S40 may include: querying the corresponding business data from the target query table sequentially according to the query field grouping information and the target business serial number; and integrating the business data through the table association relationship in the table information object to obtain the target business data.
[0077] It should be understood that the aforementioned table relationships can be relationships between tables mapping various business query information. This can include relationships between one table and another, or between one table and multiple tables, such as the relationship between the table corresponding to a user's name and the table corresponding to employment information. This embodiment does not impose any limitations on this. In this embodiment, table relationships can be established using master data fields by default. If business-defined relationships exist, these relationships can also be used simultaneously.
[0078] In the specific implementation, the business query strategy for the target business can be determined first based on the number of tables mapped to the business query information. Then, the target business serial number corresponding to the target business can be obtained according to the business query strategy. Then, the data that meets the conditions can be retrieved sequentially from the tables mapped to each business query information according to the target business serial number based on the grouping information of the query field. Finally, the data can be integrated into a complete data record through the table relationship, thereby realizing the business query.
[0079] This embodiment discloses a method for obtaining target business query information corresponding to a target business upon receiving a business query request; grouping the target business query information based on a preset field mapping table to obtain query field grouping information, wherein the preset field mapping table stores the correspondence between business fields, database fields, and scenario information; determining the business query strategy corresponding to the target business and obtaining the target business serial number corresponding to the target business based on the business query strategy; and querying the target business data corresponding to the target business based on the query field grouping information and the target business serial number. Compared to the hardware-encoded query method in the prior art, which typically only performs business queries for a single query scenario, this embodiment solves the technical problem that the hardware-encoded business query method in the prior art cannot be applied to increasingly rich business usage scenarios because it groups the target business query information corresponding to the target business based on the preset field mapping table to obtain query field grouping information and queries the business data of the target business based on the field grouping information and the target business serial number corresponding to the target business.
[0080] refer to Figure 3 , Figure 3 This is a flowchart illustrating the second embodiment of the business query method of the present invention.
[0081] Based on the first embodiment described above, in this embodiment, step S30 includes:
[0082] Step S301: Obtain the target query table corresponding to the target business query information based on the grouping information of the query field.
[0083] It should be noted that the target query table mentioned above can be a table used to query target business query information. In practical applications, if the target business query information contains multiple fields, such as: user name, salary card, and employment information, and if the user name, salary card, and employment information are in three separate tables, then these three tables are the target query tables corresponding to the target business query information.
[0084] Step S302: Determine the number of query tables in the target query table and compare the number of query tables with a preset query table number threshold.
[0085] It should be understood that the number of query tables is the same as the number of target query tables. In practical applications, if the target business query information contains three fields: user name, salary card, and employment information, and these three fields are located in different tables, then the number of target query tables can be 3.
[0086] It is understood that the above-mentioned preset query table number threshold can be the maximum number of query tables that can be sorted and paginated in the database. In this embodiment, the preset query table number threshold can be set to 3, or it can be set according to actual needs.
[0087] Step S303: Determine the sorting and pagination method corresponding to the target business query information based on the comparison results.
[0088] It should be noted that the above sorting and pagination methods can be any method of sorting and paginating the queried data, such as database sorting and pagination, memory sorting and pagination, etc. This embodiment does not limit this. In practical applications, in some scenarios, sorting may be mapped to three or four tables, or some tables cannot be sorted in the database. Therefore, this embodiment can compare the number of query tables in the target query table with a preset query table number threshold. If the number of query tables exceeds the preset query table number threshold, database sorting and pagination will not be performed; instead, memory sorting and pagination will be performed.
[0089] Step S304: Determine the business query strategy corresponding to the target business according to the sorting and pagination method.
[0090] It should be understood that, in this embodiment, the corresponding business query strategy for the database sorting and pagination method is a join query; for the memory sorting and pagination method, the corresponding business query strategy can be a single table query. Therefore, in this embodiment, the business query strategy corresponding to the target business can be determined after the sorting and pagination method is determined.
[0091] Further, the sorting and pagination method includes: database sorting and pagination method; step S303 includes: determining the sorting and pagination method corresponding to the target business query information as the database sorting and pagination method based on the comparison result; step S304 includes: determining the business query strategy corresponding to the target business as a join query based on the database sorting and pagination method.
[0092] It is understandable that the above database sorting and pagination methods can be used to paginate and sort data in a database.
[0093] It should be noted that join queries can be a way to query data based on the connection relationship between two or more tables.
[0094] Further, the sorting and pagination method includes: in-memory sorting and pagination method; step S303 includes: determining the sorting and pagination method corresponding to the target business query information as the in-memory sorting and pagination method based on the comparison result; step S304 includes: determining the business query strategy corresponding to the target business as a single-table query based on the in-memory sorting and pagination method.
[0095] It should be understood that the above memory sorting and paging method can be a way to perform data paging and sorting in memory.
[0096] Understandably, a single-table query can be a way to filter queries on tables mapped to the target business query information based on query conditions grouped according to the target business query information, similar to multiple nested subqueries in SQL (Structured Query Language, database language).
[0097] It should be noted that, in this embodiment, after retrieving the business data of the target business, the retrieved data can be sorted according to the sorting information. For database pagination queries, pagination is not required; for in-memory pagination queries, sorting and pagination according to the pagination information are necessary. After processing the data, the retrieved dataset that meets the conditions can be returned. The system can return the required data according to the query interface, and the data format is a Map collection. Furthermore, the business can convert the data to the required format according to the scenario requirements.
[0098] In the specific implementation, the target query table corresponding to the target business query information can first be obtained based on the grouping information of the query fields, and the query table data of the target query table can be determined. Then, the number of query tables is compared with the preset query table number threshold to determine whether the sorting and pagination method corresponding to the target business query information is database sorting and pagination or memory sorting and pagination. If it is database sorting and pagination, the business query strategy corresponding to the target business is a join query; if it is database sorting and pagination, the business query strategy corresponding to the target business is a single table query. Thus, the business data corresponding to the business can be queried through the corresponding business query strategy to realize business queries in general scenarios.
[0099] This embodiment discloses a method for obtaining the target query table corresponding to the target business query information based on the grouping information of the query fields; determining the number of query tables in the target query table and comparing the number of query tables with a preset query table number threshold; determining the sorting and pagination method corresponding to the target business query information based on the comparison result; and determining the business query strategy corresponding to the target business based on the sorting and pagination method. Because this embodiment determines the sorting and pagination method corresponding to the target business query information based on the comparison result of the number of query tables in the target query table and the preset query table number threshold, and determines the corresponding business query strategy based on the sorting and pagination method, data can be queried according to the business query strategy.
[0100] Furthermore, this embodiment of the invention also proposes a storage medium storing a business query program, which, when executed by a processor, implements the steps of the business query method described above.
[0101] Reference Figure 4 , Figure 4 This is a structural block diagram of the first embodiment of the business query device of the present invention.
[0102] like Figure 4 As shown, the business query device proposed in this embodiment of the invention includes:
[0103] Information acquisition module 401 is used to acquire target business query information corresponding to the target business according to the business query request when a business query request is received;
[0104] The information grouping module 402 is used to group the target business query information based on a preset field mapping table to obtain query field grouping information. The preset field mapping table stores the correspondence between business fields, database fields and scenario information.
[0105] The strategy determination module 403 is used to determine the business query strategy corresponding to the target business, and obtain the target business serial number corresponding to the target business based on the business query strategy.
[0106] The business query module 404 is used to query the target business data corresponding to the target business based on the grouping information of the query field and the target business serial number.
[0107] Furthermore, the information acquisition module 401 is also used to establish a preset field mapping table based on business fields, database fields, and scenario information; when the establishment is completed, register the table information object required for business query; when the registration is completed, call the target query interface to receive business query requests through the target query interface.
[0108] Furthermore, the information acquisition module 401 is also used to, upon receiving a business query request, acquire business query information corresponding to the target business according to the business query request; and filter the business query information according to a preset filtering rule to obtain the filtered target business query information.
[0109] Furthermore, the strategy determination module 403 is also used to query the corresponding business data from the target query table sequentially according to the query field grouping information and the target business serial number; and to integrate the business data through the table association relationship in the table information object to obtain the target business data.
[0110] This embodiment of the business query device discloses that, upon receiving a business query request, it obtains target business query information corresponding to the target business based on the business query request; groups the target business query information based on a preset field mapping table to obtain query field grouping information, wherein the preset field mapping table stores the correspondence between business fields, database fields, and scenario information; determines the business query strategy corresponding to the target business, and obtains the target business serial number corresponding to the target business based on the business query strategy; and queries the target business data corresponding to the target business based on the query field grouping information and the target business serial number. Compared with the hardware-encoded query method in the prior art, which usually only performs business queries for a single query scenario, this embodiment solves the technical problem that the hardware-encoded business query method in the prior art cannot be applied to increasingly rich business usage scenarios because it groups the target business query information corresponding to the target business based on the preset field mapping table to obtain query field grouping information, and queries the business data of the target business based on the field grouping information and the target business serial number corresponding to the target business.
[0111] Based on the first embodiment of the business query device of the present invention described above, a second embodiment of the business query device of the present invention is proposed.
[0112] In this embodiment, the strategy determination module 403 is further configured to obtain the target query table corresponding to the target business query information based on the query field grouping information; determine the number of query tables in the target query table and compare the number of query tables with a preset query table number threshold; determine the sorting and pagination method corresponding to the target business query information based on the comparison result; and determine the business query strategy corresponding to the target business based on the sorting and pagination method.
[0113] Furthermore, the sorting and pagination method includes: a database sorting and pagination method; the strategy determination module 403 is also used to determine the sorting and pagination method corresponding to the target business query information as the database sorting and pagination method based on the comparison result; and to determine the business query strategy corresponding to the target business as a join query based on the database sorting and pagination method.
[0114] Furthermore, the sorting and pagination method includes: in-memory sorting and pagination method; the strategy determination module 403 is also used to determine the sorting and pagination method corresponding to the target business query information as the in-memory sorting and pagination method based on the comparison result; and to determine the business query strategy corresponding to the target business as a single-table query based on the in-memory sorting and pagination method.
[0115] This embodiment discloses a method for obtaining the target query table corresponding to the target business query information based on the grouping information of the query fields; determining the number of query tables in the target query table and comparing the number of query tables with a preset query table number threshold; determining the sorting and pagination method corresponding to the target business query information based on the comparison result; and determining the business query strategy corresponding to the target business based on the sorting and pagination method. Because this embodiment determines the sorting and pagination method corresponding to the target business query information based on the comparison result of the number of query tables in the target query table and the preset query table number threshold, and determines the corresponding business query strategy based on the sorting and pagination method, data can be queried according to the business query strategy.
[0116] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system 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 system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0117] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0118] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory / random access memory, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0119] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A business query method, characterized in that, The business query methods include: Upon receiving a business query request, the target business query information corresponding to the target business is obtained according to the business query request; The target business query information is grouped based on a preset field mapping table to obtain query field grouping information. The preset field mapping table stores the correspondence between business fields, database fields and scenario information. Determine the business query strategy corresponding to the target business, and obtain the target business serial number corresponding to the target business based on the business query strategy; Based on the grouping information of the query field and the target business serial number, query the target business data corresponding to the target business; Before the step of obtaining the target business query information corresponding to the target business based on the business query request when a business query request is received, the method further includes: Establish a preset field mapping table based on business fields, database fields, and scenario information; Upon completion, the registration business query requires the table information objects; Upon completion of registration, the target query interface is invoked to receive business query requests. The step of determining the business query strategy corresponding to the target business includes: Based on the grouping information of the query fields, obtain the target query table corresponding to the target business query information; Determine the number of query tables in the target query table, and compare the number of query tables with a preset query table number threshold; The sorting and pagination method corresponding to the target business query information is determined based on the comparison results; The business query strategy corresponding to the target business is determined based on the sorting and pagination method.
2. The business query method as described in claim 1, characterized in that, The sorting and pagination method includes: database sorting and pagination method; the step of determining the sorting and pagination method corresponding to the target business query information based on the comparison result includes: Based on the comparison results, the sorting and pagination method corresponding to the target business query information is determined as the database sorting and pagination method; The step of determining the business query strategy corresponding to the target business based on the sorting and pagination method includes: Based on the database sorting and pagination method, the business query strategy corresponding to the target business is determined to be a join query.
3. The business query method as described in claim 1, characterized in that, The sorting and pagination method includes: memory sorting and pagination method; the step of determining the sorting and pagination method corresponding to the target business query information based on the comparison result includes: Based on the comparison results, the sorting and pagination method corresponding to the target business query information is determined to be the memory sorting and pagination method; The step of determining the business query strategy corresponding to the target business based on the sorting and pagination method includes: Based on the memory sorting and pagination method, the business query strategy corresponding to the target business is determined to be a single-table query.
4. The business query method as described in claim 1, characterized in that, The step of querying the target business data corresponding to the target business based on the grouping information of the query field and the target business serial number includes: Based on the grouping information of the query fields and the target business serial number, the corresponding business data is sequentially retrieved from the target query table; The business data is integrated by the table relationships in the table information object to obtain the target business data.
5. The business query method as described in claim 1, characterized in that, The step of obtaining target business query information corresponding to the target business based on the business query request when a business query request is received includes: Upon receiving a business query request, obtain the business query information corresponding to the target business based on the business query request; The business query information is filtered according to preset filtering rules to obtain the filtered target business query information.
6. A business query device, characterized in that, The device includes: The information acquisition module is used to acquire target business query information corresponding to the target business based on the business query request when a business query request is received. The information grouping module is used to group the target business query information based on a preset field mapping table to obtain query field grouping information. The preset field mapping table stores the correspondence between business fields, database fields and scenario information. The strategy determination module is used to determine the business query strategy corresponding to the target business, and obtain the target business serial number corresponding to the target business based on the business query strategy; The business query module is used to query the target business data corresponding to the target business based on the grouping information of the query field and the target business serial number; The information acquisition module is also used to establish a preset field mapping table based on business fields, database fields, and scenario information; when the establishment is completed, register the table information object required for business query; when the registration is completed, call the target query interface to receive business query requests through the target query interface; The strategy determination module is further configured to obtain the target query table corresponding to the target business query information based on the query field grouping information; determine the number of query tables in the target query table and compare the number of query tables with a preset query table number threshold; determine the sorting and pagination method corresponding to the target business query information based on the comparison result; and determine the business query strategy corresponding to the target business based on the sorting and pagination method.
7. A business query device, characterized in that, The device includes: a memory, a processor, and a business query program stored in the memory and executable on the processor, the business query program being configured to implement the steps of the business query method as described in any one of claims 1 to 5.
8. A storage medium, characterized in that, The storage medium stores a business query program, which, when executed by a processor, implements the steps of the business query method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Data query method and device, electronic equipment and readable storage medium
CN111639078A
Method, system and device for converting natural language query into SQL and storage medium
CN114547072A