CN110795080A - Automatic code generation system based on database annotation and construction method - Google Patents

Automatic code generation system based on database annotation and construction method Download PDF

Info

Publication number
CN110795080A
CN110795080A CN201910998100.0A CN201910998100A CN110795080A CN 110795080 A CN110795080 A CN 110795080A CN 201910998100 A CN201910998100 A CN 201910998100A CN 110795080 A CN110795080 A CN 110795080A
Authority
CN
China
Prior art keywords
automatic
module
project
database
data
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
Application number
CN201910998100.0A
Other languages
Chinese (zh)
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.)
Shandong Shunzhi Information Technology Co Ltd
Original Assignee
Shandong Shunzhi Information Technology 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 Shandong Shunzhi Information Technology Co Ltd filed Critical Shandong Shunzhi Information Technology Co Ltd
Priority to CN201910998100.0A priority Critical patent/CN110795080A/en
Publication of CN110795080A publication Critical patent/CN110795080A/en
Pending legal-status Critical Current

Links

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/21Design, administration or maintenance of databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation

Abstract

The invention discloses a code automatic generation system and a construction method based on database annotation, which relate to the technical field of computer programs, can realize the storage and reading of data model description through the annotation of a database without additionally creating a data table or a configuration file, and have the specific scheme that: the method comprises the following steps: s1: establishing a code generation platform framework; s2: selecting a grammar rule according to the type of the established code generation platform framework; s3: adding comments to the corresponding data tables and the corresponding fields according to the grammar rule selected in the S2; s4: selecting a target system; s5: scanning the annotations in the S3 according to the target system selected in the S4, and detecting whether the annotations are legal or not; s6: and fusing the code generation platform and the target system to obtain the code generation system. By using the method, the dependence degree of the generation process on the automatic code generation tool is reduced by 60%, and the learning cost of developers on the automatic code generation tool is saved by 30%.

Description

