Form import method, system, device and medium based on dynamic template mapping
By adopting dynamic template mapping technology on low-code platforms, dynamic form data is analyzed and mapping relationship between import templates and database table fields is established, and Excel import templates are dynamically generated, which solves the problems of low-code platforms' low-code platforms' low-code platforms' low-quality dynamic form data import efficiency and poor flexibility, and achieves efficient and flexible data import and adaptability enhancement.
Patent Information
- Application Number
- CN202411970225.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-04
AI Technical Summary
The dynamic forms of low-code platforms are inefficient and have poor flexibility during the data import process, and cannot effectively deal with the frequent changes in form fields, resulting in low data import efficiency and insufficient system flexibility.
The form import method based on dynamic template mapping is adopted to create a form field database by analyzing dynamic form data, and a dynamic template mapping technology is used to establish a one-to-one mapping relationship between the import template and the database table field, and dynamically generate Excel import templates to realize dynamic analysis of templates, automatic field matching, and automatic data type conversion.
It significantly improves the data import efficiency, flexibility, and adaptability of dynamic forms of low-code platforms, and can meet various low-code dynamic forms data import needs without changing back-end code.
Smart Images

Figure CN119761324A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a form import method, system, device and medium based on dynamic template mapping. Background Art
[0002] With the acceleration of digital transformation of enterprises, forms are important tools for information collection and processing in enterprise applications. Traditional form development has problems such as long cycle and poor flexibility, which makes it difficult to meet the rapidly changing needs of enterprises. Low-code platform dynamic form technology came into being, which enables rapid customization and flexible adjustment of forms through configuration rather than coding. However, the demand for data import cannot be met only through system entry. In the dynamic form of the low-code platform, the Excel data import function is implemented. Because the dynamic form often changes, the Excel import template needs to be redesigned according to the changes. Developers also need to write special code to handle different Excel template files, and the data import efficiency is low and the flexibility is poor. In other words, there is an urgent need for a method to improve the data import efficiency and flexibility of the dynamic form of the low-code platform and the adaptability of the low-code platform, so as to meet various low-code dynamic form data import needs. Summary of the invention
[0003] The purpose of this application is to provide a form import method, system, device and medium based on dynamic template mapping, which can improve the data import efficiency, flexibility and adaptability of the dynamic form of the low-code platform.
[0004] This application is implemented as follows:
[0005] In a first aspect, the present application provides a form import method based on dynamic template mapping, comprising the following steps:
[0006] Acquire dynamic form data, where the dynamic form data is a form created by a user using a dynamic form design tool of a low-code platform; create a form field database and an application model based on the dynamic form data, and generate a mapping relationship of an Excel import template based on the form field database and the application model; wherein the mapping relationship of the Excel import template is dynamically updated in response to changes in the dynamic form field data; dynamically generate an Excel import template based on the mapping relationship of the Excel import template; and use the low-code platform to read the user's form configuration information for the Excel import template to obtain a corresponding form.
[0007] In some implementations, the dynamic form data includes a form name, a form code, fields in the form, field descriptions, data types, and validation rules.
[0008] In some implementations, the dynamic form data is stored in a database table in JSON format; creating a form field database based on the dynamic form data includes: parsing the dynamic form data in JSON format, extracting corresponding field information, and dynamically constructing an SQL table creation statement that complies with database specifications based on the field information, so as to execute the SQL table creation statement in the database to create a form field database table after receiving a creation operation instruction.
[0009] In some implementations, dynamically generating an Excel import template based on a mapping relationship of the Excel import template includes: parsing the field names of the form field database and the attributes in the application model, determining that the columns in the Excel import template correspond one-to-one with the fields in the database table or the application model, and analyzing the matching of the data types of each Excel column with the data types in the database table or the application model to determine that correct conversion can be achieved during the dynamic generation of the Excel import template.
[0010] In some implementations, dynamically generating an Excel import template also includes converting null values in Excel to specific default values, and using a primary key automatically generated by a database to uniquely identify each row of data in a form field database or an application model.
[0011] In some implementations, the use of the low-code platform to read the user's form configuration information for the Excel import template includes: providing the dynamically generated Excel import template for the user to download and add data before importing it into the low-code platform, thereby using the low-code platform to read the corresponding form configuration information from the Excel import template after the user adds data.
[0012] In some implementations, the use of a low-code platform to read the user's form configuration information for the Excel import template to obtain a corresponding form includes: using a low-code platform to read the user's form configuration information for the Excel import template, and using the mapping relationship of the Excel import template to identify the table header, data type and format, verifying whether the data type in Excel is mapped one-to-one with the field in the database or application model and the type matches, saving the verified data to a database table to obtain a corresponding form, and recording error information for the data that failed the verification and feeding it back to the user.
[0013] In a second aspect, the present application provides a form import system based on dynamic template mapping, which includes:
[0014] A data acquisition module is used to acquire dynamic form data, which is a form created by a user using the dynamic form design tool of the low-code platform. A data parsing module is used to create a form field database and an application model based on the dynamic form data, and to generate a mapping relationship of an Excel import template based on the form field database and the application model; wherein the mapping relationship of the Excel import template is dynamically updated in response to changes in the dynamic form field data. A template generation module is used to dynamically generate an Excel import template based on the mapping relationship of the Excel import template. A form generation module is used to use the low-code platform to read the user's form configuration information for the Excel import template to obtain the corresponding form.
[0015] In a third aspect, the present application provides an electronic device, comprising a memory for storing one or more programs; a processor; when the one or more programs are executed by the processor, a method as described in any one of the first aspects is implemented.
[0016] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method as described in any one of the above-mentioned first aspects.
[0017] Compared with the prior art, the present invention has at least the following advantages or beneficial effects:
[0018] This application proposes a form import method based on dynamic template mapping, which creates a form field database by parsing dynamic form data, and uses dynamic template mapping technology to establish a one-to-one mapping relationship between the import template and the database table field. When the dynamic form re-deletes or modifies the fields, the mapping relationship of the generated Excel import template is dynamically changed to achieve dynamic parsing of the template, automatic matching of fields, automatic conversion of data types, and automatic regeneration of the Excel import template. There is no need to change the back-end code. Users only need to fill in the data using the newly generated Excel import template and import it into the newly generated dynamic form. This significantly improves the data import efficiency, flexibility and adaptability of the low-code platform dynamic form, and can meet various low-code dynamic form data import needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1A flowchart of an embodiment of a form import method based on dynamic template mapping of the present application;
[0021] Figure 2 A flowchart of another embodiment of a form import method based on dynamic template mapping of the present application;
[0022] Figure 3 This is a structural diagram of an embodiment of a form import system based on dynamic template mapping of the present application;
[0023] Figure 4 A structural block diagram of an electronic device provided in an embodiment of the present application.
[0024] Icon: 201, processor; 202, memory; 203, communication interface. DETAILED DESCRIPTION
[0025] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.
[0026] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0027] Example 1
[0028] The current form import method of some low-code platforms is based on the low-code platform, which manages the import fields corresponding to the document entry data to be imported through separate front-end scripts and configuration information, and edits the imported Excel template according to these import fields. During the import process, the system imports data according to the front-end script, configuration information, and import template. However, when the dynamic form fields change, the front-end script, configuration information, and Excel import template need to be modified to complete the new form import. This method will result in low data import efficiency and low flexibility.
[0029] In addition, there are some methods of importing forms. By establishing a data import configuration unit module, the disease-specific data in different formats are converted into a unified JSON format, and the import content and the number of header rows are defined, and the import form function is specified. The system will parse the header fields of the imported form, generate a unique identifier based on the form header structure, and associate it with the previously configured form data structure to ensure the relevance and consistency of the data. However, when the dynamic form fields change, the dynamic title fields in the data import configuration unit module and the Excel import template header fields need to be modified synchronously, which has a low degree of automation and insufficient flexibility.
[0030] In the above two existing technologies, when the dynamic form fields change, the front-end script, configuration information, import template or data import configuration unit module needs to be modified, resulting in limited flexibility. Since the configuration information and template need to be manually modified, the efficiency of data import is low and cannot meet the rapidly changing enterprise needs.
[0031] In response to the above problems, an embodiment of the present application provides a form import method based on dynamic template mapping, which can improve the data import efficiency and flexibility of the dynamic form of the low-code platform and the adaptability of the low-code platform.
[0032] See also Figure 1 The form import method based on dynamic template mapping includes the following steps:
[0033] Step S101: Acquire dynamic form data, where the dynamic form data is a form created by a user using a dynamic form design tool of a low-code platform;
[0034] It should be noted that in order to meet specific business needs, users can use the dynamic form design tool of the low-code platform to create a form. The dynamic form data includes the form name, form code, fields in the form, field description, data type and validation rules. The form name, form code and field description need to be filled in and set by the user. The user can specify the appropriate data type for each field in the form based on the built-in data type options provided by the low-code platform. The field attribute information, validation rules, etc. in the table will be automatically generated according to the data type selected by the user.
[0035] For example, the created dynamic form structure data can be saved in the database table form_table, which mainly includes name, code, form_config, and category_code fields. The name field stores the table structure name, the code field stores the table structure code, a globally unique attribute, and category_code is the form group code. Form_config mainly stores detailed information on the form field structure saved in JSON format.
[0036] In the above steps, the efficiency and flexibility of form creation are improved by allowing users to flexibly design forms according to actual needs without relying on developers to write code.
[0037] Step S102: creating a form field database and an application model according to the dynamic form data, and generating a mapping relationship of an Excel import template according to the form field database and the application model; wherein the mapping relationship of the Excel import template is dynamically updated in response to changes in the dynamic form field data;
[0038] It should be noted that after obtaining the dynamic form data, you first need to create a form field database based on this data to store the information of each field in the form (such as field name, data type, whether it is required, etc.). Next, you need to establish an application model that describes the structure and business logic of the form data. Based on the form field database and the application model, the system generates a mapping relationship for the Excel import template. This mapping relationship defines how the columns in the Excel file correspond to the fields in the form. Importantly, this mapping relationship is dynamic and can be automatically updated in response to changes in the dynamic form field data.
[0039] By creating a form field database and application model, the system can accurately understand the structure and business logic of the form. The introduction of dynamic mapping relationships enables the system to flexibly respond to changes in form fields without manually adjusting the Excel import template, which improves the flexibility and efficiency of data import.
[0040] Exemplarily, creating a form field database based on the dynamic form data obtained in step S101 and establishing an application model include: using the code in the form_table table as the table name to ensure that the database table of each form is unique, parsing the JSON format form configuration information stored in form_config, which describes in detail the various fields of the form, including field name, data type, length, whether it is allowed to be empty, and other attributes. By parsing the JSON data, extracting the necessary field information, and dynamically constructing an SQL table creation statement that complies with the database specification based on this information, when receiving the creation operation instruction, the system will execute the previously generated SQL table creation statement to dynamically create a form field table in the database. This process is automated, reducing the tedious work of manually creating database tables, while also ensuring the accuracy and consistency of the table structure.
[0041] Step S103: dynamically generate an Excel import template according to the mapping relationship of the Excel import template;
[0042] It should be noted that after the mapping relationship of the Excel import template is established, the Excel import template will be automatically generated according to this mapping relationship. This template contains the column headers corresponding to the form fields. Users only need to fill in the data according to the template and then import it into the system. The dynamically generated Excel import template fully matches the current form fields, avoiding import errors caused by field mismatches. At the same time, since the template is automatically generated, no manual design is required, saving time and cost.
[0043] For example, the form field, database table field name and application model attributes can be parsed to determine the one-to-one correspondence between the columns in the Excel import template and the fields in the database table or application model. At the same time, the data type of each column in Excel, such as text, number, date, etc., is analyzed to match the data type in the database table or application model to ensure correct conversion during the dynamic mapping process and ensure the consistency of the name and data type. In addition, it is necessary to handle the situation when the null value in Excel is mapped to the database or application model, and convert the null value to a specific default value empty string. At the same time, the primary key automatically generated by the database can be used during the import of the Excel import template to uniquely identify each row of data in the database or application model.
[0044] Step S104: Use the low-code platform to read the user's form configuration information for the Excel import template to obtain the corresponding form.
[0045] It should be noted that after the user imports the completed Excel file into the system, the reading function of the low-code platform can be used to parse the data in the Excel file, and fill these data into the corresponding form fields according to the mapping relationship of the Excel import template. At the same time, other configuration information of the user for the form (such as validation rules, default values, etc.) can also be read to ensure the accuracy and completeness of the data. Through the reading function of the low-code platform, it can automatically parse the data in the Excel file and fill it into the form without human intervention. This not only improves the degree of automation of data import, but also ensures the accuracy and consistency of the data. At the same time, the data can also be verified and processed according to the user's configuration information, further improving the reliability and security of the data.
[0046] Exemplarily, based on steps S101-S103, when the low-code platform creates a dynamic form, it will create the form_table database table and the form database table and application model with the code in the data row in form_table as the table name. When there is an Excel import template creation instruction, a mapping relationship between the database table with code as the table name and the Excel import template will be established, and an Excel import template will be generated. The user downloads the Excel import template, adds the data to be imported, and imports it into the low-code platform. When modifying a dynamic form that has been created, the established database table and application model will be modified at the same time, as well as the mapping relationship between the database table and application model and the Excel import template.
[0047] When the user uses the low-code platform to import data into the created dynamic form list module, first download the Excel import template generated in step S103, add the data to be imported, and import it into the low-code platform. When reading the file, correctly identify the table header, data type, and format through the dynamic template mapping relationship, verify whether the data type in Excel is mapped one-to-one with the field in the database table or application model, whether the type matches, and whether format conversion is required if the verification fails. If the final verification passes, save the data to the database table created in step S102. If the verification does not fail, generate an Excel import template through step S103 and record the error data, add an error message description and feedback to the user, and the user can upload it again after modification.
[0048] In summary, in the prior art, due to the frequent changes in dynamic form fields, it is necessary to frequently redesign the Excel import template and write special codes to handle different templates, which not only leads to low data import efficiency but also limits the flexibility of the system. The technical solution of the above embodiment effectively solves this problem by introducing a dynamic template mapping mechanism.
[0049] Specifically, in the above embodiment, a form field database is created by parsing the dynamic form data, and a one-to-one mapping relationship between the import template and the database table field is established using dynamic template mapping technology. When the dynamic form deletes or modifies the fields again, the mapping relationship of the generated Excel import template is dynamically changed to achieve dynamic parsing of the template, automatic matching of fields, automatic conversion of data types, and automatic regeneration of the Excel import template. There is no need to change the back-end code. Users only need to fill in the data using the newly generated Excel import template and import it into the newly generated dynamic form. This method significantly improves the data import efficiency, flexibility and adaptability of the low-code platform dynamic form, and can meet various low-code dynamic form data import needs.
[0050] Based on the aforementioned scheme, in some implementations of the present application, the dynamic form data is stored in a database table in JSON format; creating a form field database based on the dynamic form data includes: parsing the dynamic form data in JSON format, extracting corresponding field information, and dynamically constructing an SQL table creation statement that complies with database specifications based on the field information, so as to execute the SQL table creation statement in the database to create a form field database table after receiving a creation operation instruction.
[0051] It should be noted that by using JSON format to store dynamic form data, the form structure can be changed flexibly without the need to define a fixed database table structure in advance. This provides users with greater freedom and allows them to adjust form fields at any time according to business needs. And by parsing JSON data and dynamically building SQL table creation statements, the system can automatically complete the creation of database tables without manually writing SQL statements or adjusting database table structures. This reduces development costs and improves work efficiency. Therefore, by adopting this method of dynamically creating database tables, the system can easily cope with frequent changes in form fields. When form fields change, the system only needs to re-parse JSON data and generate new SQL table creation statements, without the need for complex modifications or reconstruction of existing database tables. This enhances the scalability and maintainability of the system.
[0052] Exemplarily, when a form field database needs to be created, the JSON format dynamic form data stored in the database table can be read first. Then, the JSON data is parsed using a JSON parser (such as JavaScript's JSON.parse() method or Python's json.loads() function, etc.) to extract detailed information of each field in the form, such as field name, data type, whether it is required, default value, etc. After the field information is extracted, an SQL table creation statement that conforms to the database specification can be dynamically constructed based on this information. In this process, the specific syntax and constraints of the database (such as primary key, foreign key, uniqueness constraint, etc.) need to be considered to ensure that the generated SQL statement can be successfully executed in the database. At the same time, it is also necessary to process the conversion of the field data type, and convert the field data type defined in JSON to the data type supported by the database. Finally, after the SQL table creation statement is constructed, the system will wait to receive a creation operation instruction. Once the instruction is received, the system will execute the SQL statement in the database to create a database table that matches the current dynamic form field. This table will be used to store the detailed information of the form field to provide support for subsequent data import and processing.
[0053] Based on the aforementioned scheme, in some implementations of the present application, the Excel import template is dynamically generated according to the mapping relationship of the Excel import template, including: parsing the field names of the form field database and the attributes in the application model, determining that the columns in the Excel import template correspond one-to-one with the fields in the database table or the application model, and analyzing the matching of the data types of each Excel column with the data types in the database table or the application model to determine that correct conversion can be achieved during the dynamic generation of the Excel import template.
[0054] It should be noted that in the above implementation, the field names of the form field database need to be parsed first. These field names represent the fields in the form created by the user through the low-code platform. At the same time, the attributes in the application model need to be parsed, which describe the business logic and constraints of the form fields. Then, based on the parsed field names and application model attributes, the correspondence between the columns in the Excel import template and the fields in the database table or application model can be determined. This step is the key to dynamically generating Excel import templates, which ensures that the data in the Excel file can be accurately mapped to the corresponding fields in the database table or application model. Then, after determining the correspondence, the data types of each Excel column and the data types in the database table or application model will be further analyzed. Because the conversion between different data types may cause data loss or errors, this step will ensure that the conversion between these data types can be correctly handled when the Excel import template is dynamically generated. Finally, after completing the above steps, the Excel import template can be dynamically generated based on the parsed field names, application model attributes, and data type matching. This template contains the column headers corresponding to the database table or application model fields, as well as possible data type conversion prompts or validation rules. Users only need to fill in the data according to the template format and then import it into the system.
[0055] That is to say, in the above implementation, by determining the correspondence between the columns of the Excel import template and the database table or application model fields, and analyzing the matching of the data types, the accuracy of the data can be ensured during the data import process. This reduces the risk of data errors and improves the reliability of data import. In addition, the dynamically generated Excel import template provides users with a clear filling guide, allowing users to easily import data into the system. At the same time, data type conversion prompts or verification rules can also be provided according to the data type matching situation, further reducing the user's difficulty of use. In addition, since the Excel import template is dynamically generated, it can easily cope with the frequent changes of form fields. When the form field changes, it only needs to re-parse the form field database and application model, and generate a new Excel import template. This enhances the flexibility and adaptability of the system implemented by this method.
[0056] Based on the aforementioned scheme, in some implementations of the present application, dynamically generating an Excel import template also includes converting empty values in Excel into specific default values, and using the primary key automatically generated by the database to uniquely identify each row of data in the form field database or application model.
[0057] It should be noted that by converting null values in Excel to specific default values, the system can ensure that the data will not be incomplete or incorrect due to null values when importing data. This improves the success rate of data import and reduces the risk of data errors. At the same time, the primary key automatically generated by the database is used to uniquely identify each row of data, ensuring the consistency and uniqueness of the data in the form field database or application model. This helps avoid data duplication or conflicts and maintains data integrity.
[0058] Based on the aforementioned scheme, in some implementation methods of the present application, the low-code platform is used to read the user's form configuration information for the Excel import template, including: providing the dynamically generated Excel import template for the user to download and add data before importing it into the low-code platform, thereby using the low-code platform to read the corresponding form configuration information from the Excel import template after the user adds data.
[0059] It should be noted that by providing dynamically generated Excel import templates for users to download and fill in data, and then import them into the low-code platform, users can interact with the system in a more intuitive and convenient way. This reduces the user's learning cost and improves the ease of use of the system. In addition, since the Excel import template is dynamically generated, the system can easily cope with frequent changes in form fields. When form fields change, the system only needs to regenerate the template without complex modifications or reconstruction of existing processes.
[0060] For example, the column headers and filling instructions in the Excel import template can be used to allow users to fill in data more accurately. At the same time, the low-code platform will also perform data verification when reading data, further ensuring the accuracy of the data.
[0061] Based on the aforementioned scheme, in some implementation methods of the present application, the low-code platform is used to read the user's form configuration information for the Excel import template to obtain the corresponding form, including: using the low-code platform to read the user's form configuration information for the Excel import template, and using the mapping relationship of the Excel import template to identify the table header, data type and format, verifying whether the data type in Excel is mapped one-to-one with the field in the database or application model and the type matches, saving the verified data to the database table to obtain the corresponding form, recording the error information of the data that failed the verification and feeding it back to the user.
[0062] It should be noted that, through the data validation process in the above implementation, it can be ensured that the data in Excel is mapped one by one with the fields in the database table or application model and the types match, thereby improving the accuracy of the data. In addition, since the validation process is based on the mapping relationship of the Excel import template, when the form field changes, only the template and mapping relationship need to be updated, without the need for complex modifications to the validation logic.
[0063] In order to enable those skilled in the art to understand the present application more intuitively, a specific example will be used here to illustrate.
[0064] like Figure 2 As shown, in this example, the form import method based on dynamic template mapping includes:
[0065] Step 1: Design dynamic forms in the low-code platform to complete the creation of low-code dynamic form database tables and application models.
[0066] The staff logs in to the low-code platform and designs the form structure by dragging and dropping on the dynamic form module design page. The form structure information is stored in the form_table database table. The formConfig in the form structure information records the basic information of the form structure, where widgetList is the specific detailed information of the form structure field. In form_table, code is the form code, and name is the form name. Use the code in form_table as the database table name, and the information in the widgetList array in formConfig as the designed dynamic form field information to create a form field database table and establish an application model. The data type of widgetList in formConfig is an array, and each piece of data records the detailed information of the form field. The main attribute information includes type, label, name, defaultValue, size, required, format, valueFormat, optionItems, etc. The value of type can be radio, checkbox, input, textarea, number, select, time, timerange, date, daterange, switch, rate, slider, etc. to identify the control type of the form. The specific identifiers are as follows:
[0067] radio indicates a single option, checkbox indicates multiple options, input indicates single-line input, textarea indicates multi-line input, number indicates a number, select indicates a drop-down selection, time indicates a time format, timerange indicates a time range selection, date indicates a date selection, daterange indicates a date range selection, switch indicates a switch button, rate indicates a rating, and slider indicates a slider.
[0068] The label of the field in the database table is the Chinese description of the table field, name is the database table field, defaultValue is the default value, and type is the data type. When the type value is radio, number, select, switch, rate, or slider, the database field is set to int type; when type is checkbox or input, the database field is set to VARCHAR type; when type is textarea, the database field is set to TEXT type; when type is time or timerange, the database field is of TIME type; when type is date or daterange, the database field is of DATETIME type.
[0069] Step 2: Establish a mapping relationship between the dynamic form database and application model and the Excel import template, and dynamically generate the Excel import template.
[0070] In step one, the creation of the form field database table and the application model has been completed. Then, the mapping relationship between the form field database table and the application model and the imported Excel template is established, and the Excel import template is dynamically generated after the form field database is changed. The mapping relationship between the application model and the dynamic Excel import template is as follows:.
[0071] In the database table, label is the title name of the Excel import template. The data cell data validity is set according to the type in the database table. When type is equal to radio, select, switch, the exported Excel template is a drop-down option, where optionItems is the selectable data. When type is checkbox, the Excel header performs aggregation operations, each column is a drop-down selection, and optionItems is the selectable content. When type is switch, the data is a drop-down selection, defaultValue is the default value, false is off, and true is on. When type is rate, it is a score, the Excel cell is a drop-down selection, max is the maximum score value, and the drop-down selected value is 1 to the maximum value. When type is slider, the Excel cell is a drop-down selection, min is the minimum value, max is the maximum value, and step is the interval between two adjacent values. When type is number, the Excel cell sets the digital validity and can only enter numbers. When type is time, timerange, date, daterange and other time formats, format is the time format, and sample content is set in the Excel cell according to format to prompt users how to fill in.
[0072] The following is an example of type radio:
[0073] {"key":93683,"type":"radio",
[0074] "options":{
[0075] "name":"radio59992","label":"Gender",
[0076]
[0077] Step 3: Upload template data files to the low-code platform
[0078] 1. The staff logs in to the low-code platform, selects the corresponding form information generated by the designed dynamic form in the data management module, clicks Import, and a prompt to download the template and upload the file pops up. The template is the Excel import template generated in step 2. Download the template according to the prompts.
[0079] 2. After filling in the content in the template, select the corresponding form information through the data management module, click Import, and a prompt for downloading the template and uploading will pop up. Click Upload File according to the prompt, select the file to be uploaded and click OK. The file will be uploaded to the server.
[0080] Step 4: Check the legality of the imported data and whether the field mapping is correct. Save the correct data to the database and feedback the incorrect data to the user.
[0081] 1. Get the Excel stream and parse the data into List <HashMap<String,List <string>>>Format and name it fileDateList, where List, HashMap, and String are programming terms and a data format in Java programming. In HashMap, the key stores the title name and the value stores the data content.
[0082] 2. Parse the template format into List <formdatainfo>format and named formDateList, where FormDataInfo is a custom dynamic template mapping data format, and contains the following content:
[0083] name, type, label, optionItems, format, valueFormat, required, min, max. FormDataInfo corresponds to the table information structure data one by one.
[0084] 3. Create two Lists <HashMap<String,Object> >Format variables, named successList and errorList, where successList stores correct data and errorList stores error data.
[0085] 4. Compare fileDateList and formDateList and convert the data into List <HashMap<String,Object> >Format data. We record a data item in fileDateList as d, and a data item in formDateList as f. If the key value of d is equal to the label value of f, a new HashMap is created, whose key is the name of f and value is the value of d.
[0086] 5. Determine the validity of the data based on the type, format, valueFormat, optionItems, size, max, and min information in f. If the data meets the requirements, it is stored in successList, otherwise it is stored in errorList. The data in successList is saved to the database, and the data in errorList is fed back to the user.
[0087] The steps to determine whether the information is valid are as follows:
[0088] 1. When type is input or textarea, determine the content length based on size.
[0089] 2. When type is equal to radio, select, or switch, traverse the data in optionItems and record each data in optionItems as p. When the value of d is the same as the label in p, convert the value of d to the value in p.
[0090] 3. When type is equal to checkbox, first perform duplicate elimination, traverse the data in optionItems, and record each data in optionItems as p. When the value of d is the same as the label in p, convert the value content of d to the value in p.
[0091] 4. When the type value is switch, the content is converted to 1 when the content is on, and converted to 0 when the content is off.
[0092] 5. When the type value is rate, determine whether the content is a positive integer between 1 and max.
[0093] 6. When the type value is equal to slider, determine whether the content is an integer number between min and max.
[0094] Calculate the number set according to step and compare whether the number is the value in the set.
[0095] 7. When type is number, determine whether the content is a number and the size is between min and max.
[0096] 8. When type is time, timerange, date, or daterange, determine whether the format meets the requirements based on format. If it meets the requirements, compare format with valueFormat to see if they are consistent. If not, convert the content to data in valueFormat format.
[0097] Example 2
[0098] See also Figure 3 , the embodiment of the present application provides a form import system based on dynamic template mapping, which includes:
[0099] A data acquisition module is used to acquire dynamic form data, which is a form created by a user using the dynamic form design tool of the low-code platform. A data parsing module is used to create a form field database and an application model based on the dynamic form data, and to generate a mapping relationship of an Excel import template based on the form field database and the application model; wherein the mapping relationship of the Excel import template is dynamically updated in response to changes in the dynamic form field data. A template generation module is used to dynamically generate an Excel import template based on the mapping relationship of the Excel import template. A form generation module is used to use the low-code platform to read the user's form configuration information for the Excel import template to obtain the corresponding form.
[0100] For the specific implementation process of the above system, please refer to the form import method based on dynamic template mapping provided in Example 1, which will not be repeated here.
[0101] Example 3
[0102] See also Figure 4 , the embodiment of the present application provides an electronic device, which includes at least one processor 201 and at least one memory 202; wherein the processor 201 and the memory 202 are directly connected to each other, or communicate with each other through a communication interface 203, or are electrically connected through one or more communication buses or signal lines to achieve data transmission or interaction; the memory 202 stores program instructions that can be executed by the processor 201, and the processor 201 calls the program instructions to execute a form import method based on dynamic template mapping. For example, the following is implemented:
[0103] Get dynamic form data, which is a form created by the user using the dynamic form design tool of the low-code platform. Create a form field database and an application model based on the dynamic form data, and generate a mapping relationship of the Excel import template based on the form field database and the application model; wherein the mapping relationship of the Excel import template is dynamically updated in response to changes in the dynamic form field data. Dynamically generate an Excel import template based on the mapping relationship of the Excel import template. Use the low-code platform to read the user's form configuration information for the Excel import template to obtain the corresponding form.
[0104] Among them, the memory 202 can be, but is not limited to, a random access memory (Random Access Memory, RAM), a read only memory (Read Only Memory, ROM), a programmable read-only memory (Programmable Read-Only Memory, PROM), an erasable programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM), an electrically erasable read-only memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc.
[0105] The processor 201 may be an integrated circuit chip with signal processing capability. The processor 201 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0106] Understandably, Figure 4 The structure shown is for illustration only. The electronic device may also include Figure 4 More or fewer components as shown, or with Figure 4 Different configurations shown. Figure 4 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0107] Example 4
[0108] The present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by the processor 201, a form import method based on dynamic template mapping is implemented. For example, the following is implemented:
[0109] Get dynamic form data, which is a form created by the user using the dynamic form design tool of the low-code platform. Create a form field database and an application model based on the dynamic form data, and generate a mapping relationship of the Excel import template based on the form field database and the application model; wherein the mapping relationship of the Excel import template is dynamically updated in response to changes in the dynamic form field data. Dynamically generate an Excel import template based on the mapping relationship of the Excel import template. Use the low-code platform to read the user's form configuration information for the Excel import template to obtain the corresponding form.
[0110] If the above functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0111] It will be apparent to those skilled in the art that the present application is not limited to the details of the exemplary embodiments described above, and that the present application can be implemented in other specific forms without departing from the spirit or essential features of the present application. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the present application is defined by the appended claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims be included in the present application. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.< / formdatainfo> < / string>
Claims
1. A form import method based on dynamic template mapping, characterized in that: The following steps are involved: Acquire dynamic form data, where the dynamic form data is a form created by a user using a dynamic form design tool of a low-code platform; Creating a form field database and an application model according to the dynamic form data, and generating a mapping relationship of an Excel import template according to the form field database and the application model; wherein the mapping relationship of the Excel import template is dynamically updated in response to changes in the dynamic form field data; Dynamically generate Excel import templates based on the mapping relationship of Excel import templates; The low-code platform is used to read the user's form configuration information for the Excel import template to obtain the corresponding form.
2. The method according to claim 1, characterized in that The dynamic form data includes form name, form code, fields in the form, field description, data type and validation rules.
3. The method according to claim 1, characterized in that: The dynamic form data is stored in a database table in JSON format; The creating a form field database according to the dynamic form data includes: parsing the dynamic form data in JSON format, extracting corresponding field information, and dynamically constructing an SQL table creation statement that complies with database specifications according to the field information, so as to execute the SQL table creation statement in the database to create a form field database table after receiving a creation operation instruction.
4. The method according to claim 1, characterized in that The method of dynamically generating an Excel import template according to the mapping relationship of the Excel import template includes: Parse the field names of the form field database and the attributes in the application model, determine the one-to-one correspondence between the columns in the Excel import template and the fields in the database table or application model, and analyze the matching of the data types of each Excel column with the data types in the database table or application model to ensure correct conversion during the dynamic generation of the Excel import template.
5. The method according to claim 4, characterized in that When dynamically generating an Excel import template, it also includes converting null values in Excel to specific default values, and using the primary key automatically generated by the database to uniquely identify each row of data in the form field database or application model.
6. The method according to claim 1, characterized in that The method of using the low-code platform to read the user's form configuration information for the Excel import template includes: The dynamically generated Excel import template is provided for users to download and import into the low-code platform after adding data, so that the low-code platform can read the corresponding form configuration information from the Excel import template after the user adds data.
7. The method according to claim 1, characterized in that The low-code platform is used to read the user's form configuration information for the Excel import template to obtain a corresponding form, including: Use the low-code platform to read the user's form configuration information for the Excel import template, and use the mapping relationship of the Excel import template to identify the table header, data type and format, verify whether the data type in Excel is mapped one by one to the field in the database or application model and the type matches, save the verified data to the database table, obtain the corresponding form, record the error information of the data that failed the verification and feedback it to the user.
8. A form import system based on dynamic template mapping, characterized in that: include: A data acquisition module, used to acquire dynamic form data, where the dynamic form data is a form created by a user using a dynamic form design tool of a low-code platform; A data parsing module, used to create a form field database and an application model according to the dynamic form data, and to generate a mapping relationship of an Excel import template according to the form field database and the application model; wherein the mapping relationship of the Excel import template is dynamically updated in response to changes in the dynamic form field data; The template generation module is used to dynamically generate the Excel import template according to the mapping relationship of the Excel import template; The form generation module is used to use the low-code platform to read the user's form configuration information for the Excel import template to obtain the corresponding form.
9. An electronic device, characterized in that: include: A memory for storing one or more programs; processor; When the one or more programs are executed by the processor, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
ANSI C12.19-based multimode data storage, configuration and read-write method
CN120234327A
Method for realizing form printing based on low-code platform
CN120540611A
Business index data storage method and system and readable storage medium
CN121705283A
Business index data storage method and system, readable storage medium
CN121705283B