Database table processing method and device, electronic equipment and readable storage medium
By selecting the target data format conversion class based on table identification data, and using a unified interface to process operation requests for multiple tables, the problems of development complexity and low system reliability caused by many interfaces in the prior art are solved, and efficient and reliable table operation request processing is achieved.
Patent Information
- Application Number
- CN202411757210.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-03-14
AI Technical Summary
When processing database table operation requests, the number of interfaces in the prior art leads to increased development and maintenance complexity, reduced code reusability, easy interface call errors, and challenges in data transmission efficiency and stability, resulting in low system reliability and efficiency.
By selecting the target data format conversion class based on the table identification data, using a unified interface to process operation requests for multiple tables, avoiding the development of multiple specific interfaces for each form separately. The method includes responding to the table operation request, determining the target data format conversion class, performing deserialization processing, constructing a structured query statement, and processing the database table.
It significantly improves the reliability and efficiency of table operation request processing, reduces the risk of developers facing complex interface specifications, improves the accuracy and stability of request processing, simplifies testing work, and speeds up request processing.
Smart Images

Figure CN119621819A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the fields of computer technology and financial technology, and in particular, to a method, device, electronic device and readable storage medium for processing a database table. Background Art
[0002] In the fields of communications, computers, and finance, operations on database tables are common requirements for various application systems. With the continuous development of business and the increasing amount of data, it is crucial to efficiently and flexibly process table operation requests sent by the front end.
[0003] When processing table operation requests, the relevant technology needs to call a specific interface (for example, in the field of finance and insurance, a corresponding interface will be developed and maintained for each financial statement in the database), and pass data according to the parameters and format specified by the interface, so as to realize the processing of table operation requests.
[0004] However, this processing method greatly increases the complexity of development and maintenance in the process of processing requests due to the large number of interfaces. Developers need to spend a lot of energy to familiarize themselves with the detailed specifications of different interfaces, which reduces the reusability of the code and makes it easy to have errors caused by improper interface calls. In addition, when multiple interfaces work together, the efficiency and stability of data transmission also face challenges, and data loss or transmission delays are prone to occur. These have seriously restricted the reliability and efficiency of the system in processing table operation requests. Summary of the invention
[0005] In view of the above situation, the embodiments of the present disclosure provide a method, device, electronic device and readable storage medium for processing a database table, aiming to solve the technical problem of low reliability and efficiency in processing table operation requests existing in the related art.
[0006] In a first aspect, an embodiment of the present disclosure provides a method for processing a database table, the method comprising:
[0007] In response to the received table operation request, based on a preset mapping relationship between the table and the data format conversion class, and according to the table identification data in the table operation request, determine the target data format conversion class;
[0008] Deserialize the table operation request through the target data format conversion class to obtain a target table operation data transmission object;
[0009] Constructing a target structured query statement according to the target table operation data transmission object and the table operation type data in the table operation request;
[0010] The target structured query statement is used to process the target table in the database to obtain a processing result.
[0011] In a second aspect, an embodiment of the present disclosure further provides a database table processing device, the device comprising:
[0012] A determination module, configured to determine, in response to a received table operation request, a target data format conversion class based on a preset mapping relationship between a table and a data format conversion class and according to table identification data in the table operation request;
[0013] A deserialization module, used to perform deserialization processing on the table operation request through the target data format conversion class to obtain a target table operation data transmission object;
[0014] A construction module, configured to construct a target structured query statement according to the target table operation data transmission object and the table operation type data in the table operation request;
[0015] The processing module is used to process the target table in the database using the target structured query statement to obtain a processing result.
[0016] In a third aspect, an embodiment of the present disclosure further provides an electronic device, comprising: a processor; and a memory arranged to store computer executable instructions, wherein when the executable instructions are executed, the processor executes the steps of the above-mentioned database table processing method.
[0017] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, which stores one or more programs. When the one or more programs are executed by an electronic device including multiple application programs, the electronic device executes the steps of the above-mentioned database table processing method.
[0018] By means of the above technical scheme, the database table processing method, device, electronic device and readable storage medium provided by the embodiment of the present disclosure achieve the purpose of using a unified interface to process the operation requests of multiple tables by selecting the target data format conversion class based on the table identification data. It is no longer necessary to develop multiple specific interfaces for each table separately, effectively solving many problems faced by the related technology when processing table operation requests, and significantly improving the reliability and efficiency of request processing. Specifically, in terms of reliability, since the operation requests of multiple tables are processed by a unified interface, the situation that developers are prone to errors due to the large number of interfaces in the related technology is effectively avoided. Developers do not need to face complex and numerous interface specifications, reduce the error probability caused by improper interface calls, ensure that each table operation request can be processed according to accurate conversion rules, and greatly improve the accuracy and stability of request processing; and because the interface processing is unified and flexible, the testing work becomes simpler and more efficient, and the quality of the code can be better guaranteed, so the reliability of the system as a whole is guaranteed. In terms of efficiency, multi-table operation requests can be processed through a unified interface, effectively avoiding the low efficiency and stability of data transmission in the collaborative work of multiple interfaces. The data format conversion class can quickly serialize and deserialize request parameters, extract valid data, reduce data transmission delays and loss risks, speed up request processing, and enable the system to respond to front-end table operation requests more efficiently.
[0019] The above description is only an overview of the technical solution of the present disclosure. In order to more clearly understand the technical means of the present disclosure, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present disclosure more obvious and easy to understand, the specific implementation methods of the present disclosure are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The drawings described herein are used to provide a further understanding of the present disclosure and constitute a part of the present disclosure. The illustrative embodiments of the present disclosure and their descriptions are used to explain the present disclosure and do not constitute an improper limitation on the present disclosure. In the drawings:
[0021] Figure 1 A schematic diagram showing an application environment of the method for processing a database table provided in an embodiment of the present disclosure;
[0022] Figure 2 A schematic diagram showing a process flow of a method for processing a database table provided in an embodiment of the present disclosure is shown;
[0023] Figure 3 An architecture diagram of a system on which the database table processing method provided by an embodiment of the present disclosure relies is shown;
[0024] Figure 4 A schematic diagram showing the structure of a database table processing device provided in an embodiment of the present disclosure is shown;
[0025] Figure 5 A schematic structural diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solutions and advantages of the present disclosure clearer, the technical solutions of the present disclosure will be clearly and completely described below in combination with the specific embodiments of the present disclosure and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present disclosure.
[0027] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that such usage is interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the term "including" and its variants are to be interpreted as open-ended terms meaning "including but not limited to".
[0029] As described above, when processing table operation requests, the relevant technology needs to call a specific interface (for example, in the field of finance and insurance, a corresponding interface will be developed and maintained for each financial statement in the database), and transfer data according to the parameters and format specified by the interface, so as to realize the processing of table operation requests. However, in the process of processing requests, this processing method will greatly increase the complexity of development and maintenance due to the large number of interfaces. Developers need to spend a lot of energy to familiarize themselves with the detailed specifications of different interfaces, the reusability of the code is reduced, and errors caused by improper interface calls are prone to occur; and when multiple interfaces work together, the efficiency and stability of data transmission are also challenged, and data loss or transmission delays are prone to occur. These all seriously restrict the reliability and efficiency of the system when processing table operation requests. Based on this, the present invention proposes a method, device, electronic device and readable storage medium for processing a database table, and the present disclosure is described in detail below through specific embodiments.
[0030] To facilitate understanding of this embodiment, the database table processing method disclosed in the embodiment of the present disclosure is first described in detail. The database table processing method provided in the embodiment of the present disclosure can be applied to Figure 1In an application environment, the client communicates with the server through a network. The server can respond to the received table operation request, determine the target data format conversion class based on the mapping relationship between the preset table and the data format conversion class and the table identification data in the table operation request; deserialize the table operation request through the target data format conversion class to obtain the target table operation data transmission object; construct the target structured query statement according to the target table operation data transmission object and the table operation type data in the table operation request; use the target structured query statement to process the target table in the database to obtain the processing result, and feed the processing result back to the client. In the present invention, by selecting the target data format conversion class based on the table identification data, the purpose of using a unified interface to process the operation requests of multiple tables is achieved, and it is no longer necessary to develop multiple specific interfaces for each table separately, which effectively solves many problems faced by related technologies in processing table operation requests and significantly improves the reliability and efficiency of request processing. Among them, the client can be but not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices. The server is generally a computer device with a certain computing capability, which includes, for example, a terminal device or a server or other processing device, wherein the terminal device may be a user equipment (UE), a mobile device, a user terminal, a terminal, a personal digital assistant (PDA), a handheld device, a computing device, etc. The server may be implemented as an independent server or a server cluster consisting of multiple servers. In some possible implementations, the method may be implemented by a processor calling a computer-readable instruction stored in a memory. The present invention is described in detail below through specific embodiments.
[0031] Figure 2 The flowchart of the method for processing a database table provided by the embodiment of the present disclosure is shown. Figure 2 It can be seen that the embodiment of the present disclosure at least includes steps S201-S204:
[0032] S201: In response to a received table operation request, based on a preset mapping relationship between a table and a data format conversion class, and according to table identification data in the table operation request, a target data format conversion class is determined.
[0033] This embodiment does not limit the format and generation method of the table operation request. For example, the format of the table operation request can be JSON format, XML format, HTTP request parameter format, etc. For the generation method of the table operation request, for example, in the field of finance and insurance, a table operation request can be generated through a page for querying financial statements. Specifically, there will be an HTML form in the page, which contains multiple input fields and drop-down menus. For example, there is a date selector for selecting the time range of the report (such as "start date" and "end date"), a drop-down menu for selecting the report type (such as "Financial Statement-Income Details" and "Financial Statement-Expenditure Details"), and a text input box for entering other filtering conditions (such as "Department Name"). When the user clicks the "Query" button, the JavaScript function will be triggered to collect the various input values in the form and assemble them into a string, such as "?startDate=2024-01-01&endDate=2024-12-31&reportType=financial-income&
[0034] department=Sales”, this string can be a table operation request.
[0035] The mapping relationship between the table and the data format conversion class is a set of pre-set mapping relationships. One table corresponds to one data format conversion class. The data format conversion class is used to serialize and deserialize parameters related to table operations. For example, for a management expense details table, you can customize its corresponding data format conversion class as follows:
[0036] @ParamPermissionCheck
[0037] @NotBlank(message="Company segment cannot be empty")
[0038] private String dno; / / company logo or number
[0039] @NotBlank(message="Business segment cannot be empty")
[0040] private String tno; / / Business ID or number
[0041] @NotBlank(message="Currency cannot be empty")
[0042] private String cno; / / Currency ID or number
[0043] @NotBlank(message="Query start month cannot be empty")
[0044] private String startMonth; / / Start month for query
[0045] @NotBlank(message="Query end month cannot be empty")
[0046] private String endMonth; / / end month of query
[0047] @NotBlank(message="Query type cannot be empty")
[0048] private String queryType; / / query type identifier
[0049] @NotBlank(message="Account set cannot be empty")
[0050] private String setOfBooksId; / / account set identifier or number
[0051] …”.
[0052] S202: Deserialize the table operation request through the target data format conversion class to obtain a target table operation data transmission object.
[0053] S203: Construct a target structured query statement according to the target table operation data transmission object and the table operation type data in the table operation request.
[0054] S204: Using the target structured query statement, the target table in the database is processed to obtain a processing result.
[0055] It can be seen that compared with the related art, the embodiment of the present disclosure achieves the purpose of using a unified interface to process the operation requests of multiple tables by selecting the target data format conversion class based on the table identification data. It is no longer necessary to develop multiple specific interfaces for each table separately, which effectively solves the many problems faced by the related art when processing table operation requests, and significantly improves the reliability and efficiency of request processing. Specifically, in terms of reliability, due to the use of a unified interface to process the operation requests of multiple tables, the situation that developers are prone to errors due to the large number of interfaces in the related art is effectively avoided. Developers do not need to face complex and numerous interface specifications, reduce the probability of errors caused by improper interface calls, ensure that each table operation request can be processed according to accurate conversion rules, and greatly improve the accuracy and stability of request processing; and because the interface processing is unified and flexible, the testing work becomes simpler and more efficient, and the quality of the code can be better guaranteed, so the reliability of the system as a whole is guaranteed. In terms of efficiency, multi-table operation requests can be processed through a unified interface, which effectively avoids the low efficiency and stability of data transmission in the collaborative work of multiple interfaces. The data format conversion class can quickly serialize and deserialize request parameters, extract valid data, reduce data transmission delays and loss risks, speed up request processing, and enable the system to respond to front-end table operation requests more efficiently.
[0056] Further, in order to better illustrate the process of the above database table processing method, as a refinement and extension of the above embodiment, the embodiment of the present invention provides several optional embodiments, but is not limited thereto, which are specifically as follows:
[0057] In some embodiments, the method is used to query, delete, modify or add the target table.
[0058] In this embodiment, if the database table processing method provided by the present disclosure is used to query the target table, then in response to the received table query request, based on the mapping relationship between the preset table and the data format conversion class, and according to the table identification data in the table query request, the target data format conversion class applicable to the target table can be determined; using the target data format conversion class, the query parameters in the query request are deserialized to obtain a target table operation data transmission object containing the query parameters; based on the target table operation data transmission object, a query statement is constructed, such as "SELECT*FROM target_tableWHERE condition", and the query statement is used to query the target table in the database to obtain the query result.
[0059] If the database table processing method provided by the present disclosure is used to delete a target table, then in response to a received table deletion request, based on a preset mapping relationship between a table and a data format conversion class, and according to table identification data in the table deletion request, a target data format conversion class applicable to the target table can be determined; using the target data format conversion class, the deletion parameters in the deletion request are deserialized to obtain a target table operation data transmission object; based on the target table operation data transmission object, a deletion statement is constructed, such as "DELETE FROM target_table WHERE condition", and the deletion statement is used to perform a deletion operation on the target table in the database to obtain a deletion result.
[0060] If the database table processing method provided by the present invention is used to change the target table, then in response to the received table change request, based on the mapping relationship between the preset table and the data format conversion class, and according to the table identification data in the table change request, the target data format conversion class applicable to the target table can be determined; using the target data format conversion class, the change parameters in the change request are deserialized to obtain the target table operation data transfer object; based on the target table operation data transfer object, a change statement is constructed, such as "UPDATE target_table SET field=new_value WHEREcondition", and the change statement is used to perform a change operation on the target table in the database to obtain a change result.
[0061] If the database table processing method provided by the present invention is used to add to a target table, then in response to a received table addition request, based on a preset mapping relationship between a table and a data format conversion class, and according to table identification data in the table addition request, a target data format conversion class applicable to the target table can be determined; using the target data format conversion class, the addition parameters in the addition request are deserialized to obtain a target table operation data transmission object; based on the target table operation data transmission object, an addition statement is constructed, such as "INSERT INTO target_table(field1,field2,...)VALUES(value1,value2,..."); the addition statement is used to perform an addition operation on the target table in the database to obtain an addition result.
[0062] In some embodiments, the method is implemented based on JAVA language; the mapping relationship is implemented through an annotation mechanism; the table operation request is deserialized through the target data format conversion class to obtain a target table operation data transmission object, including: using the target data format conversion class to deserialize the parameters related to the table operation in the table operation request to obtain a table operation parameter object; assigning the table operation parameter object to a table operation variable in a general table operation data transmission class; and assigning the table identification data to a table identification variable in the general table operation data transmission class to obtain the target table operation data transmission object; wherein the type of the table operation variable is a generic variable, and the table identification variable is an enumeration variable.
[0063] In this embodiment, the mapping relationship between the preset table and the data format conversion class is implemented through the annotation mechanism. Exemplarily, the following code defines the mapping relationship between two tables and two data format conversion classes through the annotation mechanism: @JsonSubTypes.Type(value=ManageFeeDetailDto.class,name="F006_8"), @JsonSubTypes.Type(value=DailyFundFeeDetailNoTlDto.class,name="F006_11"). It can be seen that the first annotation stipulates that when the table identification data is F006_8, the ManageFeeDetailDto class (management fee detail data transmission class) is used for serialization or deserialization; the second annotation stipulates that when the table identification data is F006_11, the DailyFundFeeDetailNoTlDto class (daily fund fee detail data transmission class) is used for serialization or deserialization. Correspondingly, the following annotation is added to the general table operation data transmission class: @JsonTypeInfo(use=JsonTypeInfo.Id.NAME,include=JsonTypeInfo.As.EXTERNAL_PROPERTY,property="procCode"), where procCode is the table identification data. In addition, the general table operation data transmission class also defines table operation variables (variable type is generic) and table identification variables (variable type is enumeration type).
[0064] During implementation, the target data format conversion class can be used to deserialize the parameters related to the table operation in the table operation request to obtain the processing result, and then encapsulate the processing result into an instantiation object of the target data format conversion class to obtain the table operation parameter object. Then, the table operation parameter object is assigned to the table operation variable; the table identification data is assigned to the table identification variable to obtain the target table operation data transmission object.
[0065] This embodiment uses annotations plus generics to achieve the generation of target table operation data transmission objects. Annotations can clearly bind table identifiers and data format conversion classes, centrally manage the mapping relationship between the two, make the code more concise and easy to modify, and greatly improve the maintainability and readability of the interface; generics give the code high reusability, build a general processing framework, and can flexibly adapt to a variety of data types. Whether it is dealing with the addition of new tables or changes in business logic, it shows stronger scalability and flexibility, which can effectively reduce development costs and reduce the probability of errors, and optimize the overall table operation processing flow.
[0066] In some embodiments, the method also includes: creating an asynchronous table operation data transfer object; setting the attribute value of the task name attribute in the asynchronous table operation data transfer object according to the target task name corresponding to the target table in the target table operation data transfer object; obtaining the variable value of the table operation variable of the target table operation data transfer object by calling the getter method of the target table operation data transfer object, and setting the attribute value of the table operation variable in the asynchronous table operation data transfer object according to the variable value; using the asynchronous table operation data transfer object as a new target table operation data transfer object, and serializing the new target table operation data transfer object using the target data format conversion class to obtain a serialization result, and sending the serialization result to a target message queue; constructing a target structured query statement according to the target table operation data transfer object and the table operation type data in the table operation request, including: obtaining the serialization result from the target message queue; and constructing the target structured query statement according to the serialization result and the table operation type data.
[0067] In this embodiment, the asynchronous table operation data transmission object can implement the Serializable interface to encapsulate table operation parameters and send them to the message queue so that the background service can perform database operations asynchronously.
[0068] After obtaining the instantiated asynchronous table operation data transfer object, in order to help identify and distinguish different asynchronous tasks, the attribute value of the task name attribute of the asynchronous table operation data transfer object can be set. During implementation, the task name attribute value in the target table operation data transfer object can be set to the attribute value of the task name attribute of the asynchronous table operation data transfer object. During specific implementation, the getter method of the target table operation data transfer object can be called to obtain the attribute value of the task name attribute of the target table operation data transfer object, and the attribute value can be set to the attribute value of the task name attribute of the asynchronous table operation data transfer object. That is, the following code can be used to set the attribute value: String taskName = dto.getTaskName(); reportDto.setTaskName(taskName). Among them, dto is the target table operation data transfer object, and reportDto is the asynchronous table operation data transfer object.
[0069] In actual application scenarios, if multiple tables are interrelated, these multiple related tables will be merged into a master table. At this time, the master table and the sub-tables will be encoded separately. For example, a parent code such as F001 is used to represent the master table, and the sub-tables belonging to this master table are defined as F001_1, F001_2, F001_3, etc. The target table may be a sub-table of a table. At this time, the attribute value of the task name attribute of the asynchronous table operation data transmission object is empty, and the target task name corresponding to the target table is stored in the attribute of the table identification variable. Based on this, in some embodiments, the target task name is obtained by taking the task name attribute value of the table identification variable as the target task name. Specifically, it can be implemented according to the following code: Dto.getprocCode().getTaskName().
[0070] You can also call the getter method of the target table operation data transfer object to obtain the variable value of the table operation variable of the target table operation data transfer object, and set the property value of the table operation variable in the asynchronous table operation data transfer object according to the variable value. For example, you can set it through the following code: reportDto.setRepParam(dto.getSubmitForm()).
[0071] It is understandable that in order to facilitate permission verification, personalized report content or audit tracking, user information properties of the asynchronous table operation data transmission object can also be set.
[0072] After setting the relevant properties of the asynchronous table operation data transfer object, use it as the new target table operation data transfer object, and use the target data format conversion class to serialize the new target table operation data transfer object to obtain a serialization result in the form of a string that can be used for transmission, and send the serialization result to the target message queue. Then get the serialization result from the target message queue; build the target structured query statement based on the serialization result and the table operation type data in the table operation request to perform relevant processing on the target table in the database.
[0073] This embodiment introduces an asynchronous processing mechanism, and implements an asynchronous processing solution by constructing an asynchronous table operation data transmission object, setting the task name and table operation properties, and using a message queue, thereby improving the system response speed, making full use of resources, and making the system more efficient and flexible when processing multi-table operations.
[0074] In actual application scenarios, with the expansion of business and geographical extension, we often face the situation where the business involves the distribution of multiple databases. However, when querying, the user does not know the specific database to which the target table belongs. Therefore, it is necessary to automatically infer and set the database identifier based on the specific information in the user's query parameters, so as to build a more complete asynchronous data processing solution that is adapted to multiple database environments. In some embodiments, the table operation request also includes a query location parameter; the method also includes: using the correspondence between the preset query location parameter and the database code, according to the query location parameter, determining the target database code; using the reflection mechanism, according to the target database code, the attribute value of the database identification attribute in the asynchronous table operation data transmission object is set.
[0075] In this embodiment, the query location parameter may be: company name, company department code or region code, etc. The corresponding relationship between the query location parameter and the database code may be set according to actual conditions, and this embodiment does not limit this.
[0076] After obtaining the target database code, the reflection mechanism can be used to set the attribute value of the database identification attribute in the asynchronous table operation data transmission object according to the target database code. Specifically, the database identification attribute can be set according to the following code, that is, by traversing the field name of the asynchronous table operation data transmission object, the field value of the sid field is set to the target database code.
[0077] public void setSubClzSid(String regionSid){
[0078] Field[]fields=this.getClass().getDeclaredFields();
[0079] for(Field field:fields){
[0080] field.setAccessible(true);
[0081] if(StringUtils.equals(field.getName(),"sid")){
[0082] try{
[0083] field.set(this,regionSid);
[0084] }catch(IllegalAccessException e){
[0085] e.printStackTrace();
[0086] }
[0087] }
[0088] }
[0089] }
[0090] This embodiment innovatively uses the reflection mechanism to accurately set the database code based on the company name or region code or company department code, effectively solving the problem of data location in a multi-database business environment. Users do not need to know the specific information of the database where the table is located. The system automatically determines the database source based on the key elements in the user's query parameters, greatly improving the accuracy and intelligence of data queries, making the system more relaxed, accurate and efficient when responding to data needs in different regions and different business scenarios. Through reflection technology, the amount of repeated code can also be reduced, the reusability and maintainability of the code can be improved, and the development and maintenance costs can also be reduced.
[0091] The present disclosure also provides a method for processing a database table, comprising the following steps:
[0092] First, the system architecture on which this embodiment relies is introduced. Figure 3 The following is an architecture diagram of the system on which the database table processing method provided by the embodiment of the present disclosure relies. Figure 3As shown in the figure, the system includes APK service (including FDS WEB, ARK gateway, FDSservice), Rocket MQ, FDS database, LinkDo scheduling platform and FDS hadoop. Among them, FDSWEB is a web-based front-end application (Front-End for FDS), which is mainly responsible for user interface related work. Users access FDS Web through a browser to initiate various operation requests, which may include query, insert, update, delete and other operations on database tables. It converts user operations into appropriate request formats and then sends them to the back-end FDS Service for processing through the APK gateway. The FDS service is responsible for processing report operation requests from the ARK gateway; it generates corresponding report data through internal logic and algorithms. When the FDS service receives a large number of query requests, some requests can be put into Rocket MQ for queue processing to improve the system's concurrent processing capabilities. The FDS database is used to store report-related data. When the FDS service processes report query requests, it needs to obtain data from these databases to generate reports. When a report query request involves big data processing, the FDS service may call the data processing capabilities in FDS Hadoop through the LinkDo scheduling platform to analyze and process the big data to generate a report.
[0093] Step S1: In response to a received table operation request, based on a preset mapping relationship between a table and a data format conversion class and according to table identification data in the table operation request, a target data format conversion class is determined.
[0094] Step S2: using the target data format conversion class, deserialize the parameters related to the table operation in the table operation request to obtain a table operation parameter object.
[0095] Step S3: Assign the table operation parameter object to the table operation variable in the general table operation data transmission class.
[0096] Step S4: assigning the table identification data to the table identification variable in the general table operation data transmission class to obtain a target table operation data transmission object; wherein the type of the table operation variable is a generic variable, and the table identification variable is an enumeration variable.
[0097] Step S5: Create an asynchronous table operation data transfer object.
[0098] Step S6: according to the target task name corresponding to the target table in the target table operation data transmission object, the attribute value of the task name attribute in the asynchronous table operation data transmission object is set.
[0099] The task name attribute value of the table identifier variable can be used as the target task name. The task name attribute value in the target table operation data transfer object can also be used as the target task name.
[0100] Step S7: acquiring the variable value of the table operation variable of the target table operation data transmission object by calling the getter method of the target table operation data transmission object, and setting the attribute value of the table operation variable in the asynchronous table operation data transmission object according to the variable value.
[0101] Step S8: using the correspondence between the preset query positioning parameters and the database code, according to the query positioning parameters, determine the target database code. Wherein, the query positioning parameters are: company name, company department code or region code.
[0102] Step S9: using the reflection mechanism, according to the target database code, the attribute value of the database identification attribute in the asynchronous table operation data transmission object is set.
[0103] Step S10: using the asynchronous table operation data transmission object as a new target table operation data transmission object, and using the target data format conversion class to serialize the new target table operation data transmission object to obtain a serialization result, and sending the serialization result to the target message queue.
[0104] Step S11: Obtain the serialization result from the target message queue.
[0105] Step S12: construct a target structured query statement according to the serialization result and table operation type data.
[0106] Step S13: construct a target structured query statement according to the target table operation data transmission object and the table operation type data in the table operation request.
[0107] Step S14: using the target structured query statement to process the target table in the database to obtain a processing result.
[0108] Those skilled in the art will appreciate that, in the above method of the specific implementation manner, the writing order of the steps does not mean a strict execution order, but does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0109] It should be noted that, in practical applications, all possible implementations described above can be combined in any manner to form possible embodiments of the present disclosure, which will not be described one by one here.
[0110] Based on the same concept, the embodiment of the present disclosure further provides a device for processing a database table, and the processing of the database table corresponds one-to-one to the processing method of the database table in the above embodiment. Figure 4 A schematic diagram showing the structure of a database table processing device provided in an embodiment of the present disclosure is shown in FIG. Figure 4 As shown, the database table processing device 400 provided in the embodiment of the present disclosure includes:
[0111] A determination module 401 is used to determine, in response to a received table operation request, a target data format conversion class based on a preset mapping relationship between a table and a data format conversion class and according to table identification data in the table operation request;
[0112] Deserialization module 402, used to perform deserialization processing on the table operation request through the target data format conversion class to obtain a target table operation data transmission object;
[0113] A construction module 403 is used to construct a target structured query statement according to the target table operation data transmission object and the table operation type data in the table operation request;
[0114] The processing module 404 is used to process the target table in the database using the target structured query statement to obtain a processing result.
[0115] In some embodiments, in the above-mentioned device, the device is used to query, delete, modify or add the target table.
[0116] In some embodiments, in the above-mentioned device, the device is implemented based on JAVA language; the mapping relationship is implemented through the annotation mechanism; the deserialization module is used to: use the target data format conversion class to deserialize the parameters related to the table operation in the table operation request to obtain a table operation parameter object; assign the table operation parameter object to the table operation variable in the general table operation data transmission class; and assign the table identification data to the table identification variable in the general table operation data transmission class to obtain the target table operation data transmission object; wherein the type of the table operation variable is a generic variable, and the table identification variable is an enumeration variable.
[0117] In some embodiments, the device also includes an asynchronous processing module, which is used to create an asynchronous table operation data transmission object; according to the target task name corresponding to the target table in the target table operation data transmission object, the attribute value of the task name attribute in the asynchronous table operation data transmission object is set; by calling the getter method of the target table operation data transmission object, the variable value of the table operation variable of the target table operation data transmission object is obtained, and according to the variable value, the attribute value of the table operation variable in the asynchronous table operation data transmission object is set; the asynchronous table operation data transmission object is used as a new target table operation data transmission object, and the new target table operation data transmission object is serialized using the target data format conversion class to obtain a serialization result, and the serialization result is sent to the target message queue; the construction module is used to obtain the serialization result from the target message queue; according to the serialization result and the table operation type data, the target structured query statement is constructed.
[0118] In some embodiments, in the above-mentioned device, the target task name is obtained by taking the task name attribute value of the table identifier variable as the target task name.
[0119] In some embodiments, the table operation request also includes a query location parameter; the device also includes a setting module, which is used to: utilize the correspondence between the preset query location parameter and the database code, and determine the target database code according to the query location parameter; utilize the reflection mechanism, and set the attribute value of the database identification attribute in the asynchronous table operation data transmission object according to the target database code.
[0120] In some embodiments, in the above-mentioned device, the query location parameter is: company name, company department code or area code.
[0121] The present invention provides a processing device for a database table. By selecting a target data format conversion class based on table identification data, the purpose of using a unified interface to process operation requests of multiple tables is achieved. It is no longer necessary to develop multiple specific interfaces for each table separately, effectively solving many problems faced by related technologies when processing table operation requests, and significantly improving the reliability and efficiency of request processing. Specifically, in terms of reliability, since a unified interface is used to process operation requests of multiple tables, the situation that developers are prone to errors due to numerous interfaces in related technologies is effectively avoided. Developers do not need to face complex and numerous interface specifications, reducing the probability of errors caused by improper interface calls, ensuring that each table operation request can be processed according to accurate conversion rules, greatly improving the accuracy and stability of request processing; and since the interface processing is unified and flexible, the testing work becomes simpler and more efficient, and the quality of the code can be better guaranteed, so the reliability of the system as a whole is guaranteed. In terms of efficiency, multi-table operation requests can be processed through a unified interface, effectively avoiding the low efficiency and stability of data transmission in multi-interface collaborative work. The data format conversion class can quickly serialize and deserialize request parameters, extract valid data, reduce data transmission delays and loss risks, speed up request processing, and enable the system to respond to front-end table operation requests more efficiently.
[0122] The specific definition of the database table processing device can refer to the definition of the database table processing method above, which will not be repeated here. Each module in the above-mentioned database table processing device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0123] Figure 5 FIG. 1 shows a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. Figure 5 As shown, at the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. Among them, the memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage, etc. Of course, the electronic device may also include hardware required for other services.
[0124] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0125] The memory is used to store programs. Specifically, the program may include program code, and the program code includes computer operation instructions. The memory may include internal memory and non-volatile memory, and provides instructions and data to the processor.
[0126] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a processing device of the database table at the logical level. The processor executes the program stored in the memory and is specifically used to execute the above method.
[0127] The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present disclosure may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure may be directly embodied as being executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in a decoding processor. The software module may be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0128] The electronic device can execute the database table processing method provided by multiple embodiments of the present disclosure, and realize the database table processing device in Figure 4 The functions of the illustrated embodiments will not be described in detail in the embodiments of the present disclosure.
[0129] The embodiments of the present disclosure also provide a computer-readable storage medium, which stores one or more programs, and the one or more programs include instructions, which, when executed by an electronic device including multiple application programs, can enable the electronic device to execute the database table processing method provided by multiple embodiments of the present disclosure.
[0130] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0131] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0132] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0133] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0134] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0135] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0136] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape, disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0137] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity or device including the element.
[0138] It will be appreciated by those skilled in the art that the embodiments of the present disclosure may be provided as methods, systems or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0139] The above are only embodiments of the present disclosure and are not intended to limit the present disclosure. For those skilled in the art, the present disclosure may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present disclosure shall be included in the scope of the claims of the present disclosure.
Claims
1. A method for processing a database table, characterized in that: The method comprises: In response to the received table operation request, based on a preset mapping relationship between the table and the data format conversion class, and according to the table identification data in the table operation request, determine the target data format conversion class; Deserialize the table operation request through the target data format conversion class to obtain a target table operation data transmission object; Constructing a target structured query statement according to the target table operation data transmission object and the table operation type data in the table operation request; The target table in the database is processed using the target structured query statement to obtain a processing result.
2. The method according to claim 1, characterized in that The method is used to query, delete, modify or add the target table.
3. The method according to claim 1, characterized in that The method is implemented based on JAVA language; the mapping relationship is implemented through an annotation mechanism; the table operation request is deserialized through the target data format conversion class to obtain a target table operation data transmission object, including: Deserialize the parameters related to the table operation in the table operation request by using the target data format conversion class to obtain a table operation parameter object; Assigning the table operation parameter object to the table operation variable in the general table operation data transmission class; and The table identification data is assigned to the table identification variable in the general table operation data transmission class to obtain the target table operation data transmission object; wherein the type of the table operation variable is a generic variable, and the table identification variable is an enumeration variable.
4. The method according to claim 1, characterized in that: The method further comprises: Create an asynchronous table operation data transfer object; According to the target task name corresponding to the target table in the target table operation data transmission object, the attribute value of the task name attribute in the asynchronous table operation data transmission object is set; By calling the getter method of the target table operation data transmission object, the variable value of the table operation variable of the target table operation data transmission object is obtained, and according to the variable value, the attribute value of the table operation variable in the asynchronous table operation data transmission object is set; The asynchronous table operation data transmission object is used as a new target table operation data transmission object, and the new target table operation data transmission object is serialized by using the target data format conversion class to obtain a serialization result, and the serialization result is sent to the target message queue; The step of constructing a target structured query statement according to the target table operation data transmission object and the table operation type data in the table operation request includes: Obtaining the serialization result from the target message queue; The target structured query statement is constructed according to the serialization result and the table operation type data.
5. The method according to claim 4, characterized in that The target task name is obtained by using the task name attribute value of the table identification variable as the target task name.
6. The method according to any one of claims 4-5, characterized in that: The table operation request also includes a query location parameter; the method also includes: Using the correspondence between the preset query positioning parameters and the database code, the target database code is determined according to the query positioning parameters; By utilizing the reflection mechanism, the attribute value of the database identification attribute in the asynchronous table operation data transmission object is set according to the target database code.
7. The method according to claim 6, characterized in that The query positioning parameters are: company name, company department code or area code.
8. A database table processing device, characterized in that: The device comprises: A determination module, configured to determine, in response to a received table operation request, a target data format conversion class based on a preset mapping relationship between a table and a data format conversion class and according to table identification data in the table operation request; A deserialization module, used to perform deserialization processing on the table operation request through the target data format conversion class to obtain a target table operation data transmission object; A construction module, configured to construct a target structured query statement according to the target table operation data transmission object and the table operation type data in the table operation request; The processing module is used to process the target table in the database using the target structured query statement to obtain a processing result.
9. An electronic device, comprising: processor; as well as A memory arranged to store computer executable instructions, wherein the executable instructions, when executed, cause the processor to perform the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing one or more programs, characterized in that: When the one or more programs are executed by an electronic device including a plurality of application programs, the electronic device executes the steps of the method as claimed in any one of claims 1 to 7.