Automatic code generation system based on database annotation and construction method
Technical Field
The invention relates to the technical field of computer programs, in particular to a code automatic generation system based on database annotation and a construction method.
Background
The significance of code automatic production lies in four aspects:
firstly, conventional codes and a database are highly abstracted, so that the duplication and sticking type mechanical repeated work of developers is reduced, the machine can automatically finish the work without others, and the development efficiency is improved. The aim of automatic code production is not to replace a human by a machine, but to allow machines and humans to exert their advantages in areas where they are skilled. The advantages of human and machine in different areas of capability are different, and human should function in areas where they are skilled, so developers should focus on parts that need to exert human subjective motivation and complex logical thinking.
Second, the accumulation and continuous rise of development technologies. A problem often encountered with software project development is that as the number of projects accumulates, the quality and level of development of the project is overly dependent on the developers themselves, and frequent manual changes of the developers often have a fatal effect on the continuing growth of the project team. The essential idea of automatic code production is that the experience of program development is converted into program code, that is, as long as the development experience is describable, the logic therein can be always implemented by a program language, and the conversion from human experience to machine code is achieved. As time and projects accumulate, more and more personnel development experience translates into machine code, which greatly relieves the project team from excessive reliance on personnel. The project team can greatly compensate the risk caused by personnel change by ensuring the continuous supplement and innovation of the code production library.
Third, the high degree of code correctness and normalization. Personnel have the possibility of making mistakes, and for the execution of machine code, the machine can be considered to have no possibility of making mistakes on the premise that the logic of the machine code is correct. Machines strictly follow the logic of code, generating code with high standards, uniformity, and efficiency, which is a great complement to the ability of humans.
Fourth, immersive training of developers. As developers develop on the basis of automatically produced codes, the developers can continuously pay attention to the technical method and the programming specification of the automatically produced codes and adapt to the technical method and the programming specification in subsequent development, and the developers have important promotion effects on the improvement of the capabilities of the developers and the normative consistency of modules of projects.
Problems existing in the prior art: additional data tables or configuration files must be created according to the specifications or rules of the code auto-generation tool itself. The development process specifications set by the code automatic generation tool must be compulsorily followed, the database design must be completed through the code generation tool or the description information must be reestablished according to the existing database structure, the existing database cannot be adapted, and the developer needs higher learning cost for the code automatic generation tool.
Disclosure of Invention
In order to solve the technical problems, the invention provides a code automatic generation system based on database annotation and a construction method thereof, wherein the code automatic generation system can realize the storage and reading of data model description through the annotation (data table watching and field annotation) of the database without additionally building a data table or a configuration file.
The technical purpose of the invention is realized by the following technical scheme:
a code automatic generation system and a construction method based on database annotation comprise the following steps:
s1: establishing a code generation platform framework;
s2: selecting a grammar rule according to the type of the established code generation platform framework;
s3: adding comments to the corresponding data tables and the corresponding fields according to the grammar rule selected in the S2;
s4: selecting a target system;
s5: scanning the annotations in the S3 according to the target system selected in the S4, and detecting whether the annotations are legal or not;
s6: and fusing the code generation platform and the target system to obtain the code generation system.
By adopting the technical scheme, firstly, a computer language is selected to establish a code generation platform, and annotations are added to corresponding data tables and corresponding fields according to grammar rules of the selected computer language, wherein a JSON format can be used for writing so as to realize storage of complex data structure description information, a data interface mainly takes common data exchange format standards such as JSON, XML and the like as main standards, and the JSON data format is gradually the main choice of the data interface format due to the light weight characteristic of the JSON data format. The generated code generation platform can be used as a complete system, the code generation platform is scanned by target systems of other platforms and used for different platforms, the code generation platform can be used for the platform after legal compatibility is detected, the code generation platform is fused with the target system after debugging once in the previous period, and the function of automatically generating codes and comments can be used through the corresponding platform in subsequent operation.
In the technical scheme, the data model information depended on by the automatic code generation tool is directly stored in the comments of the database, and the data model description can be stored and read through the comments (data table watching and field comments) of the database without additionally building a data table or a configuration file, so that the dependence degree of the generation process on the automatic code generation tool is reduced by 60%, and the learning cost of developers for the automatic code generation tool is saved by 30%.
A code automatic generation system based on database annotation comprises a project information automatic configuration module, a project automatic deployment module, an automatic domain name resolution module, a database automatic creation module, a database special account automatic creation module, a project file management (FTP) account automatic creation module, an FTP user permission automatic distribution module, a third-party library automatic introduction module, a custom frame generation module, a background management module automatic generation module, a data interface module automatic generation module, a WeChat development module automatic generation module, a WeChat SDK automatic introduction module, a portal module automatic generation module, a permission control module integration module, a system operation log module integration module and a WeChat basic function integration module.
As a preferred scheme, the project information automatic configuration module is used for completing the automatic configuration of project information, and the project information comprises project Chinese names, project English names, project background English names, project domain names, database host addresses, database names, database user passwords, data table prefixes, FTP users and FTP passwords.
Preferably, the project automatic deployment module is used for project catalog creation, virtual host file automatic creation and writing and restarting of a server process.
As a preferred scheme, the database automatic creation module is used for automatic creation of the database, automatic creation of database users and automatic authority distribution of the database users.
As a preferable scheme, the project FTP management automatic configuration module is used for automatic creation of a project dedicated FTP account, automatic password setting of a proprietary FTP account, permission setting of the dedicated FTP account for a project directory, registration of an FTP user in an operating system, and automatic switching of an FTP mode and a code generation mode.
Preferably, the custom project framework generation module is used for framework level directory creation, project configuration file creation and writing and project entry file creation and writing.
As a preferred scheme, the background management module generation module is used for directory creation, management layout creation and writing, third-party library introduction, third-party static repository introduction, data model file creation and writing, form file creation and writing, controller file creation and writing, view resource file creation and writing, and data permission checker creation.
In conclusion, the invention has the following beneficial effects:
by using the method, the code automatic generation tool can realize the storage and reading of the data model description through the comments (data table watching and field comments) of the database without additionally building a data table or a configuration file, thereby reducing the dependence degree of the generation process on the code automatic generation tool by 60 percent and saving the learning cost of developers for the automatic generation tool by 30 percent. The self-descriptiveness and the semantic degree of the structure of the database are enhanced, and the limitation of the traditional automatic generation tool on the database design process is removed.
Detailed Description
The present invention will be described in further detail below.
Example 1:
a code automatic generation system and a construction method based on database annotation comprise the following steps:
s1: establishing a code generation platform framework;
s2: selecting a grammar rule according to the type of the established code generation platform framework;
s3: adding comments to the corresponding data tables and the corresponding fields according to the grammar rule selected in the S2;
s4: selecting a target system;
s5: scanning the annotations in the S3 according to the target system selected in the S4, and detecting whether the annotations are legal or not;
s6: and fusing the code generation platform and the target system to obtain the code generation system.
By adopting the embodiment, firstly, a computer language is selected to establish a code generation platform, and annotations are added to the corresponding data table and the corresponding fields according to the grammar rules of the selected computer language, wherein the JSON format can be used for writing so as to realize the storage of the description information of the complex data structure, the data interface mainly takes the common data exchange format standards of JSON, XML and the like as the main standard, and the JSON data format is gradually the main choice of the data interface format due to the light weight characteristic of the JSON data format. The generated code generation platform can be used as a complete system, the code generation platform is scanned by target systems of other platforms and used for different platforms, the code generation platform can be used for the platform after legal compatibility is detected, the code generation platform is fused with the target system after debugging once in the previous period, and the function of automatically generating codes and comments can be used through the corresponding platform in subsequent operation.
In the embodiment 1, the data model information depended on by the code automatic generation tool is directly stored in the annotation of the database, and the data model description can be stored and read through the annotation (data table watching and field annotation) of the database without additionally creating a data table or a configuration file, so that the dependence degree of the generation process on the code automatic generation tool is reduced by 60%, and the learning cost of a developer on the automatic generation tool is saved by 30%.
Figure BDA0002240394300000071
TABLE 1
TABLE 2
Wherein: table 1 is a field annotation data model semantic definition table; table 2 annotates the data model semantic definition table for the data table.
Example 2:
a code automatic generation system based on database annotation comprises a project information automatic configuration module, a project automatic deployment module, an automatic domain name resolution module, a database automatic creation module, a database special account automatic creation module, a project file management (FTP) account automatic creation module, an FTP user permission automatic distribution module, a third-party library automatic introduction module, a custom frame generation module, a background management module automatic generation module, a data interface module automatic generation module, a WeChat development module automatic generation module, a WeChat SDK automatic introduction module, a portal module automatic generation module, a permission control module integration module, a system operation log module integration module and a WeChat basic function integration module.
The project information automatic configuration module:
after the unique identification and the project name are set for the newly-built project, automatic configuration of project information is completed according to system convention, the project information comprises project Chinese names, project English names, project background English names, project domain names, database host addresses, database names, database user passwords, data table prefixes, FTP users and FTP passwords, wherein the database user passwords are the same as the FTP passwords, and 12-digit letter and number combinations are generated randomly. Five items of information such as project names, database users, FTP users, secondary domain name addresses and the like are kept strictly consistent according to system convention, and information management of project managers and developers is facilitated.
The project automatic deployment module:
the automatic deployment comprises project directory creation, virtual host file automatic creation and writing and server process restarting. The directory creation is realized by calling a system MKDIR, and the virtual host file VHOSTS.CONF is automatically written into a virtual host configuration file extended directory configured by APACHE only by ensuring that a project default storage directory has writable rights, wherein configuration items comprise a project directory absolute path, a project corresponding domain name alias (configurable multiple items), a project access log storage position, a project error log storage position, the rights configuration of a project main directory and the like. And after the project main directory and the virtual host configuration file are successfully written, calling the restarting operation of the HTTPD server process, and finishing the automatic project deployment.
An automatic domain name resolution module:
the automatic domain name resolution is completed through a DNSPOD interface, the system automatically sends A record information to a DNSPOD authorization interface according to the project unique identifier to complete the automatic resolution of the domain name, and the domain name resolution can be completed in real time. By the domain name resolution module, the resolution of the user-defined domain name can be completed, and the automatic addition of SERVER ALIAS in VHOSTS is completed.
A database automatic creation module:
the automatic creation of the database comprises automatic creation of the database, automatic creation of database users and automatic distribution of the authority of the database users. The automatic creation of the DATABASE itself is accomplished by the CREATE DATABASE command, with the default DATABASE encoding in UT8 format. The user name of the database is automatically set as a unique item identifier according to the convention of the system, the user password of the database and each operation authority of the item database are set through the GRANT statement, and the authority is immediately validated through the FLUSH statement.
The project FTP management automatic configuration module:
the automatic configuration of project FTP management comprises automatic creation of a project-specific FTP account, automatic password setting of a proprietary FTP account, permission setting of the proprietary FTP account to a project directory, registration of an FTP user in an operating system, and automatic switching of an FTP mode and a code generation mode.
The name of the special FTP account is automatically set as a unique item identifier according to the system convention, and automatically belongs to an FTPGROUP user group, and due to the consideration of security factors, the SSH authority of the FTP user account is forbidden, and the home directory of the FTP account is set. The FTP user password is set to a random password that is automatically generated at the time of project creation, where the password is the same as the database user password by default. The permission configuration of the FTP account to the project directory is completed through CHMOD and CHOWN commands, and here, the writable permission of the FTP user to the project main directory is removed through the CHMOD command.
And after the account creation and the permission configuration are completed, the FTP account and the corresponding permission are immediately effective by restarting the VSFTPD process.
A custom project frame generation module:
a technical Framework selected by the project is set, and Zend Framework is selected as a project basic Framework in the embodiment. The frame generation mainly comprises frame level directory creation, project configuration file creation and writing, project entry file creation and writing and the like. Since the Framework selected in this embodiment is the Zend Framework, only operations involved in the Zend Framework generation will be described.
The Zend Framework secondary directory mainly comprises application, public and library, wherein the application is an application directory, the public directory is an external resource directory, and the library is a third-party library directory.
The background management module generation module:
the automatic generation of the background management module is one of core functions, high standard specifications can be provided for the development of the project management module by highly abstracting the conventional management module and considering the development flexibility of later self-defined development, and a large amount of development time cost is saved. The management module code generation will be described in detail below with respect to the Zend Framework selected in this embodiment.
The Zend Framework management module generation mainly comprises catalog creation, management layout creation and writing, third-party program library introduction, third-party static resource library introduction, data model file creation and writing, form file creation and writing, controller file creation and writing, view resource file creation and writing, data authority checker creation and the like.
Phtml, the code template of which is stored in a corresponding directory of frame resources, and a plurality of placeholders are arranged to realize the replacement of dynamic parts of the template, wherein the dynamic parts comprise project background Chinese names, project background English names and a left secondary linkage management menu in project basic information, and the left secondary linkage management menu automatically reads information of each table of the database according to system convention to complete the replacement.
The third-party program library comprises PHPExcel, PHPWord, SZKJ, WXMCRPT and the like besides the Zend library, and the introduction of the frame resource directory into the project directory is completed through the CP command.
The third-party static resource inventory is placed under public/libs catalogs and covers most common libraries involved in WEB front-end development, including BOOTSTRAP (responsive design front-end framework), FLATUI (BOOTSTRAP-based CSS front-end framework), MUI (HTML5 cross-platform front-end framework), WEUI (WeChat official front-end framework), VALIDAE (JQURERY-based JS pre-check library), BOOTSTRAP-SELECT (multifunctional pull-down component library), DATETIMEPICKER (date time control), FONT-AWSOME (CSS FONT-based icon library), EGTRELID (tree-level table library framework), BOOTSTRAP-SWITCH (BOOTSTRAP-based switching control), UEDITOR (multifunctional rich text editor), and ZTRE (tree control).
The data model file mainly completes the setting of the name of the mapped data table, the processing of newly added form data, the processing of updating the form data and the like.
The form file mainly comprises automatic configuration of form controls corresponding to all fields, and the types of the currently supported controls mainly comprise a common text type control, a date selection type control and a file uploading type control. The setting rule of the control type is as follows: automatically ignoring the primary key field to generate no form control; generating a DATE selection type control by using the DATE and DATETIME type fields; if the field comment JSON data is set to be UPLOAD, using a file uploading control; in other cases, a plain text type control is used. And automatically combining the BOOTSTRAP grid system for appearance setting of the form control, setting the control as large screen 3 grids, medium screen 4 grids, medium and small screen 5 grids and small screen 12 grids by default, and realizing the analysis operation of the occupied width configuration in a JS mode. For the automatic verification of the form control, except the file uploading control, other controls are registered in a special verification configuration file, and the development stage can be flexibly adjusted according to the requirements.
The controller file comprises common actions such as controller initialization, management list, data import, data export, data detail check, data statistics, data addition, data editing, data deletion and the like, wherein the management list and the data export share the action of acquiring query conditions. The management list comprises rich functions of multi-field combined query, multi-selection full selection reverse selection of list data, single-field forward and reverse sequence arrangement, multi-field combined sorting, batch deletion and the like. The data import page provides automatic generation and downloading of a data import template, the template adopts an EXCEL mode, a user can conveniently import various data according to needs, and batch import operation of a large amount of data is realized. Data export may provide functionality for a user to export queried data into an EXCEL file. And the data statistics automatically counts the data proportion condition according to each field, and gives a proportion icon.
The view-related program files correspond to various actions listed by the controller, and the actions include six types of views such as a management list page view, a data import page view, a data detail page view, a data statistics page view, a data addition page view and a data editing page view, wherein the views comprise PHTML files, page-specific CSS resource files and page-specific JS files, and the page-specific CSS and JS resource files are automatically imported at the top of the PHTML through assistants.
The data authority checker is a class file designed for realizing a data authority rule setting mechanism in the project. The data permission checker is characterized by dynamic mapping of classes, dynamic mapping of methods and same-name convention of action names. The dynamic mapping of the class enables the authority control entry to dynamically introduce the data authority checker operated corresponding to the current request, and the homonymy agreement between the dynamic state of the method and the action name enables the authority control entry to automatically call the homonymy method in the data authority checker according to the current request. In addition, the data authority checker is configured in the resource data table of the database system, and the configurability of the authority control system is very good.
The data interface module generates the module:
with the popularization of mobile internet, mobile applications such as mobile phone APP application, wechat application, HTML5 application and the like become more and more important components indispensable in an integrated solution. For the extension of these mobile applications, the development of system data interfaces becomes necessary. At present, data interfaces mainly use common data exchange format standards such as JSON and XML, and due to the light weight characteristic of the JSON data format, the data interfaces gradually become the main choice of the data interface format. In the design stage of the platform, in the data interface design after the prototype design of the mobile application is completed, five most common data standard interfaces including a data list, data details, data addition, data deletion and data updating are abstracted through a large amount of data interface requirement analysis. Certainly, for each actual functional module, the five types of interfaces do not necessarily meet all requirements or can generate redundancy, but the automatic generation of the five types of standard interfaces has great advantages, so that the development work efficiency of the data interface is improved, the basic codes do not need to work repeatedly, the overall standardization of a project is greatly improved, the standardization comprises naming specifications, technical implementation specifications and the like, and the important promotion effect is achieved on the synergy of team cooperation.
The DATA interface form adopts JSON format, the client side adopts HTTP POST mode to call, the input parameter adopts POST key value pair DATA form, the return parameter includes two optional parameters CODE and MSG, and one optional parameter DATA is additional DATA, such as DATA list interface.
The WeChat module automatically generates a module:
WeChat is taken as an instant messaging mobile phone application software with extremely high domestic market share, and is closely linked with daily work and life of people. Therefore, in the system design stage, the construction and development of the WeChat platform are taken as important components of the whole project. The WeChat development referred to here is based on the development of WeChat public platform, its essence is the WEB application development of the mobile terminal, and it is different from the conventional mobile WEB mobile development in that the webpage placed in the WeChat built-in browser, obtain the WeChat itself as the hardware capability of the mobile phone application through WeChat, and the built-in function of WeChat public platform such as WeChat menu, WeChat message reply, etc., can also be realized through the interface interaction of platform server and WeChat server, therefore can think that WeChat is an intermediate development mode between WEB application of mobile phone browser and mobile phone APP application, this development mode has achieved very good equilibrium in development cost and hardware operational capability. That is, on one hand, the wechat public platform application can obtain the natural advantages of the WEB application, such as cross-platform, instant update, etc.; on the other hand, the WeChat public platform can access the hardware capability by using the medium of WeChat mobile phone application, and makes up the deficiency of the conventional WEB application in the aspect of hardware operation capability.
In order to standardize the development of the WeChat public platform and improve the user experience of the WeChat public platform, the WeChat opens a set of official CSS front-end framework, the CSS framework has rich components, and the color style and the interaction experience are highly unified with the native application of the WeChat, so that the CSS framework is very suitable for being used as a front-end development framework for the development of the WeChat public platform.
Aiming at the development of a WeChat public platform, the system provides automatic generation of a WeChat module, the principle is still based on the structural design of a database, and codes are generated by abstracting the functions of common modules. The generated module is automatically introduced into the WEUI of the front-end framework, so that developers can rapidly develop applications on the basis of the WEUI.
The portal module automatically generates a module:
the modules of the portal are informationized main service windows. The individuation of each module function of the portal is strong, so that a uniform function model or page model is difficult to abstract. Therefore, when designing an automatic generation mechanism of a portal section, the goal is to minimize fixed work in the development process, such as introduction of static resources, creation of directory structures, and the like. Meanwhile, a custom action generator is designed, developers can configure action names, action identifiers and the like of required newly added actions through the custom action generator, so that directory structure creation, program file creation, static resource introduction and the like can be automatically completed, and the developers only need to pay attention to program logic development.
The authority control automatic generation module:
the information platform relates to multiple user roles, so that the information system is an information system with multiple roles and multiple users, and the platform is intended to be realized by user authority control based on the roles. For the relation of user authority control, the user authority section of this embodiment is described in detail, which is not described herein again, and only the automatic generation of the user authority control code is described.
The implementation of the entitlement control system comprises two parts, namely program code and a database. Aiming at the automatic generation of program codes, the method mainly comprises the automatic creation of an authority control code directory and the automatic creation of a code file; and aiming at the automatic generation of the database part, the automatic generation comprises the automatic creation of a database table structure related to the authority control and the automatic insertion of database table data. Because the database table structure is fixed, the method is realized by importing SQL statement files, and the table data is divided into a fixed data part and a system related data part. The fixed data refers to the authority data related to the data authority module, and the system related data is obtained according to each service data table in the database, such as action data of each module, mapping data between roles and actions, and the like. The system often sets a super manager role, and the role has access rights of all development modules of the system, so that the mapping relation between the super manager role and all module actions of the system is added to a role action mapping data table in automatic generation.
The user authority control can be divided into authority control oriented to the function module layer and authority control oriented to specific data, namely function module authority control and data authority control, and data authority control is introduced below. In the above automatic generation of the background management module, the automatic creation and writing of the data permission checker are described in detail. After the data permission checker is automatically created, the data permission checker is not associated with each module action in the functional module, if the data permission checker needs to take effect, the association needs to be completed in the automatic generation of permission control, namely, a class name corresponding to the checker is filled in a data permission checker field in a module action data table, the name is still named in a system convention form, and developers can also perform custom configuration according to needs.
The system log automatic generation module:
the system log plays a vital role in system safety monitoring and system later maintenance. The system log can be divided into a user operation log and a system debugging log from the aspect of usage. Through the user operation log, all operation history records of each user in the system can be monitored and inquired, including operation time, operation users, operation details, actual IP of the operation users and the like. Through the system debugging log, important events of the system, such as system errors, custom events and the like, can be recorded, and when the system is in an abnormal condition, operation and maintenance personnel or developers can investigate reasons caused by the abnormal condition of the system through the detailed system debugging log so as to further solve the problem. In order to facilitate the query under different situations and improve the robustness of the log system, the automatically generated system log module stores the user operation log and the system debugging log in two storage modes, namely a file storage mode and a database mode.
The WeChat basic function automatic generation module:
the automatic generation of the wechat module is described in detail above, the wechat module focuses on the functions related to each service data table of the system, and the wechat basic functions referred to herein are similar to wechat user systems, wechat parameter configuration, wechat self-defined menu configuration, wechat keyword message reply, wechat payment, wechat customer service, and the like.
The automatic generation of the WeChat basic function mainly comprises the automatic generation of program codes and the automatic generation of related data table structures and table data. The automatic generation of the program code comprises the creation of each relevant directory structure, the generation of each relevant data model file, the generation of relevant controller files and the generation of relevant view files. The related data tables comprise a micro credit user record data table, a micro credit parameter configuration data table, a micro credit self-defined menu data table, a micro credit key word information data table, a micro credit key word reply content data table, a micro credit payment flow record data table, a micro credit customer service personnel information data table, a micro credit customer message record data table and the like, the data table structures of the tables are stored through an SQL statement file, and the data tables can be automatically generated through the execution of the SQL statement file.
The present embodiment is only for explaining the present invention, and it is not limited to the present invention, and those skilled in the art can make modifications of the present embodiment without inventive contribution as needed after reading the present specification, but all of them are protected by patent law within the scope of the claims of the present invention.

