Method, device, electronic device and storage medium for developing application program
By loading framework templates and domain description files and automatically creating applications in combination with SQL mapping templates, the problem of low development efficiency in the existing technology is solved and fast and efficient application development is achieved.
Patent Information
- Application Number
- CN202110002809.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-04
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2041-01-04
AI Technical Summary
The existing application development methods rely on manual operations, resulting in low development efficiency and cannot meet the needs of rapid updates.
By loading framework templates, obtaining user's domain description files, and automatically creating applications based on SQL mapping templates, reducing manual operations and improving development efficiency.
It realizes rapid development of applications, saves development time and cost, and improves development efficiency.
Smart Images

Figure CN113760292B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to computer technology, and in particular to a method, device, electronic device and storage medium for developing an application program. Background Art
[0002] With the rapid development of computer technology, the speed of application program update is getting faster and faster, and the requirements for application program development efficiency are getting higher and higher. In the process of implementing the present invention, the inventor found that the existing application program development method mainly relies on manual operation and has low development efficiency. Summary of the invention
[0003] The embodiments of the present invention provide a method, device, electronic device and storage medium for developing an application program, which can improve the development efficiency of the application program.
[0004] In a first aspect, an embodiment of the present invention provides a method for developing an application program, the method comprising:
[0005] Loading a framework template, and generating a framework of a target application according to the framework template;
[0006] Obtaining a domain description file selected by a user, and creating a domain object under the framework of the target application according to the description data provided by the user in the domain description file;
[0007] Create an SQL mapping file for the domain object according to a structured query language SQL mapping template.
[0008] In a second aspect, an embodiment of the present invention provides a device for developing an application program, including:
[0009] A generation module, used for loading a framework template and generating a framework of a target application according to the framework template;
[0010] A first creation module, used to obtain a domain description file selected by a user, and create a domain object under the framework of the target application according to the description data provided by the user in the domain description file;
[0011] The second creation module is used to create an SQL mapping file for the domain object according to a structured query language SQL mapping template.
[0012] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for developing an application as described in any one of the embodiments of the present invention is implemented.
[0013] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method for developing an application as described in any one of the embodiments of the present invention.
[0014] In an embodiment of the present invention, a framework template can be loaded, and a framework of a target application can be generated based on the framework template, a domain description file selected by a user can be obtained, and domain objects can be created under the framework of the target application based on the description data provided by the user in the domain description file, and an SQL mapping file can be created for the domain objects based on the SQL mapping template. That is, in an embodiment of the present invention, an application can be automatically created using a pre-created framework template, domain description file, and SQL mapping template, and the user only needs to provide corresponding data according to the template requirements, thereby saving development time and development costs and improving application development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 The figure is a flow chart of a method for developing an application program provided by an embodiment of the present invention.
[0016] Figure 2 It is another flowchart of the method for developing an application program provided by an embodiment of the present invention.
[0017] Figure 3 It is a structural schematic diagram of the framework template provided by an embodiment of the present invention.
[0018] Figure 4 It is a schematic diagram of the structure of a domain description file provided by an embodiment of the present invention.
[0019] Figure 5 It is a schematic diagram of a type mapping relationship provided by an embodiment of the present invention.
[0020] Figure 6 The figure is a schematic diagram of the structure of the device for developing application programs provided by the embodiment of the present invention.
[0021] Figure 7 It is a structural diagram of a system for developing application programs provided by an embodiment of the present invention.
[0022] Figure 8 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0023] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0024] Figure 1 A flowchart of a method for developing an application provided in an embodiment of the present invention is provided. The method can be executed by a device for developing an application provided in an embodiment of the present invention, and the device can be implemented in software and / or hardware. In a specific embodiment, the device can be integrated in an electronic device. The electronic device can be a computer device such as a tablet computer, a laptop computer, a desktop computer, etc. that has a storage unit and is equipped with a microprocessor and has computing power. The following embodiments will be described by taking the device integrated in an electronic device as an example. Reference Figure 1 , the method may specifically include the following steps:
[0025] Step 101, loading a framework template, and generating a framework of a target application according to the framework template.
[0026] Specifically, the framework templates can be classified according to the type of application, for example, the framework templates can include the framework templates of Worker type applications and the framework templates of Web type applications. Among them, the hierarchical architecture in the framework template of Worker type applications includes the data operation layer (Dao layer), the domain object layer (Domain layer) and the service layer (Service layer), and the hierarchical architecture in the framework template of Web type applications includes the data operation layer (Dao layer), the domain object layer (Domain layer), the service layer (Service layer) and the presentation layer (Web layer).
[0027] The domain object layer is used to define the domain objects of the application. The domain objects may include domain objects created by users and domain objects automatically generated by the application. In a specific implementation, the implementation source code of the domain objects may be stored in the domain object layer.
[0028] The data operation layer is used to define interfaces and implementation classes. Operations such as adding, deleting, modifying, and checking underlying data need to be defined in the interface.
[0029] The service layer is used to implement business logic. For example, the business logic implementation code, application configuration files, startup script files, etc. can be stored in the service layer.
[0030] The presentation layer is used to provide a Hypertext Transfer Protocol (HTTP) interface for users to communicate and interact with applications on the page. The presentation layer has the ability to receive HTTP requests, hand over the requests to the service layer for processing, and finally return the requested data. The presentation layer can store information such as application controllers, application configuration files or pages.
[0031] Specifically, the corresponding type of framework template can be loaded in the integrated development environment (IDE) according to the application type specified by the user. The loaded framework template can be from the local electronic device or from the server. For example, if the application type specified by the user is Worker type, the framework template of Worker type is loaded, and if the application type specified by the user is Web type, the framework template of Web type is loaded. In a specific embodiment, the integrated development environment can be Maven, which is a project management tool that includes a project object model, a set of standard sets, a project life cycle, a dependency management system, and logic for running plug-in goals defined in the life cycle phase. When using Maven, a clearly defined project object model can be used to describe the project, and then Maven can apply cross-cutting logic, which comes from a set of shared (or customized) plug-ins.
[0032] In specific implementation, the framework template can be created through a developed mature application. The specific creation method is as follows:
[0033] (1) Abstract the functional modules of the developed application and obtain a hierarchical architecture.
[0034] For example, if the developed application is a Worker-type application, the resulting hierarchical architecture may include a data operation layer, a domain object layer, and a service layer. If the developed application is a Web-type application, the resulting hierarchical architecture may include a data operation layer, a domain object layer, a service layer, and a presentation layer.
[0035] (2) Extract the basic code and basic configuration of the developed application to obtain a template file.
[0036] For example, after abstracting the functional modules of the developed application, the data management service interface definition and implementation code, the basic configuration of the application, the startup script of the application, etc. can be retained to obtain a template file. The template file can be implemented by a Velocity template. Velocity is a Java-based template engine that allows the use of a template language to reference objects defined by Java code. In the template file, there can be placeholders, such as the author and package name information.
[0037] (3) Create a framework template based on the hierarchical architecture and template files.
[0038] Specifically, the external representation of each functional module of the application in the framework template is a folder directory, which includes a folder for storing source code, a folder for storing configuration files, and a Pom file for describing dependencies.
[0039] Specifically, after loading the framework template in Maven, each level of the framework template can be traversed to generate a target file corresponding to the template file, thereby obtaining the framework of the target application, and the obtained framework of the target application can be stored in the storage location specified by the user. For example, when traversing the framework template, the corresponding target file can be created according to the architecture of the framework template. When encountering a template file, a target file corresponding to the template file can be created, and the target file can be named with the name of the target application; when encountering a source-dir file, a target file corresponding to the source-dir file can be created, that is, a src / main / java file; when encountering a resource-dir file, a target file corresponding to the resource-dir file can be created, that is, a src / main / resource file; when there are placeholders in the created target file, the placeholders in the target file can be replaced with actual data according to the actual situation; in addition, when encountering a Pom file, a target file corresponding to the Pom file can be created, and the Maven coordinate address of a third party, such as groupId, artifactId, version information, etc., can be introduced in the target file.
[0040] Step 102, obtaining the domain description file selected by the user, and creating a domain object under the framework of the target application according to the description data provided by the user in the domain description file.
[0041] For example, a domain description file can be created in advance. The domain description file is used to provide a method for creating domain objects. The pre-created domain description file can be considered as a template file for creating domain objects. Domain objects can be conceptual classes within a domain or visual representations of objects in the real world. For example, in an e-commerce system, users, commodities, orders, etc. can be represented by domain objects. The domain description file can include object definition description items and object attribute description items. The object definition description items can include the name, package name, data table name, etc. of the domain object. The object attribute description items can include the attribute name, attribute type, the name of the field corresponding to the attribute in the data table, the data type in the database, whether the field in the database is allowed to be empty, and the annotation of the attribute.
[0042] After the domain description file is created, the domain description file can be stored locally in the electronic device or in the server to obtain the file storage path of the domain description file. When developing the target application, the user can provide the file storage path of the domain description file through the preset interface, and the electronic device obtains the domain description file according to the file storage path provided by the user. The user can provide description data in the domain description file, and the provided description data may include object definition description data corresponding to the object definition description item and object attribute description data corresponding to the object attribute description item. The electronic device creates the domain object under the framework of the target application according to the description data provided by the user in the domain description file.
[0043] In a specific embodiment, in order to facilitate user operation and make the description data more concise, the type mapping relationship between the simple attribute type description and the specific attribute type description can be pre-set. When specifying the attribute type in the object attribute description item, the user can be supported to enter the simple attribute type description data. After obtaining the object definition description data and the object attribute description data specified by the user in the domain description file, the simple attribute type description data in the object attribute description data can be mapped into the specific attribute type description data according to the type mapping relationship, and then the domain object can be created under the framework of the target application according to the object definition description data and the object attribute description data.
[0044] In a specific implementation, when creating a domain object in the framework of the target application according to the object definition description data and the object attribute description data, the domain object class template declared in the domain object layer of the framework template can be combined to create the domain object. The domain object class template defines the inheritance relationship and common attribute information of the domain object. The common attribute information includes the primary key, creation time (created), modification time (modified), creator (creator), editor (editor), version information (version), etc. The created domain object can be stored in the domain object layer of the target application framework, and the created domain object can include multiple ones.
[0045] Step 103: Create an SQL mapping file for the domain object according to the SQL mapping template.
[0046] Specifically, you can create a SQL mapping file for the domain object as follows:
[0047] (1) Compile domain objects and obtain SQL populated data from the compiled domain objects through the reflection mechanism.
[0048] For example, the source code of the domain object can be compiled into a class bytecode file, and then the SQL filling data can be obtained from the class bytecode file through the reflection mechanism. The obtained SQL filling data includes the class name, attribute information, and the data table obtained based on the annotation information related to the data table name acting on the class, and the column name information obtained based on the annotation information related to the attribute acting on the attribute, etc.
[0049] (2) Create SQL mapping files for domain objects based on SQL filling data and SQL mapping template.
[0050] For example, the corresponding data in the SQL mapping template can be updated according to the obtained SQL filling data, so as to obtain the SQL mapping file created for the domain object. Among them, the SQL mapping file includes the mapping information of the SQL statement (i.e. the correspondence between the statement ID and the SQL statement), the namespace, the dynamic query condition information required for data query and data modification, the data table, the column information, and the mapping relationship between the domain object attributes and the column name in the database table, etc. One domain object corresponds to one SQL mapping file.
[0051] In a specific embodiment, the SQL mapping file created for the domain object can be stored in the service layer of the target application framework. The service layer has a SQL mapping folder, and the SQL mapping file created for each domain object can be added to the SQL mapping folder. In a specific implementation, the interface and implementation class of the data operation layer of the target application framework will apply the SQL mapping file of the domain object stored in the service layer, and reference the corresponding SQL statement according to the statement id in the SQL mapping file.
[0052] In an embodiment of the present invention, a framework template can be loaded, and a framework of a target application can be generated based on the framework template, a domain description file selected by a user can be obtained, and domain objects can be created under the framework of the target application based on the description data provided by the user in the domain description file, and an SQL mapping file can be created for the domain objects based on the SQL mapping template. That is, in an embodiment of the present invention, an application can be automatically created using a pre-created framework template, domain description file, and SQL mapping template, and the user only needs to provide corresponding data according to the template requirements, thereby saving development time and development costs and improving application development efficiency.
[0053] The following takes creating a specific type of application as an example to illustrate the method for developing an application in an embodiment of the present invention. Figure 2 As shown, the following steps are included:
[0054] Step 201 , loading a framework template, and generating a framework of a target application according to the framework template.
[0055] For example, if you want to create a Web application, you can load the framework template of the Web application in Maven according to the application type specified by the user. In a specific embodiment, the framework template of the Web application loaded can be as follows: Figure 3 As shown, the doc directory is used to store the document information of the application, the db folder under the doc directory is used to store the database creation SQL statements, and the table folder is used to store the application table creation SQL statements; the template-dao folder is the data operation layer of the application, which is used to encapsulate the basic data operations of adding, deleting, modifying, and querying data; the template-domain folder is the domain object layer of the application, which is used to store the domain objects of the application; the template-service folder is the service layer of the application, which is used to provide abstract service interfaces and implementations for data management. The assembly folder under this folder is used to store Worker-type startup script files, resource-dir is used to store application configuration files, source-dir is used to store application source code, and the src.test.java folder is used to store application unit test code. template-web is the display layer of Web-type applications, providing a Hypertext Transfer Protocol (HTTP) interface for users to communicate and interact with applications on the page.
[0056] After loading the framework template of a Web-type application, each hierarchical structure of the framework template can be traversed to generate a target file corresponding to the template file, thereby obtaining the framework of the target application, which can be stored in a user-specified storage location. For example, when traversing the framework template, when encountering a template file, a target file corresponding to the template file can be created, and the target file can be named with the name of the target application; when encountering a source-dir file, a target file corresponding to the source-dir file can be created, that is, a src / main / java file; when encountering a resource-dir file, a target file corresponding to the resource-dir file can be created, that is, a src / main / resource file; when there are placeholders in the created target file, the placeholders in the target file can be replaced with actual data according to the actual situation; in addition, when encountering a Pom file, a target file corresponding to the Pom file can be created, and the third-party Maven coordinate address, such as groupId, artifactId, version information, etc., can be introduced in the target file.
[0057] Step 202: Obtain the file storage path provided by the user, and obtain the domain description file according to the file storage path.
[0058] For example, a domain description file can be created in advance. The domain description file is used to provide a method for creating domain objects. The pre-created domain description file can be considered as a template file for creating domain objects. Domain objects can be conceptual classes within a domain or visual representations of objects in the real world. For example, in an e-commerce system, users, commodities, orders, etc. can be represented by domain objects. The domain description file can include object definition description items and object attribute description items. The object definition description items can include the class name, package name, data table name, etc. of the domain object. The object attribute description items can include the attribute name, attribute type, the name of the field corresponding to the attribute in the data table, the data type in the database, whether the field in the database is allowed to be empty, and the annotation of the attribute.
[0059] After the domain description file is created, the domain description file can be stored to obtain the file storage path of the domain description file. When developing a target application, the user can provide the file storage path of the domain description file through a preset interface, and the electronic device obtains the domain description file according to the file storage path provided by the user. In a specific embodiment, the obtained domain description file can be as follows: Figure 4 shown.
[0060] Step 203: Obtain object definition description data and object attribute description data specified by the user in the domain description file.
[0061] The user can specify description data in the domain description file. The specified description data may include object definition description data corresponding to the object definition description item and object attribute description data corresponding to the object attribute description item. The electronic device creates domain objects under the framework of the target application based on the description data provided by the user in the domain description file.
[0062] In a specific embodiment, in order to facilitate user operation and make the description data more concise, a type mapping relationship between a simple attribute type description and a specific attribute type description can be pre-set. When the user specifies the attribute type in the object attribute description item, the user can be supported to enter the simple attribute type description data. After obtaining the object definition description data and the object attribute description data specified by the user in the domain description file, the simple attribute type description data in the object attribute description data can be mapped into the specific attribute type description data according to the type mapping relationship, and then the domain object can be created under the framework of the target application according to the object definition description data and the object attribute description data. In a specific embodiment, the pre-set type mapping relationship can be as follows: Figure 5 shown.
[0063] Step 204: Map the simple attribute type description in the object attribute description data into a specific attribute type description according to the attribute mapping relationship.
[0064] For example, when the user specifies the attribute type as Char in the object attribute description item, the Char type can be mapped to Character.class; when the user specifies the attribute type as json in the object attribute description item, the json type can be mapped to JSONObject.class.
[0065] Step 205: Create a domain object in the framework of the target application according to the object definition description data and the object attribute description data.
[0066] Specifically, the object definition description data and the object attribute description data can be combined with the domain object class template declared in the domain object layer of the target application framework to create a domain object. The domain object class template defines the inheritance relationship of the domain object, common attribute information, etc. The common attribute information includes primary key, creation time (created), modification time (modified), creator (creator), editor (editor), version information (version), etc. The created domain object can be stored in the domain object layer of the target application framework, and the created domain object can include multiple ones.
[0067] Step 206, compile the domain object, and obtain SQL filling data from the compiled domain object through the reflection mechanism.
[0068] For example, the source code of the domain object can be compiled into a class bytecode file, and then the SQL filling data can be obtained from the class bytecode file through the reflection mechanism. The obtained SQL filling data includes the class name, attribute information, and the data table obtained based on the annotation information related to the data table name acting on the class, and the column name information obtained based on the annotation information related to the attribute acting on the attribute, etc.
[0069] Step 207: Create a SQL mapping file for the domain object according to the SQL filling data and the SQL mapping template.
[0070] For example, the corresponding data in the SQL mapping template can be updated according to the obtained SQL filling data, so as to obtain the SQL mapping file created for the domain object. Among them, the SQL mapping file includes the mapping information of the SQL statement (i.e. the correspondence between the statement ID and the SQL statement), the namespace, the dynamic query condition information required for data query and data modification, the data table, the column information, and the mapping relationship between the domain object attributes and the column name in the database table, etc. One domain object corresponds to one SQL mapping file.
[0071] In a specific embodiment, the SQL mapping file created for the domain object can be stored in the service layer of the target application framework. The service layer has a SQL mapping folder, and the SQL mapping file created for each domain object can be added to the SQL mapping folder. In a specific implementation, the interface and implementation class of the data operation layer of the target application framework will apply the SQL mapping file of the domain object stored in the service layer, and reference the corresponding SQL statement according to the statement id in the SQL mapping file.
[0072] Step 208: Create a database and generate reference information of the database under the framework of the target application.
[0073] That is, you can also create a database for the target application. After the database is created, you can generate database reference information and save the database reference information in the service layer of the target application framework. The database reference information can include user-specified data Internet Protocol (IP), port, user name, password, etc.
[0074] Step 209: Create a data table in the database and generate an SQL statement for the data table under the framework of the target application.
[0075] Specifically, SQL statements for data tables may be generated at the service layer of the target application framework.
[0076] In an embodiment of the present invention, a framework template can be loaded, and a framework of a target application can be generated based on the framework template, a domain description file selected by a user can be obtained, and domain objects can be created under the framework of the target application based on the description data provided by the user in the domain description file, and an SQL mapping file can be created for the domain objects based on the SQL mapping template. That is, in an embodiment of the present invention, an application can be automatically created using a pre-created framework template, domain description file, and SQL mapping template, and the user only needs to provide corresponding data according to the template requirements, thereby saving development time and development costs and improving application development efficiency.
[0077] Figure 6 FIG. 1 is a structural diagram of a device for developing an application provided by an embodiment of the present invention, and the device is suitable for executing a method for developing an application provided by an embodiment of the present invention. Figure 6 As shown, the device may specifically include:
[0078] A generation module 301 is used to load a framework template and generate a framework of a target application according to the framework template;
[0079] A first creation module 302, used to obtain a domain description file selected by a user, and create a domain object under the framework of the target application according to the description data provided by the user in the domain description file;
[0080] The second creation module 303 is used to create an SQL mapping file for the domain object according to a structured query language SQL mapping template.
[0081] In one embodiment, the apparatus further comprises a third creation module;
[0082] The third creation module is used to abstract the various functional modules of the developed application to obtain a hierarchical architecture; extract the basic code and basic configuration of the developed application to obtain a template file; and create the framework template according to the hierarchical architecture and the template file.
[0083] In one embodiment, the generating module 301 generates a framework of a target application according to the framework template, including:
[0084] Each level structure of the framework template is traversed to generate a target file corresponding to the template file.
[0085] In one embodiment, the first creation module 302 obtains the domain description file selected by the user, including:
[0086] Obtaining the file storage path provided by the user;
[0087] The domain description file is obtained according to the file storage path.
[0088] In one embodiment, the first creation module 302 creates a domain object under the framework of the target application according to the description data provided by the user in the domain description file, including:
[0089] Acquire object definition description data and object attribute description data provided by the user in the domain description file;
[0090] The domain object is created under the framework of the target application according to the object definition description data and the object attribute description data.
[0091] In one embodiment, the object attribute description data includes a simplified attribute type description, and the first creation module 302 is further used to:
[0092] The simple attribute type description is mapped into a specific attribute type description according to the attribute mapping relationship.
[0093] In one embodiment, the second creation module 303 creates an SQL mapping file for the domain object according to the SQL mapping template, including:
[0094] Compile the domain object, and obtain SQL filling data from the compiled domain object through the reflection mechanism;
[0095] Create an SQL mapping file for the domain object according to the SQL filling data and the SQL mapping template.
[0096] In one embodiment, the apparatus further comprises a fourth creation module;
[0097] The fourth creation module is used to create a database and generate reference information of the database under the framework of the target application.
[0098] In one embodiment, the fourth creation module is further used to create a data table in the database and generate an SQL statement for the data table under the framework of the target application.
[0099] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the functional modules described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0100] The device of the embodiment of the present invention can load a framework template, generate a framework of a target application according to the framework template, obtain a domain description file selected by a user, create domain objects under the framework of the target application according to the description data provided by the user in the domain description file, and create an SQL mapping file for the domain object according to the SQL mapping template. That is, in the embodiment of the present invention, an application can be automatically created through a pre-created framework template, domain description file and SQL mapping template, and the user only needs to provide corresponding data according to the template requirements, thereby saving development time and development costs and improving the development efficiency of the application.
[0101] An embodiment of the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for developing an application provided in any of the above embodiments is implemented.
[0102] An embodiment of the present invention further provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the method for developing an application provided in any of the above embodiments is implemented.
[0103] Figure 7 An exemplary system architecture 600 is shown to which the method for developing an application or the apparatus for developing an application according to the embodiment of the present invention can be applied.
[0104] like Figure 7 As shown, system architecture 600 may include electronic device 601, network 602 and server 603. Network 602 is used to provide a medium for a communication link between electronic device 601 and server 603. Network 602 may include various connection types, such as wired, wireless communication links or optical fiber cables.
[0105] The user can use the electronic device 601 to interact with the server 603 through the network 602 to receive or send messages, etc. Various client applications can be installed on the electronic device 601, such as enterprise application clients, e-commerce application clients, web browser applications, search applications, instant messaging tools, and email clients.
[0106] The electronic device 601 may be any electronic device having a display screen and supporting any client, including but not limited to a tablet computer, a laptop computer, a desktop computer, and the like.
[0107] The server 603 may be a server that provides various services, such as a server that provides data storage services. The server may process the received request and feed back the request data to the electronic device.
[0108] It should be noted that the method for developing an application provided in the embodiment of the present invention is generally executed by an electronic device, and accordingly, the device for developing an application is generally disposed in the electronic device.
[0109] It should be understood that Figure 7 The number of electronic devices, networks and servers in the embodiment is only for illustration. Any number of electronic devices, networks and servers may be provided as required.
[0110] Reference below Figure 8 , which shows a schematic diagram of the structure of a computer system 700 of an electronic device suitable for implementing an embodiment of the present invention. Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0111] like Figure 8As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0112] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.
[0113] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.
[0114] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0115] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0116] The modules and / or units involved in the embodiments of the present invention may be implemented in software or hardware. The modules and / or units described may also be arranged in a processor, for example, it may be described as follows: a processor includes a generation module, a first creation module, and a second creation module. The names of these modules do not, in some cases, constitute limitations on the modules themselves.
[0117] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: loading a framework template, and generating a framework of a target application according to the framework template; obtaining a domain description file selected by a user, and creating a domain object under the framework of the target application according to the description data provided by the user in the domain description file; and creating an SQL mapping file for the domain object according to a structured query language SQL mapping template.
[0118] According to the technical solution of the embodiment of the present invention, a framework template can be loaded, and a framework of a target application can be generated according to the framework template, a domain description file selected by a user can be obtained, and domain objects can be created under the framework of the target application according to the description data provided by the user in the domain description file, and an SQL mapping file can be created for the domain object according to the SQL mapping template. That is, in the embodiment of the present invention, an application can be automatically created by using a pre-created framework template, a domain description file, and an SQL mapping template, and the user only needs to provide corresponding data according to the template requirements, thereby saving development time and development costs and improving the development efficiency of the application.
[0119] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for developing an application, characterized in that: include: Loading a framework template, and generating a framework of a target application according to the framework template; wherein the framework template is created in the following manner: abstracting each functional module of a developed application to obtain a hierarchical architecture; extracting the basic code and basic configuration of the developed application to obtain a template file; creating the framework template according to the hierarchical architecture and the template file; generating a framework of a target application according to the framework template, including: traversing each hierarchical architecture of the framework template to generate a target file corresponding to the template file; Obtaining a domain description file selected by a user, and creating a domain object under the framework of the target application according to the description data provided by the user in the domain description file; Create an SQL mapping file for the domain object according to a structured query language SQL mapping template.
2. The method for developing an application according to claim 1, characterized in that: The step of obtaining the domain description file selected by the user includes: Obtaining the file storage path provided by the user; The domain description file is obtained according to the file storage path.
3. The method for developing an application according to claim 1, characterized in that: The step of creating a domain object under the framework of the target application according to the description data provided by the user in the domain description file includes: Acquire object definition description data and object attribute description data provided by the user in the domain description file; The domain object is created under the framework of the target application according to the object definition description data and the object attribute description data.
4. The method for developing an application according to claim 3, characterized in that: The object attribute description data includes a simple attribute type description, and before creating the domain object under the framework of the target application according to the object definition description data and the object attribute description data, it also includes: The simple attribute type description is mapped into a specific attribute type description according to the attribute mapping relationship.
5. The method for developing an application according to claim 1, characterized in that: The step of creating a SQL mapping file for the domain object according to the SQL mapping template includes: Compile the domain object, and obtain SQL populated data from the compiled domain object through the reflection mechanism; Create an SQL mapping file for the domain object according to the SQL filling data and the SQL mapping template.
6. The method for developing an application according to claim 1, characterized in that: The method further comprises: A database is created, and reference information of the database is generated under the framework of the target application.
7. The method for developing an application according to claim 6, characterized in that: The method further comprises: A data table is created in the database, and an SQL statement for the data table is generated under the framework of the target application.
8. A device for developing an application, characterized in that: include: A generation module, used for loading a framework template, and generating a framework of a target application according to the framework template; wherein the framework template is created in the following manner: abstracting each functional module of a developed application to obtain a hierarchical architecture; extracting the basic code and basic configuration of the developed application to obtain a template file; creating the framework template according to the hierarchical architecture and the template file; generating a framework of a target application according to the framework template, including: traversing each hierarchical architecture of the framework template to generate a target file corresponding to the template file; A first creation module, used to obtain a domain description file selected by a user, and create a domain object under the framework of the target application according to the description data provided by the user in the domain description file; The second creation module is used to create an SQL mapping file for the domain object according to a structured query language SQL mapping template.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method for developing an application program according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for developing an application program as claimed in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method and system for developing applications for consulting content and services on a telecommunications network
CN104321743A
Python frame generating method and system
CN107506201A