CN109254992B - Project generation method and system, computer system and computer-readable storage medium - Google Patents

Project generation method and system, computer system and computer-readable storage medium Download PDF

Info

Publication number
CN109254992B
CN109254992B CN201811194231.5A CN201811194231A CN109254992B CN 109254992 B CN109254992 B CN 109254992B CN 201811194231 A CN201811194231 A CN 201811194231A CN 109254992 B CN109254992 B CN 109254992B
Authority
CN
China
Prior art keywords
metadata
target
project
template
template file
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
CN201811194231.5A
Other languages
Chinese (zh)
Other versions
CN109254992A (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.)
Jingdong Technology Holding Co Ltd
Original Assignee
JD Digital Technology Holdings 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 JD Digital Technology Holdings Co Ltd filed Critical JD Digital Technology Holdings Co Ltd
Priority to CN201811194231.5A priority Critical patent/CN109254992B/en
Publication of CN109254992A publication Critical patent/CN109254992A/en
Application granted granted Critical
Publication of CN109254992B publication Critical patent/CN109254992B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present disclosure provides a project generation method, including obtaining a configuration file, wherein the configuration file includes configuration information for generating a target project; acquiring metadata from a target database according to configuration information in the configuration file; determining a template file of a target project; and inputting the metadata into the template file to generate the target project. The present disclosure also provides a project generation system, a computer system, and a computer-readable storage medium.

Description

Project generation method and system, computer system and computer-readable storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a project generation method and system, a computer system, and a computer-readable storage medium.
Background
In the current system development process, a database model is generally required to be designed, SQL is generated, a database building table is built, then a project is built, a project structure is built manually, enumeration and entity classes are built, SQL corresponding xml files and the like are compiled according to services, and service logic, a front end and a management background are realized. However, when a database model is designed manually, the problem of non-specification can not be found in time, so that the subsequent maintenance cost is too high; the inconsistency of the database table, the field and the system code is easy to occur and is difficult to perceive, the table is increased, the field modification cannot be timely and accurately kept synchronous with the code, manual maintenance is needed, time and labor are wasted, and errors are easy to occur. Moreover, manually-built projects are complicated repeatedly, structural styles are different, a large amount of time is spent on configuring and debugging the projects, tools, general solutions and the like accumulated in the past projects need to be manually moved to new projects, and work is consumed.
Therefore, in the course of implementing the disclosed concept, the inventors found that there are at least the following problems in the related art:
by adopting a mode of designing a database model and newly building a project structure by adopting the related technology, the problems that the database model is not standard and the built project is repeated and fussy can occur.
Disclosure of Invention
In view of the above, the present disclosure provides a project generation method and system, a computer system, and a computer-readable storage medium.
One aspect of the present disclosure provides a project generation method, including obtaining a configuration file, where the configuration file includes configuration information for generating a target project; acquiring metadata from a target database according to the configuration information in the configuration file; determining a template file of the target project; and inputting the metadata into the template file to generate the target item.
According to the embodiment of the disclosure, acquiring metadata from a target database according to configuration information in the configuration file comprises judging whether the structural design of the target database meets a preset rule or not in the process of acquiring the metadata from the target database; displaying prompt information under the condition that the structural design of the target database is judged not to meet a preset rule; and acquiring the metadata under the condition that the structural design of the target database meets a preset rule.
According to an embodiment of the present disclosure, the method further includes determining a type of the template file before the metadata is input into the template file and the target item is generated; determining an input strategy of the metadata according to the type of the template file; and inputting the metadata into the template file according to the determined input strategy.
According to the embodiment of the disclosure, the framework of the template file comprises a service terminal subsystem, a user foreground subsystem, an operation background subsystem and a common component subsystem.
According to an embodiment of the present disclosure, inputting the metadata into the template file, and generating the target item includes: generating a background management page of the target project based on the template file; and after the background management page of the target project is generated, in the process of starting the target project, combining the macro definition of the template engine and the enumeration class pre-loaded with the metadata to display the background management page.
Another aspect of the present disclosure provides a project generating system, including a first obtaining module, configured to obtain a configuration file, where the configuration file includes configuration information for generating a target project; the second acquisition module is used for acquiring metadata from the target database according to the configuration information in the configuration file; the first determining module is used for determining the template file of the target project; and a generating module, configured to input the metadata into the template file, and generate the target item.
According to an embodiment of the present disclosure, the second obtaining module includes a determining unit, configured to determine whether a structural design of the target database meets a preset rule in a process of obtaining metadata from the target database; the first display unit is used for displaying prompt information under the condition that the structural design of the target database is judged not to meet a preset rule; and an obtaining unit configured to obtain the metadata when it is determined that the structural design of the target database satisfies a preset rule.
According to an embodiment of the present disclosure, the system further includes a second determining module, configured to determine a type of the template file before the metadata is input into the template file and the target item is generated; a third determining module, configured to determine an input policy of the metadata according to the type of the template file; and the input module is used for inputting the metadata into the template file according to the determined input strategy.
According to the embodiment of the disclosure, the framework of the template file comprises a service terminal subsystem, a user foreground subsystem, an operation background subsystem and a common component subsystem.
According to an embodiment of the present disclosure, the generating module includes a generating unit, configured to generate a background management page of the target project based on the template file; and the second display unit is used for displaying the background management page in combination with the macro definition of the template engine and the enumeration class preloaded with the metadata in the process of starting the target project after the background management page of the target project is generated.
Yet another aspect of the disclosure provides a computer system comprising one or more processors; 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 implement the item generation method as described above.
Yet another aspect of the present disclosure provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to implement a project generation method as described above.
Another aspect of the disclosure provides a computer program comprising computer executable instructions for implementing the project generation method as described above when executed.
According to the embodiment of the disclosure, because a technical means of automatically generating the target project by determining the template file of the target project and inputting the metadata into the template file is adopted, the technical problems that the database model is not standard and the project is repeatedly and fussy to build in the related art in a manner of manually designing the database model and newly building the project structure in the related art are at least partially overcome, and further the technical effects of automatically generating the target project and improving the project generation efficiency are achieved.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments of the present disclosure with reference to the accompanying drawings, in which:
FIG. 1 schematically illustrates an exemplary system architecture to which the project generation methods and systems may be applied, according to embodiments of the present disclosure;
FIG. 2 schematically shows a flow diagram of a project generation method according to an embodiment of the present disclosure;
FIG. 3 schematically illustrates a flow diagram for obtaining metadata from a target database according to configuration information in a configuration file, according to an embodiment of the present disclosure;
FIG. 4 schematically shows a flow diagram of a project generation method according to another embodiment of the present disclosure;
FIG. 5 schematically shows a schematic diagram of the architecture of a template file according to an embodiment of the present disclosure;
FIG. 6 schematically shows a flow diagram for generating a target item according to an embodiment of the present disclosure;
FIG. 7 schematically illustrates a block diagram of a project generation system according to an embodiment of the present disclosure;
FIG. 8 schematically illustrates a block diagram of a second acquisition module according to an embodiment of the disclosure;
FIG. 9 schematically shows a block diagram of a project generation system according to another embodiment of the present disclosure;
FIG. 10 schematically shows a block diagram of a generation module according to an embodiment of the disclosure; and
FIG. 11 schematically illustrates a block diagram of a computer system suitable for implementing the above-described method, according to 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 illustrative only 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 disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not 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 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 is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have 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.). Where a convention analogous to "A, B or at least one of C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B or C" would include but not be limited to systems that have 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 embodiment of the disclosure provides a project generation method and a system, wherein the method comprises the steps of obtaining a configuration file, wherein the configuration file comprises configuration information used for generating a target project; acquiring metadata from a target database according to configuration information in the configuration file; determining a template file of a target project; and inputting the metadata into the template file to generate the target project.
Fig. 1 schematically illustrates an exemplary system architecture to which the project generation method and system may be applied, according to an embodiment of the present disclosure. It should be noted that fig. 1 is only an example of a system architecture to which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, and does not mean that the embodiments of the present disclosure may not be applied to other devices, systems, environments or scenarios.
As shown in fig. 1, according to an embodiment of the present disclosure, a corresponding configuration file may be obtained from a storage area where the configuration file is stored, and then metadata may be obtained from a database according to the obtained configuration file, for example, according to a database source included in the configuration file, such as attributes of a database driver, an address, a port, a database name, a user name, a password, and the like, metadata may be read and processed through the data source, and an association relationship between a table, a field, and a field may be simultaneously saved. After the metadata is read, a template file for determining the target project can be obtained from the template library, and the metadata is input into the template file to generate the target project. For example, through recursion traversal of the maintained template root directory, through different template file types, the corresponding processing logic is realized, the template file of the target project is determined, the target code is generated and output to the designated path, and the project code generation is completed.
According to the embodiment of the disclosure, by determining the template file of the target project, inputting the metadata into the template file, and automatically generating the target project, the technical problems that the database model is not standard and the project is repeatedly and fussy to build due to the adoption of a mode of manually designing the database model and newly building the project structure in the related technology are at least partially overcome. For example, the problems of non-standardization, non-consistency and repeated fussy basic work in the process from database design to project code writing of developers in WEB system development built by a Maven and SSM framework can be solved. Where Maven is a project building and management tool. The SSM framework is an abbreviation of Spring + Spring MVC + MyBatis, is a current mainstream Java EE enterprise-level framework, and is suitable for building various large-scale enterprise-level application systems.
FIG. 2 schematically shows a flow diagram of a project generation method according to an embodiment of the present disclosure.
As shown in fig. 2, the method includes operations S210 to S240.
In operation S210, a configuration file is acquired, wherein the configuration file includes configuration information for generating a target item.
In operation S220, metadata is acquired from the target database according to the configuration information in the configuration file.
In operation S230, a template file of the target item is determined.
In operation S240, metadata is input into the template file, and a target item is generated.
According to the embodiment of the disclosure, the configuration file can be read by the code generator, and the metadata is obtained from the target database according to the configuration information in the configuration file. According to the embodiment of the disclosure, the metadata can be further processed, then the maintained template root directory is recursively traversed, corresponding processing logic is realized through different template file types, the metadata is input into the template file, the target code is generated and output to the specified path, and the generation of the project code is completed.
According to an embodiment of the present disclosure, the configuration information for generating the target item may include various kinds, for example, may include, but is not limited to, the following information: 1. a database source: the method comprises five attributes including database drive, address, port, database name, user name and password, wherein metadata is read through a data source and processed, and the association relationship among a table, a field and field enumeration is stored at the same time, and the processed attributes are as follows: table: table name, table remark, table object name, table class name; field: database column names, Java names, capital letters of Java names, remarks, JDBC types, Java types, simplified remarks, whether enumeration is performed, the maximum length is performed, and whether the remarks are empty or not; field enumeration: enumerating the described Chinese pinyin letters, capitalizing underlines, enumerating numerical values and enumerating description. 2. Inclusion and exclusion of table names: the method comprises the steps of including table names and excluding table names, determining a table which is generated and not generated according to the two configurations of the table names separated by English commas, including all the table names if the included table names are null, not excluding the table names if the excluded table names are null, and having exclusion priority higher than the included table names. 3. Item-related configuration: the system comprises three attributes of groupId, artifactId and projectName, wherein the groupId represents a developer ID, the artifactId represents a project name and is used for constructing a maven project, determining an output path and generating a package name, and the projectName represents the project name and is used for managing background display. sysModules: the lower case letters are underlined, the characters are not more than 40 at most, English commas are separated, the service is defaulted, if the attribute is configured, a specified number of interface service subsystems are generated, the interface service is often used for the detailed splitting of the interface service, for example, in order to reduce the influence of the service interface on the interaction with a fund company, the fund front end can be split and configured into the service, and the fund front end is a function-front. Servlet 3: if true, then servlet3 will be introduced, actually subject to the container. Output folder: output folder, support D: the form of \ \ gen and/gen. 7. Generating a strategy: when the target file is generated, if the target file does not exist, the target file is uniformly generated. For the case where a target file exists, there are three parameters that can control the generation policy. Forcedly generated target files, forceGenerateFiles, separated by english commas, are often used to cover target generated files; if the generation is not repeated, isReGenerator, true will only cover the file involved in the generation table field modification; IsoOverWrite, true, or false, valid when isReGenerate is not true, indicates whether the target file is overwritten, and is not overwritten by default. An author: and (4) a project author notes the generated code. According to the embodiment of the disclosure, the new project is generated by using the template file of the target project, the configuration file, the code style and the frame structure are maintained uniformly and stably and available, the generation can be directly deployed and operated after the completion, and a series of complex work of newly building the project every time is avoided. Meanwhile, the template can be adjusted according to actual conditions, and the general solutions and tools in the original project are continuously maintained in the template, so that the improved accumulation of the project can be directly used in a new project. The method can solve the problems that the manual project creation is complicated, low in efficiency, different in style, easy to make mistakes, and new projects are manually moved in the original solution, tools and the like.
According to the embodiment of the disclosure, because a technical means of automatically generating the target project by determining the template file of the target project and inputting the metadata into the template file is adopted, the technical problems that the database model is not standard and the project is repeatedly and fussy due to the fact that the database model is artificially designed and the project structure is newly built in the related technology are at least partially solved, and further the technical effects of automatically generating the target project and improving the project generation efficiency are achieved.
The method shown in fig. 2 is further described with reference to fig. 3-6 in conjunction with specific embodiments.
FIG. 3 schematically illustrates a flow diagram for obtaining metadata from a target database according to configuration information in a configuration file, according to an embodiment of the disclosure.
As shown in fig. 3, acquiring metadata from the target database according to the configuration information in the configuration file includes operations S221 to S223.
In operation S221, in the process of obtaining metadata from the target database, it is determined whether the structural design of the target database satisfies a preset rule.
In operation S222, in a case where it is determined that the structural design of the target database does not satisfy the preset rule, the prompt information is displayed.
In operation S223, in case that it is judged that the structural design of the target database satisfies the preset rule, the metadata is acquired.
According to the embodiment of the disclosure, in the process of acquiring metadata from the target database, if the code generator finds that the database design does not meet the preset rules, for example, the database, the table and the field names are not in the form of lowercase underlines, have no remarks, have default fields and the like, the code generator prompts and quits, and ensures that developers find and modify in time.
According to the embodiment of the disclosure, after tables and fields in the database are newly added and modified, the database structure and the codes can be ensured to be consistent through regeneration, and the problems of manual maintenance omission and errors are avoided.
Through the embodiment of the disclosure, when the metadata is read, if the database design is found to be out of specification (if the database, the table and the field names are not in a form of underlining of a lower case letter, and no remarks are made), the user is prompted, and developers can be ensured to find and modify in time; after tables and fields are newly added and modified, the structures and codes of the database can be ensured to be consistent through regeneration, so that modifications such as database model, enumeration and the like can be timely and accurately synchronized with the codes, and the problems of manual maintenance omission and errors are avoided.
FIG. 4 schematically shows a flow diagram of a project generation method according to another embodiment of the present disclosure.
As shown in fig. 4, the method includes operations S250 to S270.
In operation S250, before inputting metadata into a template file and generating a target item, a type of the template file is determined.
According to the embodiment of the disclosure, the metadata is input into the template file, the new project is generated by using the project template, the configuration file, the code style and the frame structure are maintained uniformly and stably and available, the generation can be directly deployed and operated after the generation is completed, and a series of complex work of newly building the project every time is avoided.
In operation S260, an input policy of metadata is determined according to the type of the template file.
In operation S270, metadata is input into the template file according to the determined input policy.
According to the embodiment of the disclosure, in the process of inputting the metadata into the template file, since the regenerated project may cover the original modification (generally, business SQL Mapper), a custom code block may be added into the template, the content of the target modification may be put into the custom part, the target custom part is read before the coverage and is filled into the template, and then the error coverage is ensured, and the function that the newly generated target file can retain the modification in the old target file is realized by using the custom code block.
According to an embodiment of the present disclosure, the input policy may be the following policies: 1. all tables are merged: merging the data of all tables needed by the template, and managing the left column of the background and the home page; 2. and (3) single table merging: when the template generates a target file, all table information needs to be traversed to generate a corresponding target file which is used for an entity class, a database access layer, a transaction management layer, a service layer, a controller layer, a background page and the like; 3. table field merging: the enumeration needs to generate a target enumeration class according to the dimensions of a table and a field, and one enumeration description is equivalent to one enumeration in the enumeration class; 4. merging of single files: for configuration files and common Java classes of some SSMs, filling database configuration, package names and the like; 5. single file replication: the method can be a default processing mode and is commonly used for the resource files, and only the vm suffix needs to be removed and copied to the target path.
According to the embodiment of the disclosure, the target project may include one or more target files, and the generation policy of the target files may be determined according to the type of the template file.
For example, jquery. js.vm, the template type determines that metadata does not need to be input, and the metadata is copied to a target path to generate jquery. js; vm determines the metadata required to be input to each table, and outputs a target file of table0dao.xml, tablel dao.xml tablel 2 dao.xml.
According to the embodiment of the disclosure, the framework of the template file comprises a service terminal subsystem, a user foreground subsystem, an operation background subsystem and a common component subsystem.
Fig. 5 schematically shows a schematic diagram of the architecture of a template file according to an embodiment of the present disclosure.
As shown in fig. 5, the system of generated target items may generally include a service subsystem, a user foreground subsystem, an operator background subsystem, and a common component subsystem. The user foreground subsystem is used for interacting with a front-end page of a user and is independent of a database; the service terminal system provides a service interface for the foreground and bears user services; the operation background subsystem is used for operation background management; the public component subsystem is provided for the service terminal subsystem, the user foreground subsystem and the operation background subsystem in a dependent mode, and repeated maintenance is avoided.
According to an embodiment of the present disclosure, a service subsystem may include an entity class layer, a database access layer, an external interface layer, a transaction layer, a service layer, and a front-end control layer. The user foreground subsystem may include an entity class layer, a service layer, and a front end control layer. The operation background subsystem can comprise an entity class layer, a database access layer, an external interface layer, a transaction layer, a service layer and a front-end control layer. The common component subsystem may include an entity class layer, a base component layer, and a common tools layer.
According to an embodiment of the present disclosure, the user foreground subsystem may also be used for single merging of configuration files and copying of resource files; the service interface of the service terminal system comprises a service layer except a configuration file, the business layer is combined according to the table, and the business layer inherits the base class and depends on a common component, so that the operation of a single table can be supported; the operation background subsystem adds the table-based combination of a control layer and pages (listing, editing and viewing) on the basis of interface service, and provides page functions for each table basis of the background; the common components comprise the combination of entity class, enumeration class, data access layer and SQL Mapper configuration, and the common components are relied on by the front end, the service and the background, so that the common use is realized. The SQL Mapper is used for applying an XML mapping file for accessing a database in Mybatis and generating and executing SQL in an SQL splicing mode.
According to the embodiment of the present disclosure, the enumeration of the entity class may be automatically generated through metadata, and only the code needs to be regenerated after the modification, and the enumeration information is obtained by analyzing the remark in a specific format, for example, there is a field state in the order table order, and the remark is: the order status, 1, unpaid, 2, paid, is resolved into an enumeration class of order status, EmOrderState, and the enumeration therein is represented by pinyin underlining, such as WEI _ zuhifu (1, "unpaid"), YI _ zuhifu (2, "paid"), that is, if the enumeration class is modified, only the database remarks need to be modified and then regenerated. According to the embodiment of the disclosure, the project entity class, enumeration and SQL Mapper can be synchronized by reading metadata; generating a new item using the template item; and the entity class, enumeration, a database access layer, SQL Mapper, a transaction layer and a service layer are combined and generated according to a table.
Usually, the default field of a table contains id (primary key), mark (remark), created _ time (creation time), modified _ time (modification time), yn (valid or not, logical deletion identifier), and the default field is written into a fixed value in the SQL Mapper for automatic generation, so as to mask the damage of the application to the data. If the time is written, establishing time, and if the time is modified to be the current time, whether the effective write is dead or effective; the modification time is set as the current time during updating, the condition that whether the adding is effective or not is used for preventing the access to the logically deleted data, the condition that whether the deleting (logical deleting, actually updating) is effective or not is also used for defaulting the adding to be effective, and whether the updating field is dead or not is invalid or not, so that the system risk is shielded on the SQL level.
Generating SQL Mapper, and providing a writing object by default by the system; writing the object and writing the database id back to the object; writing in batches; pressing an id primary key for updating; updating by condition (supporting expected influence line number); querying according to id; querying the list according to the condition; inquiring the record number according to the condition; selecting one bar (whether null can be accepted or not) according to conditions; selecting a unique record (whether null can be accepted or not) according to conditions; paging query; pressing an id primary key for logical deletion; the method of deleting according to the condition logic (supporting the expected influence line number) and the LIKE comprises all basic single table operations, and almost all business processing can be completed and SQL writing by developers is not needed through the expanding Map of the object, the supporting IN (main key and enumeration), the LIKE (character string) and the query of time (date type, date larger or smaller than the specified date).
Through the embodiment of the disclosure, the template file is divided into a plurality of subsystems, so that each part of the template can be adjusted according to actual conditions.
FIG. 6 schematically shows a flow diagram for generating a target item according to an embodiment of the disclosure.
As shown in fig. 6, inputting metadata into a template file and generating a target item includes operations S241 to S242.
In operation S241, a background management page of the target item is generated based on the template file.
In operation S242, after the background management page of the target item is generated, in the process of starting the target item, the background management page is displayed in combination with the macro definition of the template engine and the enumeration class of the preloaded metadata.
According to the embodiment of the disclosure, the service subsystem and the user foreground subsystem can be generated in addition to the background management page of the target project based on the template file generation. The template engine can adopt a Velocity template engine, and the output display and logic control of variables can be performed by analyzing the placeholder and the markup language of the template, so that page rendering is realized.
According to the embodiment of the disclosure, the background management page can be divided into a list, an editing page and a detail page, the three pages can be obtained through consistent interfaces through analysis, the data can be taken and displayed by writing in corresponding interfaces when different tables are combined with a template, and different UI components are introduced by judging the type, enumeration, time, character string, number and the like of a field during generation, so that the repeated labor of the page is avoided. According to the embodiment of the disclosure, the macro definition and the enumeration class of the pre-loading metadata of the template engine are combined, and the metadata of the table and the field are also combined. For example, one field is time type, then time component is used; a field string type, is presented using an input box.
Through the embodiment of the disclosure, through preloading enumeration classes and combining macro definition of template engine Velocity, values can be directly taken and pull-down can be displayed on an interface, such as order state fields, and the pull-down box can be translated and displayed without binding enumeration and iteration.
FIG. 7 schematically shows a block diagram of a project generation system according to an embodiment of the present disclosure.
As shown in FIG. 7, the project generation system 400 includes a first acquisition module 410, a second acquisition module 420, a first determination module 430, and a generation module 440.
The first obtaining module 410 is configured to obtain a configuration file, where the configuration file includes configuration information for generating a target item.
The second obtaining module 420 is configured to obtain metadata from the target database according to the configuration information in the configuration file.
The first determining module 430 is used for determining a template file of the target project.
The generating module 440 is configured to input the metadata into the template file to generate the target item.
According to the embodiment of the disclosure, because a technical means of automatically generating the target project by determining the template file of the target project and inputting the metadata into the template file is adopted, the technical problems that the database model is not standard and the project is repeatedly and fussy due to the fact that the database model is artificially designed and the project structure is newly built in the related technology are at least partially solved, and further the technical effects of automatically generating the target project and improving the project generation efficiency are achieved.
Fig. 8 schematically illustrates a block diagram of a second acquisition module according to an embodiment of the disclosure.
As shown in fig. 8, the second obtaining module 420 includes a determining unit 421, a first presenting unit 422, and a obtaining unit 423.
The determining unit 421 is configured to determine whether the structural design of the target database satisfies a preset rule in the process of obtaining the metadata from the target database.
The first display unit 422 is configured to display the prompt information when it is determined that the structural design of the target database does not meet the preset rule.
The obtaining unit 423 is configured to obtain the metadata if the structural design of the target database is determined to satisfy the preset rule.
Through the embodiment of the disclosure, when the metadata is read, if the database design is found to be out of specification (if the database, the table and the field names are not in a form of underlining of a lower case letter, and no remarks are made), the user is prompted, and developers can be ensured to find and modify in time; after tables and fields are newly added and modified, the consistency of the database structure and codes can be ensured by regenerating, and the problems of manual maintenance omission and errors are avoided.
FIG. 9 schematically shows a block diagram of a project generation system according to another embodiment of the present disclosure.
As shown in fig. 9, the project generation system 400 further includes a second determination module 450, a third determination module 460, and an input module 470 according to an embodiment of the present disclosure.
The second determining module 450 is used to determine the type of the template file before inputting the metadata into the template file and generating the target project.
The third determination module 460 is used for determining an input policy of the metadata according to the type of the template file.
The input module 470 is used to input the metadata into the template file according to the determined input policy.
Through the embodiment of the disclosure, the template can be modified according to actual needs, codes, tools and the like which need to be perfected are added, and the metadata is input into the template file according to the determined input strategy, so that the technical effects of automatically generating the target project and improving the project generation efficiency are achieved, and the problem of repeated maintenance of new project codes is avoided.
According to the embodiment of the disclosure, the framework of the template file comprises a service terminal subsystem, a user foreground subsystem, an operation background subsystem and a common component subsystem.
Through the embodiment of the disclosure, the template file is divided into a plurality of subsystems, so that each part of the template can be adjusted according to actual conditions.
FIG. 10 schematically shows a block diagram of a generation module according to an embodiment of the disclosure.
As shown in fig. 10, the generating module 440 includes a generating unit 441 and a second presenting unit 442.
The generating unit 441 is configured to generate a background management page of the target project based on the template file.
The second presentation unit 442 is configured to, after the background management page of the target item is generated, in a process of starting the target item, combine the macro definition of the template engine and the enumeration class of the preloaded metadata to present the background management page.
Through the embodiment of the disclosure, through preloading enumeration classes and combining macro definition of template engine Velocity, values can be directly taken and pull-down can be displayed on an interface, such as order state fields, and the pull-down box can be translated and displayed without binding enumeration and iteration.
Any number of modules, sub-modules, units, sub-units, or at least part of the functionality of any number thereof according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, sub-modules, units, and sub-units according to the embodiments of the present disclosure may be implemented by being split into a plurality of modules. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented at least in part as a hardware circuit, 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 may be implemented in any other reasonable manner of hardware or firmware by integrating or packaging a circuit, or in any one of or a suitable combination of software, hardware, and firmware implementations. Alternatively, one or more of the modules, sub-modules, units, sub-units according to embodiments of the disclosure may be at least partially implemented as a computer program module, which when executed may perform the corresponding functions.
For example, any plurality of the first obtaining module 410, the second obtaining module 420, the first determining module 430, the generating module 440, the second determining module 450, the third determining module 460, the input module 470, the judging unit 421, the first presenting unit 422 and the obtaining unit 423, the generating unit 441 and the second presenting unit 442 may be combined and implemented in one module/unit/sub-unit, or any one of the modules/units/sub-units may be split into a plurality of modules/units/sub-units. Alternatively, at least part of the functionality of one or more of these modules/units/sub-units may be combined with at least part of the functionality of other modules/units/sub-units and implemented in one module/unit/sub-unit. According to the embodiment of the present disclosure, at least one of the first obtaining module 410, the second obtaining module 420, the first determining module 430, the generating module 440, the second determining module 450, the third determining module 460, the input module 470, the judging unit 421, the first presenting unit 422, the obtaining unit 423, the generating unit 441, and the second presenting unit 442 may be at least partially implemented as a hardware circuit, 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 may be implemented by hardware or firmware in any other reasonable manner of integrating or packaging a circuit, or implemented by any one of three manners of software, hardware, and firmware, or implemented by a suitable combination of any of them. Alternatively, at least one of the first obtaining module 410, the second obtaining module 420, the first determining module 430, the generating module 440, the second determining module 450, the third determining module 460, the input module 470, the judging unit 421, the first presenting unit 422 and the obtaining unit 423, the generating unit 441 and the second presenting unit 442 may be at least partially implemented as a computer program module, which may perform corresponding functions when executed.
FIG. 11 schematically illustrates a block diagram of a computer system suitable for implementing the above-described method, according to an embodiment of the present disclosure. The computer system illustrated in FIG. 11 is only one example and should not impose any limitations on the scope of use or functionality of embodiments of the disclosure.
As shown in fig. 11, a computer system 500 according to an embodiment of the present disclosure includes a processor 501, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. The processor 501 may comprise, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 501 may also include onboard memory for caching purposes. Processor 501 may include a single processing unit or multiple processing units for performing different actions of a method flow according to embodiments of the disclosure.
In the RAM 503, various programs and data necessary for the operation of the system 500 are stored. The processor 501, the ROM 502, and the RAM 503 are connected to each other by a bus 504. The processor 501 performs various operations of the method flows according to the embodiments of the present disclosure by executing programs in the ROM 502 and/or the RAM 503. Note that the programs may also be stored in one or more memories other than the ROM 502 and the RAM 503. The processor 501 may also perform various operations of method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
According to an embodiment of the present disclosure, system 500 may also include an input/output (I/O) interface 505, input/output (I/O) interface 505 also being connected to bus 504. The system 500 may also include one or more of the following components connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
According to embodiments of the present disclosure, method flows according to embodiments of the present disclosure may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511. The computer program, when executed by the processor 501, performs the above-described functions defined in the system of the embodiments of the present disclosure. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples may include, but are 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 present 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, a computer-readable storage medium may include ROM 502 and/or RAM 503 and/or one or more memories other than ROM 502 and RAM 503 described above.
The flowchart 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 various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used in advantageous combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.

Claims (8)

1. A method of project generation, comprising:
acquiring a configuration file, wherein the configuration file comprises configuration information used for generating a target project;
acquiring metadata from a target database according to configuration information in the configuration file;
determining a template file of the target project;
inputting the metadata into the template file to generate the target project;
the framework of the template file comprises a service terminal system, a user foreground subsystem, an operation background subsystem and a public component subsystem;
wherein inputting the metadata into the template file, and generating the target item comprises:
generating a background management page of the target project based on the template file; and
after a background management page of the target project is generated, in the process of starting the target project, the background management page is displayed by combining macro definition of a template engine and enumeration class pre-loaded with the metadata, wherein the template engine is used for performing output display and logic control on variables by analyzing placeholders and markup languages of a template, so that page rendering is realized.
2. The method of claim 1, wherein the method further comprises:
determining the type of the template file before inputting the metadata into the template file and generating the target project;
determining an input strategy of the metadata according to the type of the template file; and
and inputting the metadata into the template file according to the determined input strategy.
3. The method of claim 1, wherein obtaining metadata from a target database according to configuration information in the configuration file comprises:
in the process of acquiring metadata from the target database, judging whether the structural design of the target database meets a preset rule or not;
displaying prompt information under the condition that the structural design of the target database is judged not to meet a preset rule; and
and acquiring the metadata under the condition that the structural design of the target database meets a preset rule.
4. A project generation system, comprising:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a configuration file, and the configuration file comprises configuration information used for generating a target project;
the second acquisition module is used for acquiring metadata from a target database according to the configuration information in the configuration file;
the first determining module is used for determining a template file of the target project;
the generating module is used for inputting the metadata into the template file and generating the target project;
the framework of the template file comprises a service terminal system, a user foreground subsystem, an operation background subsystem and a public component subsystem;
wherein the generating module comprises:
the generating unit is used for generating a background management page of the target project based on the template file; and
and the second display unit is used for displaying the background management page in combination with macro definition of a template engine and enumeration class preloading of the metadata in the process of starting the target item after the background management page of the target item is generated, wherein the template engine is used for performing output display and logic control on variables by analyzing placeholders and markup languages of a template, so that page rendering is realized.
5. The system of claim 4, wherein the system further comprises:
the second determining module is used for determining the type of the template file before the metadata is input into the template file and the target project is generated;
the third determining module is used for determining the input strategy of the metadata according to the type of the template file; and
and the input module is used for inputting the metadata into the template file according to the determined input strategy.
6. The system of claim 4, wherein the second acquisition module comprises:
the judging unit is used for judging whether the structural design of the target database meets a preset rule or not in the process of acquiring the metadata from the target database;
the first display unit is used for displaying prompt information under the condition that the structural design of the target database is judged not to meet a preset rule; and
and the acquisition unit is used for acquiring the metadata under the condition that the structural design of the target database meets a preset rule.
7. A computer system, comprising:
one or more processors;
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 implement the item generation method of any of claims 1 to 3.
8.A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to carry out the item generation method of any one of claims 1 to 3.
CN201811194231.5A 2018-10-12 2018-10-12 Project generation method and system, computer system and computer-readable storage medium Active CN109254992B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811194231.5A CN109254992B (en) 2018-10-12 2018-10-12 Project generation method and system, computer system and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811194231.5A CN109254992B (en) 2018-10-12 2018-10-12 Project generation method and system, computer system and computer-readable storage medium

Publications (2)

Publication Number Publication Date
CN109254992A CN109254992A (en) 2019-01-22
CN109254992B true CN109254992B (en) 2020-11-20

Family

ID=65046332

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811194231.5A Active CN109254992B (en) 2018-10-12 2018-10-12 Project generation method and system, computer system and computer-readable storage medium

Country Status (1)

Country Link
CN (1) CN109254992B (en)

Families Citing this family (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110046170B (en) * 2019-04-22 2021-07-27 深圳乐信软件技术有限公司 Statement execution method, device, equipment and medium based on multi-file management
CN110489106A (en) * 2019-07-22 2019-11-22 北京字节跳动网络技术有限公司 A kind of generation method, device, medium and the electronic equipment of project initial code
CN110427133A (en) * 2019-07-31 2019-11-08 中国工商银行股份有限公司 Data processing method and data processing equipment
CN110806895A (en) * 2019-11-04 2020-02-18 精硕科技(北京)股份有限公司 Project creation method and device and computer readable storage medium
CN110825459B (en) * 2019-11-08 2023-11-03 深圳前海环融联易信息科技服务有限公司 Enumeration constant hot loading method, device, computer equipment and storage medium
CN110889272A (en) * 2019-11-29 2020-03-17 中国银行股份有限公司 Data processing method, device, equipment and storage medium
CN111145011B (en) * 2019-12-27 2024-04-23 中国银行股份有限公司 Banking system building method and device
CN111368073A (en) * 2020-02-06 2020-07-03 贝壳技术有限公司 Inter-system data interaction method and device, storage medium and electronic equipment
CN111401840B (en) * 2020-03-13 2023-10-27 中国建设银行股份有限公司 Method, apparatus, device and computer readable medium for generating guarantor information
CN113709196B (en) * 2020-05-20 2023-11-14 奇安信科技集团股份有限公司 Data extraction method, apparatus, computer device, medium, and program product
CN112286519A (en) * 2020-08-12 2021-01-29 北京海致网聚信息技术有限公司 SQL-based dynamic application creation method
CN112905167B (en) * 2021-03-11 2023-10-27 北京字节跳动网络技术有限公司 Application operation method and device and electronic equipment
CN113515303B (en) * 2021-05-19 2024-02-13 中国工商银行股份有限公司 Project transformation method, device and equipment
CN113821202B (en) * 2021-08-27 2023-12-22 济南浪潮数据技术有限公司 Method, device and equipment for generating management software file and readable storage medium
CN114153547B (en) * 2021-12-06 2023-11-17 珠海金山数字网络科技有限公司 Management page display method and device
CN115293365A (en) * 2022-08-23 2022-11-04 网络通信与安全紫金山实验室 Management method, device, management platform and storage medium of machine learning model
CN115586896B (en) * 2022-09-29 2023-08-04 通号智慧城市研究设计院有限公司 Page project development method, equipment and storage medium based on template engine

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101076793A (en) * 2004-08-31 2007-11-21 国际商业机器公司 System structure for enterprise data integrated system
CN103412749A (en) * 2013-07-29 2013-11-27 福建联迪商用设备有限公司 Relational database based code generation method and code generator
CN105447760A (en) * 2015-11-13 2016-03-30 广东网金控股股份有限公司 Templatizing and configuring method for standardized investing and financing transaction system
CN106874388A (en) * 2017-01-11 2017-06-20 中科院微电子研究所昆山分所 A kind of heterogeneous system data cascade operation method for auto constructing based on relevant database
CN107273116A (en) * 2017-05-22 2017-10-20 互联天下科技发展(深圳)有限公司 The method that code is produced using the Code Generator based on framework

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070067388A1 (en) * 2005-09-21 2007-03-22 Angelov Dimitar V System and method for configuration to web services descriptor
CN101477549B (en) * 2009-01-20 2011-06-08 中国测绘科学研究院 Knowledge base supported spatial database design method and system
CN103838558B (en) * 2012-11-22 2017-06-20 中国移动通信集团公司 Website build a station system and method, access website method and webpage adaptation system
US9607063B1 (en) * 2015-12-10 2017-03-28 International Business Machines Corporation NoSQL relational database (RDB) data movement
CN107168940B (en) * 2017-03-29 2020-06-16 长春市万易科技有限公司 Report generation system and method
CN107291448A (en) * 2017-05-19 2017-10-24 上海瀚乾信息技术服务有限公司 A kind of Software Develop Project Management system
CN107357942A (en) * 2017-09-04 2017-11-17 山东达创网络科技股份有限公司 A kind of source code auxiliary Core Generator and its generation method
CN108536432A (en) * 2018-04-09 2018-09-14 重庆塞尔特科技有限公司 A kind of modular research and development of products flow control method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101076793A (en) * 2004-08-31 2007-11-21 国际商业机器公司 System structure for enterprise data integrated system
CN103412749A (en) * 2013-07-29 2013-11-27 福建联迪商用设备有限公司 Relational database based code generation method and code generator
CN105447760A (en) * 2015-11-13 2016-03-30 广东网金控股股份有限公司 Templatizing and configuring method for standardized investing and financing transaction system
CN106874388A (en) * 2017-01-11 2017-06-20 中科院微电子研究所昆山分所 A kind of heterogeneous system data cascade operation method for auto constructing based on relevant database
CN107273116A (en) * 2017-05-22 2017-10-20 互联天下科技发展(深圳)有限公司 The method that code is produced using the Code Generator based on framework

Also Published As

Publication number Publication date
CN109254992A (en) 2019-01-22

Similar Documents

Publication Publication Date Title
CN109254992B (en) Project generation method and system, computer system and computer-readable storage medium
US9092314B2 (en) On-the-fly technical support
CN108762743B (en) Data table operation code generation method and device
JP2014507029A (en) Formatting data by example
US9195456B2 (en) Managing a catalog of scripts
US11128721B2 (en) Action flow fragment management
US9141344B2 (en) Hover help support for application source code
US9286038B2 (en) Interface development and operation
US10275234B2 (en) Selective bypass of code flows in software program
US20230315416A1 (en) Code translation method and apparatus, and device
US20200097260A1 (en) Software application developer tools platform
CN116301856B (en) Design method, device, equipment and medium of visual form designer
JP2016224579A (en) Information processor and information processing method
CN112685040A (en) Method, device, equipment and storage medium for generating interface file in android system
US11977473B2 (en) Providing a pseudo language for manipulating complex variables of an orchestration flow
US20150074678A1 (en) Device and method for automating a process of defining a cloud computing resource
CN113805877A (en) Project engineering construction method and device based on IDEA plug-in
JP2015011685A (en) Business rule management system and business rule management method
US20230350657A1 (en) Translating large source code using sparse self-attention
CN112035367B (en) Method and system for checking workflow correctness of big data platform
CN106687999B (en) Generating a set of instructions implementing rules designed to update objects specified according to an application data model
CN114077632A (en) Data model construction method, ETL operation execution method, device and terminal equipment
CN115629828A (en) State machine display method, device and medium
CN114020358A (en) Interface rendering method and device based on iOS application
CN117201469A (en) Method and computing device for developing deployment customization project

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: Room 221, 2nd floor, Block C, 18 Kechuang 11th Street, Beijing Daxing District, Beijing

Applicant after: Jingdong Digital Technology Holding Co., Ltd.

Address before: Room 221, 2nd floor, Block C, 18 Kechuang 11th Street, Daxing Economic and Technological Development Zone, Beijing, 100176

Applicant before: Beijing Jingdong Financial Technology Holding Co., Ltd.

GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: Room 221, 2 / F, block C, 18 Kechuang 11th Street, Daxing District, Beijing, 100176

Patentee after: Jingdong Technology Holding Co.,Ltd.

Address before: Room 221, 2 / F, block C, 18 Kechuang 11th Street, Daxing District, Beijing, 100176

Patentee before: JINGDONG DIGITAL TECHNOLOGY HOLDINGS Co.,Ltd.