Claims (8)

1. A method for constructing a code automatic generation system based on database annotation is characterized by comprising the following steps:
s1: establishing a code generation platform framework;
s2: selecting a grammar rule according to the type of the established code generation platform framework;
s3: adding comments to the corresponding data tables and the corresponding fields according to the grammar rule selected in the S2;
s4: selecting a target system;
s5: scanning the annotations in the S3 according to the target system selected in the S4, and detecting whether the annotations are legal or not;
s6: and fusing the code generation platform and the target system to obtain the code generation system.
2. An automatic code generation system based on database annotation, based on the construction method of claim 1, is characterized by comprising an automatic project information configuration module, an automatic project deployment module, an automatic domain name resolution module, an automatic database creation module, an automatic database special account creation module, an automatic project file management FTP account creation module, an automatic FTP user permission allocation module, an automatic third-party library introduction module, a custom frame generation module, a background management module automatic generation module, an automatic data interface module generation module, an automatic WeChat development module generation module, a WeChat SDK automatic introduction module, an automatic portal module generation module, a permission control module integration module, a system operation log module integration module and a WeChat basic function integration module.
3. The system of claim 2, wherein the automatic project information configuration module is configured to perform automatic configuration of various items of information of the project, including a project chinese name, a project english name, a project background english name, a project domain name, a database host address, a database name, a database username, a database user password, a data table prefix, an FTP user, and an FTP password.
4. The system of claim 2, wherein the project auto-deployment module is configured to create a project directory, automatically create and write a virtual host file, and restart a server process.
5. The system for automatically generating code based on database annotation as claimed in claim 2, wherein said database automatic creation module is used for automatic creation of database itself, automatic creation of database user and automatic assignment of authority of database user.
6. The system of claim 2, wherein the project FTP management auto-configuration module is used for automatic creation of project-specific FTP accounts, automatic password setting of proprietary FTP accounts, permission setting of proprietary FTP accounts to project directories, registration of FTP users in the operating system, and automatic switching between FTP mode and code generation mode.
7. The system of claim 2, wherein the custom project framework generation module is configured to create a framework hierarchy directory, create and write project profiles, and create and write project entry files.
8. The system of claim 2, wherein the background management module generation module is configured to create a directory, create and write a management layout, import a third-party library, import a third-party static repository, create and write a data model file, create and write a form file, create and write a controller file, create and write a view resource file, and create a data permission checker.
CN201910998100.0A 2019-10-21 2019-10-21 Automatic code generation system based on database annotation and construction method Pending CN110795080A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910998100.0A CN110795080A (en) 2019-10-21 2019-10-21 Automatic code generation system based on database annotation and construction method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910998100.0A CN110795080A (en) 2019-10-21 2019-10-21 Automatic code generation system based on database annotation and construction method

