Disclosure of Invention
In view of the above problems, it is an object of the present invention to provide a database design support apparatus and method with versatility and flexibility.
To achieve the above object, the present invention provides a database design assistance device, including:
a demand analysis module: the system is used for analyzing the requirements of database design, generating a page characteristic value table and generating a JSP page prototype according to the page characteristic value table;
the document generation module: the database script and the database table structure document are generated according to the page characteristic value table;
a research and development module: the database entity object generation system is used for generating a database entity object after demonstrating a database script and a database table structure document;
a report generation module: the method is used for generating a test case by utilizing the characteristic values in the page characteristic value table, comparing the page characteristic value table and generating a database completion report.
The database design support device preferably includes:
a first import module: the standard form document is used for importing the custom made form document;
an acquisition module: the system comprises a standard form file, a document structure and a table structure, wherein the standard form file is used for storing a standard form file;
a creation module: the system is used for creating a list page field and an editing page field according to the record data of the page in the standard form document;
a circulation module: the system comprises an acquisition module, a creation module, a processing module and a display module, wherein the acquisition module and the creation module are used for sequentially processing each page in a standard form document;
a generation module: and the page feature value table is generated according to the table structure, the list page field and the edit page field of each page, and a JSP page prototype is generated according to the page feature value table.
Preferably, the database design assistance device further includes a document generation module that:
a second import module: for importing a customized standard form document;
a compiling module: the basic characteristic value table is compiled according to the page characteristic value table;
a selection module: the system is used for selecting a database and a code naming specification to generate a code characteristic value;
a table structure creation module: and the database script and database table structure document is generated according to the basic characteristic value table and the code characteristic value.
Preferably, the database entity objects in the database demonstration module include: entity files, interface files and implementation mapper files.
The database design assisting device preferably further comprises a testing module: and the automatic testing of the database entity is carried out by checking the missing or forgotten field through a regular expression.
On the other hand, in order to achieve the purpose, the invention adopts the following technical scheme: a database design assisting method comprises the following steps:
s1: analyzing the requirement of the database design, generating a page characteristic value table, and generating a JSP page prototype according to the page characteristic value table;
s2: generating a database script and a database table structure document according to the page characteristic value table;
s3: after the database script and the database table structure document are demonstrated, a database entity object is generated;
s4: and generating a test case by using the characteristic values in the page characteristic value table, and comparing the page characteristic value table to generate a database completion report.
Preferably, the database design assisting method in step S1 specifically includes the following steps:
s11: importing a standard form document customized by a customer;
s12: acquiring a document structure of a certain page in the standard form document and creating a form structure;
s13: creating a list page field and an editing page field according to the record data of the page in the standard form document;
s14: performing the processing of steps S12-S13 for each page in the standard form document in turn;
s15: and generating the page characteristic value table according to the table structure, the list page field and the edit page field of each page, and generating a JSP page prototype according to the page characteristic value table.
In the database design assisting method, preferably, the step S2 specifically includes the following steps:
s21: importing a customized standard form document;
s22: compiling a basic characteristic value table according to the page characteristic value table;
s23: selecting a database and a code naming specification to generate a code characteristic value;
s24: and generating a database script and a database table structure document according to the basic characteristic value table and the code characteristic value.
In the method for assisting database design, preferably, in step S3, the database entity object includes: entity files, interface files and implementation mapper files.
The database design assisting method preferably further includes step S5: and checking the missing or forgotten field through a regular expression, and carrying out automatic test on the database entity.
Due to the adoption of the technical scheme, the invention has the following advantages:
(1) the data source of the reporting system can be verified, and the generated result can be traced. And the verification is made in the stage of demand analysis, and the inspection is made in the stage of running test. And matching degree verification is carried out through the regular expression, so that the quality of the reporting system software is ensured.
(2) And in the requirement analysis stage, a JSP page prototype is generated according to the custom-made form, so that a product manager can conveniently and better perform requirement communication, the customer requirements are thoroughly mined, and the custom-made page characteristic form is enriched. The product manager at the stage can complete the business prototype only by simply arranging the client form, and the time for drawing the business prototype can be saved.
(3) And in the design stage, manufacturing a basic characteristic form according to the customized page characteristic form. The transition process from requirement analysis to design is solved, and the database script and the database document are generated at the same time. This process translates the requirements completely into design. The stage reduces the link of the product manager and the architect, and can save the time for writing documents and generating scripts by a database.
(4) In the research and development stage, the system is used for generating entity objects, including business operation methods of adding, modifying, deleting and inquiring, database operation classes and related SQL statements, so that the development time of programmers is shortened, the generation is accurate, and the debugging time is shortened. This stage reduces programmer repeat code writing and debugging time.
(5) And in the testing stage, a test case and a software completion report are generated, so that the testing of testers is facilitated. The software completion report can evaluate the consistency of the generated service interface and the delivery data source, and can evaluate the consistency of the generated service logic code, the input data and the delivery data source data. The stage saves the time for the testers to compile test cases and click and check the page.
(6) The system generates the system, the business logic code and the business interface completely according to the client form, and simultaneously generates the industry library, and the project framework is not limited by the industry, has very strong adaptability, and can be widely applied to the field of database design.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the description of the present invention, it should be noted that the terms "upper", "lower", "front", "rear", "inside", "outside", and the like indicate orientations or positional relationships based on those shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the system or element referred to must have a specific orientation, be constructed in a specific orientation, and be operated, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," "third," and the like are used to define elements only for convenience in distinguishing between the elements, and if not otherwise stated, are not to be construed as indicating or implying any relative importance.
In the description of the present invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
Interpretation of terms:
JSP: java Server Pages; a java server page; a dynamic web page technology standard.
The database design auxiliary device and the database design auxiliary method provided by the embodiment of the invention can achieve the following results in each stage of the whole software life cycle: the method comprises the steps of generating a demonstration model for a product manager in a requirement analysis stage, generating a design module for a framework engineer in a design stage, generating a service code for a research and development engineer in a research and development stage, and generating a test case for a test engineer in a test stage.
As shown in fig. 1, the present invention provides a database design assistance device, including the following:
the demand analysis module 1: the method is used for analyzing the requirements of database design, generating a page characteristic value table K1 and generating a JSP page prototype according to the page characteristic value table K1; in practical application, the requirements of a database which needs to be designed by a client are filled into a standard form document, and the standard form document records the requirements of the client; the standard form document includes an Excel document.
The document generation module 2: the system is used for generating database scripts and database table structure documents according to the page characteristic value table K1;
the basic characteristic value table K0 includes in practical application: glossary, dictionary, english name labels, field types, and field descriptions.
The code characteristic value table K2 includes, in practical applications: serial number, condition value, parameter list and remark list.
The database table structure document comprises in practical application: column name, data type, type length, decimal number, whether primary key, allow null, default, description, and remark column.
Database demonstration module 3: the database entity object generation system is used for generating a database entity object after demonstrating a database script and a database table structure document; entity objects are generated using the field descriptions of the base feature value table K0 and the code feature value table K2, including add, delete, modify, business methods of query, database operation classes, and related SQL statements. Entity objects include Entity (Entity) files, MyBatis interface files, and MyBatis-implementation mapper (xml) files. Finally, JSP code is generated.
The report generation module 4: the method is used for generating a test case by using the characteristic values in the page characteristic value table, such as an input field length, verification of a mandatory field and a boundary value analysis case, and comparing the page characteristic value table to generate a database completion report.
As shown in fig. 2, the database design assistance apparatus, preferably, the requirement analysis module 1 includes:
the first import module 11: the standard form document is used for importing the custom made form document; the standard form document comprises an Excel document.
The acquisition module 12: the method comprises the steps of obtaining a document structure of a certain page in a standard form document and creating a form structure; the document structure includes a field name, a field type, a field length, a primary key, whether null, and a description.
The creation module 13: creating a list page field and an edit page field according to the record data of the page in the standard form document;
the circulation module 14: processing each page in the standard form document in turn by using the acquisition module 12 and the creation module 13;
the generation module 15: the method is used for generating a page characteristic value table K1 according to the table structure, the list page field and the edit page field of each page, and generating a JSP page prototype according to the page characteristic value table K1. By demonstrating the business model, engineers can judge whether the model meets the requirements of customers, if not, the page characteristic value table K1 can be modified, and then the modules are repeatedly utilized until a JSP page prototype meeting the requirements of customers is obtained.
As shown in fig. 3, the database design assistance apparatus is preferably such that the document creation module 2 includes:
a second import module: for importing a customized standard form document;
a compiling module: the basic characteristic value table is compiled according to the page characteristic value table;
a selection module: the system is used for selecting a database and a code naming specification to generate a code characteristic value;
a table structure creation module: and the database script and database table structure document is generated according to the basic characteristic value table and the code characteristic value.
The database design assisting device preferably includes the following database entity objects in the database demonstration module 3: entity files, interface files and implementation mapper files.
The database design aid preferably further comprises a test module 5: the method is used for checking the missing or forgotten fields through the regular expression, and carrying out automatic testing on the database entity.
On the other hand, to achieve the above object, as shown in fig. 4,
the invention adopts the following technical scheme: a database design assisting method comprises the following steps:
s1: analyzing the requirement of database design, generating a page characteristic value table K1, and generating a JSP page prototype according to the page characteristic value table K1;
s2: generating a database script and a database table structure document according to the page characteristic value table K1; the page feature value table K1 in practical applications includes a glossary, a dictionary, english name labels, grammatical features, query conditions, query field control features, edit page display, and original columns. According to the page characteristic value table K1, a basic characteristic value table K0 and a code characteristic value table K2 are generated at the same time. The generation of the database script comprises recording field names, recording field types, recording field lengths, recording main keys, whether the records are empty, recording description and field creation, and then circularly recording until generating a table building end statement. The module compiles a basic characteristic value table K0 according to a page characteristic value table K1, then selects a database, code naming specifications and the like according to business needs, generates a code characteristic value K2, compares the page characteristic value table K1 if the result meets the business review of a client, and generates a database script and a database design document if the page characteristic value table K1 meets the business requirements of the client. If the code characteristic value K2 is not qualified for the business review, the basic characteristic value table K0 is generated again according to the page characteristic value table K1. If the comparison page characteristic value table K1 does not meet the business requirements of the customer, a basic characteristic value table K0 is generated again according to the page characteristic value table K1.
S3: after the database script and the database table structure document are demonstrated, a database entity object is generated;
FIG. 5 is a diagram illustrating the steps of generating an Entity (Entity) file. Sequentially comprises the following steps: analyzing the package name, the class name and the class annotation; creating a project structure file according to the package name and the class name; an entity class reference, class name is created. The cyclic record sequentially comprises the steps of obtaining an attribute name, obtaining an attribute type, obtaining an attribute length, obtaining an attribute description, generating an attribute annotation and generating an attribute code; and circulating the steps and finally generating the entity file.
FIG. 6 is a schematic diagram illustrating the steps of generating a MyBatis interface file. Sequentially comprises the following steps: analyzing the package name and the class name; creating a project homostructured file according to the package name and the class name; creating an entity class reference interface name; creating a method and annotating; cycling through each page in the table document; and finally generating an interface file.
FIG. 7 is a schematic diagram illustrating the steps of generating MyBatis- -implementing a mapper file. Sequentially comprises the following steps: a basic column list splicing (Base _ column _ list), an insertion splicing (insert) method, an insertion splicing macro (insert batch) method, an update splicing (update) method and a query splicing (query) method, wherein the splicing is performed according to an identity query (queryByID) method and the splicing is performed according to an identity delete (deleteByID) method; circulating the above steps; and judging whether the field is the last field, if so, ending the method and ending the file.
S4: and generating a test case by using the characteristic values in the page characteristic value table K1, and comparing the page characteristic value table to generate a database completion report.
As shown in fig. 8, in the database design assisting method, preferably, the step S1 specifically includes the following steps:
s11: importing a standard form document customized by a customer; the standard form document includes various fields that the customer needs to customize, such as: business name, risk point location, risk factor, risk level, and the like.
S12: acquiring a document structure of a certain page in a standard form document and creating a form structure; in practice, a table structure in a database is established by adopting a document structure of a certain page in an Excel table; usually, Excel tables are in row and column format, and the table structure in the database is also in row and column format.
S13: creating a list page field and an edit page field according to the record data of the page in the standard form document; and recording the data recorded in the Excel table into a list page field and an edit page field. The record data comprises field name, field type, field length, primary key and whether the field is null or not.
S14: the processing of steps S12-S13 is performed for each page in the standard form document in turn; each page in the standard form document is subjected to the processing of steps S12-S13.
S15: and generating the page characteristic value table according to the table structure, the list page field and the edit page field of each page, and generating a JSP page prototype according to the page characteristic value table. Each page in a standard table document generates a JSP page.
As shown in fig. 9, in the method for aided design of database design, step S2 preferably includes the following steps:
s21: importing a customized standard form document;
s22: compiling a basic characteristic value table according to the page characteristic value table;
s23: selecting a database and a code naming specification to generate a code characteristic value;
s24: and generating a database script and a database table structure document according to the basic characteristic value table and the code characteristic value.
Preferably, the database entity object in step S3 includes: entity files, interface files and implementation mapper files.
The database design assistance method preferably further includes step S5: and checking the missing or forgotten fields through a regular expression to automatically test the database entity.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.