CN113805877B - Project engineering construction method and device based on IDEA plug-in - Google Patents

Project engineering construction method and device based on IDEA plug-in Download PDF

Info

Publication number
CN113805877B
CN113805877B CN202111132339.3A CN202111132339A CN113805877B CN 113805877 B CN113805877 B CN 113805877B CN 202111132339 A CN202111132339 A CN 202111132339A CN 113805877 B CN113805877 B CN 113805877B
Authority
CN
China
Prior art keywords
project
template
module
file
generating
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
CN202111132339.3A
Other languages
Chinese (zh)
Other versions
CN113805877A (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.)
Industrial and Commercial Bank of China Ltd ICBC
ICBC Technology Co Ltd
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
ICBC 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 Industrial and Commercial Bank of China Ltd ICBC, ICBC Technology Co Ltd filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202111132339.3A priority Critical patent/CN113805877B/en
Publication of CN113805877A publication Critical patent/CN113805877A/en
Application granted granted Critical
Publication of CN113805877B publication Critical patent/CN113805877B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/35Creation or generation of source code model driven

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a project engineering construction method based on an IDEA plug-in, which can be applied to the financial field. The method comprises the following steps: receiving project configuration information of a user; generating a data model according to the project configuration information; and generating a project file catalog and a target file according to the data model and the project template, wherein the project template comprises a main frame template and a service code template, and the target file comprises a configuration file and a service code file corresponding to the project file catalog. The present disclosure also provides a construction apparatus, a device, a storage medium, and a program product of project engineering.

Description

Project engineering construction method and device based on IDEA plug-in
Technical Field
The present disclosure relates to the field of computer technology, in particular to the field of software development, and more particularly to a method, an apparatus, a device, a medium, and a program product for constructing project engineering based on IDEA plug-ins.
Background
With the development of internet technology, software development has undergone the evolution from traditional development to low-code software development and zero-code software development.
In one example, the low-code and zero-code platforms basically provide development services in a cloud platform mode, and the functions provided by the platforms mainly comprise database table visual design, automatic code generation based on a database table structure, generation of corresponding Controller, service, DAO files of a database table, myBatis XML mapping and other files, no catalog and configuration files related to a project framework are generated, the files are independent of the specific project framework and cannot be directly operated, and a developer is required to manually perform configuration to operate, so that the problem of low development efficiency exists.
Disclosure of Invention
In view of the foregoing, the present disclosure provides methods, apparatus, devices, media, and program products for the construction of IDEA plug-in based project engineering.
According to a first aspect of the present disclosure, there is provided a method for constructing an IDEA-plug-in-based project engineering, including: receiving project configuration information of a user;
generating a data model according to the project configuration information; and
Generating project file catalogues and target files according to the data model and the project template,
The project template comprises a main frame template and a service code template, and the target file comprises a configuration file and a service code file corresponding to the project file catalog.
According to an embodiment of the present disclosure, the item configuration information includes an item name, a module type, component information, and database configuration information.
According to an embodiment of the disclosure, the generating a data model according to the project configuration information includes:
Variable labels in the main frame template and the business code template are obtained;
and constructing a data model according to the variable labels and the project configuration information and the template language specification.
According to an embodiment of the disclosure, the project file directory includes a project main file directory and a module file directory, and the generating the project file directory and the target file according to the data model and the project template includes:
acquiring the project name, the module name and the module type;
generating a project main file catalog and a configuration file according to the project names and the main frame template;
generating a module file catalog and a configuration file according to the project name, the module type and the main frame template; and
And generating a service code file according to the project configuration information, the database configuration information and the service code template.
According to an embodiment of the present disclosure, the module type includes a multi-level module and a single-level module, the main frame template includes a single-level module template and a multi-level module template, and generating the module file directory and the configuration file according to the project name, the module type and the main frame template includes:
When the module type is a single-stage module, generating a single-stage module file catalog and a configuration file according to the project name and the single-stage module template;
and when the module type is a multi-level module, generating a multi-level module file catalog and a configuration file according to the project name and the multi-level module template.
According to an embodiment of the present disclosure, the multi-level module templates include a multi-level module master catalog template, an interface module master catalog template, a protocol module master catalog template, and an interface implementation module master catalog template.
According to an embodiment of the present disclosure, the main frame template further includes a main frame start module template, a main frame common module template, and a main frame test module template, and generating the project main file directory and the configuration file according to the project name and the main frame template includes:
Generating a project starting module file catalog and a configuration file according to the project names and the main frame starting module template;
Generating a project public module file catalog and a configuration file according to the project names and the main frame public module template; and
And generating a project test module file catalog and a configuration file according to the project names and the main frame test module template.
According to an embodiment of the present disclosure, the service code template includes a Controller class template, a service interface class template, a service implementation class template, a MyBatis interface class template, a MyBatis mapping file template, an entity class template, and a test class entry template, and generating the service code file according to the item configuration information, the database configuration information, and the service code template includes:
Generating a Controller code file according to the database configuration information and the Controller class template;
Generating a Service code file according to the database configuration information and the Service interface class template;
generating a DAO file according to the database configuration information and the MyBatis interface class template;
generating a MyBatis XML mapping file according to the database configuration information and the MyBatis mapping file template; and
And generating a unit test file according to the database configuration information and the test class entry template.
A second aspect of the present disclosure provides a construction apparatus of project engineering, including: the receiving module is used for receiving project configuration information of a user;
the first generation module is used for generating a data model according to the project configuration information; and
And the second generation module is used for generating a project file catalog and a target file according to the data model and the project template, wherein the project template comprises a main frame template and a service code template, and the target file comprises a configuration file and a service code file corresponding to the project file catalog.
A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the above-described method of constructing an IDEA plug-in based project engineering.
A fourth aspect of the present disclosure also provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the above-described method of constructing an IDEA plug-in based project.
A fifth aspect of the present disclosure also provides a computer program product comprising a computer program which, when executed by a processor, implements the above-described method of constructing an IDEA plug-in based project.
Drawings
The foregoing and other objects, features and advantages of the disclosure will be more apparent from the following description of embodiments of the disclosure with reference to the accompanying drawings, in which:
fig. 1 schematically illustrates an application scenario diagram of a method of constructing an IDEA-plug-in-based project engineering according to an embodiment of the disclosure. ;
FIG. 2 schematically illustrates a flow diagram of a method of building an IDEA-based project in accordance with an embodiment of the present disclosure;
FIG. 3 schematically illustrates a flow diagram of another method of construction of IDEA-based project engineering, in accordance with an embodiment of the present disclosure;
FIG. 4 schematically illustrates a flow diagram of generating project file directories and target files according to a data model and project templates according to an embodiment of the present disclosure;
FIG. 5 schematically illustrates a block diagram of a construction apparatus of project engineering according to an embodiment of the present disclosure; and
Fig. 6 schematically illustrates a block diagram of an electronic device adapted to implement a method of construction of IDEA-plug-in based project engineering, in accordance with an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is only exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. In addition, in the following description, descriptions of well-known structures and techniques are omitted so as not to unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and/or the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be construed to have meanings consistent with the context of the present specification and should not be construed in an idealized or overly formal manner.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a convention should be interpreted in accordance with the meaning of one of skill in the art having generally understood the convention (e.g., "a system having at least one of A, B and C" would include, but not be limited to, systems having a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
The terms and terms appearing in the present disclosure will be explained first.
Low code: a system for quickly building enterprise informatization by a developer depending on a platform is provided, in the process, a user only needs a small amount of code writing, and most other works are completed through visual dragging and clicking.
No code: a development mode without any code programming is mainly used for surrounding enterprise data and business management requirements, designing a data structure in a visual mode, setting access rights and defining a platform of a workflow in a user interaction mode.
Freemarker template engine: APACHE FREEMARKER TM is a Java library for generating text output (HTML web pages, emails, configuration files, source code, etc.) from templates and data.
Freemarker data model: the freemaker data model contains specific values of variables available in the template. The Freemarker data model may be a Java object or an XML file. The freemaker data model is a tree structure.
Freemarker template: text files written using FREEMARKER Template Language (FTL) are commonly named FTL as extensions.
IDEA: intelliJ IDEA is an integrated environment for java programming language development. IntelliJ IDEA supports plug-in development, and the use of plug-ins can effectively improve our development efficiency and user experience.
With the rapid development of internet technology, the development of software has also undergone the evolution from traditional software development to low-code software development and zero-code software development. Low code and zero code fall within the scope of fast development tools that abstract some common code and provide them with visual pages for user operation so that developers can quickly select, drag and create desired functional components.
In one example, both low code and zero code platforms are basically provided in a cloud platform (i.e., APaaS) manner, and the functionality provided by these platforms mainly includes database table visualization design, automatic code generation based on database table structure, and the like.
Some third party organizations, such as MyBatis, myBatisPlus, provide tools for automatically generating codes based on database table structures, which only generate the corresponding Controller, service, DAO, myBatis XML mapping, etc. files of the database tables, and do not generate the related directories and files of the project frames, and these files are independent of the specific project frames, cannot be directly operated, and can be operated only by manually copying the files into the project, configuring and compiling the files.
The project framework generating method only acquires template data corresponding to the project framework according to the framework specification, and then generates a corresponding project framework file based on the template data, but lacks a starting class, a configuration file and the like which are necessary for starting a project, and cannot be directly compiled and operated, and a architect or a developer is required to manually create and configure the project framework to enable the generated project framework to be in a specific operable condition; only providing a framework of single application, and not supporting a project framework of a micro-service architecture style; the project framework generating method does not support multiple module types, such as a single-stage layering module and a multi-stage layering module; only the project framework is generated, but the service codes cannot be generated into the designated project modules, and the service codes need to be manually generated and then manually imported, namely, the automatic code generation in the designated service modules is not supported.
Based on the above technical problems, an embodiment of the present disclosure provides a method for constructing an project engineering based on an IDEA plug-in, including: receiving project configuration information of a user; generating a data model according to the project configuration information; and generating a project file catalog and a target file according to the data model and the project template, wherein the project template comprises a main frame template and a service code template, and the target file comprises a configuration file and a service code file corresponding to the project file catalog.
Fig. 1 schematically illustrates an application scenario diagram of a method of constructing an IDEA-plug-in-based project engineering according to an embodiment of the disclosure. It should be noted that the application scenario illustrated in fig. 1 is merely an example of an application scenario in which embodiments of the present disclosure may be used to help those skilled in the art understand the technical content of the present disclosure, but does not mean that embodiments of the present disclosure may not be used in other devices, systems, environments, or scenarios. It should be noted that, the method and the device for constructing the project engineering based on the IDEA plug-in provided by the embodiment of the disclosure may be used in related aspects of the financial field, and may also be used in any field other than the financial field, and the application field of the method and the device for constructing the project engineering based on the IDEA plug-in provided by the embodiment of the disclosure is not limited.
Fig. 1 schematically illustrates an application scenario diagram of a method of constructing an IDEA-plug-in-based project engineering according to an embodiment of the disclosure.
As shown in fig. 1, the application scenario 100 according to this embodiment may include a scenario in which a developer performs project development. The network 104 is used as a medium to provide communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages or the like. The terminal devices 101, 102, 103 may have IDEA cards or the like installed thereon.
The terminal devices 101, 102, 103 may be a variety of electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (by way of example only) providing support for users to construct project projects using the terminal devices 101, 102, 103. The background management server may process the received data such as the user project configuration information, and feed back the processing result (such as project engineering, data, etc. generated according to the user project configuration information) to the terminal device.
It should be noted that, the method for constructing project engineering based on IDEA plug-in provided in the embodiments of the present disclosure may be generally performed by the server 105. Accordingly, the construction apparatus of the IDEA-plug-in-based project engineering provided by the embodiments of the present disclosure may be generally provided in the server 105. The method of constructing an IDEA-based project engineering provided by the embodiments of the present disclosure may also be performed by a server or a server cluster that is different from the server 105 and is capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Accordingly, the construction apparatus of the IDEA-plug-in-based project engineering provided by the embodiments of the present disclosure may also be provided in a server or a server cluster that is different from the server 105 and is capable of communicating with the terminal devices 101, 102, 103 and/or the server 105.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
The following describes in detail the construction method of the IDEA-plug-in-based project engineering of the disclosed embodiment with reference to fig. 2 to 4 based on the scenario described in fig. 1.
Fig. 2 schematically illustrates a flow chart of a method of construction of IDEA plug-in based project engineering in accordance with an embodiment of the present disclosure.
As shown in fig. 2, the construction method of the IDEA-plug-in-based project engineering of this embodiment includes operations S210 to S230, which may be performed by a processor or a computing device.
In operation S210, item configuration information of a user is received.
In one example, the IDEA is an integrated environment developed by the java programming language. The system has very powerful functions in the aspects of intelligent code assistants, automatic code prompt, reconstruction, java support, various version tools (git, svn and the like), JUnit, CVS integration, code analysis, innovative GUI design and the like.
The IDEA plug-in the embodiments of the present disclosure is pre-developed by a developer according to project examples, and the main functions include engineering scaffolds, module generation tools and code generation tools. Wherein the engineering scaffold: generating a project main frame based on a Freemarker template, wherein the project main frame comprises a project starting module (a starting class, a basic configuration file and the like), a public module (a common directory structure), a custom service module and the like; module generation tool: adding a service module into the existing project according to service requirements and generating a service code under the service module based on a database table structure; code generation tool: according to the service requirement, generating a service code under the service module based on the database table structure in the existing service module.
The user can generate project main body frames, service modules and service codes by using the main frame templates and the service code templates provided by the IDEA plug-in by default, and project engineering is quickly constructed. The template is written by a developer by using a Freemarker template language, and if the main frame template and the business code template provided by the IDEA do not meet project requirements, a user can customize the project main frame template and the business code template within the range of the existing data model by referring to the Freemarker template specification.
The user inputs project configuration information through an operation interface provided by the IDEA plug-in. The project configuration information may be project generation paths, project information, module information, database configuration information, and the like.
In operation S220, a data model is generated according to the item configuration information.
The data model is a data container and the internal structure is a definition of a specific multi-level project structure. A data model may be constructed according to the item configuration information received in operation S210, and the item configuration information may be filled into the freejacket data model according to the freejacket template language specification, so that the freejacket template engine processes the freejacket template that has been defined according to the freejacket variable values in the data model.
In operation S230, a project file directory and a target file are generated according to the data model and the project template, wherein the project template includes a main frame template and a service code template, and the target file includes a configuration file and a service code file corresponding to the project file directory.
In one example, the project templates include a main frame template and a business code template written by a developer using the Freemarker template language. According to the data model and the project template obtained in operation S220 as input parameters, the APACHE FREEMARKER template engine is invoked, and the project file directory and each module file directory, and the configuration file and the service code file corresponding to the project file directory can be output.
By the method for constructing project engineering based on the IDEA plug-in, project file catalogs and project frames can be quickly generated according to project configuration information of users, service codes are automatically generated based on database tables, workload of developers is reduced, development efficiency is improved, and quick development of a server side is achieved.
Fig. 3 schematically illustrates a flow chart of another method of construction of IDEA plug-in based project engineering in accordance with an embodiment of the present disclosure.
In operation S310, item configuration information of a user is received.
According to an embodiment of the present disclosure, the project configuration information includes a project name, a module type, component information, and database configuration information.
In one example, a user clicks on an engineering scaffold in an IDEA plug-in, enters a build project main body frame page, and sets an output root directory and a template root directory on an initialization setting page; setting project information in a project setting page, wherein the project information comprises information such as a project center text name, a parent package name, a version number, description information, a project type and the like, the parent package name is a prefix of a Java package name, such as com. Gykj, and then a complete Java package name and a file directory are automatically generated according to the project name and the module name according to the prefix; the project type comprises a single application and a micro-service application, wherein the single application and the micro-service application respectively correspond to different components, when the project type is the micro-service application, the micro-service application is selected to pop up a frame type option, and a architect or a developer selects a micro-service frame to be used: DSF frames or SpringCloudAlibaba frames.
The components used by the project are selected according to the project requirement on the component setting page, and can be a log component, a security component, an interface document component, a global serial number component, a system management component, a local cache component and the like; setting information such as module name, module type and the like on a module setting page, and adding or deleting modules at the same time; the database configuration information includes information such as database type, version, database name, URL, database user name, and password.
In operation S320, variable tags in the main frame template and the service code template are acquired.
In operation S330, a data model is constructed according to the template language specification according to the variable tag and the project configuration information.
In one example, a developer builds a data model from FREEMARKER variable tags in the main framework template and business code template. The main function of the data model is to store, as a data container, the project configuration information acquired in operation S310, including data such as project generation paths, project information (project name, package name, version number, etc.), module information (module name, module type), component information, database configuration information, etc., for use by the FREEMARKER engine.
In operation S340, a project file directory and a target file are generated according to the data model and the project template.
FIG. 4 schematically illustrates a flow diagram of generating project file directories and target files according to a data model and project templates according to an embodiment of the present disclosure.
As shown in fig. 4, operation S340 includes operations S341 to S344, in which operation S342 is an execution step of generating a project frame for the engineering scaffold of the IDEA plug-in, operation S343 is an execution step of generating a service module catalog file by the module generating tool, and operation S344 is an execution step of generating a service code file by the code generating tool.
In operation S341, an item name, a module name, and a module type are acquired.
In operation S342, project main file directories and profiles are generated according to the project names and the main frame templates.
In one example, information such as a project name, a module name, and a module type is acquired according to project configuration information in operation S310, and a project main file directory and a configuration file are automatically generated according to the project name and a main frame template.
According to an embodiment of the present disclosure, the main frame template further includes a main frame start module template, a main frame common module template, and a main frame test module template.
The main frame template is as follows:
Pt. $ { pn } -master: project master file catalog templates.
A) $ { pn } -app: the project starting module files the catalog template.
B) $ { pn } -common: project common module file directory templates.
C) $ { pn } -test: project test module file directory template.
Mmt $ { pn } - $ { mn }: the module type is a multi-level module master catalog template.
A) $ { pn } - $ { mn } -api: the service interface module files directory template.
B) $ { pn } - $ { mn } -controller: service release protocol module file directory template.
C) $ { pn } - $ { mn } -provider: the service interface implements a module file directory template.
Smt $ { pn } - $ { mn }: the module type is a single-level module master file directory template.
Test $ { pn } - $ { mn } -test: the test module hosts a file directory template.
Wherein, the variable pn is the project name, the variable mn is the module name, the variable grp is the Java package group name, the variable cmp is the Java package company name, and the variable pnp is the Java package project name. The term "pn" refers to a primary file directory, the term "mmt" $ { pn "$ { mn }, the term" sm "$ { pn" $ { mn }, the term "$ { pn } -the term" $ { pn }, $ { mn } -the term "is a secondary file directory, the term" $ { pn }, $ { mn } -api, $ { pn }, $ { mn } -controller, $ { pn }, $ { mn } -provider is a tertiary file directory, and the term "mmt" $ { pn $ { mn }, is a subdirectory of the term "mmt" $ { pn }, $mn }.
According to the embodiment of the disclosure, a project start module file catalog and a configuration file are generated according to the project names and the main frame start module template.
The main frame startup module template is as follows:
$ { pn } -app: the project starting module hosts the catalog template.
A) java $ { grp } $ { cmp } $ { pnp }, app: the item initiates a class catalog template.
B) ProjectBootApplication, java. Ftl: the project initiates a class template.
C) application-dev. Yml. Ftl: the project initiates a profile template.
D) logback-spring. Xml. Ftl: project log configuration file templates.
E) pon.xml.ftl: maven POM file template.
In one example, the startup module template automatically generates startup module levels of file directories, startup files, configuration files, etc. of the project according to the project name, and copies non-template files in the startup module to the corresponding file directories. The generated project frames and business codes can be directly compiled and operated by adding the starting module template, development personnel are not required to carry out secondary development, manual configuration and other works, and development efficiency is improved.
According to the embodiment of the disclosure, project common module file catalogs and configuration files are generated according to project names and the main frame common module templates.
In one example, the common module template is mainly a common module all-level file directory, configuration class and the like which automatically generate the project according to the project name.
The main frame common module template is as follows:
$ { pn } -common: project common module master catalog templates.
A) java $ { grp } $ { cmp } $ { pnp }, common: project common module class catalog templates.
B) pon.xml.ftl: maven POM file template.
According to the embodiment of the disclosure, a project test module file directory and a configuration file are generated according to the project name and the main frame test module template.
In one example, the main frame test module template mainly generates each level of file catalogue, test base class, configuration file and the like of the test module of the project automatically according to the project name, and copies the non-template files in the test module to the corresponding file catalogue.
The project test module templates are as follows:
$ { pn } -test-common: project test public module master catalog templates.
A) BaseControllerTest. Java. Ftl: and testing the basic class template.
B) application-ut. Yml. Ftl: and testing the configuration file template.
C) pon.xml.ftl: maven POM file template.
$ { Pn } -test-start: project test starting module master catalog template.
A) pon.xml.ftl: maven POM file template.
By setting project test module templates, creation of test modules and generation of test case codes are supported.
In operation S343, a module file directory and a configuration file are generated according to the item name, the module type, and the main frame template.
According to an embodiment of the present disclosure, the module types include a multi-stage module and a single-stage module, and the main frame template includes a single-stage module template and a multi-stage module template. The multi-level module template comprises a multi-level module master catalog template, an interface module master catalog template, a protocol module master catalog template and an interface realization module master catalog template. When the module type is a single-stage module, generating a single-stage module file catalog and a configuration file according to the project configuration information and the single-stage module template; and when the module type is a multi-level module, generating a multi-level module file catalog and a configuration file according to the project configuration information and the multi-level module template.
In one example, a single-level module refers to an application module that adopts a traditional three-layer (i.e., presentation layer, business layer, data access layer) structure, where the single-level module only divides the hierarchy, and the sub-modules are not being divided. The multi-level module refers to a service module which is divided into three sub-modules according to a service interface sub-module, a service realization sub-module and a service protocol sub-module. By adopting the module division mode, different service realization and different service release protocols can be realized for the same service interface, and the micro-service architecture can be conveniently supported. For the service realization sub-module, a traditional application three-layer structure (namely, a presentation layer, a service layer and a data access layer) is adopted inside the sub-module. Multiple module layered structures can be supported simultaneously by arranging a single-stage module template and a multi-stage module template.
In operation S344, a service code file is generated according to the project configuration information, the database configuration information, and the service code template.
According to the embodiment of the disclosure, the service code templates comprise a Controller class template, a service interface class template, a service implementation class template, a MyBatis interface class template, a MyBatis mapping file template, an entity class template and a test class entry template.
The business code template is as follows:
control. Java. Ftl: SPRINGMVC controller class templates.
Service. Java. Ftl: service interface class templates.
Serviceimpl. The service implements class templates.
A mapper, java, ftl: myBatis interface class templates.
Mapper. Xml. Ftl: myBatis maps to the file template.
Identity, java, ftl: entity class templates.
Testcontroller.java.ftl: class entry templates are tested.
In one example, the service code template mainly generates Controller, service, DAO, myBatis XML mapping file, unit test file and other codes corresponding to the selected database table.
Based on the user selected database table and the business code template, a call APACHE FREEMARKER to the template engine may generate a corresponding code file.
For example, a Controller code file is generated according to the database table structure and the Controller class template; generating a Service code file according to the database table structure and the Service interface class template; generating a DAO file according to the database table structure and the MyBatis interface class template; generating a MyBatis XML mapping file according to the database table structure and the MyBatis mapping file template; and generating a unit test file according to the database table structure and the test class entry template.
According to the method for constructing the project engineering based on the IDEA plug-in, the user-defined IDEA plug-in is adopted, the frame catalog, the code file and the configuration file are automatically generated according to project configuration information of a user, the main frame template and the service code template, and the starting module and the public module are generated by default, so that the generated project can be compiled and run, the single-module architecture style and the micro-service architecture style are supported, the single-module layered structure and the multi-module layered structure are supported, and the development efficiency of developers is improved.
Based on the project construction method based on the IDEA plug-in, the disclosure also provides a project construction device. The device will be described in detail below in connection with fig. 5.
FIG. 5 schematically illustrates a block diagram of a construction apparatus of project engineering according to an embodiment of the present disclosure.
As shown in fig. 5, the construction apparatus 500 of the project of this embodiment includes a receiving module 510, a first generating module 520, and a second generating module 530.
The receiving module 510 is configured to receive project configuration information of a user. In an embodiment, the receiving module 510 may be configured to perform the operation S210 described above, which is not described herein.
The first generation module 520 is configured to generate a data model according to the project configuration information. In an embodiment, the first generating module 520 may be used to perform the operation S220 described above, which is not described herein.
The second generating module 530 is configured to generate a project file directory and a target file according to the data model and the project template, where the project template includes a main frame template and a service code template, and the target file includes a configuration file and a service code file corresponding to the project file directory. In an embodiment, the second generating module 530 may be configured to perform the operation S230 described above, which is not described herein.
Any of the plurality of modules of the receiving module 510, the first generating module 520, and the second generating module 530 may be combined in one module to be implemented, or any of the plurality of modules may be split into a plurality of modules according to an embodiment of the present disclosure. Or at least some of the functionality of one or more of the modules may be combined with, and implemented in, at least some of the functionality of other modules. According to embodiments of the present disclosure, at least one of the receiving module 510, the first generating module 520, and the second generating module 530 may be implemented at least in part as hardware circuitry, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or in hardware or firmware, such as any other reasonable way of integrating or packaging circuitry, or in any one of or a suitable combination of any of the three. Or at least one of the receiving module 510, the first generating module 520 and the second generating module 530 may be at least partially implemented as computer program modules which, when executed, may perform the respective functions.
Fig. 6 schematically illustrates a block diagram of an electronic device adapted to implement a method of construction of IDEA-plug-in based project engineering, in accordance with an embodiment of the present disclosure.
As shown in fig. 6, an electronic device 600 according to an embodiment of the present disclosure includes a processor 601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. The processor 601 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or an associated chipset and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), or the like. Processor 601 may also include on-board memory for caching purposes. The processor 601 may comprise a single processing unit or a plurality of processing units for performing different actions of the method flows according to embodiments of the disclosure.
In the RAM 603, various programs and data necessary for the operation of the electronic apparatus 600 are stored. The processor 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. The processor 601 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM 602 and/or the RAM 603. Note that the program may be stored in one or more memories other than the ROM 602 and the RAM 603. The processor 601 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in one or more memories.
According to an embodiment of the present disclosure, the electronic device 600 may also include an input/output (I/O) interface 605, the input/output (I/O) interface 605 also being connected to the bus 604. The electronic device 600 may also include one or more of the following components connected to the I/O interface 605: an input portion 606 including a keyboard, mouse, etc.; an output portion 607 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The drive 610 is also connected to the I/O interface 605 as needed. Removable media 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on drive 610 so that a computer program read therefrom is installed as needed into storage section 608.
The present disclosure also provides a computer-readable storage medium that may be embodied in the apparatus/device/system described in the above embodiments; or may exist alone without being assembled into the apparatus/device/system. The computer-readable storage medium carries one or more programs which, when executed, implement methods in accordance with embodiments of the present disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example, but is not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, the computer-readable storage medium may include ROM 602 and/or RAM 603 and/or one or more memories other than ROM 602 and RAM 603 described above.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowcharts. When the computer program product runs in a computer system, the program code is used for enabling the computer system to realize the method for constructing project engineering based on IDEA plug-ins provided by the embodiment of the disclosure.
The above-described functions defined in the system/apparatus of the embodiments of the present disclosure are performed when the computer program is executed by the processor 601. The systems, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed in the form of signals over a network medium, and downloaded and installed via the communication section 609, and/or installed from the removable medium 611. The computer program may include program code that may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 609, and/or installed from the removable medium 611. The above-described functions defined in the system of the embodiments of the present disclosure are performed when the computer program is executed by the processor 601. The systems, devices, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
According to embodiments of the present disclosure, program code for performing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, such computer programs may be implemented in high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. Programming languages include, but are not limited to, such as Java, c++, python, "C" or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that the features recited in the various embodiments of the disclosure and/or in the claims may be provided in a variety of combinations and/or combinations, even if such combinations or combinations are not explicitly recited in the disclosure. In particular, the features recited in the various embodiments of the present disclosure and/or the claims may be variously combined and/or combined without departing from the spirit and teachings of the present disclosure. All such combinations and/or combinations fall within the scope of the present disclosure.
The embodiments of the present disclosure are described above. These examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the embodiments cannot be used advantageously in combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be made by those skilled in the art without departing from the scope of the disclosure, and such alternatives and modifications are intended to fall within the scope of the disclosure.

Claims (9)

1. The method for constructing the project engineering based on the IDEA plug-in is characterized by comprising the following steps of:
Receiving project configuration information of a user;
generating a data model according to the project configuration information; and
Generating project file catalogues and target files according to the data model and the project template,
Wherein the project template comprises a main frame template and a business code template, the target file comprises a configuration file and a business code file corresponding to the project file catalog,
The project configuration information comprises a project name, a module type, component information and database configuration information;
The generating a data model according to the project configuration information comprises the following steps:
Variable labels in the main frame template and the business code template are obtained;
Constructing a data model according to the variable labels and the project configuration information and the template language specifications,
The project file catalogue comprises a project main file catalogue and a module file catalogue, and the generating the project file catalogue and the target file according to the data model and the project template comprises the following steps:
acquiring the project name, the module name and the module type;
generating a project main file catalog and a configuration file according to the project names and the main frame template;
generating a module file catalog and a configuration file according to the project name, the module type and the main frame template; and
And generating a service code file according to the database configuration information and the service code template.
2. The method of claim 1, wherein the module types include a multi-level module and a single-level module, the main frame template includes a single-level module template and a multi-level module template, and the generating a module file directory and a configuration file from the project name, the module types, and the main frame template includes:
When the module type is a single-stage module, generating a single-stage module file catalog and a configuration file according to the project name and the single-stage module template;
and when the module type is a multi-level module, generating a multi-level module file catalog and a configuration file according to the project name and the multi-level module template.
3. The method of claim 2, wherein the multi-level module templates comprise a multi-level module master catalog template, an interface module master catalog template, a protocol module master catalog template, and an interface implementation module master catalog template.
4. The method of claim 1, wherein the main frame template further comprises a main frame launch module template, a main frame common module template, and a main frame test module template, the generating project main file directories and configuration files from the project names and the main frame templates comprising:
Generating a project starting module file catalog and a configuration file according to the project names and the main frame starting module template;
Generating a project public module file catalog and a configuration file according to the project names and the main frame public module template; and
And generating a project test module file catalog and a configuration file according to the project names and the main frame test module template.
5. The method of claim 1, wherein the business code templates comprise a Controller class template, a service interface class template, a service implementation class template, a MyBatis interface class template, a MyBatis mapping file template, an entity class template, and a test class entry template, and wherein generating the business code file from the database configuration information and the business code template comprises:
Generating a Controller code file according to the database configuration information and the Controller class template;
Generating a Service code file according to the database configuration information and the Service interface class template;
generating a DAO file according to the database configuration information and the MyBatis interface class template;
generating a MyBatis XML mapping file according to the database configuration information and the MyBatis mapping file template; and
And generating a unit test file according to the database configuration information and the test class entry template.
6. A construction apparatus of project engineering, comprising:
the receiving module is used for receiving project configuration information of a user;
the first generation module is used for generating a data model according to the project configuration information; and
A second generation module for generating a project file catalog and a target file according to the data model and the project template, wherein the project template comprises a main frame template and a service code template, the target file comprises a configuration file and a service code file corresponding to the project file catalog,
The project configuration information comprises a project name, a module type, component information and database configuration information;
The first generation module is also used for acquiring variable labels in the main frame template and the business code template; constructing a data model according to the variable labels and the project configuration information and the template language specifications,
The project file catalogue comprises a project main file catalogue and a module file catalogue, and the second generation module is specifically used for acquiring the project name, the module name and the module type; generating a project main file catalog and a configuration file according to the project names and the main frame template; generating a module file catalog and a configuration file according to the project name, the module type and the main frame template; and generating a service code file according to the database configuration information and the service code template.
7. An electronic device, comprising:
one or more processors;
Storage means for storing one or more programs,
Wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-5.
8. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to perform the method according to any of claims 1-5.
9. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 5.
CN202111132339.3A 2021-09-26 2021-09-26 Project engineering construction method and device based on IDEA plug-in Active CN113805877B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111132339.3A CN113805877B (en) 2021-09-26 2021-09-26 Project engineering construction method and device based on IDEA plug-in

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111132339.3A CN113805877B (en) 2021-09-26 2021-09-26 Project engineering construction method and device based on IDEA plug-in

Publications (2)

Publication Number Publication Date
CN113805877A CN113805877A (en) 2021-12-17
CN113805877B true CN113805877B (en) 2024-06-25

Family

ID=78938703

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111132339.3A Active CN113805877B (en) 2021-09-26 2021-09-26 Project engineering construction method and device based on IDEA plug-in

Country Status (1)

Country Link
CN (1) CN113805877B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114296701A (en) * 2021-12-23 2022-04-08 中科软齐(武汉)科技有限公司 Java web project development method capable of quickly generating engineering files
CN115686498A (en) * 2022-11-15 2023-02-03 南京鼎华智能系统有限公司 System and method for generating data model

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6968541B1 (en) * 2000-10-04 2005-11-22 International Business Machines Corporation Apparatus and method for template instantiation with a cross compiler
CN102375743B (en) * 2011-10-20 2014-10-08 北京金和软件股份有限公司 SOA(Service-Oriented Architecture) system development method based on model and template
CN106528165B (en) * 2016-11-11 2019-10-08 深圳中兴网信科技有限公司 Code generating method and code generating system
CN108196825A (en) * 2017-12-28 2018-06-22 新华三大数据技术有限公司 The construction method and system of software project
CN110032369A (en) * 2019-04-24 2019-07-19 成都市映潮科技股份有限公司 A kind of code automatic generation method, device and medium
CN112748908B (en) * 2020-12-31 2024-02-27 广东广宇科技发展有限公司 Method and device for developing Restful service based on SSM framework

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
The implementation of template method pattern by aspect based on configuration file;Liu Jicheng Etc.;2015 10th International Conference on Computer Science & Education (ICCSE);20150910;全文 *
一种基于模型和模板融合的自动代码生成方法;王博 等;现代电子技术;20191115;第42卷(第22期);全文 *