Publications (1)

Publication Number Publication Date
CN110795080A true CN110795080A (en) 2020-02-14

Family

ID=69439433

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910998100.0A Pending CN110795080A (en) 2019-10-21 2019-10-21 Automatic code generation system based on database annotation and construction method

Country Status (1)

Country Link
CN (1) CN110795080A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107273109A (en) * 2013-02-06 2017-10-20 谷歌公司 The method and system modeled to source code and the method using data model
CN111488143A (en) * 2020-04-15 2020-08-04 南京及物智能技术有限公司 Automatic code generation device and method based on Springboot2
CN112068895A (en) * 2020-08-10 2020-12-11 深圳市鼎盛光电有限公司 Code configuration method and device, video playing equipment and storage medium
CN113867700A (en) * 2021-11-30 2021-12-31 阿里云计算有限公司 Model construction method, display platform, server and storage medium
CN114201229A (en) * 2021-11-04 2022-03-18 智新控制系统有限公司 LIN configuration code automatic generation method, system and computer readable storage medium
CN115981614A (en) * 2023-02-24 2023-04-18 美云智数科技有限公司 Project engineering modularization processing method, electronic equipment and computer storage medium
WO2024031983A1 (en) * 2022-08-10 2024-02-15 华为云计算技术有限公司 Code management method and related device

