CN113641680A - jqGrid table code generation method and device - Google Patents

jqGrid table code generation method and device Download PDF

Info

Publication number
CN113641680A
CN113641680A CN202111016192.1A CN202111016192A CN113641680A CN 113641680 A CN113641680 A CN 113641680A CN 202111016192 A CN202111016192 A CN 202111016192A CN 113641680 A CN113641680 A CN 113641680A
Authority
CN
China
Prior art keywords
jqgrid
field
data item
information
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111016192.1A
Other languages
Chinese (zh)
Inventor
马文建
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bank of China Ltd
Original Assignee
Bank of China 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 Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202111016192.1A priority Critical patent/CN113641680A/en
Publication of CN113641680A publication Critical patent/CN113641680A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • G06F16/90344Query processing by using string matching techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/177Editing, e.g. inserting or deleting of tables; using ruled lines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/194Calculation of difference between files

Abstract

The invention provides a jqGrid table code generation method and a device, belonging to big data, wherein the method comprises the following steps: determining the name of the data item and the display type of the data item in the jqGrid table according to the requirement specification; searching a designated database according to the name of the data item, matching the designated database with a data table in the database, and determining matched field information; determining a jqGrid table display item code according to the matched field information and the display type of the data item in the jqGrid table; and determining the jqGrid table code according to the jqGrid table display item code and the jqGrid table configuration information code generated in advance. The invention solves the problems of low manual coding speed, low efficiency and easy error, and realizes the automatic generation of the jqGrid table code.

Description

jqGrid table code generation method and device
Technical Field
The invention relates to the technical field of computer data processing, in particular to a jqGrid table code generation method and device.
Background
This section is intended to provide a background or context to the embodiments of the invention that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
In a financial application system, displaying data items is a great feature of the financial application system. In a function page, it is a very common scenario to show tens or even hundreds of data items at the same time. These data items are often in one-to-one correspondence with fields in one or more data tables in the database. Therefore, during the development of the financial application system, developers often need to find the corresponding field from the data table and then match the field with the data item in the front-end page. This is a time-consuming and laborious activity with high repeatability.
Therefore, how to provide a new solution, which can solve the above technical problems, is a technical problem to be solved in the art.
Disclosure of Invention
The embodiment of the invention provides a jqGrid table code generation method, which solves the problems of low manual coding speed, low efficiency and easy error, and realizes the automatic generation of the jqGrid table code, and the method comprises the following steps:
determining the name of the data item and the display type of the data item in the jqGrid table according to the requirement specification;
searching a designated database according to the name of the data item, matching the designated database with a data table in the database, and determining matched field information;
determining a jqGrid table display item code according to the matched field information and the display type of the data item in the jqGrid table;
and determining the jqGrid table code according to the jqGrid table display item code and the jqGrid table configuration information code generated in advance.
An embodiment of the present invention further provides a jqGrid table code generating device, including:
the data item information determining module is used for determining the name of the data item and the display type of the data item in the jqGrid table according to the requirement specification;
the searching and matching module is used for searching the specified database according to the data item name, matching the specified database with a data table in the database and determining matched field information;
the jqGrid table display item code determining module is used for determining a jqGrid table display item code according to the matched field information and the display type of the data item in the jqGrid table;
and the jqGrid table code determining module is used for determining the jqGrid table code according to the jqGrid table display item code and the pre-generated jqGrid table configuration information code.
The embodiment of the invention also provides computer equipment which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor realizes the jqGrid table code generation method when executing the computer program.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program for executing the jqGrid table code generation method is stored in the computer-readable storage medium.
The embodiment of the invention provides a jqGrid table code generation method and a device, comprising the following steps: firstly, determining the name of a data item and the display type of the data item in a jqGrid table according to a requirement specification; then searching a designated database according to the name of the data item, matching the designated database with a data table in the database, and determining matched field information; determining a jqGrid table display item code according to the matched field information and the display type of the data item in the jqGrid table; and finally determining the jqGrid table code according to the jqGrid table display item code and the pre-generated jqGrid table configuration information code. According to the embodiment of the invention, the data item name in the requirement specification is used as the search condition to be input, and is compared with the field description information in the specified data table in the database, so that the corresponding field in the database table can be automatically matched, and then the jqGrid table code is generated by taking the corresponding field as the reference. The invention solves the problems of low manual coding speed, low efficiency and easy error, realizes the automatic generation of the jqGrid table code, can solve the problem of time and labor consumption when a system developer develops the front-end application with the jqGrid table, and can release the developer from complex and repeated development activities, thereby accelerating the project development progress and reducing the development cost.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts. In the drawings:
fig. 1 is a schematic diagram of a jqGrid table code generation method according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of a process of determining matched field information in a jqGrid table code generation method according to an embodiment of the present invention.
Fig. 3 is a schematic diagram of a process of determining matched field information in a jqGrid table code generation method according to an embodiment of the present invention.
Fig. 4 is a schematic diagram of a process for determining a code of a jqGrid table display item according to a method for generating a jqGrid table code according to an embodiment of the present invention.
Fig. 5 is a schematic diagram of a hump naming mode conversion process of a jqGrid table code generation method according to an embodiment of the present invention.
Fig. 6 is a schematic diagram of a computer device for executing a jqGrid table code generation method implemented by the present invention.
Fig. 7 is a schematic diagram of a jqGrid table code generation apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. The exemplary embodiments and descriptions of the present invention are provided to explain the present invention, but not to limit the present invention.
The invention belongs to big data. Fig. 1 is a schematic diagram of a jqGrid table code generation method according to an embodiment of the present invention, as shown in fig. 1,
the embodiment of the invention provides a jqGrid table code generation method, which solves the problems of low manual coding speed, low efficiency and easy error, and realizes the automatic generation of the jqGrid table code, and the method comprises the following steps:
step 101: determining the name of the data item and the display type of the data item in the jqGrid table according to the requirement specification;
step 102: searching a designated database according to the name of the data item, matching the designated database with a data table in the database, and determining matched field information;
step 103: determining a jqGrid table display item code according to the matched field information and the display type of the data item in the jqGrid table;
step 104: and determining the jqGrid table code according to the jqGrid table display item code and the jqGrid table configuration information code generated in advance.
The jqGrid table code generation method provided by the embodiment of the invention comprises the following steps: firstly, determining the name of a data item and the display type of the data item in a jqGrid table according to a requirement specification; then searching a designated database according to the name of the data item, matching the designated database with a data table in the database, and determining matched field information; determining a jqGrid table display item code according to the matched field information and the display type of the data item in the jqGrid table; and finally determining the jqGrid table code according to the jqGrid table display item code and the pre-generated jqGrid table configuration information code. According to the embodiment of the invention, the data item name in the requirement specification is used as the search condition to be input, and is compared with the field description information in the specified data table in the database, so that the corresponding field in the database table can be automatically matched, and then the jqGrid table code is generated by taking the corresponding field as the reference. The invention solves the problems of low manual coding speed, low efficiency and easy error, realizes the automatic generation of the jqGrid table code, can solve the problem of time and labor consumption when a system developer develops the front-end application with the jqGrid table, and can release the developer from complex and repeated development activities, thereby accelerating the project development progress and reducing the development cost.
In the embodiment of the present invention, jqGrid refers to a jQuery plug-in used for displaying table data.
When writing the jqGrid code by a manual mode, a developer needs to convert data items defined in a requirement specification into the jqGrid code item by item, and then searches the mapping relation between each data item and a corresponding field in a database item by item. In a typical financial application system, it is very common to display data items and database tables with fields as many as tens or even hundreds, so it is time and labor consuming if a jqGrid table is created manually. In order to solve the problem, the embodiment of the invention provides a jqGrid table code generation method based on text similarity calculation, which is used for solving the technical development pain point. When the method for generating the jqGrid table code provided by the embodiment of the present invention is implemented specifically, in an embodiment, the method may include:
determining the name of the data item and the display type of the data item in the jqGrid table according to the requirement specification;
searching a designated database according to the name of the data item, matching the designated database with a data table in the database, and determining matched field information;
determining a jqGrid table display item code according to the matched field information and the display type of the data item in the jqGrid table;
and determining the jqGrid table code according to the jqGrid table display item code and the jqGrid table configuration information code generated in advance.
In the above embodiment, the data item name in the requirement specification is input as a search condition, and is compared with the field description information in the specified data table in the database, so that the corresponding field in the database table can be automatically matched, and then the jqGrid table code is generated by taking the corresponding field as a reference. The invention solves the problems of low manual coding speed, low efficiency and easy error, realizes the automatic generation of the jqGrid table code, can solve the problem of time and labor consumption when a system developer develops the front-end application with the jqGrid table, and can release the developer from complex and repeated development activities, thereby accelerating the project development progress and reducing the development cost.
When the method for generating the jqGrid table code provided by the embodiment of the present invention is implemented specifically, in an embodiment, according to a requirement specification, determining a name of a data item and a display type of the data item in the jqGrid table includes: from the requirements specification, the name of the generated data item and the presentation type of the data item in the jqGrid table are specified.
From the naming convention, if the variable names used by the display data items are not consistent with the names of the corresponding fields in the database table, it will become very difficult to establish and maintain the mapping relationship between the two in the future. Fig. 2 is a schematic diagram of a process of determining matched field information of a jqGrid table code generation method according to an embodiment of the present invention, and as shown in fig. 2, when the method for generating a jqGrid table code according to an embodiment of the present invention is implemented specifically, in an embodiment, a designated database is searched according to a name of a data item, and is matched with a data table in the database, and the determining of matched field information includes:
step 201: appointing a database to be searched and the name of a data table in the appointed database;
step 202: reading the table building information of the data table according to the name of the data table in the specified database; wherein, the table building information comprises: field information and its associated field description information;
step 203: searching a designated database according to the name of the data item, and performing similarity matching operation on the name of the data item and field description information of a data table in the database by using a text similarity calculation algorithm to determine matched field information.
In an embodiment, the process of determining the matched field information mainly includes:
firstly, appointing a database to be searched and the name of a data table in the appointed database; the database may include a plurality of data tables, and therefore, when the name of the data table in the database is specified, the plurality of data tables may be specified.
Then, reading the table building information of the data table according to the name of the data table in the specified database; wherein, the table-building information includes but is not limited to: field information and its associated field description information;
and finally, searching a designated database according to the name of the data item, and performing similarity matching operation on the name of the data item and field description information of a data table in the database by using a text similarity calculation algorithm to determine matched field information.
In the above embodiment, the similarity matching operation is performed on the data item name and the field description information of the data table in the database to obtain the matched field information, so that the problems of naming specification and establishing and maintaining the mapping relationship between the data item and the corresponding field in the database table are solved. Meanwhile, the name of the data item in the requirement specification is used as a search condition to be input, the search condition is compared with field description information in a specified data table in a database, the corresponding field in the database table can be automatically matched, and then a jqGrid table code is generated by taking the corresponding field as a reference. The problems of low manual coding speed, low efficiency and high error probability are solved, and the automatic generation of the jqGrid table code is realized.
Fig. 3 is a schematic diagram of a process of determining matched field information of a jqGrid table code generation method according to an embodiment of the present invention, as shown in fig. 3, when the method for generating a jqGrid table code according to an embodiment of the present invention is implemented specifically, in an embodiment, an assigned database is searched according to a name of a data item, and a similarity matching operation is performed on the name of the data item and field description information of a data table in the database by using a text similarity calculation algorithm to determine matched field information, where the method includes:
step 301: constructing a text similarity calculation algorithm;
step 302: searching a designated database according to the data item name, and performing matching operation on the data item name and field description information of a data table in the database;
step 303: if the data item is completely matched with the field description information of the data table in the database and only one data item is matched, the data item and the field description information are in one-to-one correspondence, and the field information corresponding to the field description information is output as matched field information;
step 304: if the data item is completely matched with the field description information of the data table in the database and is matched with a plurality of data items, outputting the field information corresponding to the first matched field description information as matched field information by using the first matched corresponding relation as the data item; when a plurality of field description information are matched, carrying out special identification on the output jqGrid table code;
step 305: if the data item is not completely matched with the field description information of the data table in the database, performing character string similarity matching operation on the name of the data item and the field description information of the data table in the database by using a text similarity calculation algorithm, selecting the field information corresponding to the field description information with the highest similarity, and outputting the field information as matched field information; and when the matched field information is obtained through the character string similarity matching operation, carrying out special identification on the output jqGrid table code.
In the embodiment, a specified database is searched according to the name of a data item, similarity matching operation is performed on the name of the data item and field description information of a data table in the database by using a text similarity calculation algorithm, and the process of determining matched field information mainly comprises the following steps:
firstly, constructing a text similarity calculation algorithm; the main basis is the ratio of the number of the same characters to the total number of the characters;
then, searching a specified database according to the name of the data item, and performing matching operation on the name of the data item and field description information of a data table in the database;
if the data item is completely matched with the field description information of the data table in the database and only one data item is matched, the data item and the field description information are in one-to-one correspondence, and the field information corresponding to the field description information is output as matched field information;
if the data item is completely matched with the field description information of the data table in the database and is matched with a plurality of data items, outputting the field information corresponding to the first matched field description information as matched field information by using the first matched corresponding relation as the data item; when a plurality of field description information are matched, carrying out special identification on the output jqGrid table code; for example, when a data item is matched to a plurality of field description information, the output jqGrid table code is output in a red font.
If the data item is not completely matched with the field description information of the data table in the database, performing character string similarity matching operation on the name of the data item and the field description information of the data table in the database by using a text similarity calculation algorithm, selecting the field information corresponding to the field description information with the highest similarity, and outputting the field information as matched field information; and when the matched field information is obtained through the character string similarity matching operation, carrying out special identification on the output jqGrid table code. For example, when the matched field information is obtained through string similarity matching operation, the output jqGrid table code is output by adopting a red font; in another embodiment, in order to distinguish the case where the data item is matched with a plurality of field description information, on the basis that the data item is matched with a plurality of field description information and the output jqGrid table code is output in a red font, when the matched field information is obtained through string similarity matching operation, the output jqGrid table code is output in a green font, so as to ensure that the output jqGrid table code is distinguished in different colors when the matched field information is distinguished to belong to different cases.
In one example of an embodiment of the present invention,
the process of matching corresponding fields in a specified database table according to the name of a data item specified by a user mainly comprises the following steps:
a. its tabulation information is read from the specified database table(s), including but not limited to: field names, field description information, etc.;
b. and performing character string matching calculation on the data item name and the description information of all the database fields based on the following algorithm:
if the data item is completely matched with the field description information and only one data item is matched, the data item is in one-to-one correspondence with the field;
if the data item is completely matched with the field description information and is matched with a plurality of fields, the first matched field is used as the corresponding field of the data item, and when the jqGrid code is generated by output, the corresponding code is output in a red font;
and if the data item is not completely matched with the field description information, calculating by adopting a text similarity calculation algorithm, selecting a field with the highest similarity as a corresponding field of the data item, and outputting the corresponding code in a red font when the jqGrid code is generated.
In the above embodiment, the similarity matching operation is performed on the data item name and the field description information of the data table in the database to obtain the matched field information, so that the problems of naming specification and establishing and maintaining the mapping relationship between the data item and the corresponding field in the database table are solved. Meanwhile, the name of the data item in the requirement specification is used as a search condition to be input, the search condition is compared with field description information in a specified data table in a database, the corresponding field in the database table can be automatically matched, and then a jqGrid table code is generated by taking the corresponding field as a reference. The problems of low manual coding speed, low efficiency and high error probability are solved, and the automatic generation of the jqGrid table code is realized.
In a specific implementation of the jqGrid table code generation method provided by the embodiment of the present invention, in an embodiment, a text similarity calculation algorithm is constructed as follows:
similarity is the number of characters of the data item which is identical with the number of characters of the field description information/the number of characters of the field description information.
Fig. 4 is a schematic diagram illustrating a process of determining a code of a jqGrid table display item of a jqGrid table code generation method according to an embodiment of the present invention, and as shown in fig. 4, when a method for generating a jqGrid table code according to an embodiment of the present invention is implemented specifically, in an embodiment, a code of a jqGrid table display item is determined according to matched field information and a display type of a data item in a jqGrid table, where the method includes:
step 401: extracting field names from the matched field information;
step 402: converting the field name into a hump naming mode;
step 403: determining a display item code of the jqGrid table according to the field name of the hump naming mode and the display type of the data item in the jqGrid table; the display type of the data item in the jqGrid table comprises the following steps: plain text, a money type supporting formatting, a date type supporting formatting, a drop-down box type, a floating point type decimal type supporting formatting, and an account number type.
In the embodiment, a jqGrid table display item code is determined according to the matched field information and the display type of the data item in the jqGrid table, and the main process comprises the following steps:
firstly, extracting a field name from matched field information; then, converting the field name into a hump naming mode; finally, automatically generating a jqGrid table display item code according to the field name of the hump naming mode and the display type of the data item in the jqGrid table; if an ambiguous data item exists, it is marked with a special color-coded text. For example, when ambiguous data items exist, they are marked with red text.
The display type of the data item in the jqGrid table at least comprises the following components: the method comprises the following steps of general text, amount type supporting formatting, date type supporting formatting, drop-down box type, floating point type decimal type supporting formatting and account number type.
In the above embodiment, the similarity matching operation is performed on the data item name and the field description information of the data table in the database to obtain the matched field information, so that the problems of naming specification and establishing and maintaining the mapping relationship between the data item and the corresponding field in the database table are solved. Meanwhile, the name of the data item in the requirement specification is used as a search condition to be input, the search condition is compared with field description information in a specified data table in a database, the corresponding field in the database table can be automatically matched, and then a jqGrid table code is generated by taking the corresponding field as a reference. The problems of low manual coding speed, low efficiency and high error probability are solved, and the automatic generation of the jqGrid table code is realized.
Fig. 5 is a schematic diagram of a hump naming mode conversion process of a jqGrid table code generation method according to an embodiment of the present invention, and as shown in fig. 5, when the jqGrid table code generation method according to the embodiment of the present invention is implemented specifically, in an embodiment, a field name is converted into a hump naming mode, where the method includes:
step 501: converting all field names into lower case letters; wherein, the small letter contains the preset character;
step 502: converting a first letter after a character is preset in the lower case letters into an upper case letter;
step 503: converting the first letter into a lower case letter;
step 504: deleting the preset character and outputting the field name of the hump naming mode.
In an embodiment, the field name is converted into a hump naming mode, and the specific process may include:
firstly, converting all field names into lower case letters; wherein, the small letter contains the preset character;
then converting a first letter after a preset character in the lower case letters into an upper case letter;
then converting the first letter into a lower case letter;
and finally deleting the preset character and outputting the field name of the hump naming mode.
In one example of the embodiment of the present invention, the preset character is "_", that is, underline; firstly, the method
Firstly, converting all field names into lower case letters; the lower case contains an "_" such as abc _ def;
then converting the first letter after the _' in the lower case letters into upper case letters; for example, abc _ Def is converted to abc _ Def;
then converting the first letter into a lower case letter; if the first letter is already a lower case letter, this step is skipped;
finally, deleting the preset character and outputting the field name of the hump naming mode; for example, "_" is deleted, and abcDef is output.
In a specific implementation of the method for generating a jqGrid table code according to the embodiment of the present invention, in an embodiment, determining the jqGrid table code according to the jqGrid table display item code and a jqGrid table configuration information code generated in advance includes:
generating jqGrid table configuration information codes including table names, table titles, whether to support addition or deletion and whether to support Excel import according to the content designated by a user or adopting default configuration; if the Excel import is supported, generating a corresponding import template, and if the double-click event response is supported, generating a corresponding empty function;
and integrating and formatting the jqGrid table display item code and the jqGrid table configuration information code, and outputting the jqGrid table code.
In an embodiment, determining a jqGrid table code according to a jqGrid table display item code and a jqGrid table configuration information code generated in advance may include:
firstly, generating jqGrid table configuration information codes including a table name, a table title, whether to support addition or deletion and whether to support Excel import according to the content designated by a user or adopting default configuration; if the Excel import is supported, generating a corresponding import template, and if the double-click event response is supported, generating a corresponding empty function;
then, the jqGrid table display item code and the jqGrid table configuration information code are integrated and formatted, and the jqGrid table code is output.
In the above embodiment, the similarity matching operation is performed on the data item name and the field description information of the data table in the database to obtain the matched field information, so that the problems of naming specification and establishing and maintaining the mapping relationship between the data item and the corresponding field in the database table are solved. Meanwhile, the name of the data item in the requirement specification is used as a search condition to be input, the search condition is compared with field description information in a specified data table in a database, the corresponding field in the database table can be automatically matched, and then a jqGrid table code is generated by taking the corresponding field as a reference. The problems of low manual coding speed, low efficiency and high error probability are solved, and the automatic generation of the jqGrid table code is realized.
According to the embodiment of the invention, the data item name in the requirement specification is used as the search condition to be input, the search condition is compared with the field description information in the specified data table in the database, the best matched data item is found, and then the data item is converted into the front-end table used by jqGrid on the basis of the data item name.
The problems of low manual coding speed, low efficiency and high possibility of errors are solved, and the problems of naming specification and establishment and maintenance of the mapping relation between the data items and the corresponding fields in the database table are solved.
By the method and the device, the problem that a system developer consumes time and labor when developing the front-end application with the jqGrid table can be solved, and the developer can be liberated from complex and repeated development activities, so that the project development progress is accelerated, and the development cost is reduced.
The jqGrid table code generation method provided by the embodiment of the present invention is briefly described below with reference to specific scenarios:
the principle of the jqGrid table code generation method provided by the embodiment of the invention comprises the following steps:
1) according to the requirement specification, specifying the generated data item name and the display type of the data item name in the jqGrid table;
2) specifying the database to be searched, and the names of tables in the database (multiple tables may be specified);
3) reading the table building information of the specified table in the database, including but not limited to: field names, field description information, etc.;
4) based on the text similarity calculation method provided by the invention, similarity matching operation is carried out on the data item names and the field description information obtained by inquiring in the step 3 item by item to obtain the field information which is most matched with the data item names;
5) and generating the code of the data item by combining the display type of the data item in the jqGrid table on the basis of the field name obtained by matching in the step 4. If the ambiguous data item exists, marking the ambiguous data item by using red characters;
6) and combining the codes generated by all the data items, adding other information required for generating the jqGrid table, and generating the final jqGrid table code.
The method for generating the jqGrid table code based on the text similarity calculation can be used for automatically matching the corresponding fields in the database table and then generating the jqGrid table code by taking the fields as the reference. The problems of low manual coding speed, low efficiency and high error probability are solved, and the problems of naming specification and establishment and maintenance of the mapping relation between the data items and the corresponding fields in the database table are solved. By taking the name of the data item in the requirement specification as the search condition input, the method compares the name with the field description information in the specified data table in the database to find the best matched data item, and then converts the best matched data item into the front-end table used by jqGrid on the basis of the best matched data item. By the method and the device, the problem that a system developer consumes time and labor when developing the front-end application with the jqGrid table can be solved, and the developer can be liberated from complex and repeated development activities, so that the project development progress is accelerated, and the development cost is reduced.
When the principle of the jqGrid table code generation method provided by the embodiment of the invention is realized, the key steps comprise:
1) and matching corresponding fields in the specified database table according to the names of the data items specified by the user.
a. Its tabulation information is read from the specified database table(s), including but not limited to: field names, field description information, etc.
b. And performing character string matching calculation on the data item name and the description information of all the database fields based on the following algorithm:
if the data item is completely matched with the field description information and only one data item is matched, the data item is in one-to-one correspondence with the field;
if the data item is completely matched with the field description information and is matched with a plurality of fields, the first matched field is used as the corresponding field of the data item, and when the jqGrid code is generated by output, the corresponding code is output in a red font;
and if the data item is not completely matched with the field description information, calculating by adopting a text similarity calculation algorithm, selecting a field with the highest similarity as a corresponding field of the data item, and outputting the corresponding code in a red font when the jqGrid code is generated.
The text similarity calculation algorithm is as follows:
similarity is the number of characters of the data item which is identical with the number of characters of the field description information/the number of characters of the field description information.
2) And (3) converting the field name into a hump naming mode with the first letter lower case on the basis of the field name obtained by matching in the step (1). The conversion strategy is as follows:
a. converting all field names into lower case letters;
b. converting the first letter after the _ "character into a capital letter;
c. converting the first letter into a lower case letter;
d. all "_" characters are deleted.
3) And 2, converting the basis, and generating the code of the data item by combining the display type of the data item in the jqGrid table. If an ambiguous data item exists, it is marked with a red font.
Supported jqGrid exposure types are as follows:
a. a plain text;
b. a money type that supports formatting;
c. a date type that supports formatting;
d. a drop-down frame type;
e. supporting a formatted floating point type decimal type;
f. the account type.
4) And generating configuration information codes of the table, such as the name and the title of the table, whether addition is supported, whether deletion is supported, whether Excel import is supported, and the like.
5) And if the Excel import is supported, generating a corresponding import template.
6) If a double click event response is supported, a corresponding null function is generated.
7) And integrating the codes in the steps 3, 4, 5 and 6 to generate a final jqGrid table code.
In the process of implementing the jqGrid table code generation method provided by the embodiment of the present invention, the method mainly includes:
1) matching corresponding fields in a specified database table according to the name of the data item specified by the user;
2) converting the field name obtained by matching into a hump naming mode;
3) generating a table display item code of jqGrid according to the naming information obtained in the step 2 and the display item type designated by the user;
4) generating a configuration information code of the jqGrid table;
5) the code is integrated, formatted, and output.
The embodiment of the invention also provides a modular example of the jqGrid table code generation method, which mainly comprises the following steps:
1) and searching a matching module. And the database table is responsible for matching corresponding fields in a specified database table according to the name of the data item specified by the user.
2) A name translation module. And (4) converting the field name obtained by matching in the step (1) into a hump naming mode.
3) The jqGrid table shows the item code generation module. And generating a table display item code of jqGrid according to the naming information obtained in the step 2 and the display item type designated by the user.
4) And configuring an information code generation module for the jqGrid table. And generating codes such as a form name, a form title, whether addition is supported, whether deletion is supported, whether Excel import is supported and the like according to user specification or default configuration.
5) And the code integration and formatting output module. And integrating, formatting and outputting the codes generated in the step 3 and the step 4.
By taking the name of the data item in the requirement specification as the search condition input, the method compares the name with the field description information in the specified data table in the database to find the best matched data item, and then converts the best matched data item into the front-end table used by jqGrid on the basis of the best matched data item.
By the method and the device, the problem that a system developer consumes time and labor when developing the front-end application with the jqGrid table can be solved, and the developer can be liberated from complex and repeated development activities, so that the project development progress is accelerated, and the development cost is reduced.
Fig. 6 is a schematic diagram of a computer device for executing a jqGrid table code generation method implemented by the present invention, and as shown in fig. 6, an embodiment of the present invention further provides a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the jqGrid table code generation method when executing the computer program.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program for implementing the jqGrid table code generation method is stored in the computer-readable storage medium.
The embodiment of the invention also provides a jqGrid table code generation device, which is described in the following embodiment. Because the principle of the device for solving the problems is similar to a jqGrid table code generation method, the implementation of the device can refer to the implementation of the jqGrid table code generation method, and repeated parts are not described again.
Fig. 7 is a schematic diagram of a jqGrid table code generation apparatus according to an embodiment of the present invention, and as shown in fig. 7, an embodiment of the present invention further provides a jqGrid table code generation apparatus, which may include:
a data item information determining module 701, configured to determine, according to the requirement specification, a name of a data item and a display type of the data item in the jqGrid table;
a search matching module 702, configured to search a specified database according to the data item name, match the specified database with a data table in the database, and determine matching field information;
a jqGrid table display item code determining module 703, configured to determine a jqGrid table display item code according to the matched field information and the display type of the data item in the jqGrid table;
a jqGrid table code determining module 704, configured to determine a jqGrid table code according to the jqGrid table display item code and a jqGrid table configuration information code generated in advance.
In an embodiment of the invention, when the jqGrid table code generating apparatus provided in the embodiment of the present invention is implemented specifically, the search matching module is specifically configured to:
appointing a database to be searched and the name of a data table in the appointed database;
reading the table building information of the data table according to the name of the data table in the specified database; wherein, the table building information comprises: field information and its associated field description information;
searching a designated database according to the name of the data item, and performing similarity matching operation on the name of the data item and field description information of a data table in the database by using a text similarity calculation algorithm to determine matched field information.
In an embodiment of the invention, when the jqGrid table code generating apparatus provided in the embodiment of the present invention is implemented specifically, the search matching module is further configured to:
constructing a text similarity calculation algorithm;
searching a designated database according to the data item name, and performing matching operation on the data item name and field description information of a data table in the database;
if the data item is completely matched with the field description information of the data table in the database and only one data item is matched, the data item and the field description information are in one-to-one correspondence, and the field information corresponding to the field description information is output as matched field information;
if the data item is completely matched with the field description information of the data table in the database and is matched with a plurality of data items, outputting the field information corresponding to the first matched field description information as matched field information by using the first matched corresponding relation as the data item; when a plurality of field description information are matched, carrying out special identification on the output jqGrid table code;
if the data item is not completely matched with the field description information of the data table in the database, performing character string similarity matching operation on the name of the data item and the field description information of the data table in the database by using a text similarity calculation algorithm, selecting the field information corresponding to the field description information with the highest similarity, and outputting the field information as matched field information; and when the matched field information is obtained through the character string similarity matching operation, carrying out special identification on the output jqGrid table code.
In an embodiment of the invention, when the jqGrid table code generating device provided in the embodiment of the present invention is implemented specifically, the search matching module is further configured to construct a text similarity calculation algorithm according to the following manner:
similarity is the number of characters of the data item which is identical with the number of characters of the field description information/the number of characters of the field description information.
In a specific implementation of the apparatus for generating a jqGrid table code according to an embodiment of the present invention, in an embodiment, the jqGrid table display item code determination module is specifically configured to:
extracting field names from the matched field information;
converting the field name into a hump naming mode;
determining a display item code of the jqGrid table according to the field name of the hump naming mode and the display type of the data item in the jqGrid table; the display type of the data item in the jqGrid table comprises the following steps: plain text, a money type supporting formatting, a date type supporting formatting, a drop-down box type, a floating point type decimal type supporting formatting, and an account number type.
In a specific implementation of the apparatus for generating a jqGrid table code according to an embodiment of the present invention, in an embodiment, the jqGrid table display item code determining module is further configured to:
converting all field names into lower case letters; wherein, the small letter contains the preset character;
converting a first letter after a character is preset in the lower case letters into an upper case letter;
converting the first letter into a lower case letter;
deleting the preset character and outputting the field name of the hump naming mode.
In a specific implementation of the apparatus for generating a jqGrid table code according to an embodiment of the present invention, in an embodiment, the jqGrid table code determining module is specifically configured to:
generating jqGrid table configuration information codes including table names, table titles, whether to support addition or deletion and whether to support Excel import according to the content designated by a user or adopting default configuration; if the Excel import is supported, generating a corresponding import template, and if the double-click event response is supported, generating a corresponding empty function;
and integrating and formatting the jqGrid table display item code and the jqGrid table configuration information code, and outputting the jqGrid table code.
To sum up, a method and an apparatus for generating jqGrid table codes provided by the embodiments of the present invention include: firstly, determining the name of a data item and the display type of the data item in a jqGrid table according to a requirement specification; then searching a designated database according to the name of the data item, matching the designated database with a data table in the database, and determining matched field information; determining a jqGrid table display item code according to the matched field information and the display type of the data item in the jqGrid table; and finally determining the jqGrid table code according to the jqGrid table display item code and the pre-generated jqGrid table configuration information code. According to the embodiment of the invention, the data item name in the requirement specification is used as the search condition to be input, and is compared with the field description information in the specified data table in the database, so that the corresponding field in the database table can be automatically matched, and then the jqGrid table code is generated by taking the corresponding field as the reference. The invention solves the problems of low manual coding speed, low efficiency and easy error, realizes the automatic generation of the jqGrid table code, can solve the problem of time and labor consumption when a system developer develops the front-end application with the jqGrid table, and can release the developer from complex and repeated development activities, thereby accelerating the project development progress and reducing the development cost.
The names of the data items in the requirement specification are used as search conditions to be input, the search conditions are compared with field description information in a specified data table in a database, the data items which are most matched are found, and then the data items are converted into a front-end table used by jqGrid on the basis of the data items.
The problems of low manual coding speed, low efficiency and high possibility of errors are solved, and the problems of naming specification and establishment and maintenance of the mapping relation between the data items and the corresponding fields in the database table are solved.
By the method and the device, the problem that a system developer consumes time and labor when developing the front-end application with the jqGrid table can be solved, and the developer can be liberated from complex and repeated development activities, so that the project development progress is accelerated, and the development cost is reduced.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (16)

1. A jqGrid table code generation method is characterized by comprising the following steps:
determining the name of the data item and the display type of the data item in the jqGrid table according to the requirement specification;
searching a designated database according to the name of the data item, matching the designated database with a data table in the database, and determining matched field information;
determining a jqGrid table display item code according to the matched field information and the display type of the data item in the jqGrid table;
and determining the jqGrid table code according to the jqGrid table display item code and the jqGrid table configuration information code generated in advance.
2. The method of claim 1, wherein searching the specified database for matches to data tables in the database based on the data item names to determine matching field information comprises:
appointing a database to be searched and the name of a data table in the appointed database;
reading the table building information of the data table according to the name of the data table in the specified database; wherein, the table building information comprises: field information and its associated field description information;
searching a designated database according to the name of the data item, and performing similarity matching operation on the name of the data item and field description information of a data table in the database by using a text similarity calculation algorithm to determine matched field information.
3. The method of claim 2, wherein searching the specified database based on the name of the data item, performing a similarity matching operation between the name of the data item and field description information of data tables in the database using a text similarity calculation algorithm to determine matching field information, comprises:
constructing a text similarity calculation algorithm;
searching a designated database according to the data item name, and performing matching operation on the data item name and field description information of a data table in the database;
if the data item is completely matched with the field description information of the data table in the database and only one data item is matched, the data item and the field description information are in one-to-one correspondence, and the field information corresponding to the field description information is output as matched field information;
if the data item is completely matched with the field description information of the data table in the database and is matched with a plurality of data items, outputting the field information corresponding to the first matched field description information as matched field information by using the first matched corresponding relation as the data item; when a plurality of field description information are matched, carrying out special identification on the output jqGrid table code;
if the data item is not completely matched with the field description information of the data table in the database, performing character string similarity matching operation on the name of the data item and the field description information of the data table in the database by using a text similarity calculation algorithm, selecting the field information corresponding to the field description information with the highest similarity, and outputting the field information as matched field information; and when the matched field information is obtained through the character string similarity matching operation, carrying out special identification on the output jqGrid table code.
4. The method of claim 3, wherein the text similarity calculation algorithm is constructed as follows:
similarity is the number of characters of the data item which is identical with the number of characters of the field description information/the number of characters of the field description information.
5. The method of claim 1, wherein determining a jqGrid table presentation item code according to the matched field information and the presentation type of the data item in the jqGrid table comprises:
extracting field names from the matched field information;
converting the field name into a hump naming mode;
determining a display item code of the jqGrid table according to the field name of the hump naming mode and the display type of the data item in the jqGrid table; the display type of the data item in the jqGrid table comprises the following steps: plain text, a money type supporting formatting, a date type supporting formatting, a drop-down box type, a floating point type decimal type supporting formatting, and an account number type.
6. The method of claim 5, wherein converting the field name to a hump naming mode comprises:
converting all field names into lower case letters; wherein, the small letter contains the preset character;
converting a first letter after a character is preset in the lower case letters into an upper case letter;
converting the first letter into a lower case letter;
deleting the preset character and outputting the field name of the hump naming mode.
7. The method of claim 1, wherein determining the jqGrid form code based on the jqGrid form presentation item code and a pre-generated jqGrid form configuration information code comprises:
generating jqGrid table configuration information codes including table names, table titles, whether to support addition or deletion and whether to support Excel import according to the content designated by a user or adopting default configuration; if the Excel import is supported, generating a corresponding import template, and if the double-click event response is supported, generating a corresponding empty function;
and integrating and formatting the jqGrid table display item code and the jqGrid table configuration information code, and outputting the jqGrid table code.
8. A jqGrid table code generating apparatus, comprising:
the data item information determining module is used for determining the name of the data item and the display type of the data item in the jqGrid table according to the requirement specification;
the searching and matching module is used for searching the specified database according to the data item name, matching the specified database with a data table in the database and determining matched field information;
the jqGrid table display item code determining module is used for determining a jqGrid table display item code according to the matched field information and the display type of the data item in the jqGrid table;
and the jqGrid table code determining module is used for determining the jqGrid table code according to the jqGrid table display item code and the pre-generated jqGrid table configuration information code.
9. The apparatus of claim 8, wherein the search matching module is specifically configured to:
appointing a database to be searched and the name of a data table in the appointed database;
reading the table building information of the data table according to the name of the data table in the specified database; wherein, the table building information comprises: field information and its associated field description information;
searching a designated database according to the name of the data item, and performing similarity matching operation on the name of the data item and field description information of a data table in the database by using a text similarity calculation algorithm to determine matched field information.
10. The apparatus of claim 9, wherein the search matching module is further configured to:
constructing a text similarity calculation algorithm;
searching a designated database according to the data item name, and performing matching operation on the data item name and field description information of a data table in the database;
if the data item is completely matched with the field description information of the data table in the database and only one data item is matched, the data item and the field description information are in one-to-one correspondence, and the field information corresponding to the field description information is output as matched field information;
if the data item is completely matched with the field description information of the data table in the database and is matched with a plurality of data items, outputting the field information corresponding to the first matched field description information as matched field information by using the first matched corresponding relation as the data item; when a plurality of field description information are matched, carrying out special identification on the output jqGrid table code;
if the data item is not completely matched with the field description information of the data table in the database, performing character string similarity matching operation on the name of the data item and the field description information of the data table in the database by using a text similarity calculation algorithm, selecting the field information corresponding to the field description information with the highest similarity, and outputting the field information as matched field information; and when the matched field information is obtained through the character string similarity matching operation, carrying out special identification on the output jqGrid table code.
11. The apparatus of claim 10, wherein the search matching module is further configured to construct the text similarity calculation algorithm as follows:
similarity is the number of characters of the data item which is identical with the number of characters of the field description information/the number of characters of the field description information.
12. The apparatus of claim 8, wherein the jqGrid table shows an item code determination module specifically to:
extracting field names from the matched field information;
converting the field name into a hump naming mode;
determining a display item code of the jqGrid table according to the field name of the hump naming mode and the display type of the data item in the jqGrid table; the display type of the data item in the jqGrid table comprises the following steps: plain text, a money type supporting formatting, a date type supporting formatting, a drop-down box type, a floating point type decimal type supporting formatting, and an account number type.
13. The apparatus of claim 12, wherein the jqGrid table shows an item code determination module further to:
converting all field names into lower case letters; wherein, the small letter contains the preset character;
converting a first letter after a character is preset in the lower case letters into an upper case letter;
converting the first letter into a lower case letter;
deleting the preset character and outputting the field name of the hump naming mode.
14. The apparatus of claim 8, wherein the jqGrid table code determination module is specifically configured to:
generating jqGrid table configuration information codes including table names, table titles, whether to support addition or deletion and whether to support Excel import according to the content designated by a user or adopting default configuration; if the Excel import is supported, generating a corresponding import template, and if the double-click event response is supported, generating a corresponding empty function;
and integrating and formatting the jqGrid table display item code and the jqGrid table configuration information code, and outputting the jqGrid table code.
15. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of any of claims 1 to 7 when executing the computer program.
16. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program for executing a method according to any one of claims 1 to 7.
CN202111016192.1A 2021-08-31 2021-08-31 jqGrid table code generation method and device Pending CN113641680A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111016192.1A CN113641680A (en) 2021-08-31 2021-08-31 jqGrid table code generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111016192.1A CN113641680A (en) 2021-08-31 2021-08-31 jqGrid table code generation method and device

Publications (1)

Publication Number Publication Date
CN113641680A true CN113641680A (en) 2021-11-12

Family

ID=78424650

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111016192.1A Pending CN113641680A (en) 2021-08-31 2021-08-31 jqGrid table code generation method and device

Country Status (1)

Country Link
CN (1) CN113641680A (en)

Similar Documents

Publication Publication Date Title
US8959122B2 (en) Data processing device
US8190613B2 (en) System, method and program for creating index for database
CN115061721A (en) Report generation method and device, computer equipment and storage medium
CN111160045B (en) Game resource file translation method, device and equipment
CN100550020C (en) A kind of method and apparatus that is used to solve the Chinese software issue of supporting multilanguage
CN106776495B (en) Document logic structure reconstruction method
US8965797B2 (en) Explosions of bill-of-materials lists
CN111191429A (en) System and method for automatic filling of data table
CN111984745A (en) Dynamic expansion method, device, equipment and storage medium for database field
CN111753536A (en) Automatic patent application text writing method and device
CN113641680A (en) jqGrid table code generation method and device
CN114676155A (en) Code prompt information determining method, data set determining method and electronic equipment
CN114911751A (en) Method, device and equipment for building coal preparation plant management platform and readable storage medium
CN115114297A (en) Data lightweight storage and search method and device, electronic equipment and storage medium
CN114691643A (en) Data migration method and system applied to domestic substitution
CN115168623A (en) Full-text retrieval method and system for water conservancy industry standard
CN111273913B (en) Method and device for outputting application program interface data represented by specifications
CN112214494A (en) Retrieval method and device
CN112559550A (en) Multi-data-source NL2SQL system based on semantic rules and multi-dimensional model
CN114116877B (en) Data conversion method, device, computer equipment and medium
CN110232102B (en) Personnel relation model modeling method based on transfer learning
CN113656443B (en) Data disassembling method and device, electronic equipment and storage medium
CN115455035B (en) Data query model construction method and computer-readable storage medium
US11526336B2 (en) Community-oriented, cloud-based digital annealing platform
WO2021084807A1 (en) Information-providing system

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