Also Published As

Publication number Publication date
CN113805877A (en) 2021-12-17

Similar Documents

Publication Publication Date Title
US11561846B2 (en) API notebook tool
US20230236809A1 (en) Ios application program construction method and apparatus, electronic device, and storage medium
US9430207B1 (en) Automated cross-platform native mobile application generation with cloud driven user interface and workflow synthesis
US9690558B2 (en) Orchestrating the lifecycle of multiple-target applications
US20210208854A1 (en) System and method for enhancing component based development models with auto-wiring
US20130117652A1 (en) Techniques to generate custom electronic forms
JP2021111368A (en) API-based software development platform
CN113805877B (en) Project engineering construction method and device based on IDEA plug-in
CN111221521A (en) Method and device for generating log code, computer system and readable storage medium
US20120174068A1 (en) Testing Software Code
US20130067456A1 (en) Application configuration framework for enterprise resource planning application installation
CN113778848A (en) Test code generation method, device, computer system and medium
CN110895471A (en) Installation package generation method, device, medium and electronic equipment
EP3654175A1 (en) Terminal device, ui extension method, and ui extension program
CN114237651A (en) Installation method and device of cloud native application, electronic equipment and medium
CN113127361A (en) Application program development method and device, electronic equipment and storage medium
US11195137B2 (en) Model-driven and automated system for shared resource solution design
KR20170105325A (en) Method for analyzing source code, system and apparatus for executing the method
US11314530B2 (en) User-based extension setting devices, methods, and programs
US20200097260A1 (en) Software application developer tools platform
CN114048415A (en) Form generation method and device, electronic equipment and computer readable storage medium
Galizia et al. Using Apache Airavata and EasyGateway for the creation of complex science gateway front-end
CN113032004B (en) Method, apparatus and program product for managing development jobs in a development environment
CN113760733A (en) Unit testing method and device
CN116700745A (en) Application deployment method and device based on container cloud platform, electronic equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant