CN108268253B - Interface code generation method and terminal equipment - Google Patents

Interface code generation method and terminal equipment Download PDF

Info

Publication number
CN108268253B
CN108268253B CN201710312852.8A CN201710312852A CN108268253B CN 108268253 B CN108268253 B CN 108268253B CN 201710312852 A CN201710312852 A CN 201710312852A CN 108268253 B CN108268253 B CN 108268253B
Authority
CN
China
Prior art keywords
interface
field
authority
code
report document
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.)
Active
Application number
CN201710312852.8A
Other languages
Chinese (zh)
Other versions
CN108268253A (en
Inventor
张振伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201710312852.8A priority Critical patent/CN108268253B/en
Priority to PCT/CN2018/083549 priority patent/WO2018201895A1/en
Publication of CN108268253A publication Critical patent/CN108268253A/en
Application granted granted Critical
Publication of CN108268253B publication Critical patent/CN108268253B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems

Abstract

The invention provides an interface code generation method and terminal equipment, which are applicable to the technical field of computers, and the method comprises the following steps: establishing an interface field corresponding to an interface structure in a database based on the predefined interface structure; exporting the interface field through a report generation tool to generate a report document, receiving an interface field modification instruction sent by a user in the report document, and modifying the interface field of the report document; importing the modified report document, and updating the interface field in the database according to the modified report document; and filling the updated interface field into the code template so as to generate the interface code matched with the interface field. The invention ensures that developers can flexibly enter and modify the interface fields in the report document at any time without being limited by a visualization tool, thereby improving the maintenance efficiency of the interface fields; in the invention, the well-defined interface document can be directly synchronized into the code for use, thereby improving the development efficiency of developers.

Description

Interface code generation method and terminal equipment
Technical Field
The invention belongs to the technical field of computers, and particularly relates to an interface code generation method and terminal equipment.
Background
In a WEB development mode with front and back ends separated, a developer usually needs to define an interface document to specify the interface form, such as interface address, parameters, type, meaning, and the like. Various API management tools have been developed to enable developers to more efficiently manage interface documents. After the interface document is input and maintained by using a visual tool specifically provided by the API management tool, the correctness of a real interface can be automatically verified by analyzing the interface structure corresponding to the interface document besides the fact that reusable Mock data can be automatically generated, so that the development efficiency of developers is improved to a certain extent by the API management tool.
However, although the developer can enter and maintain the interface document through the visualization tool specifically provided by the API management tool, the well-defined interface document cannot be directly synchronized into the code for use, and thus it is difficult to further improve the development efficiency.
Disclosure of Invention
In view of this, embodiments of the present invention provide an interface code generation method and a terminal device, so as to solve the problem that it is difficult to further improve the development efficiency of developers because a defined interface document in the prior art cannot be directly synchronized into a code for use.
A first aspect of an embodiment of the present invention provides an interface code generation method, including:
establishing an interface field corresponding to an interface structure in a database based on the predefined interface structure;
exporting the interface field through a report generation tool to generate a report document, receiving an interface field modification instruction sent by a user in the report document, and modifying the interface field of the report document;
importing the modified report document, and updating an interface field in the database according to the modified report document;
and filling the updated interface field into a code template so that the code template generates an interface code matched with the updated interface field.
A second aspect of an embodiment of the present invention provides an interface code generation apparatus, including:
the maintenance module is used for establishing an interface field corresponding to the interface structure in a database based on a predefined interface structure;
the export module is used for exporting the interface field through a report generation tool to generate a report document, receiving an interface field modification instruction sent by a user in the report document and modifying the interface field of the report document;
the updating module is used for importing the modified report document and updating the interface field in the database according to the modified report document;
and the first generation module is used for filling the updated interface field into a code template so as to enable the code template to generate an interface code matched with the updated interface field.
A third aspect of the embodiments of the present invention provides a terminal device, where the terminal device includes a memory, a processor, and an interface code generation program that is stored in the memory and is executable on the processor, and the processor implements the following steps when executing the interface code generation program:
establishing an interface field corresponding to an interface structure in a database based on the predefined interface structure;
exporting the interface field through a report generation tool to generate a report document, receiving an interface field modification instruction sent by a user in the report document, and modifying the interface field of the report document;
importing the modified report document, and updating an interface field in the database according to the modified report document;
and filling the updated interface field into a code template so that the code template generates an interface code matched with the updated interface field.
A fourth aspect of embodiments of the present invention provides a computer-readable storage medium storing an interface code generation program that, when executed by at least one processor, implements the steps of:
establishing an interface field corresponding to an interface structure in a database based on the predefined interface structure;
exporting the interface field through a report generation tool to generate a report document, receiving an interface field modification instruction sent by a user in the report document, and modifying the interface field of the report document;
importing the modified report document, and updating an interface field in the database according to the modified report document;
and filling the updated interface field into a code template so that the code template generates an interface code matched with the updated interface field.
In the embodiment of the invention, the interface field is exported to generate the report document, the report document modified by the user is imported, and the synchronous update of the interface field is realized in the database according to the interface field modified by the user in the report document, so that developers do not need to be limited by a visual tool specifically provided by an API (application programming interface) management tool, can flexibly input and modify the interface field in the report document at any time, and the maintenance efficiency of the interface field in the database is improved; the interface code can be automatically generated by using the code template by filling the interface field in the report document into the code template, and the well-defined interface document can be directly synchronized into the code for use, so that the development efficiency of developers is further improved compared with the conventional API management tool.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
FIG. 1 is a flowchart of an implementation of a method for generating interface codes according to an embodiment of the present invention;
fig. 2 is a flowchart of a specific implementation of the interface code generation method S103 according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating an implementation of a method for generating interface code according to another embodiment of the present invention;
FIG. 4 is a flowchart illustrating an implementation of a method for generating interface code according to another embodiment of the present invention;
fig. 5 is a flowchart illustrating a specific implementation of the interface code generation method S403 according to another embodiment of the present invention;
fig. 6 is a block diagram of an interface code generation apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a terminal device according to an embodiment of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
In order to explain the technical means of the present invention, the following description will be given by way of specific examples.
Fig. 1 shows an implementation flow of an interface code generation method provided by an embodiment of the present invention, where the method flow includes steps S101 to S104. The specific realization principle of each step is as follows:
s101: and establishing an interface field corresponding to the interface structure in a database based on the predefined interface structure.
In the embodiment of the invention, the interface is a shared boundary for information exchange between the database and an external system. An interface is a declaration of a series of methods, and is a collection of method features, and an interface has only method features and no method implementation, so that the methods can be implemented in different places by different classes, and the implementations can have different functions. The external system calls the interface provided by the database and can realize the methods based on the parameters corresponding to the methods in the interface, thereby achieving the functions required to be realized by the external system. In order to ensure that the parameters of each method in the interface have corresponding fields existing in the database, the data table and the fields which should be established and maintained by the database are determined by acquiring the interface structure which is predefined by a user in a database management interface or a configuration file. The predefined interface structure includes basic attributes such as table name, field, type, primary key, foreign key, and index.
And generating a template according to a preset SQL statement, reading each basic attribute corresponding to the interface structure, and respectively filling each basic attribute into the SQL statement generation template so as to output a corresponding SQL execution statement. Thereafter, the system executes the SQL execute statement, creates a new data table in the database with the table name, creates fields in the data table that match the types, and creates a primary key, a foreign key, an index, and the like. Therefore, based on the predefined interface structure, in the database, maintenance of the interface field corresponding to the interface structure is achieved.
S102: and exporting the interface field through a report generation tool to generate a report document, receiving an interface field modification instruction sent by a user in the report document, and modifying the interface field of the report document.
In the embodiment of the invention, the export of the interface field in the database is realized through the report generation tool. The report generation tool includes, but is not limited to, Java-based open source report tools jasperports, BI suite Pentaho, Web-based report solution OpenReports with jasperports as a report generation engine, Java class library Pentaho Reporting, Eclipse-based open source code report system BIRT, and a Excel report generation tool based on Jakarta POI API. Preferably, the report generation tool in the embodiment of the present invention is an Excel report generation tool based on Jakarta poiai, and the Excel report generation tool is also referred to as JXLS framework.
Processing a data table maintained by the database based on a JXLS framework, taking each interface field in the database as a java entity class, and exporting the java entity class to generate an Excel report document. Specifically, the field names and the field types of the interface fields in the data table are exported, the interface field names are exported to the row names or the column names of the Excel report document, and the specific field types are exported to the field contents corresponding to the rows or the columns in the report document.
And the exported Excel report document is stored in a storage path designated by a user in the system. When a user wants to view the interface fields of the data tables in the database in a system or other external environments, the method can be realized by transmitting and viewing the Excel report documents correspondingly exported by the data tables. A user can visually check the interface fields and the specific field types displayed by the Excel report document without inputting SQL sentences with specified grammar rules into a database. Meanwhile, the database requires higher security, so that the interface fields are exported to an Excel report document for an external system developer to check, the problem that the external system needs to be connected with the database in real time to check the interface fields in the table can be avoided, the external system developer is allowed to be connected with the database only when necessary is guaranteed, and the security of the database is improved.
Because the Excel report document has editability, when a user checks the Excel report document and needs to modify the interface fields in the database, the user can firstly modify the interface fields in the Excel report document. The modification of the interface field includes, but is not limited to, adding the interface field, deleting the interface field, and modifying attributes of the interface field, such as a field name and a field type. When the user executes the modification operation in the Excel report document, an interface field modification instruction sent by the user is received in the report document, and each interface field in the report document is directly modified according to the interface field modification instruction.
S103: and importing the modified report document, and updating an interface field in the database according to the modified report document.
And importing the Excel report document edited by the user into a specified storage path of the system based on a JXLS framework. And reading the data table name and each first interface field corresponding to the report document, simultaneously reading each second interface field actually corresponding to the data table from the database according to the data table name, and comparing each first interface field with each second interface field respectively, or comparing each second interface field with each first interface field respectively. If the second interface field identical to the first interface field does not exist, the first interface field is represented as a new field, so that the new field is automatically constructed in the data table of the database. If the first interface field identical to the second interface field does not exist, the second interface field is the interface field which needs to be deleted by the user, so that a preset SQL statement is called in the table of the database, and the field is deleted. Or, when the first interface field in the Excel report document is not completely matched with the second interface field of the table in the database, deleting the data table by using a preset SQL statement, such as a DROPTABLE statement, and then rebuilding by using a CREATE statement, so as to store a new data table which is completely matched with each first interface field in the Excel report document in the database.
When the field name of a first interface field in the Excel report document is the same as the field name of a second interface field in the data table, and the field type of the first interface field is different from the field type of the second interface field, the method indicates that a user only modifies the type of the interface field, so that in the table of the database, whether the data of the field type of the second interface field can be converted into the data of the field type of the first interface field is judged, and if the data of the field type of the second interface field can be converted into the data of the field type of the first interface field is modified by using a preset SQL statement, such as a CAST statement or a CONVERT statement. And if the data of the field type of the second interface field cannot be converted into the data of the field type of the first interface field, sending an error prompt.
For example, if the field type of the second interface field is integer and the field type of the first interface field is character string type, determining that the integer data can be converted into the character string type data; if the field type of the second interface field is floating point type and the field type of the first interface field is integer type, the condition of small point data loss can occur when the floating point type data is converted into integer type data, so that the storage precision of the original data is reduced, and the floating point type data cannot be converted into integer type data.
As an embodiment of the present invention, as shown in fig. 2, the step S103 specifically includes:
s201: and if more than two modified report documents are imported at the same time, sending a conflict alarm prompt, and merging the more than two modified report documents when a report document merging instruction is received.
If more than two modified report documents are imported at the same time, it indicates that a plurality of users modify the same report document exported by the system before the time. For example, if the report document exported by the system is transmitted to two different terminals a and B, namely, the document 1 and the document 2 on the terminal a and the terminal B, respectively, so that the terminal user a and the terminal user B can view and manage the interface fields in the report document, and meanwhile, the terminal user a and the terminal user B both update the interface fields in the report document under the condition that they do not know each other, when the document 1 and the document 2 are imported into the system at the same time, the system cannot determine which report document is used. Under the condition, the system respectively sends conflict alarm prompts to the terminal user a and the terminal user b to prompt the user whether to carry out merging processing on the report documents. When receiving a report document merging instruction sent by any user, the system merges the document 1 and the document 2, namely, all the interface fields and the interface types in the document 1 and the document 2 are gathered in one report document.
S202: and updating the interface fields in the database according to the report document obtained after combination.
And importing the report document into the database based on the interface fields and the report document after the interface types are summarized, so that the interface fields maintained in the database are updated according to the same implementation principle of the S103.
S104: and filling the updated interface field into a code template so that the code template generates an interface code matched with the updated interface field.
In the embodiment of the invention, the code template is a Velocity template. A Velocity template is a Java-based engine framework that provides a template language that can be used on objects and variables defined in Java. And when the interface field maintained in the data table of the database is the same as the interface field of the Excel report document and the field types are completely matched, acquiring an xml file which is correspondingly generated by the data table, wherein the xml file comprises the label of each interface field. And calling a vector template, reading the pre-generated xml file by using an ant task Anakia in the vector template, automatically filling each interface field in the xml file into the vector template after reading, and generating an interface code matched with the interface field. Specifically, in the generated Java engineering file, the Velocity template filled with each interface field is read, and the interface fields in the Velocity template are transmitted to the Java engineering file, so as to generate the corresponding Java interface code. Therefore, the interface structure of the generated Java interface code is the same as the interface structure defined in the Excel report document.
By automatically generating the Java interface code, developers do not need to repeatedly define a DTO (data Transfer object) code about the interface in an engineering code file in the process of realizing the code.
In the embodiment of the invention, the interface field is exported to generate the report document, the report document modified by the user is imported, and the synchronous update of the interface field is realized in the database according to the interface field modified by the user in the report document, so that developers do not need to be limited by a visual tool specifically provided by an API (application programming interface) management tool, can flexibly input and modify the interface field in the report document at any time, and the maintenance efficiency of the interface field in the database is improved; the interface code can be automatically generated by using the code template by filling the interface field in the report document into the code template, and the well-defined interface document can be directly synchronized into the code for use, so that the development efficiency of developers is further improved compared with the conventional API management tool.
As another embodiment of the present invention, fig. 3 shows an implementation flow of an interface code generation method provided by an embodiment of the present invention. As shown in fig. 3, after the above step S104, the method further includes a step S105 and a step S106, which are specifically as follows:
s105: and storing the interface code to obtain a code file and generating the version number of the code file.
The version number is an identification number of the code version. Each time the interface code and code file is generated, there is a version number. The version number is used to let the developer know whether the interface code it calls is a version that it needs. And according to the version number, the user can inquire the function annotation corresponding to the version number from the record table, so that whether the function provided by the interface code is a function required by the user can be determined based on the interface code and the version number of the code file.
In the embodiment of the invention, the code file is a Java engineering file. When the interface code is generated each time, the system reads a version number which is not distributed to use in sequence from a preset version number sequence, so that the version number is used as a version number of the generated interface code at the current time, and the version number is used as the version number of the code file corresponding to the interface code.
S106: and displaying the version number of the code file.
On one hand, the system takes the generated version number as the file name of the Java project file, and annotates the version number in the interface code of the Java project file. On the other hand, each Java engineering file and its corresponding version number are shown in an interface detail page displayed by the system.
In the embodiment of the invention, the version number of the code file is generated and displayed, so that the version prompt function is provided for developers, when the interface is upgraded, the developers can intuitively know whether the called interface code is the interface of the latest version through the version number displayed by the system, different developers can jointly execute development operation based on the interface codes with the same version number, and the situation that the version numbers of the interface codes are inconsistent is avoided.
As still another embodiment of the present invention, as shown in fig. 4, after the above S104, the method further includes:
s401: and when a calling instruction based on the interface code sent by the user is received, acquiring the account authority of the user.
After the interface code file is generated, the item information and the interface information set for the interface code file are acquired. The project information indicates functions to be implemented by the interface code file, specific information of a software development project corresponding to the interface code file, and the like. For example, the project information may be information such as a person in charge of the project, a group member of the project, and a description of the project. The interface information includes the annotation content of the interface code as well as the interface code itself.
And when detecting that the user calls the interface code to manage the information in the data table through the database interface corresponding to the interface code, or managing the item information and the interface information of the interface code, performing authority identification on the user. At this time, a management account currently used by the user is acquired, and the management account is matched from a preset account permission list, so that account permission corresponding to the management account is determined. When each management account is generated, the account authority corresponding to the management account is preset in an account authority list by a database manager. The account number authority corresponding to the management account number comprises a first authority and a second authority.
If the current management account used by the user is not matched in the account permission list, the account permission corresponding to the management account is a null value, or the account permission corresponding to the management account is an illegal permission, the account permission of the user is determined to be the first permission.
S402: and if the account number authority is the first authority, refusing to respond to the calling instruction.
In the embodiment of the invention, the first authority represents that the user is limited to view and manage the associated information of the interface code, and the associated information of the interface code comprises interface information and project information. Thus, the system will not respond to any call instructions issued by the user.
S403: and if the account number authority is a second authority, responding to the calling instruction.
In the embodiment of the invention, the second authority represents that the user is allowed to view and manage part of or all the associated information of the interface code. The second authority comprises a viewing authority, a part of management authority and a management authority. Thus, under a second privilege of a different type, the system will respond to a different call instruction issued by the user.
Fig. 5 shows a specific implementation flow of the interface code generation method S403 according to another embodiment of the present invention, which is detailed as follows:
s501: and if the account number authority is the viewing authority, responding to the interface information viewing instruction.
In the embodiment of the present invention, the call instruction based on the interface code includes an interface information viewing instruction based on the interface code, an interface information management instruction, and an item information management instruction, and the second authority includes a viewing authority, a partial management authority, and a management authority.
And when the account permission corresponding to the management account used by the user is confirmed to be the viewing permission from the account permission list, opening the interface information viewing permission based on the interface code for the user, but not opening other management permissions of the interface code. Under the condition that the account authority is the viewing authority, if the call instruction received by the system is the interface information viewing instruction, the interface information of the interface code is displayed after the call instruction is responded, so that the user can view the interface information in a read-only state and cannot modify the interface information.
If the call instruction received by the system is an interface information management instruction or a project information management instruction, refusing to respond to the call instruction, namely not responding to the call instruction.
S502: and if the account number authority is partial management authority, responding to the interface information viewing instruction and the interface information management instruction.
When the account authority corresponding to the management account used by the user is confirmed to be partial management authority from the account authority list, only interface information management and viewing authority based on the interface code is opened for the user, and project information management authority of the interface code is not opened. Under the condition that the account number authority is partial management authority, if the call instruction received by the system is an interface information viewing instruction or an interface information management instruction, the interface information of the interface code is displayed after the call instruction is responded. And if the call instruction received by the system is an interface information management instruction, modifying and updating the interface information of the interface code according to the specific information carried by the interface information management instruction.
And if the call instruction received by the system is the project information management instruction, refusing to respond to the call instruction, namely not responding to the call instruction.
S503: and if the account number authority is the management authority, responding to the interface information viewing instruction, the interface information management instruction and the project information management instruction.
And when the account authority corresponding to the management account used by the user is confirmed to be the management authority from the account authority list, opening all management authorities based on the interface codes for the user, including authority for interface information management, viewing and authority for project information management. Under the condition that the account number authority is the management authority, the system responds to the call instruction no matter the call instruction received by the system is the interface information viewing instruction, the interface information management instruction or the project information management instruction.
In the embodiment of the invention, the calling instruction based on the interface code sent by the user can be properly responded by confirming whether the user manages the account number to be the first authority or the second authority and confirming which kind of authority the user is in the second authority again under the condition of the second authority, so that the possibility that the interface code is illegally leaked and called by an illegal user is reduced. Because the existing API management tool lacks the authority maintenance strategy, the interface code generation method provided by the embodiment of the invention can make up the defects of the existing API management tool and improve the safety of the interface code.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention
Fig. 6 shows a block diagram of an interface code generation apparatus according to an embodiment of the present invention, which corresponds to the interface code generation method described in the foregoing embodiment, and only shows a part related to the embodiment of the present invention for convenience of description.
Referring to fig. 6, the apparatus includes:
and the maintenance module 61 is configured to establish an interface field corresponding to the interface structure in the database based on the predefined interface structure.
And the exporting module 62 is configured to export the interface field through a report generation tool to generate a report document, receive an interface field modification instruction sent by a user in the report document, and modify the interface field of the report document.
And the updating module 63 is configured to import the modified report document, and update the interface field in the database according to the modified report document.
And a first generating module 64, configured to populate the updated interface field to a code template, so that the code template generates an interface code matching the updated interface field.
Optionally, the interface code generation apparatus further includes:
and the second generation module is used for storing the interface code to obtain a code file and generating the version number of the code file.
And the display module is used for displaying the version number of the code file.
Optionally, the updating module 63 includes:
and the merging submodule is used for sending a conflict alarm prompt if more than two modified report documents are imported at the same time, and merging the more than two modified report documents when a report document merging instruction is received.
And the updating submodule is used for updating the interface fields in the database according to the report documents obtained after combination.
Optionally, the interface code generation apparatus further includes:
and the acquisition module is used for acquiring the account authority of the user when receiving a calling instruction based on the interface code sent by the user.
And the first permission module is used for refusing to respond to the calling instruction if the account permission is the first permission.
And the second permission module is used for responding to the calling instruction if the account permission is a second permission.
Optionally, the second permission includes a viewing permission, a partial management permission, and a management permission, the call instruction includes an interface information viewing instruction, an interface information management instruction, and an item information management instruction, and the second permission module includes:
and the first response submodule is used for responding to the interface information viewing instruction if the account number authority is the viewing authority.
And the second response submodule is used for responding to the interface information viewing instruction and the interface information management instruction if the account number authority is partial management authority.
And the third response submodule is used for responding to the interface information viewing instruction, the interface information management instruction and the project information management instruction if the account number authority is the management authority.
Fig. 7 is a schematic structural diagram of a terminal device according to an embodiment of the present invention. As shown in fig. 7, the terminal device 7 of this embodiment includes: a processor 70, a memory 71 and a computer program 72, such as an interface code generating program, stored in said memory 71 and executable on said processor 70. The processor 70, when executing the computer program 72, implements the steps in the various interface code generation method embodiments described above, such as steps 101 to 104 shown in fig. 1. Alternatively, the processor 70, when executing the computer program 72, implements the functions of the modules in the above-described device embodiments, such as the functions of the modules 61 to 64 shown in fig. 6.
Illustratively, the computer program 72 may be partitioned into one or more modules that are stored in the memory 71 and executed by the processor 70 to implement the present invention. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 72 in the terminal device 7. For example, the computer program 72 may be divided into a maintenance module, an export module, an update module, and a first generation module, and each module has the following specific functions:
the maintenance module is used for establishing an interface field corresponding to the interface structure in a database based on the predefined interface structure.
The export module is used for exporting the interface field through a report generation tool to generate a report document, receiving an interface field modification instruction sent by a user in the report document, and modifying the interface field of the report document.
And the updating module is used for importing the modified report document and updating the interface field in the database according to the modified report document.
The first generation module is used for filling the updated interface field into a code template so that the code template generates an interface code matched with the updated interface field.
The terminal device 7 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The terminal device 7 may include, but is not limited to, a processor 70 and a memory 71. It will be understood by those skilled in the art that fig. 7 is only an example of the terminal device 7, and does not constitute a limitation to the terminal device 7, and may include more or less components than those shown, or combine some components, or different components, for example, the terminal device 7 may further include an input-output device, a network access device, a bus, etc.
The Processor 70 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 71 may be an internal storage unit of the terminal device 7, such as a hard disk or a memory of the terminal device 7. The memory 71 may also be an external storage device of the terminal device 7, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the terminal device 7. Further, the memory 71 may also include both an internal storage unit and an external storage device of the terminal device 7. The memory 71 is used for storing the computer program and other programs and data required by the terminal device. The memory 71 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.

Claims (10)

1. An interface code generation method, comprising:
establishing an interface field corresponding to an interface structure in a database based on the predefined interface structure;
based on a JXLS framework, taking each interface field in the database as a java entity class, exporting the java entity class to generate a report document, receiving an interface field modification instruction sent by a user in the report document, and modifying the interface field of the report document;
importing the modified report document to a specified storage path based on a JXLS framework, and updating an interface field in the database according to the modified report document;
generating a corresponding xml file for a data table corresponding to the updated interface field in the database, wherein the xml file comprises a label for each interface field;
and calling an ant task Anakia in a vector template engine to read the xml file, filling each interface field in the xml file into the vector template, transmitting the interface field in the vector template into the Java engineering file, and generating an interface code matched with the updated interface field.
2. The interface code generation method of claim 1, further comprising:
storing the interface code to obtain a code file and generating a version number of the code file;
and displaying the version number of the code file.
3. The interface code generation method according to claim 1 or 2, wherein the importing the modified report document and updating the interface field in the database according to the modified report document includes:
if more than two modified report documents are imported at the same time, sending a conflict alarm prompt, and merging the more than two modified report documents when a report document merging instruction is received;
and updating the interface fields in the database according to the report document obtained after combination.
4. The interface code generation method of claim 1, further comprising:
when a calling instruction based on the interface code sent by a user is received, acquiring the account authority of the user;
if the account number authority is a first authority, refusing to respond to the calling instruction;
and if the account number authority is a second authority, responding to the calling instruction.
5. The interface code generation method of claim 4, wherein the second authority includes a viewing authority, a partial management authority, and a management authority, and the responding to the call instruction if the account authority is the second authority includes:
if the account number authority is the viewing authority, responding to an interface information viewing instruction;
if the account number authority is partial management authority, responding to an interface information viewing instruction and an interface information management instruction;
and if the account number authority is the management authority, responding to the interface information checking instruction, the interface information management instruction and the project information management instruction.
6. A terminal device, comprising a memory, a processor, and an interface code generation program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the interface code generation program:
establishing an interface field corresponding to an interface structure in a database based on the predefined interface structure;
based on a JXLS framework, taking each interface field in the database as a java entity class, exporting the java entity class to generate a report document, receiving an interface field modification instruction sent by a user in the report document, and modifying the interface field of the report document;
importing the modified report document to a specified storage path based on a JXLS framework, and updating an interface field in the database according to the modified report document;
generating a corresponding xml file for a data table corresponding to the updated interface field in the database, wherein the xml file comprises a label for each interface field;
and calling an ant task Anakia in a vector template engine to read the xml file, filling each interface field in the xml file into the vector template, transmitting the interface field in the vector template into the Java engineering file, and generating an interface code matched with the updated interface field.
7. The terminal device according to claim 6, wherein the processor, when executing the interface code generation program, further performs the steps of:
storing the interface code to obtain a code file and generating a version number of the code file;
and displaying the version number of the code file.
8. The terminal device according to claim 6, wherein the step of importing the modified report document and updating the interface field in the database according to the modified report document specifically comprises:
if more than two modified report documents are imported at the same time, sending a conflict alarm prompt, and merging the more than two modified report documents when a report document merging instruction is received;
and updating the interface fields in the database according to the report document obtained after combination.
9. The terminal device according to claim 6, wherein the processor, when executing the interface code generation program, further performs the steps of:
when a calling instruction based on the interface code sent by a user is received, acquiring the account authority of the user;
if the account number authority is a first authority, refusing to respond to the calling instruction;
and if the account number authority is a second authority, responding to the calling instruction.
10. A computer-readable storage medium storing an interface code generation program, characterized in that the interface code generation program realizes the steps of the interface code generation method according to any one of claims 1 to 5 when executed by at least one processor.
CN201710312852.8A 2017-05-05 2017-05-05 Interface code generation method and terminal equipment Active CN108268253B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201710312852.8A CN108268253B (en) 2017-05-05 2017-05-05 Interface code generation method and terminal equipment
PCT/CN2018/083549 WO2018201895A1 (en) 2017-05-05 2018-04-18 Interface code generation method, apparatus, terminal device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710312852.8A CN108268253B (en) 2017-05-05 2017-05-05 Interface code generation method and terminal equipment

Publications (2)

Publication Number Publication Date
CN108268253A CN108268253A (en) 2018-07-10
CN108268253B true CN108268253B (en) 2020-01-03

Family

ID=62771645

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710312852.8A Active CN108268253B (en) 2017-05-05 2017-05-05 Interface code generation method and terminal equipment

Country Status (2)

Country Link
CN (1) CN108268253B (en)
WO (1) WO2018201895A1 (en)

Families Citing this family (28)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109062801B (en) * 2018-08-01 2021-09-14 四川长虹电器股份有限公司 Automatic conversion system for software interface
CN109614102A (en) * 2018-10-09 2019-04-12 平安科技(深圳)有限公司 Code automatic generation method, device, electronic equipment and storage medium
CN109726213B (en) * 2018-12-10 2021-11-19 阿里巴巴(中国)有限公司 Program code conversion method, device, medium and computing equipment
CN109828963A (en) * 2018-12-14 2019-05-31 中国平安人寿保险股份有限公司 Method of data synchronization, device, system, computer and readable storage medium storing program for executing
CN109933573B (en) * 2019-01-30 2021-06-01 北京融链科技有限公司 Database service updating method, device and system
CN109918433B (en) * 2019-01-31 2024-05-07 平安科技(深圳)有限公司 Message storage method and device based on universal data interface and computer equipment
CN110109656A (en) * 2019-03-25 2019-08-09 平安科技(深圳)有限公司 Interface analogy method, device, computer equipment and storage medium
CN110175022B (en) * 2019-04-25 2023-10-13 平安科技(深圳)有限公司 Method and device for automatically generating POJO class, storage medium and computer equipment
CN110262782A (en) * 2019-05-10 2019-09-20 平安科技(深圳)有限公司 The interface comparison method and device of software systems
CN110262783B (en) * 2019-05-22 2023-08-08 深圳华科云动力科技有限公司 Interface generation method and device and terminal equipment
CN110377514A (en) * 2019-07-12 2019-10-25 中汇信息技术(上海)有限公司 Management method, device, electronic equipment and the storage medium of software component
CN112256252B (en) * 2019-07-22 2023-09-26 腾讯科技(深圳)有限公司 Interface generation method and device, storage medium and electronic equipment
CN110474970B (en) * 2019-07-31 2022-03-01 澳克多普有限公司 Code synchronization method, device and system
CN110955451B (en) * 2019-12-06 2023-07-25 中国银行股份有限公司 Method and device for changing online interface
CN111125064B (en) * 2019-12-24 2023-08-29 中国建设银行股份有限公司 Method and device for generating database schema definition statement
CN111126008B (en) * 2019-12-25 2023-05-26 广东南方海岸科技服务有限公司 Code generation method and device based on XSD, computer equipment and storage medium
CN111459466B (en) * 2020-03-31 2023-10-20 广州酷狗计算机科技有限公司 Code generation method, device, equipment and storage medium
CN111695328B (en) * 2020-06-16 2023-01-24 深圳前海微众银行股份有限公司 Method, device, equipment and storage medium for generating simulation test message
CN111782650B (en) * 2020-06-28 2024-04-05 京东科技控股股份有限公司 Dynamic data warehousing method and device, electronic equipment and storage medium
CN112380281A (en) * 2020-10-30 2021-02-19 中国人寿保险股份有限公司 Platform layer code generation method and device, electronic equipment and storage medium
CN112463261A (en) * 2020-11-20 2021-03-09 北京达佳互联信息技术有限公司 Interface calling method and device
CN112947963A (en) * 2021-02-26 2021-06-11 平安普惠企业管理有限公司 Interface operation and maintenance method and device, computer equipment and storage medium
CN113095039A (en) * 2021-03-09 2021-07-09 智慧芽信息科技(苏州)有限公司 Processing method, device and server for indexing file custom field
CN112947911A (en) * 2021-04-26 2021-06-11 平安普惠企业管理有限公司 Interface script generation method, device, equipment and storage medium
CN113282457B (en) * 2021-05-25 2022-11-22 浪潮通用软件有限公司 Method, device and medium for maintaining heterogeneous system integration interface information
CN114153909A (en) * 2021-11-26 2022-03-08 北京人大金仓信息技术股份有限公司 Database table structure translation method and device based on Velocity template engine
CN114168119B (en) * 2021-12-07 2024-04-05 北京百度网讯科技有限公司 Code file editing method, device, electronic equipment and storage medium
CN114003293B (en) * 2021-12-30 2022-03-08 云账户技术(天津)有限公司 Interface management method, device, electronic equipment and readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104375814A (en) * 2013-08-14 2015-02-25 腾讯科技(深圳)有限公司 Generation method and device of an interface document
CN105404527A (en) * 2015-09-24 2016-03-16 国网山东省电力公司 Interface configuration method and system based on SAP (System Applications and Products in Data Processing) platform

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103136097A (en) * 2011-11-29 2013-06-05 神州数码信息系统有限公司 Method of software testing simulator frame construction
WO2016040942A1 (en) * 2014-09-12 2016-03-17 Quickvault, Inc. Method and system for forensic data tracking

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104375814A (en) * 2013-08-14 2015-02-25 腾讯科技(深圳)有限公司 Generation method and device of an interface document
CN105404527A (en) * 2015-09-24 2016-03-16 国网山东省电力公司 Interface configuration method and system based on SAP (System Applications and Products in Data Processing) platform

Also Published As

Publication number Publication date
CN108268253A (en) 2018-07-10
WO2018201895A1 (en) 2018-11-08

Similar Documents

Publication Publication Date Title
CN108268253B (en) Interface code generation method and terminal equipment
KR102209737B1 (en) Methods and systems for providing verifiable, auditable, and immutable inputs to smart contracts
CN104391934B (en) Data verification method and device
CN107798038B (en) Data response method and data response equipment
CN108984712A (en) Counting method, equipment and readable storage medium storing program for executing are made based on business scenario
CN109840257B (en) Database query method, database query device, computer device and readable storage medium
CN103970758A (en) Database accessing system and method
CN108255967B (en) Method and device for calling storage process, storage medium and terminal
CN108460068A (en) Method, apparatus, storage medium and the terminal that report imports and exports
CN112631924A (en) Automatic testing method and device, computer equipment and storage medium
CN114443592A (en) Data storage method and device, electronic equipment and storage medium
EP3693869A1 (en) Method and apparatus for managing knowledge base, device and medium
US20220084021A1 (en) Object Oriented Smart Contracts for UTXO-Based Blockchains
CN115543428A (en) Simulated data generation method and device based on strategy template
CN114816361A (en) Method, device, equipment, medium and program product for generating splicing project
CN114237798A (en) Data processing method, device, server and storage medium
CN113504904A (en) User-defined function implementation method and device, computer equipment and storage medium
CN117008890B (en) Extended application development system and method
WO2023273410A1 (en) Specification design method and apparatus, and related device
CN117632756A (en) Test data generation method and device, electronic equipment and storage medium
CN116185385A (en) Visual interface management method, system, terminal and storage medium
CN114610287A (en) Block chain intelligent contract generation method and device and electronic equipment
CN115061835A (en) Method and device for determining method call relation
CN114998038A (en) Abnormal policy processing method and system
CN112000366A (en) System parameter configuration method and device based on code generator

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
GR01 Patent grant
GR01 Patent grant