Business processing method and device based on same database and multiple environment data tables
By identifying the business environment and loading a collection of multi-environment data tables in financial software development, using preset plug-ins to modify it when database instructions are detected, the problems of high database costs and high code invasiveness in the existing technology are solved, and the correct data tables are dynamically used in the same database are reduced, reducing cost and invasiveness.
Patent Information
- Application Number
- CN202411518874.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-03-11
AI Technical Summary
In the development of financial software, in order to support multi-branch software testing, multiple environments need to be added, resulting in high database costs and high code invasiveness.
By identifying the current business environment when the application is started, and loading the multi-environment data table collection and suffix name, when a database instruction is detected, the preset plug-in is used to obtain the data table collection, and modify the database instruction according to the multi-environment data table suffix name, to achieve dynamic use of the correct data table.
It reduces database costs and code intrusion, avoids the need for new databases and code modifications, and realizes the dynamic use of correct data tables in the same database according to different environments.
Smart Images

Figure CN119597754A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the fields of software development and financial technology, and in particular to a business processing method and device based on the same database and multi-environment data tables. Background Art
[0002] With the application of computer technology in the financial field, more and more application software is being developed for the promotion and trading of financial products. Due to business growth, in the process of application software development, in order to improve development efficiency and speed up the software launch, multiple branches need to conduct software testing at the same time. Each branch needs a different test environment, so multiple sets of environments need to be added to support it. The existing solution is to add a new database, and different branches use different databases, or to share a database and add different environment tables. However, the solution of adding a new database so that different branches use different databases takes a long time to prepare data, which increases the database cost; the solution of adding different environment tables to the shared database requires corresponding code modifications. Different branches correspond to different environment tables, and the code is highly dependent and invasive. Therefore, how to reduce database costs and reduce code invasiveness has become an urgent problem to be solved. Summary of the invention
[0003] The present application provides a business processing method and device based on the same database and multi-environment data tables to reduce database costs and reduce code intrusiveness.
[0004] In a first aspect, the present application provides a business processing method based on the same database and multiple environment data tables, the method comprising:
[0005] When the application is started, the current business environment is identified, and a multi-environment data table set and a multi-environment data table suffix corresponding to the current business environment are loaded;
[0006] When a database instruction of the application is detected, based on a preset plug-in, a data table set included in the database instruction is obtained;
[0007] When a data table in the data table set exists in the multi-environment data table set, a target data table set is obtained based on the multi-environment data table suffix, and the database instruction is modified based on the target data table set to obtain a target instruction;
[0008] Execute the target instruction to obtain an execution result, and perform business processing based on the execution result to obtain a business processing result.
[0009] In a second aspect, the present application further provides a business processing device based on the same database and multiple environment data tables, the device comprising:
[0010] The data table information loading module is used to identify the current business environment when the application is started, and load the multi-environment data table set and the multi-environment data table suffix name corresponding to the current business environment;
[0011] A data table set acquisition module, configured to acquire a data table set contained in a database instruction based on a preset plug-in when a database instruction of the application is detected;
[0012] A database instruction modification module, used for obtaining a target data table set based on the multi-environment data table suffix when a data table in the data table set exists in the multi-environment data table set, and modifying the database instruction based on the target data table set to obtain a target instruction;
[0013] The target instruction execution module is used to execute the target instruction, obtain an execution result, and perform business processing based on the execution result to obtain a business processing result.
[0014] In a third aspect, the present application also provides a computer device, comprising a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program and implement the business processing method based on the same database and multi-environment data tables as described above when executing the computer program.
[0015] In a fourth aspect, the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor implements the business processing method based on the same database and multiple environment data tables as described above.
[0016] The present application discloses a business processing method and device based on the same database and multi-environment data tables. When an application is started, the current business environment is identified, and a multi-environment data table set and a multi-environment data table suffix corresponding to the current business environment are loaded; when a database instruction of the application is detected, a data table set contained in the database instruction is obtained based on a preset plug-in; when a data table in the data table set exists in the multi-environment data table set, a target data table set is obtained based on the multi-environment data table suffix, and the database instruction is modified based on the target data table set to obtain a target instruction; the target instruction is executed to obtain an execution result, and business processing is performed based on the execution result to obtain a business processing result. The present application obtains a data table set in a database instruction through a preset plug-in, and when a data table in the data table set exists in a multi-environment data table set, the database instruction is modified based on the multi-environment data table suffix. The database instruction can be modified according to different environments, and the correct data table can be dynamically used according to different environments in the same database without adding a new database and modifying the code, thereby reducing database costs and code intrusiveness. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 It is a schematic flow chart of a first embodiment of a business processing method based on the same database and multiple environment data tables provided by an embodiment of the present application;
[0019] Figure 2 is a schematic flow chart of a second embodiment of a business processing method based on the same database and multiple environment data tables provided by an embodiment of the present application;
[0020] Figure 3 is a schematic flow chart of a third embodiment of a business processing method based on the same database and multiple environment data tables provided by an embodiment of the present application;
[0021] Figure 4 A schematic block diagram of a business processing device based on the same database and multiple environment data tables provided in an embodiment of the present application;
[0022] Figure 5 A schematic block diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0024] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0025] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0026] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0027] The embodiment of the present application provides a business processing method and device based on the same database and multi-environment data tables. Among them, the business processing method based on the same database and multi-environment data tables can be applied to the server, and the data table set in the database instruction is obtained through the preset plug-in, and when the data table in the data table set exists in the multi-environment data table set, the database instruction is modified based on the multi-environment data table suffix name, and the database instruction can be modified according to different environments, so that the correct data table can be used dynamically according to different environments in the same database without adding a new database and modifying the code, thereby reducing the database cost and code intrusiveness. Among them, the server can be an independent server or a server cluster.
[0028] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0029] See also Figure 1 , Figure 1This is a schematic flow chart of a business processing method based on the same database and multi-environment data tables provided by an embodiment of the present application. The business processing method based on the same database and multi-environment data tables can be applied to a server, and is used to obtain a data table set in a database instruction through a preset plug-in, and when a data table in the data table set exists in a multi-environment data table set, the database instruction is modified based on the multi-environment data table suffix name, and the database instruction can be modified according to different environments, realizing the dynamic use of the correct data table according to different environments in the same database without adding a new database and modifying the code, thereby reducing the database cost and code intrusiveness.
[0030] like Figure 1 As shown, the business processing method based on the same database and multiple environment data tables specifically includes steps S101 to S104.
[0031] S101. When the application is started, identify the current business environment, and load a multi-environment data table set and a multi-environment data table suffix corresponding to the current business environment;
[0032] In one embodiment, when the application or management service is started, it is connected to the unified configuration platform, and preset configuration information is read from the configuration platform, including a multi-environment data table set and a multi-environment data table suffix.
[0033] In a specific embodiment, when the application is started, the current business environment is identified. Specifically, it can be implemented through environment variables, configuration files or startup parameters. For example, by reading the value of the environment variable, it is determined whether the current business environment is a development business environment, a test business environment or a production business environment.
[0034] In one embodiment, according to the identified business environment, the corresponding multi-environment data table set and multi-environment data table suffix are obtained and loaded from the unified configuration platform. The multi-environment data table set defines which tables need to be distinguished according to the environment, and the multi-environment data table suffix defines the suffix corresponding to the multi-environment data table.
[0035] Furthermore, when the application is started, before identifying the current business environment and loading the multi-environment data table set and the multi-environment data table suffix name corresponding to the current business environment, it also includes: generating the multi-environment data table set and the multi-environment data table suffix name based on a unified configuration platform and preset configuration information.
[0036] In this embodiment, the unified configuration platform can store and manage configuration information of different environments. The unified configuration platform provides a user interface, allowing administrators or developers to add, modify and delete configuration information.
[0037] In one embodiment, a multi-environment data table set is generated through a unified configuration platform. Specifically, based on the configuration information input by the user, it is determined which data tables need to be differentiated according to different environments, and a multi-environment data table set is created in the configuration platform, listing all the data table names that need to be differentiated according to the environments.
[0038] In one embodiment, unique suffixes are defined for different environments. For example, the development environment may use "dev", the test environment uses "test", and the production environment uses "prod". Each environment is associated with a corresponding suffix by creating a mapping in the unified configuration platform.
[0039] S102: when a database instruction of the application is detected, obtaining a data table set included in the database instruction based on a preset plug-in;
[0040] Furthermore, when a database instruction of the application is detected, based on a preset plug-in, a data table set contained in the database instruction is obtained, including: when a database instruction of the application is detected, based on a preset plug-in, the database instruction is intercepted, and the database instruction is parsed to obtain at least one data table contained in the database instruction, and the data table set is generated.
[0041] In one embodiment, all database instructions issued by the application are intercepted using a preset plug-in, wherein the preset plug-in may be a SQL (Structured Query Language) plug-in, or may be other plug-ins set by the user according to actual needs.
[0042] In one embodiment, the plug-in parses the intercepted database instruction, extracts all data table names involved therein, and forms a data table set.
[0043] In a specific embodiment, when a database request is detected, the plug-in captures database instructions, such as SQL statements, and uses a built-in or third-party parser (such as an SQL parser) to parse the captured database instructions. The parser can understand the structure of database instructions, including but not limited to operations such as SELECT, INSERT, UPDATE, and DELETE.
[0044] In one embodiment, the parser extracts the names of the data tables involved from the database instructions, including the main table, sub-table, and junction table.
[0045] In one embodiment, a data structure (such as a list, a set, or a hash table) is created to store the parsed data table names. The data table names are deduplicated and formatted to ensure that the data table names in the set are unique and formatted correctly, such as removing any unnecessary spaces or aliases.
[0046] S103: when a data table in the data table set exists in the multi-environment data table set, obtaining a target data table set based on the multi-environment data table suffix, and modifying the database instruction based on the target data table set to obtain a target instruction;
[0047] In one embodiment, it is checked whether each data table in the data table set exists in the multi-environment data table set. If so, according to the configured multi-environment data table suffix, the data table names are modified to the original data table name plus the multi-environment data table suffix, as a specific environment data table. If the data table in the data table set is not in the multi-environment data table, the original data table name is kept unchanged and used as a common environment data table.
[0048] In one embodiment, based on the target data table set, the original SQL statement is modified to generate a target instruction.
[0049] Furthermore, before step S103, it also includes: traversing the data table set, comparing each data table in the data table set with the multi-environment data table one by one, and obtaining a comparison result; based on the comparison result, determining whether the data table in the first data table exists in the multi-environment data table.
[0050] In one embodiment, the data table set operated by the application is traversed, and each data table is processed one by one. The data table name obtained by the traversal is compared with the table name in the multi-environment data table set. Checking whether the current data table name exists in the multi-environment data table set can be implemented by a search algorithm, such as hash table search, binary search or linear search.
[0051] In one embodiment, for each data table, it is recorded whether its table name exists in the multi-environment data table set. Specifically, a judgment is made based on the comparison result. Specifically, if the table name of the data table exists in the multi-environment data table set, it is determined that the data table exists in the multi-environment data table set; if the table name of the data table does not exist in the multi-environment data table set, it is determined that the data table does not exist in the multi-environment data table set.
[0052] Furthermore, when the data table in the data table set exists in the multi-environment data table set, a target data table set is obtained based on the multi-environment data table suffix name, and the database instruction is modified based on the target data table set. After obtaining the target instruction, it also includes: obtaining the historical instruction record of the current business environment, and obtaining the number of occurrences of the database instruction based on the historical instruction record; when the number of occurrences is greater than or equal to a preset number threshold, the database instruction and the target instruction are stored correspondingly in a preset instruction library corresponding to the current business environment.
[0053] In this embodiment, the original database instructions and the target instructions in the preset instruction library are associated so that the target instructions can be directly obtained.
[0054] In one embodiment, after the database instruction is intercepted and processed to obtain the target instruction, the historical instruction record of the current business environment is queried to obtain the past execution status of the instruction.
[0055] In a specific embodiment, for each database instruction, the number of occurrences in the historical records is counted, and the number of occurrences is compared with a preset number threshold, and if the number of occurrences of the instruction is greater than or equal to the preset number threshold, the database instruction and its corresponding target instruction are stored in a preset instruction library corresponding to the current business environment.
[0056] In one embodiment, the instructions in the preset instruction library are evaluated periodically, and instructions whose occurrence times in a cycle are less than a preset threshold are removed.
[0057] In the above embodiment, commonly used database instructions can be automatically identified and optimized, thus avoiding repeated parsing and modification processes and improving the processing efficiency of database instructions.
[0058] S104: Execute the target instruction to obtain an execution result, and perform business processing based on the execution result to obtain a business processing result.
[0059] In one embodiment, the modified target instruction is sent to the database for execution, and the execution result is returned.
[0060] In one embodiment, after receiving the result returned by the database, the application further processes the result according to the business logic, which may include data screening, aggregation, conversion or integration with other data sources, etc., to obtain the final business processing result.
[0061] The above embodiment provides a business processing method and device based on the same database and multi-environment data tables. When the application is started, the current business environment is identified, and the multi-environment data table set and the multi-environment data table suffix corresponding to the current business environment are loaded; when the database instruction of the application is detected, the data table set contained in the database instruction is obtained based on the preset plug-in; when the data table in the data table set exists in the multi-environment data table set, the target data table set is obtained based on the multi-environment data table suffix, and the database instruction is modified based on the target data table set to obtain the target instruction; the target instruction is executed to obtain the execution result, and based on the execution result, business processing is performed to obtain the business processing result. The present application obtains the data table set in the database instruction through a preset plug-in, and when the data table in the data table set exists in the multi-environment data table set, the database instruction is modified based on the multi-environment data table suffix. The database instruction can be modified according to different environments, and the correct data table can be dynamically used according to different environments in the same database without adding a new database and modifying the code, thereby reducing the database cost and code intrusiveness.
[0062] See also Figure 2 , Figure 2 This is a schematic flow chart of a business processing method based on the same database and multiple environment data tables provided by an embodiment of the present application. The business processing method based on the same database and multiple environment data tables can be applied to the server to intelligently handle the needs of multiple environment data tables, ensuring the isolation of specific environment data while retaining the consistency of shared data tables. This allows you to dynamically use the correct data table according to different environments in the same database without adding a new database or modifying the code, reducing database costs and code intrusion.
[0063] like Figure 2 As shown, the step S103 of the business processing method based on the same database and multiple environment data tables specifically includes steps S201 to S203.
[0064] S201, when traversing to a data table existing in the multi-environment data table set, adding the multi-environment data table suffix to the data table as a specific environment data table;
[0065] S202, using the data table that only exists in the data table set as a common environment data table;
[0066] S203: When the traversal of the data table set is completed, the target data table set is obtained based on the specific environment data table and the public environment data table.
[0067] In one embodiment, for each data table in the data table set, it is checked whether it exists in the multi-environment data table set.
[0068] In one embodiment, if a data table exists in a multi-environment data table set, it indicates that the data table needs to be differentiated according to different business environments. At this time, a predefined multi-environment data table suffix is added to the data table name and used as a specific environment data table. For example, if the original data table name is users and the multi-environment data table suffix is _dev, the data table name for the specific environment will become users_dev.
[0069] In one embodiment, if a data table name is not in the multi-environment data table set, that is, the data table does not need to be differentiated according to different business environments, it is used as a common environment data table.
[0070] In one embodiment, for the common environment data table, its original data table name is kept unchanged.
[0071] In one embodiment, the common environment data table name is directly added to the target data table collection so as to be directly used when executing the database instruction.
[0072] In one implementation, when all data tables in the data table set are checked and processed, the traversal process ends. All specific environment data tables and common environment data tables are combined to form a target data table set.
[0073] In the above embodiment, the preset plug-in can intelligently handle the needs of multi-environment data tables, ensuring the isolation of specific environment data while retaining the consistency of shared data tables. This allows you to dynamically use the correct data tables according to different environments in the same database without adding a new database or modifying the code, reducing database costs and code intrusion.
[0074] See also Figure 3 , Figure 3 This is a schematic flow chart of a business processing method based on the same database and multiple environment data tables provided by an embodiment of the present application. The business processing method based on the same database and multiple environment data tables can be applied to a server, and is used to store database instructions whose usage times exceed a threshold and their corresponding target instructions through a preset instruction library. When a preset plug-in intercepts a database instruction, it searches for it in the preset instruction library. If the database instruction exists in the preset instruction library, its corresponding target instruction can be directly obtained without parsing and modifying operations, thereby improving processing efficiency.
[0075] like Figure 3As shown, after step S101, the business processing method based on the same database and multiple environment data tables further includes steps S301 to S303.
[0076] S301: When a database instruction of the application is detected, the database instruction is intercepted based on the preset plug-in, and the database instruction is matched in a preset instruction library corresponding to the current business environment;
[0077] S302, when an instruction identical to the database instruction is matched, obtaining a target instruction corresponding to the instruction;
[0078] S303: Update the database instruction to the target instruction, execute the target instruction, obtain an execution result, and perform business processing based on the execution result to obtain a business processing result.
[0079] In this embodiment, the preset instruction library stores database instructions and target instructions obtained by optimizing each database instruction.
[0080] In one embodiment, when a database instruction is detected, the preset plug-in automatically intercepts the database instruction and matches the intercepted database instruction with the preset instruction library corresponding to the current business environment. Since different business environments may correspond to different environment data tables and environment data table suffixes, the target instructions corresponding to the same database instruction in different business environments may be different, so different business environments correspond to different preset instruction libraries.
[0081] In a specific embodiment, the structure, parameters, operation type, etc. of the database instruction are compared with the instructions in the preset instruction library. If there is an instruction in the preset instruction library that is exactly the same as the intercepted instruction, or there is a general instruction that can cover the intercepted instruction, it is considered that the match is successful.
[0082] In one embodiment, if the match is successful, a target instruction corresponding to the database instruction is obtained from a common instruction database.
[0083] In one embodiment, the original database instruction is updated to the matched target instruction, the updated target instruction is executed, and the result is returned to the application program. Based on the execution result, corresponding business processing is performed to obtain the final business processing result.
[0084] In one embodiment, if no preset instruction is matched, the database instruction is parsed according to the above embodiment to obtain a data table set, and each data table in the data table set is compared with the multi-environment data table set to determine whether it exists in the multi-environment data table set. If the data table exists in the multi-environment data table set, a suffix is added to the data table and it is used as a specific environment data table; if the data table does not exist in the multi-environment data table set, it is not processed and is used as a common environment data table. Based on the specific environment data table and the common environment data table, a target data table set is obtained, and the database instruction is modified based on the target data table set to obtain a target instruction.
[0085] In the above embodiment, database instructions whose usage times exceed a threshold and their corresponding target instructions are stored in a preset instruction library. When the preset plug-in intercepts a database instruction, it is searched in the preset instruction library. If the database instruction exists in the preset instruction library, its corresponding target instruction can be directly obtained without the need for parsing and modification, thereby improving processing efficiency.
[0086] See also Figure 4 , Figure 4 The embodiment of the present application provides a schematic block diagram of a business processing device based on the same database and multiple environment data tables, and the business processing device based on the same database and multiple environment data tables is used to execute the aforementioned business processing method based on the same database and multiple environment data tables. The business processing device based on the same database and multiple environment data tables can be configured on a server.
[0087] like Figure 4 As shown, the business processing device 400 based on the same database and multiple environment data tables includes:
[0088] The data table information loading module 401 is used to identify the current business environment when the application is started, and load the multi-environment data table set and the multi-environment data table suffix name corresponding to the current business environment;
[0089] The data table set acquisition module 402 is used to acquire the data table set contained in the database instruction based on the preset plug-in when the database instruction of the application is detected;
[0090] A database instruction modification module 403 is used to obtain a target data table set based on the multi-environment data table suffix when a data table in the data table set exists in the multi-environment data table set, and to modify the database instruction based on the target data table set to obtain a target instruction;
[0091] The target instruction execution module 404 is used to execute the target instruction, obtain an execution result, and perform business processing based on the execution result to obtain a business processing result.
[0092] Furthermore, the business processing device 400 based on the same database and multiple environment data tables further includes a data table determination module, and the data table determination module includes:
[0093] A comparison result obtaining unit, used for traversing the data table set, comparing each data table in the data table set one by one with the multi-environment data table, and obtaining a comparison result;
[0094] A data table determination unit is used to determine whether a data table in the first data table exists in the multi-environment data table based on the comparison result.
[0095] Furthermore, the database instruction modification module 403 includes:
[0096] A specific environment data table obtaining unit is used to add the multi-environment data table suffix to the data table as a specific environment data table when traversing to a data table existing in the multi-environment data table set;
[0097] A common environment data table obtaining unit, used to use a data table that only exists in the data table set as a common environment data table;
[0098] The target data table set obtaining unit is used to obtain the target data table set based on the specific environment data table and the common environment data table when the traversal of the data table set is completed.
[0099] Furthermore, the data table set acquisition module 402 is specifically used to intercept the database instruction based on a preset plug-in when a database instruction of the application is detected, and parse the database instruction to obtain at least one data table contained in the database instruction and generate the data table set.
[0100] Furthermore, the service processing device 400 based on the same database and multiple environment data tables further includes an instruction matching module, and the instruction matching module includes:
[0101] A database instruction matching unit, configured to intercept the database instruction based on the preset plug-in when a database instruction of the application is detected, and match the database instruction in a preset instruction library corresponding to the current business environment;
[0102] A target instruction acquisition unit, configured to acquire a target instruction corresponding to the instruction when an instruction identical to the database instruction is matched;
[0103] The target instruction execution unit is used to update the database instruction to the target instruction, and execute the target instruction to obtain an execution result, so as to perform business processing based on the execution result and obtain a business processing result.
[0104] Furthermore, the business processing device 400 based on the same database and multiple environment data tables further includes an instruction storage module, and the instruction storage module includes:
[0105] An occurrence number acquisition unit, used to acquire a historical instruction record of the current business environment, and obtain the occurrence number of the database instruction based on the historical instruction record;
[0106] The instruction storage unit stores the database instruction and the target instruction in a preset instruction library corresponding to the current business environment when the number of occurrences is greater than or equal to a preset number threshold.
[0107] Furthermore, the business processing device 400 based on the same database and multiple environment data tables further includes:
[0108] The data table information configuration module is used to generate the multi-environment data table set and the multi-environment data table suffix name based on a unified configuration platform and preset configuration information.
[0109] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device and each module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0110] The above-mentioned device can be implemented in the form of a computer program. Figure 5 Runs on the computer device shown.
[0111] See also Figure 5 , Figure 5 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device may be a server.
[0112] See also Figure 5 The computer device includes a processor, a memory and a network interface connected through a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.
[0113] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any business processing method based on the same database and multiple environment data tables.
[0114] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0115] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any business processing method based on the same database and multiple environment data tables.
[0116] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0117] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0118] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:
[0119] When the application is started, the current business environment is identified, and a multi-environment data table set and a multi-environment data table suffix corresponding to the current business environment are loaded;
[0120] When a database instruction of the application is detected, based on a preset plug-in, a data table set included in the database instruction is obtained;
[0121] When a data table in the data table set exists in the multi-environment data table set, a target data table set is obtained based on the multi-environment data table suffix, and the database instruction is modified based on the target data table set to obtain a target instruction;
[0122] Execute the target instruction to obtain an execution result, and perform business processing based on the execution result to obtain a business processing result.
[0123] In one embodiment, when the data table in the data table set is implemented to exist in the multi-environment data table set, the processor obtains a target data table set based on the multi-environment data table suffix, and modifies the database instruction based on the target data table set. Before obtaining the target instruction, the processor is further configured to implement:
[0124] Traversing the data table set, comparing each data table in the data table set with the multi-environment data table one by one, and obtaining a comparison result;
[0125] Based on the comparison result, it is determined whether a data table in the first data table exists in the multi-environment data table.
[0126] In one embodiment, when the data table in the data table set is implemented to exist in the multi-environment data table set, the processor obtains a target data table set based on the multi-environment data table suffix, and modifies the database instruction based on the target data table set, and when the target instruction is obtained, is used to implement:
[0127] When traversing to a data table existing in the multi-environment data table set, adding the multi-environment data table suffix to the data table as a specific environment data table;
[0128] Using the data table that only exists in the data table set as a common environment data table;
[0129] When the traversal of the data table set is completed, the target data table set is obtained based on the specific environment data table and the common environment data table.
[0130] In one embodiment, when the processor detects the database instruction of the application and obtains the data table set included in the database instruction based on the preset plug-in, it is configured to implement:
[0131] When a database instruction of the application is detected, the database instruction is intercepted based on a preset plug-in, and the database instruction is parsed to obtain at least one data table included in the database instruction, and the data table set is generated.
[0132] In one embodiment, after the processor recognizes the current business environment when the application is started and loads the multi-environment data table set and the multi-environment data table suffix corresponding to the current business environment, it is also used to implement:
[0133] When a database instruction of the application is detected, the database instruction is intercepted based on the preset plug-in, and the database instruction is matched in a preset instruction library corresponding to the current business environment;
[0134] When an instruction identical to the database instruction is matched, obtaining a target instruction corresponding to the instruction;
[0135] The database instruction is updated to the target instruction, and the target instruction is executed to obtain an execution result, so as to perform business processing based on the execution result to obtain a business processing result.
[0136] In one embodiment, when the data table in the data table set is implemented to exist in the multi-environment data table set, the processor obtains a target data table set based on the multi-environment data table suffix, and modifies the database instruction based on the target data table set. After obtaining the target instruction, the processor is further used to implement:
[0137] Acquire historical instruction records of the current business environment, and obtain the number of occurrences of the database instruction based on the historical instruction records;
[0138] When the number of occurrences is greater than or equal to a preset number threshold, the database instruction and the target instruction are correspondingly stored in a preset instruction library corresponding to the current business environment.
[0139] In one embodiment, the processor is further used to implement the following before identifying the current business environment and loading the multi-environment data table set and the multi-environment data table suffix corresponding to the current business environment when the application is started:
[0140] Based on the unified configuration platform and preset configuration information, the multi-environment data table set and the multi-environment data table suffix are generated.
[0141] A computer-readable storage medium is also provided in an embodiment of the present application, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and the processor executes the program instructions to implement any business processing method based on the same database and multi-environment data tables provided in the embodiment of the present application.
[0142] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (Smart Medi a Card, SMC), a secure digital (Secure Digital, SD) card, a flash memory card (Flash Card), etc., equipped on the computer device.
[0143] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A business processing method based on the same database and multiple environment data tables, characterized in that: include: When the application is started, the current business environment is identified, and a multi-environment data table set and a multi-environment data table suffix corresponding to the current business environment are loaded; When a database instruction of the application is detected, based on a preset plug-in, a data table set included in the database instruction is obtained; When a data table in the data table set exists in the multi-environment data table set, a target data table set is obtained based on the multi-environment data table suffix, and the database instruction is modified based on the target data table set to obtain a target instruction; Execute the target instruction to obtain an execution result, and perform business processing based on the execution result to obtain a business processing result.
2. The business processing method based on the same database and multiple environment data tables according to claim 1 is characterized in that: When the data table in the data table set exists in the multi-environment data table set, a target data table set is obtained based on the multi-environment data table suffix, and the database instruction is modified based on the target data table set. Before obtaining the target instruction, the method further includes: Traversing the data table set, comparing each data table in the data table set with the multi-environment data table one by one, and obtaining a comparison result; Based on the comparison result, it is determined whether a data table in the first data table exists in the multi-environment data table.
3. The business processing method based on the same database and multiple environment data tables according to claim 2 is characterized in that: When the data table in the data table set exists in the multi-environment data table set, a target data table set is obtained based on the multi-environment data table suffix, and the database instruction is modified based on the target data table set to obtain a target instruction, including: When traversing to a data table existing in the multi-environment data table set, adding the multi-environment data table suffix to the data table as a specific environment data table; Using the data table that only exists in the data table set as a common environment data table; When the traversal of the data table set is completed, the target data table set is obtained based on the specific environment data table and the common environment data table.
4. The business processing method based on the same database and multiple environment data tables according to claim 1 is characterized in that: When the database instruction of the application is detected, based on the preset plug-in, obtaining the data table set contained in the database instruction includes: When a database instruction of the application is detected, the database instruction is intercepted based on a preset plug-in, and the database instruction is parsed to obtain at least one data table included in the database instruction, and the data table set is generated.
5. The business processing method based on the same database and multiple environment data tables according to claim 1 is characterized in that: When the application is started, the current business environment is identified, and after the multi-environment data table set and the multi-environment data table suffix corresponding to the current business environment are loaded, the following is also included: When a database instruction of the application is detected, the database instruction is intercepted based on the preset plug-in, and the database instruction is matched in a preset instruction library corresponding to the current business environment; When an instruction identical to the database instruction is matched, obtaining a target instruction corresponding to the instruction; The database instruction is updated to the target instruction, and the target instruction is executed to obtain an execution result, so as to perform business processing based on the execution result to obtain a business processing result.
6. The business processing method based on the same database and multiple environment data tables according to claim 1, characterized in that: When the data table in the data table set exists in the multi-environment data table set, a target data table set is obtained based on the multi-environment data table suffix, and the database instruction is modified based on the target data table set. After obtaining the target instruction, the method further includes: Acquire historical instruction records of the current business environment, and obtain the number of occurrences of the database instruction based on the historical instruction records; When the number of occurrences is greater than or equal to a preset number threshold, the database instruction and the target instruction are correspondingly stored in a preset instruction library corresponding to the current business environment.
7. The business processing method based on the same database and multiple environment data tables according to any one of claims 1 to 6, characterized in that: When the application is started, the current business environment is identified, and before the multi-environment data table set and the multi-environment data table suffix corresponding to the current business environment are loaded, the following is also included: Based on the unified configuration platform and preset configuration information, the multi-environment data table set and the multi-environment data table suffix are generated.
8. A business processing device based on the same database and multiple environment data tables, characterized in that: include: The data table information loading module is used to identify the current business environment when the application is started, and load the multi-environment data table set and the multi-environment data table suffix name corresponding to the current business environment; A data table set acquisition module, configured to acquire a data table set contained in a database instruction based on a preset plug-in when a database instruction of the application is detected; A database instruction modification module, used for obtaining a target data table set based on the multi-environment data table suffix when a data table in the data table set exists in the multi-environment data table set, and modifying the database instruction based on the target data table set to obtain a target instruction; The target instruction execution module is used to execute the target instruction, obtain an execution result, and perform business processing based on the execution result to obtain a business processing result.
9. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program and implement the business processing method based on the same database and multiple environment data tables as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the business processing method based on the same database and multiple environment data tables according to any one of claims 1 to 7.