CN114443015A - Method for generating adding, deleting, modifying and checking service interface based on database metadata - Google Patents
Method for generating adding, deleting, modifying and checking service interface based on database metadata Download PDFInfo
- Publication number
- CN114443015A CN114443015A CN202210110750.9A CN202210110750A CN114443015A CN 114443015 A CN114443015 A CN 114443015A CN 202210110750 A CN202210110750 A CN 202210110750A CN 114443015 A CN114443015 A CN 114443015A
- Authority
- CN
- China
- Prior art keywords
- data
- metadata
- database
- api
- user
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
- G06F8/315—Object-oriented languages
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/25—Integrating or interfacing systems involving database management systems
Abstract
The invention relates to a method for generating an add-delete-modify-check service interface based on database metadata, which comprises the following steps: step 1, preparing the previous data of metadata; step 2, determining tableId corresponding to the main table according to the UUID and the name of the data table; and 3, generating the database metadata addition, deletion, modification and check API interface. The technical scheme has the advantages that: the method is suitable for scenes of relationships among complex tables; adapting to the scene of the change of the data structure; the method and the device realize that the user permission can be controlled by configuring the attributes of the API, ensure the safety of the interface, reduce the workload of manually and repeatedly compiling the SQL statement and improve the development efficiency.
Description
Technical Field
The invention relates to a generation method, in particular to a generation method of an add-delete-modify-check service interface based on database metadata, and belongs to the technical field of database metadata processing.
Background
With the rapid development of information technology, data is increasing, and the need for data addition, deletion, modification and check services among multiple tables is increasing.
1. When the data tables are numerous and the relationships among the tables are complex, field matching among the tables needs to be carried out manually, and it is difficult to quickly and conveniently merge data from a plurality of data tables into one data set for carrying out the operations of increasing, deleting, modifying and checking the database.
2. When the data structure changes or different query parameters are needed, only the sql can be rewritten to regenerate the interface, which brings great repeated development workload.
Therefore, a new solution to solve the above technical problems is urgently needed.
Disclosure of Invention
The invention provides a method for generating an add-delete check-up service interface based on metadata of a database aiming at the problems in the prior art, which is used for solving the problem that SQL (structured query language) needs to be rewritten to generate the add-delete check-up service interface under the scenes of complex inter-table relation, data structure change and the like and simultaneously realizing that the data security of the interface can be ensured by configuring the attribute of the interface to control the user access authority. The method comprises the following steps: a user configures a service database through a front-end page, configures a timing task in a metadata management page, and automatically reads a table and a table structure in the database through JDBC, wherein the information including table names, field types, precision, length and field remarks is stored in a metadata list; the user selects the data table, the field length, the precision, the type and the service attribute of the data table can be modified, such as the incidence relation among a primary key generation rule, a field generation rule and the table, and the modified configuration can be stored in the metadata table; the system determines the tableId corresponding to the main table through UUID (Universal Unique identifier) and the data table name; calling and executing actions on the API according to the URL address and the tableId appointed by the front end and the back end, and returning a result set; the user can configure the user authority of the API, control the access authority among the table resources to ensure the safety of the data;
in order to achieve the above object, the technical solution of the present invention is a method for generating an add-delete-modify-check service interface based on metadata of a database, wherein the method comprises the following steps:
step 1, preparing the early data of metadata;
step 2, determining tableId corresponding to the main table according to the UUID and the name of the data table;
and 3, generating a metadata addition, deletion, modification and check API interface.
As an improvement of the present invention, step 1, the previous data preparation of metadata is specifically as follows:
step 1.1, a user configures a service database through a front-end page;
step 1.2, configuring a timing task in a metadata management page, and automatically reading all tables, table fields and data in the tables in a database to a metadata list through JDBC;
step 1.3, the tables and table structures in the service database are shown in the metadata list: including table name, field type, field description;
step 1.4, a user selects a data table, and the length, the precision and the type of a field of the data table are configured; service attributes, such as primary key generation rules, may also be modified; and generating rules by the fields, configuring a data association relation table by using foreign keys and constraint relations among the tables, and storing modified configuration information in a metadata table.
As an improvement of the present invention, step 2, the tableId corresponding to the master table is determined according to the UUID and the name of the data table, specifically as follows,
step 2.1, the user acquires the data table and the table structure in the metadata according to the step 1 and presents the data table and the table structure to the user in a list form;
step 2.2, the user selects a table which needs to generate the API, and the system determines the tableId corresponding to the main table through UUID (Universal Unique identifier) and the data table name;
as an improvement of the present invention, step 3, database metadata addition, deletion, modification and check API interface generation, specifically as follows,
step 3.1, according to the URL address and the tableId appointed by the front end and the back end, and the API mapping of adding, deleting, modifying and checking;
step 3.2, repeating the step 2 to the step 3, and repeatedly creating a plurality of APIs for different tables, different parameters and different operations (increasing, deleting, modifying and checking);
step 3.3, when the operation data of the API is changed, calling the API by the appointed URL address and the tableID in the step 3.1;
step 3.4, the user checks the validity of the input parameters according to the parameter list corresponding to the url, such as: tableid, pageNo, pageSize, etc.;
step 3.5, the user can set the access authority relationship between the user and the table resource in the attribute configuration for protecting the safety of the data;
and 3.6, if the parameters are legal and the user has interface access authority, calling the API to perform the operations of increasing, deleting, modifying and checking the data table, serializing the result data according to the json format and returning the data to the front end for display, wherein the data in the background database is synchronously modified and the operations of increasing, deleting, modifying and checking the data table are not required to be performed on the background writing sql at the moment.
Compared with the prior art, the invention has the following advantages:
1) in the technical scheme, in the metadata preparation stage, the configuration of the data association relation table by using the foreign keys and the constraint relation between the tables is supported, the dynamic maintenance of the data association relation table is realized, the automatic generation of the API (application programming interface) of the database metadata addition, deletion, modification and check service is supported, and the workload of manually and repeatedly compiling SQL (structured query language) statements is reduced;
2) the method is suitable for the scene of data structure change, supports automatic generation of database metadata, and increases, deletes, changes and checks the API interface, improves the development efficiency and saves the cost;
3) the method can meet the control of the access authority of the API for increasing, deleting, modifying and checking the metadata of the database, and ensures the security of the data through the setting of the attribute of the API for increasing, deleting, modifying and checking the metadata of the database.
Drawings
Fig. 1 is an overall framework diagram of a method for generating an add-delete censoring service interface based on database metadata according to an embodiment of the present invention.
Detailed Description
For the purpose of enhancing an understanding of the present invention, the present embodiment will be described in detail below with reference to the accompanying drawings.
Example 1: referring to fig. 1, a method for generating an add-delete-modify-check service interface based on database metadata includes the following steps:
step 1, the previous data preparation of the metadata,
step 1.1, a user configures a service database through a front-end page;
step 1.2, configuring a timing task in a metadata management page, and automatically reading all tables, table fields and data in the tables in a database to a metadata list through JDBC;
step 1.3, the tables and table structures in the service database are shown in the metadata list: including table name, field type, field description;
step 1.4, a user selects a data table, and the length, the precision and the type of a field of the data table are configured; service attributes, such as primary key generation rules, may also be modified; and generating rules by the fields, configuring a data association relation table by using foreign keys and constraint relations among the tables, and storing modified configuration information in a metadata table.
Step 2, determining tableId corresponding to the main table according to the UUID and the name of the data table,
step 2.1, the user acquires the data table and the table structure in the metadata according to the step 1 and presents the data table and the table structure to the user in a list form;
step 2.2, the user selects a table which needs to generate the API, and the system determines the tableId corresponding to the main table through UUID (Universal Unique identifier) and data table name;
step 3, generating the database metadata addition, deletion, modification and check API interface,
step 3.1, according to the URL address and the tableId appointed by the front end and the back end, and the API mapping of adding, deleting, modifying and checking;
step 3.2 repeat step 2 to step 3, and repeatedly create a plurality of APIs for different tables, different parameters and different operations (increase, delete, change and check);
3.3, when the API operation data is changed, calling the API by the appointed URL address and the tableId in the step 3.1;
step 3.4, the user checks the validity of the input parameters according to the parameter list corresponding to the url, such as: tableeid, pageNo, pageSize, etc.;
step 3.5, the user can set the access authority relation between the user and the table resource in the attribute configuration for protecting the safety of the data;
and 3.6 if the parameters are legal and the user has interface access authority, calling the API to perform the operation of increasing, deleting, modifying and checking the data table, serializing the result data according to the json format and returning the data to the front end for display, and synchronously modifying the data in the background database at the moment without writing SQL in the background to perform the operation of increasing, deleting, modifying and checking the data table.
The embodiment provides a method for automatically generating the API (application programming interface) of the database metadata adding, deleting, modifying and checking service when the incidence relation or the data structure among complex tables changes, and SQL (structured query language) writing in a background is not needed.
According to one or more embodiments, referring to fig. 1, an interface generation system for an add-delete censorship service based on database metadata comprises a metadata module, a data interface module, and a data operation module,
the functions of the metadata module include:
configuring a service database, and regularly reading all tables, table fields and data in the tables in the database into a metadata list;
the functions of the data interface module include:
the field length, precision and type of the data table can be configured by selecting the structure of the data table acquisition table; service attributes, such as primary key generation rules, may also be modified; the system establishes URL addresses and tableids appointed by the front end and the rear end and the mapping of the adding, deleting, modifying and checking API (application programming interface) through UUID (universal Unique identifier) and tableId corresponding to a main table determined by a data table name;
the functions of the data operation module comprise:
and checking the parameter validity and the user access authority of the API, calling the API to perform addition, deletion, modification and check operations on the data table, serializing the result data according to a json format and returning the data to the front end for display, wherein the data in the background database is synchronously modified and finished.
And (3) a metadata newly added interface, namely executing a POST method according to the tableId acquired in the step (2), wherein specific example codes are as follows:
and (3) executing the DELETE method according to the tableId acquired in the step 2, wherein specific example codes are as follows:
and (3) executing the PUT method according to the tableId acquired in the step (2), wherein specific example codes are as follows:
executing a GET method according to the tableId acquired in the step 2, wherein specific example codes are as follows:
it should be noted that the above-mentioned embodiments are not intended to limit the scope of the present invention, and all equivalent modifications and substitutions based on the above-mentioned technical solutions are within the scope of the present invention as defined in the claims.
Claims (4)
1. A generation method of an add-delete check-change service interface based on database metadata is characterized by comprising the following steps:
step 1, preparing the early data of metadata;
step 2, determining tableId corresponding to the main table according to the UUID and the name of the data table;
and 3, generating the database metadata addition, deletion, modification and check API interface.
2. The method of claim 1, wherein the database metadata-based interface generation method for add, delete, and modify services,
step 1, preliminary data preparation of metadata, specifically as follows:
step 1.1, a user configures a service database through a front-end page;
step 1.2, configuring a timing task in a metadata management page, and automatically reading all tables, table fields and data in the tables in a database to a metadata list through JDBC;
step 1.3, the tables and table structures in the service database are shown in the metadata list: including table name, field type, field description;
step 1.4, a user selects a data table, and the length, the precision and the type of a field of the data table are configured; the business attribute and the primary key generation rule can be modified; and generating rules by the fields, configuring a data association relation table by using foreign keys and constraint relations among the tables, and storing modified configuration information in a metadata table.
3. The method of claim 2, wherein the database metadata-based interface generation method for add, delete, and modify services,
step 2, determining the tableId corresponding to the main table according to the UUID and the name of the data table, specifically as follows,
step 2.1, the user acquires the data table and the table structure in the metadata according to the step 1 and presents the data table and the table structure to the user in a list form;
and 2.2, selecting a table needing to generate the addition, deletion, modification and check service API by the user, and determining the tableId corresponding to the main table by the system through the UUID (Universal Unique identifier) and the data table name.
4. The method according to claim 3, wherein the database metadata-based interface generation method for add, delete, and modify services,
step 3, generating the database metadata adding, deleting, modifying and checking API interface, specifically as follows,
step 3.1, according to the URL address and the tableId appointed by the front end and the back end, and the API mapping of adding, deleting, modifying and checking;
step 3.2, repeating the step 2 to the step 3, and repeatedly creating a plurality of APIs for different tables, different parameters and different operations (increasing, deleting, modifying and checking);
step 3.3, when the operation data of the API is changed, calling the API by the appointed URL address and the tableID in the step 3.1;
step 3.4, the user checks the validity of the input parameters according to the parameter list corresponding to the url, such as: tableeid, pageNo, pageSize, etc.;
step 3.5, the user can set the access authority relationship between the user and the table resource in the attribute configuration for protecting the safety of the data;
and 3.6, if the parameters are legal and the user has interface access authority, calling the API to perform the operation of increasing, deleting, modifying and checking the data table, serializing the result data according to the json format and returning the data, and synchronously modifying and finishing the data in the background database without performing the operation of increasing, deleting, modifying and checking the data table by writing sql in the background.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210110750.9A CN114443015A (en) | 2022-01-29 | 2022-01-29 | Method for generating adding, deleting, modifying and checking service interface based on database metadata |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210110750.9A CN114443015A (en) | 2022-01-29 | 2022-01-29 | Method for generating adding, deleting, modifying and checking service interface based on database metadata |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114443015A true CN114443015A (en) | 2022-05-06 |
Family
ID=81371204
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210110750.9A Pending CN114443015A (en) | 2022-01-29 | 2022-01-29 | Method for generating adding, deleting, modifying and checking service interface based on database metadata |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114443015A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115422280A (en) * | 2022-11-04 | 2022-12-02 | 杭州西湖新基建数字技术有限公司 | Interface method for data addition, deletion and modification of uncertain data structure |
CN115687317A (en) * | 2022-10-21 | 2023-02-03 | 南京上游软件有限公司 | Method for realizing Java-end-based multi-branch tree object adding, deleting, modifying and checking service |
-
2022
- 2022-01-29 CN CN202210110750.9A patent/CN114443015A/en active Pending
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115687317A (en) * | 2022-10-21 | 2023-02-03 | 南京上游软件有限公司 | Method for realizing Java-end-based multi-branch tree object adding, deleting, modifying and checking service |
CN115687317B (en) * | 2022-10-21 | 2023-10-03 | 南京上游软件有限公司 | Method for realizing Java-end-based multi-way tree object adding, deleting and checking service |
CN115422280A (en) * | 2022-11-04 | 2022-12-02 | 杭州西湖新基建数字技术有限公司 | Interface method for data addition, deletion and modification of uncertain data structure |
CN115422280B (en) * | 2022-11-04 | 2023-02-14 | 杭州西湖新基建数字技术有限公司 | Interface method for increasing, deleting and modifying data of uncertain data structure |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107688500B (en) | Distributed task processing method, device, system and equipment | |
US11468103B2 (en) | Relational modeler and renderer for non-relational data | |
CN106951430B (en) | Account table query method and device | |
CN110908997B (en) | Data blood relationship construction method and device, server and readable storage medium | |
CN111177788A (en) | Hive dynamic desensitization method and dynamic desensitization system | |
CN114443015A (en) | Method for generating adding, deleting, modifying and checking service interface based on database metadata | |
WO2020135613A1 (en) | Data query processing method, device and system, and computer-readable storage medium | |
CN106294695A (en) | A kind of implementation method towards the biggest data search engine | |
CN109241384B (en) | Scientific research information visualization method and device | |
CN102708203A (en) | Database dynamic management method based on XML metadata | |
CN111818175B (en) | Enterprise service bus configuration file generation method, device, equipment and storage medium | |
CN110399368B (en) | Method for customizing data table, data operation method and device | |
CN111414378B (en) | Class metadata framework based on GraphQL | |
CA3176758A1 (en) | Method and apparatus for introducing data to a graph database | |
CN112364083A (en) | Data dictionary management method, system and storage medium based on configuration file | |
CN110795431B (en) | Environment monitoring data processing method, device, equipment and storage medium | |
CN113282599A (en) | Data synchronization method and system | |
CN103678591A (en) | Device and method for automatically executing multi-service receipt statistical treatment | |
CN111090803A (en) | Data processing method and device, electronic equipment and storage medium | |
CN113918149A (en) | Interface development method and device, computer equipment and storage medium | |
US11755631B2 (en) | Workflow-based dynamic data model and application generation | |
CN111198678A (en) | Method and device for generating GraphQL front-end operation interface | |
CN112667598A (en) | Data model rapid construction system based on business demand change | |
CN113722337B (en) | Service data determination method, device, equipment and storage medium | |
CN114610803A (en) | Data processing method and device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |