Request processing method and device
By generating the interface storage path and mapping the interface code template during the table data creation process, the problem of repetitive work caused by manually writing interface code is solved, and an efficient and user-friendly request processing method is achieved, improving the efficiency and adaptability of interface generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-09
- Publication Date
- 2026-03-10
AI Technical Summary
In existing technologies, manually writing interface code results in high code repetition, low efficiency, wasted manpower, and failure to meet actual application requirements.
By responding to a received table data creation request, obtaining the fields, field types, and table identifier, calling the pre-built table data creation code, generating the interface storage path, and using the interface code template to map and generate the interface for operating the table data, the step of generating the interface separately is reduced.
It enables the automatic generation of interfaces while creating table data, improving interface generation efficiency, saving manpower and time, and enriching interface types to adapt to various business scenarios.
Smart Images

Figure CN121635877A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and more particularly to a method and apparatus for processing requests. Background Technology
[0002] In business scenarios involving table data processing, operations such as adding, deleting, modifying, and querying table data are indispensable. These operations are typically implemented through corresponding operation interfaces, such as save, delete, modify, and query interfaces. Existing methods for generating interfaces usually involve manually writing the corresponding interface code based on the constructed table data definition.
[0003] In the process of realizing this invention, the inventors discovered the following problems in the prior art:
[0004] The existing method of manually writing interface code results in high code repetition. Every time a new table is created, corresponding interface code needs to be developed and written. This repetitive work not only wastes human resources, but also has low interface generation efficiency. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a request processing method and apparatus that achieves efficient and user-friendly request processing. While creating table data, the corresponding interface is generated simultaneously, eliminating the need for separate interface generation, greatly improving interface generation efficiency, and saving manpower and time.
[0006] To achieve the aforementioned objective, according to one aspect of an embodiment of the present invention, a request processing method is provided, comprising:
[0007] In response to receiving a table data creation request from the requester, retrieve the fields, field types, corresponding field values, and table identifier of the table data;
[0008] Based on the field, the field type, the field value, and the table identifier, a pre-established table data creation code is invoked to create table data. During the invocation of the table data creation code, an interface storage path for the table data is generated. Based on the interface storage path and a preset interface code template, an interface for operating the table data and the definition of the interface are mapped and generated.
[0009] The table data and the definition of the interface are returned to the requesting party.
[0010] Optionally, during the process of calling the table data creation code, generating an interface storage path for the table data interface includes: determining the interface type corresponding to the table data; generating code using the interface storage path in the table data creation code, and generating interface storage paths for different interface types based on the interface type and the table identifier.
[0011] Optionally, there are multiple preset interface code templates, and each interface code template has a corresponding general storage path; mapping and generating the interface of the table data according to the interface storage path and the preset interface code template includes: performing character matching between the interface storage path and each of the general storage paths, and using the interface code template corresponding to the successfully matched general storage path as the target interface code template for mapping; determining interface parameters according to the fields and field types of the table data; and generating the interface of the table data according to the target interface code template and the interface parameters.
[0012] Optionally, based on the field, the field type, the field value, and the table identifier, a pre-established table data creation code is invoked to create table data, including: establishing a mapping relationship between the field and a preset table field, and a mapping relationship between the field type and a preset table field type, according to a preset mapping rule, obtaining a field mapping relationship and a field type mapping relationship; marking the field mapping relationship and the field type mapping relationship with the table identifier and storing them in an information table; performing type conversion on the field value according to the table field type corresponding to the field type; establishing a correspondence between the type-converted field value and the table field according to the table field corresponding to the field; storing the table field and the corresponding type-converted field value in a data table and associating the data table with the information table; using the information table and the corresponding data table as the created table data.
[0013] Optionally, the method further includes: in response to receiving a request to add a field for the table data, determining the new table field corresponding to the new field, and the new table field type corresponding to the field type of the new field; adding the new field and the corresponding new table field to the field mapping relationship, and adding the field type of the new field and the corresponding new table field type to the field type mapping relationship; converting the field value of the new field according to the new table field type, and storing the type-converted field value and the corresponding new table field into the data table.
[0014] Optionally, after storing the converted field values and the corresponding newly added table fields into the data table, the method further includes: determining whether the newly added field request has a default value; if the default value exists, converting the default value according to the type of the newly added table field, and using the converted default value to synchronously modify the value of the corresponding historical data in the newly added table field.
[0015] According to a second aspect of the present invention, a method for invoking an interface is provided, comprising:
[0016] In response to receiving an interface call request from the requester, the table identifier of the table data contained in the definition of the interface is obtained. The interface is used to operate on the table data and is generated during the process of calling the table data creation code.
[0017] Based on the table identifier, the input parameters of the interface are converted, and the interface is called through the interface definition using the converted input parameters to operate on the table data;
[0018] In response to receiving the operation result returned by the interface, the operation result is returned to the requesting party.
[0019] Optionally, the table data includes an information table and a data table; the information table stores field mapping relationships and field type mapping relationships with table identifiers; the input parameters of the interface are converted according to the table identifier, including: finding the field mapping relationship and field type mapping relationship corresponding to the table identifier in the information table; converting the input parameter fields of the interface into table fields according to the field mapping relationship; and converting the input parameter field types of the interface into table field types according to the field type mapping relationship.
[0020] According to a third aspect of the present invention, a request processing apparatus is provided, comprising:
[0021] The information acquisition module is used to respond to a table data creation request sent by the requester and obtain the fields, field types, corresponding field values, and table identifier of the table data.
[0022] The request processing module is used to call a pre-established table data creation code to create table data based on the field, the field type, the field value and the table identifier. During the process of calling the table data creation code, the module generates an interface storage path for the table data and maps and generates an interface for operating the table data and the definition of the interface based on the interface storage path and a preset interface code template.
[0023] The result return module is used to return the table data and the definition of the interface to the requester.
[0024] According to a fourth aspect of the present invention, a requested electronic processing apparatus is provided, comprising:
[0025] One or more processors;
[0026] Storage device for storing one or more programs.
[0027] When the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in the first aspect of the embodiments of the present invention.
[0028] According to a fifth aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method provided in the first aspect of the present invention.
[0029] One embodiment of the invention has the following advantages or beneficial effects: By responding to a table data creation request sent by a requester, the invention obtains the fields, field types, corresponding field values, and table identifier of the table data; based on the fields, field types, field values, and table identifier, it calls pre-established table data creation code to create the table data; and during the process of calling the table data creation code, it generates an interface storage path for the table data; based on the interface storage path and a preset interface code template, it maps and generates an interface for operating the table data and the interface definition; and returns the table data and interface definition to the requester. This technical solution achieves an efficient and user-friendly request processing method, generating the corresponding interface while creating the table data, eliminating the need for separate interface generation, greatly improving interface generation efficiency, and saving manpower and time. Attached Figure Description
[0030] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:
[0031] Figure 1 This is a schematic diagram of the main flow of a request processing method according to an embodiment of the present invention;
[0032] Figure 2 This is a schematic diagram of the table data update operation corresponding to the newly added field in an embodiment of the present invention;
[0033] Figure 3 This is a schematic diagram of the table data update operation corresponding to the field modification in an embodiment of the present invention;
[0034] Figure 4 This is a schematic diagram illustrating the principle of interface calls in an embodiment of the present invention;
[0035] Figure 5 This is a schematic diagram illustrating the overall process of creating table data according to an embodiment of the present invention;
[0036] Figure 6 This is a schematic diagram illustrating the composition of table data in an embodiment of the present invention;
[0037] Figure 7 This is a schematic diagram of the main modules of a request processing apparatus according to an embodiment of the present invention;
[0038] Figure 8 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;
[0039] Figure 9This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation
[0040] It should be noted that the acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0041] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0042] The existing method of manually writing interface code results in high code repetition. Every time a new table is created, corresponding interface code needs to be developed and written. This repetitive work not only wastes human resources, but also has low interface generation efficiency, and cannot well meet the needs of practical applications.
[0043] To address the aforementioned problems in existing technologies, this invention proposes a request processing method that automatically generates interfaces for operating on table data while creating the table data according to requirements. Furthermore, it supports the generation of various interface types. As long as the required interface code templates are pre-written, all subsequent table data can directly generate corresponding interfaces. This achieves an efficient and user-friendly request processing method, generating corresponding interfaces simultaneously with table data creation, eliminating the need for separate interface generation, significantly improving interface generation efficiency, saving manpower and time, and providing a wider range of interface types to better meet the needs of various business scenarios.
[0044] Figure 1 This is a schematic diagram of the main flow of a request processing method according to an embodiment of the present invention, as shown below. Figure 1 As shown, the request processing method of this embodiment of the invention includes the following steps S101 to S103.
[0045] Step S101: In response to receiving the table data creation request sent by the requester, obtain the fields, field types, corresponding field values, and table identifier of the table data.
[0046] Specifically, table creation is primarily used to store and organize related data, and table data exists in various business scenarios. Users send table creation requests to the system through the client, directly inputting the necessary information for the table to be created on the page: table name, table identifier, fields contained in the table data, the type of each field, and the corresponding field value. For example, the table name is "Statistics Table," the table identifier is "T1," the fields include "name" and "age," the corresponding field types are "string" and "int," and the corresponding field values are "zhangsan" and "20." The page encapsulates the received necessary information for creating the table data into a table creation request and sends it to the table creation system. The table creation system parses the received table creation request to obtain the fields contained in the table data to be created, the field types, the corresponding field values, and the table identifier of the table data.
[0047] Step S102: Based on the field, the field type, the field value, and the table identifier, call the pre-established table data creation code to create table data. During the process of calling the table data creation code, generate the interface storage path of the table data. Based on the interface storage path and the preset interface code template, map and generate the interface for operating the table data and the definition of the interface.
[0048] Specifically, the purpose of creating table data is to provide convenient data storage services for requesters. Inevitably, operations such as adding, deleting, modifying, and querying the data will be performed. Essentially, the existence of table data and the existence of operation interfaces are inherently interdependent. Therefore, this embodiment of the invention pre-develops code for creating table data and defines a method for generating the interface storage path for table data according to agreed-upon rules. The table creation system uses the obtained fields, field types, field values, and table identifier as input parameters to the table data creation code, calls the pre-established table data creation code, creates the table data, and simultaneously generates the interface storage path corresponding to the interface that can operate on the table data. Then, combined with a pre-developed interface code template, the interface storage path is mapped and associated with the interface code template to generate the interface for the table data, as well as the definition of the interface.
[0049] According to one embodiment of the present invention, table data is created by calling pre-established table data creation code based on the field, the field type, the field value, and the table identifier. This includes: establishing a mapping relationship between the field and a preset table field, and a mapping relationship between the field type and a preset table field type, according to preset mapping rules, obtaining field mapping relationships and field type mapping relationships; marking the field mapping relationships and field type mapping relationships with the table identifier and storing them in an information table; performing type conversion on the field value according to the table field type corresponding to the field type; establishing a correspondence between the type-converted field value and the table field according to the table field corresponding to the field; storing the table field and the corresponding type-converted field value in a data table and associating the data table with the information table; and using the information table and the corresponding data table as the created table data.
[0050] Specifically, considering existing methods for processing table data, tables with different structures typically require separate table creation. For example, there might be tables for order statistics, items for sale statistics, and logistics customer statistics. This necessitates creating three different tables, which can amount to hundreds or even thousands in a comprehensive business scenario. Excessive table data can hinder subsequent operations and management. This invention addresses this issue by using a homogenized design for tables with different structures. It employs two types of tables—information tables and data tables—to accommodate creation requests for all table structures. The information table primarily stores field mappings and field type mappings, while the data table stores data from various tables. Standard table fields and field types are pre-defined for use in the data table. Considering that data is generally stored in string format, this invention sets the table field type to string. The standard table fields are defined as: field1, field2, field3, ..., fieldn.
[0051] Furthermore, based on the fields in the table data creation request, a mapping relationship between the fields and table fields is established according to the order mapping rules. For example, if there are fields: name, age, and sex, then the mapping relationship between the table fields is name-field1, age-field2, and sex-field3. Similarly, based on the field type of the field name being string, the field type of the field age being int, and the field type of the field sex being boolean, there are field type mapping relationships string-string, int-string, and sex-string. This embodiment of the invention uses a field mapper to store field mapping relationships and a field type mapper to store field type mapping relationships, and marks the table identifier on both the field mapper and the field type mapper to distinguish table data with different structures. Table 1(a) below shows an example of a field mapper, and Table 1(b) below shows an example of a field type mapper.
[0052] Furthermore, based on the field mapper and field type mapper in the information table, the corresponding table field type is determined, and the field values are converted according to the corresponding table field type. Then, based on the corresponding table field, a correspondence is established between the table field and the converted field value. The table field and its corresponding converted field value are stored in the data table, and the data stored in the data table is identified by a table identifier to link the information table. Of course, other character mapping methods can also be used to link the information table. Finally, the table data exists in the form of an information table and its corresponding data table.
[0053] According to another embodiment of the present invention, the method further includes: in response to receiving a request to add a field for the table data, determining the new table field corresponding to the new field and the new table field type corresponding to the field type of the new field; adding the new field and the corresponding new table field to the field mapping relationship, adding the field type of the new field and the corresponding new table field type to the field type mapping relationship; converting the field value of the new field according to the new table field type, and storing the type-converted field value and the corresponding new table field into the data table.
[0054] Specifically, the structure of the table data constructed above may change as business upgrades require. When there is a need to add new fields, this embodiment of the invention does not require recreating the table data; it only needs to specify the new field and its corresponding new field type. According to the mapping rules, the new table field corresponding to the new field and the new table field type corresponding to the new field type are determined. The new field and its corresponding new table field are added to the corresponding field mapping relationship according to the table identifier; the new field type and its corresponding new table field type are added to the corresponding field type mapping relationship according to the table identifier. Finally, the field value of the new field is type-converted according to the new table field type, and the converted field value and its corresponding new table field are stored in the area corresponding to the table identifier in the data table.
[0055] With the method of this invention, when the table structure changes and is updated, it is only necessary to modify the field mapping relationship and the field type mapping relationship, and store the corresponding field values in the data table after type conversion, thus avoiding the need to create a new table.
[0056] According to another embodiment of the present invention, after storing the converted field value and the corresponding new table field into the data table, the method further includes: determining whether the new field request has a field default value; if the field default value has a field default value, converting the field default value according to the new table field type, and using the type-converted field default value to synchronously modify the value of the corresponding historical data in the new table field in the data table.
[0057] Specifically, since new fields in the table are added during usage, the corresponding historical data in the table will be empty for these new fields. When a new field is a common attribute, a default value can be set when adding it. For example, in a personnel statistics table for the same department, the initial fields are only name, age, and gender. If a department name needs to be added, the department name in the previous historical data will not have a specific value. To maintain data integrity, a default value can be set to "Department A," so that the department name is also synchronized in the personnel information in the historical data. Therefore, after storing the converted field value and the corresponding new table field into the table, it is necessary to determine whether the new field request has a default value. If so, the default value should be converted to the type of the new table field, and the converted default value should be used to synchronously modify the value of the new table field corresponding to the new field in the historical data of the table identifier in the table to ensure data integrity. Of course, for new fields with individual differences, this default field value cannot be used, and there is no need to configure a default value.
[0058] Figure 2This diagram illustrates the table data update operation corresponding to a newly added field in this embodiment of the invention. The diagram only shows the case where the newly added field has no corresponding field value. Upon receiving a request to add a field to the table data, the table identifier is obtained; the system checks if the newly added field is duplicated, i.e., whether the newly added field already exists in the table data. If it does, the process ends directly. If not, the system modifies the field mapper corresponding to the table identifier based on the newly added table field; and modifies the field type mapper corresponding to the table identifier based on the newly added table field type. Finally, it determines whether the newly added field request has a default value. If it does, a type conversion is performed, and the value of the historical data corresponding to the table identifier in the newly added table field is synchronously modified. If there is no default value, the process ends directly.
[0059] Understandably, embodiments of the present invention also support modification of field content in table data. In response to receiving a field modification request for table data, the original field and the corresponding modified field are obtained; the original field in the field mapping relationship is modified to the modified field, and the data is saved and submitted.
[0060] Figure 3 This is a schematic diagram of the table data update operation corresponding to field modification in an embodiment of the present invention. The table building system receives a field modification request for table data, obtains the original field and the corresponding modified field; first, it determines whether the modified field is duplicated, that is, whether it exists in the table data. If it is duplicated, the process ends directly; if it is not duplicated, the modified field is used to replace the original field corresponding to the original table field, the field mapper is modified, the original field in the field mapping relationship is changed to the modified field, and the process is saved and submitted.
[0061] According to another embodiment of the present invention, in the process of calling the table data creation code, generating an interface storage path for the table data interface includes: determining the interface type corresponding to the table data; generating code using the interface storage path in the table data creation code, and generating interface storage paths for different interface types according to the interface type and the table identifier.
[0062] Specifically, this embodiment of the invention considers the inherent correlation between table data creation and interface generation, therefore, the code for generating the interface storage path is also incorporated into the table data creation code. Furthermore, considering that table data operations have different requirements in various business scenarios—while adding, deleting, modifying, and querying are the four basic operations, there may also be other operation requirements such as paginated lists and search lists—this embodiment of the invention summarizes commonly used interface types, or defines corresponding interface types according to business domains, determining the corresponding interface type based on the business domain where the table data resides. Then, using the interface storage path generation code in the table data creation code, different interface storage paths are generated based on the determined interface type and table identifier. For example, for a save-type interface, where the table identifier corresponding to the current table data is bodyData, this invention uses a Uniform Resource Locator (URL) as the storage path. Therefore, the storage path for the save-type interface generated by the code is: http: / / domain / table / bodyData / save, where the domain is a pre-assigned domain name, determined according to the specific system.
[0063] According to another embodiment of the present invention, the number of preset interface code templates is multiple, and each interface code template has a corresponding general storage path; mapping and generating the interface of the table data according to the interface storage path and the preset interface code template includes: performing character matching between the interface storage path and each of the general storage paths, and using the interface code template corresponding to the successfully matched general storage path as the target interface code template for mapping; determining interface parameters according to the fields and field types of the table data; and generating the interface of the table data according to the target interface code template and the interface parameters.
[0064] Specifically, the interface code templates in this embodiment of the invention are usually multiple, covering the needs of various users as much as possible. They are pre-developed as code templates by R&D personnel, and a corresponding general storage path is assigned to each interface code template according to the agreed storage path determination rules. In this embodiment of the invention, a URL is used to represent the storage path, as shown in Table 2 below: where tableCode is the table identifier.
[0065] Furthermore, the generated interface storage path and various general storage paths are matched character by character. In this embodiment of the invention, a successful match is considered successful as long as the format matches and all characters other than the domain name and tableCode are matched. Through matching, the target interface code template is mapped to find the target interface code template. Then, based on the fields and field types of the table data and the type of the interface, the input and output parameters of the interface are determined. Finally, the interface parameters are connected to the target interface code template to generate an interface that can manipulate table data, and an interface definition containing the table identifier is generated based on the generated interface.
[0066] Understandably, in order to facilitate the use of the generated interface by the requester creating the table data, the definition of the generated interface in this embodiment of the invention has been optimized. In addition to displaying the name of the interface, examples of input and output parameters are also displayed on the front end so that users can correctly use the interface generated by the system.
[0067] Based on the table data and corresponding interface generated from the above-described request processing, this embodiment of the invention also provides an interface invocation method, comprising: in response to receiving an interface invocation request sent by a requester, obtaining a table identifier of the table data contained in the definition of the interface, wherein the interface is used to operate on the table data and is generated during the process of invoking the table data creation code; converting the input parameters of the interface according to the table identifier, and using the converted input parameters to invoke the interface through the definition of the interface to operate on the table data; and in response to receiving the operation result returned by the interface, returning the operation result to the requester.
[0068] Specifically, when the requesting party uses the interface generated by the aforementioned table data creation code to operate on the table data, it sends an interface call request. This request includes the interface's input parameters and definition. When the database system receives the interface call request, it retrieves the table identifier from the interface definition. The table data at this point is also constructed using the aforementioned table data construction method. Based on the table identifier, it queries the corresponding input parameter conversion rule and converts the interface's input parameters into internal parameters consistent with the table data's internal fields. Using these internal parameters—the converted input parameters—the interface is called through its definition to perform operations on the table data. Finally, the returned value from the interface is returned to the requesting party.
[0069] According to one embodiment of the present invention, the table data includes an information table and a data table; the information table stores field mapping relationships and field type mapping relationships with table identifiers; the input parameters of the interface are converted according to the table identifiers, including: searching for the field mapping relationship and field type mapping relationship corresponding to the table identifier in the information table; converting the input parameter fields of the interface into table fields according to the field mapping relationships; and converting the input parameter field types of the interface into table field types according to the field type mapping relationships.
[0070] Specifically, the table data in this embodiment of the invention is created by the aforementioned table data creation code. Therefore, the table data exists in the form of both information tables and data tables. After obtaining the table identifier, the information table is searched for the field mapping relationship and field type mapping relationship corresponding to the table identifier. Based on the found field mapping relationship and field type mapping relationship, the fields of the interface input parameters are converted to obtain the table fields and table field types corresponding to the input parameters. Then, the table fields and table field types are used to operate on the data in the data table.
[0071] It should be noted that for query operations, since the data in the data table is to be returned, and the data in the data table is stored as table fields and table field types, before returning the interface result, it is necessary to restore the table field and table field type data in the query result to field and field type data according to the field mapping relationship and field type mapping relationship.
[0072] Figure 4 This is a schematic diagram illustrating the principle of interface calls in an embodiment of the present invention. Taking the save type interface and query type interface as examples, the requesting party needs to save name: zhangsan, age: 12, sex: true to the table data identified by table code, and sends a request to call the save interface. After receiving the request, the database system of the table data obtains the table identifier, and according to the field mapping relationship and field type mapping relationship in the information table, converts name, age, and sex into the corresponding table characters field1, field2, and field3, and converts the types of zhangsan, 12, and true into the string types "zhangsan", "12", and "1". Using the table identifier code as the boundary, field1 "zhangsan", field2 "12", and field3 "1" are saved in the data table. Similarly, for the query interface, when the system receives a query interface call request, it obtains the table identifier code from it, and queries the data table for field1 "zhangsan", field2 "12", and field3 "1" under code. Based on the field mapping relationship and field type mapping relationship in the associated information table, it restores field1, field2, and field3 to name, age, and sex, and restores "zhangsan", "12", and "1" to zhangsan, 12, and true, thus obtaining the returned query results.
[0073] Figure 5This is a schematic diagram of the overall process for creating table data according to an embodiment of the present invention. Upon receiving a table data creation request, the table data to be created undergoes a duplicate check to ensure that the table data does not currently exist in the database and that the fields it contains are unique. Next, rule checks are performed on the field mapping relationships in the field mapper and the field type mapping relationships in the field type mapper; after passing the checks, the data in each mapper is saved to the information table. Furthermore, code is generated using the interface storage path in the table data creation code to generate the interface for operating the table data and interface information, such as interface parameters. Subsequently, the data table storing the data is associated with the information table through a table identifier, saving other information about the table data creation, such as creation time and requester information. Understandably, if a check exception occurs during the above verification process, a creation failure message is returned to the requester so that the requester is aware of the reason and can make adjustments accordingly.
[0074] Figure 6 This is a schematic diagram illustrating the composition of table data in an embodiment of the present invention. As can be seen, table data is stored in the database in the form of information tables and data tables. The information table mainly includes a table identifier, a field mapper, and a field type mapper. The data table is mainly used to store the data corresponding to specific table fields. The interface storage path generation code mentioned in this embodiment can be stored in the information table construction code to ensure that the data table only stores data-related information.
[0075] The request processing method of this invention generates interfaces simultaneously with the creation of table data. Furthermore, based on the field mapping and field type mapping relationships in the information table, heterogeneous table data can be aggregated. Multiple table data structures can be stored using only the information table and the data table, eliminating the need for repetitive interface code development for different table structures. Moreover, through the mapping relationship between the interface storage path and the interface code template, multiple interfaces required by multiple data tables can be generated based on the same set of interface code templates, greatly improving the efficiency of interface generation and saving labor costs.
[0076] Figure 7 This is a schematic diagram of the main modules of a request processing apparatus according to an embodiment of the present invention. Figure 7 As shown, the request processing device 700 mainly includes an information acquisition module 701, a request processing module 702, and a result return module 703.
[0077] The information acquisition module 701 is used to respond to a table data creation request sent by the requester and acquire the fields, field types, corresponding field values, and table identifier of the table data.
[0078] The request processing module 702 is used to call a pre-established table data creation code to create table data according to the field, the field type, the field value and the table identifier, and generate the interface storage path of the table data during the process of calling the table data creation code. According to the interface storage path and the preset interface code template, an interface for operating the table data and the definition of the interface are mapped and generated.
[0079] The result return module 703 is used to return the table data and the definition of the interface to the requester.
[0080] According to an embodiment of the present invention, the request processing module 702 is further configured to: determine the interface type corresponding to the table data; generate code using the interface storage path in the code created by the table data; and generate interface storage paths for different interface types according to the interface type and the table identifier.
[0081] According to another embodiment of the present invention, the number of preset interface code templates is multiple, and each interface code template has a corresponding general storage path; the request processing module 702 is further configured to: perform character matching between the interface storage path and each of the general storage paths, and use the interface code template corresponding to the successfully matched general storage path as the target interface code template for mapping; determine interface parameters according to the fields and field types of the table data; and generate the interface of the table data according to the target interface code template and the interface parameters.
[0082] According to another embodiment of the present invention, the request processing module 702 is further configured to: establish a mapping relationship between the field and a preset table field, and a mapping relationship between the field type and a preset table field type, according to a preset mapping rule, to obtain a field mapping relationship and a field type mapping relationship; mark the field mapping relationship and the field type mapping relationship with the table identifier and store them in an information table; perform type conversion on the field value according to the table field type corresponding to the field type; establish a correspondence between the type-converted field value and the table field according to the table field corresponding to the field; store the table field and the corresponding type-converted field value in a data table and associate the data table with the information table; and use the information table and the corresponding data table as the created table data.
[0083] According to another embodiment of the present invention, the request processing device 700 further includes a table data field addition module (not shown in the figure), configured to: in response to receiving a request to add a field for the table data, determine the new table field corresponding to the new field, and the new table field type corresponding to the field type of the new field; add the new field and the corresponding new table field to the field mapping relationship, and add the field type of the new field and the corresponding new table field type to the field type mapping relationship; perform type conversion on the field value of the new field according to the new table field type, and store the type-converted field value and the corresponding new table field into the data table.
[0084] According to another embodiment of the present invention, the request processing device 700 further includes a table data synchronization module (not shown in the figure), which is used to: after storing the converted field value and the corresponding new table field into the data table, determine whether the new field request has a field default value; if the field default value has a field default value, convert the field default value according to the type of the new table field, and use the type-converted field default value to synchronously modify the value of the corresponding historical data in the new table field in the data table.
[0085] Figure 8 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied.
[0086] like Figure 8 As shown, system architecture 800 may include terminal devices 801, 802, and 803, a network 804, and a server 805. Network 804 serves as the medium for providing communication links between terminal devices 801, 802, and 803 and server 805. Network 804 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.
[0087] Users can use terminal devices 801, 802, and 803 to interact with server 805 via network 804 to receive or send messages, etc. Various communication client applications, such as request processing applications, can be installed on terminal devices 801, 802, and 803 (for example only).
[0088] Terminal devices 801, 802, and 803 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0089] Server 805 can be a server providing various services, such as a backend management server supporting requests made by users using terminal devices 801, 802, and 803 (for example only). The backend management server can respond to a table data creation request sent by the requester by obtaining the fields, field types, corresponding field values, and table identifier of the table data; based on the fields, field types, field values, and table identifier, it can call pre-established table data creation code to create the table data. During the process of calling the table data creation code, it can generate an interface storage path for the table data, and based on the interface storage path and a preset interface code template, it can map and generate an interface for operating the table data and the definition of the interface; it can then return the table data and the interface definition to the requester for processing, and feed back the processing result (e.g., a returned result – for example only) to the terminal device.
[0090] It should be noted that the request processing method provided in the embodiments of the present invention is generally executed by the server 805, and correspondingly, the request processing device is generally set in the server 805.
[0091] It should be understood that Figure 8 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0092] The following is for reference. Figure 9 It shows a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Figure 9 The terminal device or server shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.
[0093] like Figure 9 As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 902 or programs loaded from storage section 908 into random access memory (RAM) 903. The RAM 903 also stores various programs and data required for the operation of the system 900. The CPU 901, ROM 902, and RAM 903 are interconnected via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0094] The following components are connected to I / O interface 905: an input section 906 including a keyboard, mouse, etc.; an output section 907 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to I / O interface 905 as needed. A removable medium 911, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 910 as needed so that computer programs read from it can be installed into storage section 908 as needed.
[0095] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 909, and / or installed from removable medium 911. When the computer program is executed by central processing unit (CPU) 901, it performs the functions defined above in the system of this invention.
[0096] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0097] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0098] The units described in the embodiments of the present invention can be implemented in software or in hardware. The described units can also be housed in a processor; for example, a processor can be described as including: an information acquisition module, a request processing module, and a result return module.
[0099] In some cases, the names of these modules do not constitute a limitation on the module itself. For example, the result return module can also be described as "a module for returning the table data and the definition of the interface to the requester".
[0100] On the other hand, the present invention also provides a computer-readable medium, which may be included in the device described in the embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to: in response to receiving a table data creation request sent by a requester, obtain the fields, field types, corresponding field values, and table identifier of the table data; based on the fields, field types, field values, and table identifier, call pre-established table data creation code to create the table data, and during the invocation of the table data creation code, generate an interface storage path for the table data; based on the interface storage path and a preset interface code template, map and generate an interface for operating the table data and the definition of the interface; and return the table data and the interface definition to the requester.
[0101] The technical solution according to the embodiments of the present invention has the following advantages or beneficial effects: by responding to a table data creation request sent by a requester, obtaining the fields, field types, corresponding field values, and table identifier of the table data; calling pre-established table data creation code based on the fields, field types, field values, and table identifier to create the table data, and generating an interface storage path for the table data during the process of calling the table data creation code; mapping and generating an interface for operating the table data and the interface definition based on the interface storage path and a preset interface code template; and returning the table data and interface definition to the requester, the technical solution realizes an efficient and user-friendly request processing method. It generates the corresponding interface while creating the table data, eliminating the need for separate interface generation, greatly improving the efficiency of interface generation, and saving manpower and time.
[0102] The specific embodiments described herein do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method of processing a request, characterized by, The method comprises the following steps: In response to receiving a table data creation request sent by a requester, obtaining fields, field types, corresponding field values and a table identifier of the table data; According to the fields, the field types, the field values and the table identifier, calling a pre-established table data creation code to create table data, and in the process of calling the table data creation code, generating an interface storage path of the table data, and according to the interface storage path and a preset interface code template, mapping and generating an interface for operating the table data and a definition of the interface; Returning the table data and the definition of the interface to the requester.
2. The method of claim 1, wherein, In the process of calling the table data creation code, the interface storage path of the table data interface is generated, comprising: Determining an interface type corresponding to the table data; Using an interface storage path generation code in the table data creation code, generating an interface storage path of different interface types according to the interface type and the table identifier.
3. The method of claim 1, wherein, The number of the preset interface code templates is multiple, and each of the interface code templates has a corresponding general storage path; According to the interface storage path and the preset interface code template, the interface of the table data is mapped and generated, comprising: Performing character matching on the interface storage path and each of the general storage paths, and taking an interface code template corresponding to a general storage path that is successfully matched as a target interface code template of mapping; Determining an interface parameter according to the fields and the field types of the table data; Generating the interface of the table data according to the target interface code template and the interface parameter.
4. The method of claim 1, wherein, According to the fields, the field types, the field values and the table identifier, calling a pre-established table data creation code to create table data, comprising: According to a preset mapping rule, establishing a mapping relationship between the fields and preset table fields, and a mapping relationship between the field types and preset table field types, obtaining a field mapping relationship and a field type mapping relationship, marking the table identifier on the field mapping relationship and the field type mapping relationship, and storing the field mapping relationship and the field type mapping relationship in an information table; According to a table field type corresponding to the field type, performing type conversion on the field values; according to a table field corresponding to the field, establishing a corresponding relationship between the type-converted field values and the table field, storing the table field and the corresponding type-converted field values in a data table, and associating the data table with the information table; The information table and the corresponding data table are taken as the created table data.
5. The method of claim 4, wherein, The method further comprises: In response to receiving an added field request for the table data, determining an added table field corresponding to the added field, and an added table field type corresponding to a field type of the added field; adding the added field and the corresponding added table field to the field mapping relationship, and adding the field type of the added field and the corresponding added table field type to the field type mapping relationship; Performing type conversion on the field values of the added field according to the added table field type, and storing the type-converted field values and the corresponding added table field in the data table.
6. The method of claim 5, wherein, After the converted field value and the corresponding new table field are stored in the data table, the method further includes: determining whether the new field request has a field default value, and in the case of the field default value, type-converting the field default value according to the new table field type, and synchronously modifying the value of the corresponding historical data in the new table field in the data table using the type-converted field default value.
7. A method of invoking an interface, characterized by, Comprise: in response to receiving an interface call request sent by a requestor, obtaining a table identifier of table data contained in a definition of the interface, the interface being used for operating the table data, and the interface being generated in a process of calling table data creation code; according to the table identifier, converting an input parameter of the interface, and calling the interface through the definition of the interface using the converted input parameter to operate the table data; in response to receiving an operation result returned by the interface, returning the operation result to the requestor.
8. The method of claim 7, wherein, The table data comprises an information table and a data table; the information table stores a field mapping relationship and a field type mapping relationship with a table identifier; according to the table identifier, converting an input parameter of the interface, comprises: finding the field mapping relationship and the field type mapping relationship corresponding to the table identifier from the information table; according to the field mapping relationship, converting the input field of the interface into a table field; and according to the field type mapping relationship, converting the input field type of the interface into a table field type.
9. A processing device of a request, characterized by, Comprise: an information acquisition module, configured to, in response to receiving a table data creation request sent by a requestor, acquire a field, a field type, a corresponding field value and a table identifier of table data; a request processing module, configured to, according to the field, the field type, the field value and the table identifier, call pre-established table data creation code to create table data, and in a process of calling the table data creation code, generate an interface storage path of the table data, and according to the interface storage path and a preset interface code template, map to generate an interface for operating the table data and a definition of the interface; a result returning module, configured to return the table data and the definition of the interface to the requestor.
10. A mobile electronic device terminal, characterized by Comprise: one or more processors; a storage device configured to store one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method in any one of claims 1-6.
11. A computer readable medium having stored thereon a computer program, characterized in that The program is executed by the processor to implement the method in any one of claims 1-6.