Citations (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004265278A (en) * 2003-03-04 2004-09-24 Jasminsoft:Kk Automatic program generation device
JP2009301385A (en) * 2008-06-16 2009-12-24 Yahoo Japan Corp Name database creation device, method, and program
CN101697120A (en) * 2009-11-05 2010-04-21 河南辉煌科技股份有限公司 Relational database based generation method of J2EE code
CN102957553A (en) * 2011-08-25 2013-03-06 中兴通讯股份有限公司 Method and device for automatic generation of excitation codes
CN102968306A (en) * 2012-11-29 2013-03-13 广东全通教育股份有限公司 Method and system for automatically generating code based on data model drive
CN103309904A (en) * 2012-03-16 2013-09-18 阿里巴巴集团控股有限公司 Method and device for generating data warehouse ETL (Extraction, Transformation and Loading) codes
CN104050085A (en) * 2014-06-25 2014-09-17 北京思特奇信息技术股份有限公司 Forced code standard inspection method and system
CN104142824A (en) * 2014-07-08 2014-11-12 北京彩云动力教育科技有限公司 Code generator based on class library and realization method of code generator
US20160012024A1 (en) * 2014-07-08 2016-01-14 Cognizant Technology Solutions India Pvt. Ltd. Method and system for automatic generation and validation of html5 compliant scripts
CN105446983A (en) * 2014-06-30 2016-03-30 国际商业机器公司 Method and device used for generating data format descriptive language model
CN105487864A (en) * 2015-11-26 2016-04-13 北京京东尚科信息技术有限公司 Method and device for automatically generating code
CN106095408A (en) * 2016-05-31 2016-11-09 浙江网新恒天软件有限公司 A kind of system and method for data monitoring and Code automatic build and deployment
CN106919434A (en) * 2017-03-22 2017-07-04 恒生电子股份有限公司 A kind of code generating method and device
CN107357942A (en) * 2017-09-04 2017-11-17 山东达创网络科技股份有限公司 A kind of source code auxiliary Core Generator and its generation method
US20180267781A1 (en) * 2017-03-20 2018-09-20 Coursera Inc. Code generation for isomorphic data fetching
CN109189383A (en) * 2018-08-28 2019-01-11 厦门海迈科技股份有限公司 The generation method of code file, calculates equipment and storage medium at device
CN110083340A (en) * 2019-03-19 2019-08-02 深圳壹账通智能科技有限公司 Code generating method, device, computer equipment and storage medium
CN110111850A (en) * 2018-01-09 2019-08-09 上海交通大学医学院附属瑞金医院 A kind of biomolecule information database annotation method and system

Patent Citations (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004265278A (en) * 2003-03-04 2004-09-24 Jasminsoft:Kk Automatic program generation device
JP2009301385A (en) * 2008-06-16 2009-12-24 Yahoo Japan Corp Name database creation device, method, and program
CN101697120A (en) * 2009-11-05 2010-04-21 河南辉煌科技股份有限公司 Relational database based generation method of J2EE code
CN102957553A (en) * 2011-08-25 2013-03-06 中兴通讯股份有限公司 Method and device for automatic generation of excitation codes
CN103309904A (en) * 2012-03-16 2013-09-18 阿里巴巴集团控股有限公司 Method and device for generating data warehouse ETL (Extraction, Transformation and Loading) codes
CN102968306A (en) * 2012-11-29 2013-03-13 广东全通教育股份有限公司 Method and system for automatically generating code based on data model drive
CN104050085A (en) * 2014-06-25 2014-09-17 北京思特奇信息技术股份有限公司 Forced code standard inspection method and system
CN105446983A (en) * 2014-06-30 2016-03-30 国际商业机器公司 Method and device used for generating data format descriptive language model
US20160012024A1 (en) * 2014-07-08 2016-01-14 Cognizant Technology Solutions India Pvt. Ltd. Method and system for automatic generation and validation of html5 compliant scripts
CN104142824A (en) * 2014-07-08 2014-11-12 北京彩云动力教育科技有限公司 Code generator based on class library and realization method of code generator
CN105487864A (en) * 2015-11-26 2016-04-13 北京京东尚科信息技术有限公司 Method and device for automatically generating code
CN106095408A (en) * 2016-05-31 2016-11-09 浙江网新恒天软件有限公司 A kind of system and method for data monitoring and Code automatic build and deployment
US20180267781A1 (en) * 2017-03-20 2018-09-20 Coursera Inc. Code generation for isomorphic data fetching
CN106919434A (en) * 2017-03-22 2017-07-04 恒生电子股份有限公司 A kind of code generating method and device
CN107357942A (en) * 2017-09-04 2017-11-17 山东达创网络科技股份有限公司 A kind of source code auxiliary Core Generator and its generation method
CN110111850A (en) * 2018-01-09 2019-08-09 上海交通大学医学院附属瑞金医院 A kind of biomolecule information database annotation method and system
CN109189383A (en) * 2018-08-28 2019-01-11 厦门海迈科技股份有限公司 The generation method of code file, calculates equipment and storage medium at device
CN110083340A (en) * 2019-03-19 2019-08-02 深圳壹账通智能科技有限公司 Code generating method, device, computer equipment and storage medium

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107273109A (en) * 2013-02-06 2017-10-20 谷歌公司 The method and system modeled to source code and the method using data model
CN107273109B (en) * 2013-02-06 2020-11-10 谷歌有限责任公司 Method and system for modeling source code and method for using data model
CN111488143A (en) * 2020-04-15 2020-08-04 南京及物智能技术有限公司 Automatic code generation device and method based on Springboot2
CN112068895A (en) * 2020-08-10 2020-12-11 深圳市鼎盛光电有限公司 Code configuration method and device, video playing equipment and storage medium
CN112068895B (en) * 2020-08-10 2023-12-19 深圳市鼎盛光电有限公司 Code configuration method, device, video playing equipment and storage medium
CN114201229A (en) * 2021-11-04 2022-03-18 智新控制系统有限公司 LIN configuration code automatic generation method, system and computer readable storage medium
CN114201229B (en) * 2021-11-04 2024-04-05 智新控制系统有限公司 LIN configuration code automatic generation method, system and computer readable storage medium
CN113867700A (en) * 2021-11-30 2021-12-31 阿里云计算有限公司 Model construction method, display platform, server and storage medium
CN113867700B (en) * 2021-11-30 2022-03-08 阿里云计算有限公司 Model construction method, display platform, server and storage medium
WO2024031983A1 (en) * 2022-08-10 2024-02-15 华为云计算技术有限公司 Code management method and related device
CN115981614A (en) * 2023-02-24 2023-04-18 美云智数科技有限公司 Project engineering modularization processing method, electronic equipment and computer storage medium
CN115981614B (en) * 2023-02-24 2023-07-07 美云智数科技有限公司 Modular processing method for project engineering, electronic equipment and computer storage medium

Similar Documents

Publication Publication Date Title
CN110795080A (en) Automatic code generation system based on database annotation and construction method
CN106528129B (en) A kind of Web application interface generation system and method
CN109062567B (en) B/S structure-based information management system rapid development platform
CN101218565B (en) Technique for migrating a host environment to a new system platform, transaction control assembly and related disperse client system
CN110069246A (en) The plateform system and its application that a kind of Java Web application is quickly developed
US9514115B2 (en) Method for creating form validation program and corresponding form interface according to result set metadata
CN102222005A (en) Service model-oriented software running platform and running mode thereof
CN104615425A (en) Method and system for developing software system based on features and feature tree
CN101276271A (en) Method and interceptor system facing to tangent plane programming
CN112416345B (en) Universal client software integration system
US20100217839A1 (en) Development system, server of development system, and development method
CN108228762B (en) Method and system for configuring master database universal templates
CN104182228A (en) Method and system for creating network applications
Fox Beginning SharePoint 2010 Development
CN103164226B (en) A kind of set top box human-computer interface automatic generation method
KR100922526B1 (en) Method and system of managing data quality through provisioning of metadata in the execution of business process
Girbea et al. Efficient address space generation for an OPC UA server
CN104318310A (en) Chain hotel guestroom management system
WO2008024164A1 (en) Dynamic program support links
Penberthy Exam Ref 70-486 Developing ASP. NET MVC 4 Web Applications (MCSD): Developing ASP. NET MVC 4 Web Applications
CN104899045A (en) Universal software coding assistance system and method
CN103870276A (en) Blog application system
Fox et al. Pro Oracle Application Express 4
Lu et al. A J2EE based Management Information System for Higher Vocational Colleges
CN113779939B (en) Document hot patch generation method, document hot patch application method and document hot patch Ding Zhuangzhi

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