A data import method, device and system

CN116383221BActive Publication Date: 2026-09-25BAIRONG ZHIXIN (BEIJING) TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310272899.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-20
Publication Date
2026-09-25
Estimated Expiration
2043-03-20

AI Technical Summary

Technical Problem

[0003]目前,现有技术中的数据导入方式一般是采用模板导入,即将数据输入模板中,再基于带有数据的模板上传至服务端,以将数据导入数据库中,然而,上述方式中的模板固定,无法扩展,尤其是在有新增列头数据时,都需要对数据库中的实体类进行二次开发上线,导致数据导入的灵活性较差,从而影响数据的导入效率,无法快速的响应客户需求

Benefits of technology

[0027]借由上述技术方案,本发明提供的一种数据导入方法、装置及系统,是在需要对数据进行导入时,首先基于模板配置页面中的目标列头数据生成目标导入模板,其中,目标列头数据为模板配置页面中被选定的全部或部分指定列头数据,指定列头数据对应于数据库中的已有列头数据,然后在目标导入模板中对目标列头数据对应的行数据进行配置,以获得对应的目标导入文件,最后将目标导入文件上传至服务端,以便服务端解析目标导入文件并利用反射机制动态生成实体类将目标导入文件中的行数据导入数据库中。通过本发明提供的技术方案,能够使得数据导入所采用的模板能够基于在模板配置页面中从指定列头数据被选定的目标列头数据生成,且指定列头数据均为数据库中的已有列头数据,使得配置文件在上传服务端后,服务端能够利用反射机制生成目标列头数据对应的实体类,从而依据实体类与数据库中数据表的导入对应关系将行数据快速、准确的导入数据库中,使得导入模板可灵活配置并扩展,在有新增列头数据时,动态生成实体类,无需对数据库中的实体类进行二次开发上线,有效提升数据导入的灵活性和效率,进而对客户需求实现快速响应。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116383221B_ABST
    Figure CN116383221B_ABST
Patent Text Reader

Abstract

The application discloses a data import method, device and system, relates to the technical field of data processing, and mainly aims at making data import more flexible, improving data import efficiency, and responding to user demand quickly. The main technical scheme of the application is as follows: a target import template is generated based on target column header data in a template configuration page, wherein the target column header data is all or part of specified column header data selected in the template configuration page, and the specified column header data corresponds to existing column header data in a database; row data corresponding to the target column header data is configured in the target import template, so that a corresponding target import file is obtained; and the target import file is uploaded to a server, so that the server analyzes the target import file, dynamically generates an entity class by using a reflection mechanism, and imports the row data in the target import file into the database. The application is used for data import.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a data import method, apparatus and system. Background Technology

[0002] With the rapid development of internet technology, various information systems are increasingly being used in daily work and life, accumulating a large amount of related data. To fully explore the value of this data, it is usually imported into an information system for storage, so that it can be imported into subsequent applications for analysis.

[0003] Currently, the data import method in existing technologies generally uses template import, which involves inputting data into a template and then uploading the template with the data to the server to import the data into the database. However, the templates in the above method are fixed and cannot be extended. Especially when there is new column header data, the entity classes in the database need to be redeveloped and deployed, resulting in poor flexibility in data import, which affects the efficiency of data import and makes it impossible to quickly respond to customer needs. Summary of the Invention

[0004] In view of the above problems, the present invention provides a data import method, apparatus and system, the main purpose of which is to make data import more flexible and improve data import efficiency so as to quickly respond to user needs.

[0005] To solve the above-mentioned technical problems, the present invention proposes the following solution:

[0006] In a first aspect, the present invention provides a data import method applied to a client, the method comprising:

[0007] A target import template is generated based on the target column header data in the template configuration page, wherein the target column header data is all or part of the specified column header data selected in the template configuration page, and the specified column header data corresponds to the existing column header data in the database;

[0008] Configure the row data corresponding to the target column header data in the target import template to obtain the corresponding target import file;

[0009] The target import file is uploaded to the server so that the server can parse the target import file and dynamically generate entity classes using reflection to import the row data in the target import file into the database.

[0010] Secondly, the present invention provides a data import method applied to a server, the method comprising:

[0011] Receive and parse the target import file uploaded by the client to obtain the corresponding target column header data and row data;

[0012] The entity class corresponding to the target column header data is dynamically generated based on the reflection mechanism.

[0013] Construct a mapping relationship between the entity class and the row data, and use the mapping relationship to import the row data into the database accordingly.

[0014] Thirdly, the present invention provides a data import device for use on a client side, the device comprising:

[0015] The first generation unit is used to generate a target import template based on the target column header data in the template configuration page, wherein the target column header data is all or part of the specified column header data selected in the template configuration page, and the specified column header data corresponds to the existing column header data in the database;

[0016] A configuration unit is used to configure the row data corresponding to the target column header data in the target import template obtained by the first generation unit, so as to obtain the corresponding target import file;

[0017] The upload unit is used to upload the target import file obtained by the configuration unit to the server, so that the server can parse the target import file and dynamically generate an entity class using reflection to import the row data in the target import file into the database.

[0018] Fourthly, the present invention provides a data import device for use on a server, the device comprising:

[0019] The first parsing unit is used to receive and parse the target import file uploaded by the client to obtain the corresponding target column header data and row data.

[0020] The third generation unit is used to dynamically generate the entity class corresponding to the target column header data obtained by the first parsing unit based on the reflection mechanism.

[0021] The import unit is used to construct the mapping relationship between the entity class obtained by the third generation unit and the row data, and to import the row data into the database accordingly using the mapping relationship.

[0022] Fifthly, the present invention provides a data import system, including a client and a server.

[0023] When the client imports data, it executes any of the above-described methods for executing client data import.

[0024] When importing data, the server executes any of the above-mentioned data import methods.

[0025] To achieve the above objectives, according to a sixth aspect of the present invention, a storage medium is provided, the storage medium including a stored program, wherein, when the program is executed, the device on which the storage medium is located executes the data import method of the first or second aspect described above.

[0026] To achieve the above objectives, according to a seventh aspect of the present invention, a processor is provided for running a program, wherein the program executes the data import and generation method of the first or second aspect described above.

[0027] By means of the above technical solution, the present invention provides a data import method, apparatus and system, which, when data needs to be imported, firstly generates a target import template based on the target column header data in the template configuration page, wherein the target column header data is all or part of the specified column header data selected in the template configuration page, and the specified column header data corresponds to the existing column header data in the database. Then, the row data corresponding to the target column header data is configured in the target import template to obtain the corresponding target import file. Finally, the target import file is uploaded to the server so that the server can parse the target import file and use the reflection mechanism to dynamically generate entity classes to import the row data in the target import file into the database. The technical solution provided by this invention enables the template used for data import to be generated based on the target column header data selected from the specified column header data in the template configuration page. Since the specified column header data are all existing column header data in the database, after the configuration file is uploaded to the server, the server can use reflection to generate the entity class corresponding to the target column header data. Based on the import correspondence between the entity class and the data table in the database, the row data can be quickly and accurately imported into the database. This allows the import template to be flexibly configured and extended. When new column header data is added, the entity class is dynamically generated without requiring secondary development and deployment of the entity classes in the database, effectively improving the flexibility and efficiency of data import and enabling rapid response to customer needs.

[0028] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0029] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0030] Figure 1 This invention provides a flowchart of a data import method applied to a client, according to an embodiment of the present invention.

[0031] Figure 2 This invention provides a flowchart of a data import method applied to a server, according to an embodiment of the present invention.

[0032] Figure 3 This invention provides a block diagram of a data import device for a client application, according to an embodiment of the present invention.

[0033] Figure 4 This invention provides a block diagram of another data import device for a client application, according to an embodiment of the present invention.

[0034] Figure 5 This diagram illustrates a data import device for a server according to an embodiment of the present invention.

[0035] Figure 6 This invention provides a different block diagram for data import applied to the server side, according to an embodiment of the present invention.

[0036] Figure 7 A block diagram of a data import system provided by an embodiment of the present invention is shown. Detailed Implementation

[0037] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0038] Currently, existing data import methods typically employ template import, where data is input into a template and then uploaded to the server to import the data into the database. However, the templates used in this method are fixed and cannot be extended. Especially when new column header data is added, secondary development and deployment of entity classes in the database are required, resulting in poor data import flexibility and impacting import efficiency, hindering rapid response to customer needs. This invention generates an import template based on the selected target column header data in the template configuration page, where the selected column header data is all existing column header data in the database. After the configuration file is uploaded to the server, the server can use reflection to generate the entity classes corresponding to the target column header data. Based on the import correspondence between the entity classes and the data tables in the database, the row data is quickly and accurately imported into the database. This allows for flexible configuration and extension of the import template, dynamically generating entity classes when new column header data is added, eliminating the need for secondary development and deployment of entity classes in the database. This effectively improves the flexibility and efficiency of data import, enabling rapid response to customer needs.

[0039] Therefore, this invention provides a data import method that makes data import more flexible and improves import efficiency, enabling a faster response to user needs. The specific execution steps are as follows: Figure 1 As shown, this is applied to the client and includes:

[0040] 101. Generate the target import template based on the target column header data in the template configuration page.

[0041] The target column header data refers to all or part of the specified column header data selected in the template configuration page, and the specified column header data corresponds to the existing column header data in the database. It should be noted that in this embodiment, the executing entity is a smart device capable of responding to the client, such as a mobile phone or computer. This embodiment does not limit this. The template configuration page is a page that can be operated by the user, which is generated in advance based on the existing column header data in the corresponding database. That is, there is a one-to-one correspondence between the existing column header data in the database and the specified column header data. It is used to configure the template that the user needs to import data. Specifically, the existing column header data can be used as the selectable specified column header data to generate the template configuration page, and the template configuration page is deployed on the client. However, since the data import situation and requirements are not fixed in the actual environment, there will often be a situation where new data needs to be stored, that is, the need to import and store the row data of newly added column header data. In order to facilitate the user to add column header data in the database on the client, a configurable option to add column header data can be set in the template configuration page, so that the user can add new column header data in advance according to the needs, thereby updating the specified column header data in the template configuration page, so as to meet the user's needs and generate the corresponding import template, that is, the target import template, so as to execute the subsequent step 102.

[0042] Furthermore, to quickly configure an import template that meets the needs of importing new data when there is a need to store new data, thereby improving the efficiency and flexibility of data import, the template configuration page specifically includes an option to add column header data. Before generating the target import template based on the target column header data in the template configuration page, the method further includes: generating a column header addition request based on the configuration operation of the option to add column header data; sending the column header addition request to the server so that the server can parse the column header addition request, add the added column header data in the column header addition request to the database, and update the specified column header data in the template configuration page. The option to add column header data can be a custom output box for writing and adding column header data in the database, or multiple predicted backup column header data can be pre-set for selecting and adding column header data in the database; this embodiment does not limit this. To further meet the needs of data import, functions such as deleting, modifying, and querying specified column header data can also be set in the template configuration page simultaneously.

[0043] 102. Configure the row data corresponding to the target column header data in the target import template to obtain the corresponding target import file.

[0044] It should be noted that in this embodiment, after the target import template is generated, the user can directly download and write row data, or write row data in a dedicated area for displaying the target import template on the template configuration page. This embodiment does not limit this, as long as it can configure the row data corresponding to the target column header data, thereby completing the data of the target import template to generate the target import file.

[0045] 103. Upload the target import file to the server so that the server can parse the target import file and use reflection to dynamically generate entity classes to import the row data in the target import file into the database.

[0046] It should be noted that in this embodiment, the server is the server with the corresponding database deployed. After the target import file is configured, it needs to be uploaded to the server. After obtaining the target import file, the server can parse it to obtain the target column header data and the corresponding row data. Since the target column header data is selected from the specified column header data, and the specified column header data corresponds to the existing column header data of the data table in the database, the server can use the reflection mechanism to dynamically generate the entity class corresponding to the target column header data and build a mapping relationship between the entity class and the row data so as to import the row data corresponding to the target column header data into the database based on the entity class and the mapping relationship.

[0047] Based on the above Figure 1 As can be seen from the implementation method, the data import method provided by this invention first generates a target import template based on the target column header data in the template configuration page when data needs to be imported. The target column header data is all or part of the specified column header data selected in the template configuration page, and the specified column header data corresponds to the existing column header data in the database. Then, the row data corresponding to the target column header data is configured in the target import template to obtain the corresponding target import file. Finally, the target import file is uploaded to the server so that the server can parse the target import file and use the reflection mechanism to dynamically generate entity classes to import the row data in the target import file into the database. The technical solution provided by this invention enables the template used for data import to be generated based on the target column header data selected from the specified column header data in the template configuration page. Since the specified column header data are all existing column header data in the database, after the configuration file is uploaded to the server, the server can use reflection to generate the entity class corresponding to the target column header data. Based on the import correspondence between the entity class and the data table in the database, the row data can be quickly and accurately imported into the database. This allows the import template to be flexibly configured and extended. When new column header data is added, the entity class is dynamically generated without requiring secondary development and deployment of the entity classes in the database, effectively improving the flexibility and efficiency of data import and enabling rapid response to customer needs.

[0048] Furthermore, this embodiment of the invention also provides another data import method, which enables more flexible data import and improves data import efficiency to quickly respond to user needs. The specific execution steps are as follows: Figure 2 As shown, it is applied to the server side and includes:

[0049] 201. Receive and parse the target import file uploaded by the client to obtain the corresponding target column header data and row data.

[0050] It should be noted that in this embodiment, the execution entity is the server. Since the target import file is row data configured based on the import template generated from the target column header data selected from the specified column header data in the client template configuration page, the server can parse the target import file after the client uploads it to obtain the target column header data and row data for subsequent step 201. It should also be noted that since the specified column header data in the template configuration page is generated based on existing column header data in the database, and there is a need to add new column header data from time to time, in order to meet the user's need for fast data import, specifically, before receiving and parsing the target import file generated by the target import template configuration, the method further includes: obtaining existing column header data in the database; generating a template configuration page using the existing column header data as selectable specified column header data and configurable options for adding new column header data, and deploying the template configuration page on the client. That is, a page for configuring the import template is pre-deployed on the client, thereby improving the efficiency and flexibility of the user's configuration of the import template, and thus improving the efficiency of data import.

[0051] Furthermore, since the aforementioned data import process may require the addition of new column header data from time to time, in order to further improve the configuration flexibility and efficiency of the import template, as well as the efficiency of the server in importing data into the database, the method specifically includes, after deploying the template configuration page on the client: receiving and parsing the column header addition request sent by the client to obtain the corresponding new column header data; adding the new column header data to the database; and updating the specified column header data in the template configuration page. Users can customize the configuration based on the "Add Column Header Data" option in the template configuration page. For example, they can directly write new column header fields or pre-configure predicted alternative column header fields and select the new column header field. This embodiment does not limit this. After the "Add Column Header Data" option is configured, a column header addition request will be automatically generated and sent to the server. This request contains the new column header data to be added to the database. Based on this request, the server will add the parsed new column header data to the data table in the database. Since only the column header data is added at this time, the corresponding row data is not imported at the same time. In order to quickly respond to customer needs, the specified column header data in the template configuration page can be automatically updated, that is, the new column header data can be used as the specified column header data for users to select, thereby configuring an import template corresponding to the user's needs.

[0052] 202. Dynamically generate entity classes corresponding to target column header data based on reflection mechanism.

[0053] It should be noted that, in this embodiment, in order to more conveniently obtain existing column header data from the database and import corresponding row data, it is necessary to create an entity class in the program that corresponds to the data table in the database, so that the retrieved or imported data is stored in the form of a list. That is to say, the entity class is the medium for importing or importing data into the database. Due to the characteristics of the reflection mechanism, and the fact that the target column header data is selected from the existing column header data in the database, the entity class corresponding to the target column header data can be dynamically generated based on the reflection mechanism, so that the row data corresponding to the target column header data can be imported into the database.

[0054] Furthermore, since the target import file can have its row data configured directly in the template configuration page, or the target import template can be downloaded first and then the row data configured, the latter carries a certain risk of modifying the column header data. Once the target column header data in the target import template is modified, it will cause the modified target column header data to not correspond to the specified column header data, and thus not correspond to the existing column header data in the database. This will lead to data import failure or incomplete data import. To avoid the above situation affecting the integrity and efficiency of data import, specifically, before dynamically generating the entity class corresponding to the target column header data based on the reflection mechanism, the following steps are taken: determining whether there is invalid column header data in the target column header data based on the existing column header data in the database; if not, dynamically generating the entity class corresponding to the target column header data based on the reflection mechanism; if so, triggering the import prompt instruction and performing the corresponding operation based on the import prompt instruction. Invalid data refers to target column header data in the imported file that does not correspond to existing column header data in the database, i.e., modified target column header data. The import prompt instruction can be an import missing instruction, which means that the row data corresponding to the unmodified target column header data can be imported into the database first, thereby improving data import efficiency. Alternatively, it can be an import failure instruction, which means that the import of the target imported file can be directly determined to have failed, prompting the user to reconfigure the target imported file to ensure the integrity of each imported data. This embodiment does not limit the specific method used and can automatically configure the corresponding triggering rules according to the user's import needs.

[0055] Furthermore, regarding the aforementioned triggering of import prompt instructions, the specific execution process for performing corresponding operations based on import prompt instructions is as follows: Import prompt instructions include at least one of import missing instructions and import failure instructions; specifically, when an import missing instruction is triggered, a missing prompt message generated based on invalid column header data is fed back to the client, and an entity class corresponding to the valid column header data in the target column header data is dynamically generated based on a reflection mechanism, so as to import the row data corresponding to the valid column header data into the database; when an import failure instruction is triggered, a failure prompt message generated based on invalid column header data is fed back to the client, and the data import operation is stopped. Among them, valid column header data refers to the target column header data in the target import file that corresponds to the existing column header data in the database, i.e., the unmodified target column header data. The import missing command can also provide feedback to the client on the modified target column header data, i.e., feedback on which data was imported and which data was not imported, so that users can be aware of incomplete imported data in a timely manner while ensuring import efficiency. The import failure command can stop the data import operation and provide feedback to the client on the presence of invalid column header data in the entire target import file, i.e., ensuring the integrity of the data import. The import failure command can also provide information such as the row and column numbers corresponding to the invalid column header data.

[0056] 203. Construct a mapping relationship between entity classes and row data, and use the mapping relationship to import the row data into the database accordingly.

[0057] It should be noted that, in this embodiment, since the target column header data and row data have a corresponding relationship, after generating the entity class, the mapping relationship between the entity class and the row data can be directly constructed, thereby using the mapping relationship to import the row data into the database, so that the row data can be accurately and quickly imported into the data table of the database.

[0058] Based on the above Figure 2 As can be seen from the implementation, the data import method provided by this invention first receives and parses the target import file uploaded by the client to obtain the corresponding target column header data and row data when data import is required. Then, it dynamically generates the entity class corresponding to the target column header data based on a reflection mechanism. Finally, it constructs a mapping relationship between the entity class and the row data and uses the mapping relationship to import the row data into the database accordingly. According to the technical solution provided by this invention, it can ensure that the target column header data in the target import file corresponds to the existing column header data in the database, and uses a reflection mechanism to generate the entity class corresponding to the target column header data. Thus, based on the import correspondence between the entity class and the data table in the database, as well as the mapping relationship between the entity class and the row data, the row data can be quickly and accurately imported into the database. When new column header data is added, the entity class is dynamically generated without the need for secondary development and deployment of the entity class in the database, effectively improving the flexibility and efficiency of data import, and thus enabling rapid response to customer needs.

[0059] Furthermore, as a response to the above Figure 1-2 The implementation of the method embodiment shown in this invention provides a data import device that makes data import more flexible and improves data import efficiency to quickly respond to user needs. The embodiment of this device corresponds to the foregoing method embodiment. For ease of reading, this embodiment will not repeat the details of the foregoing method embodiment, but it should be understood that the device in this embodiment can implement all the contents of the foregoing method embodiment. Specifically, as shown... Figure 3 As shown, the device, applied to a client, includes:

[0060] The first generation unit 31 is used to generate a target import template based on the target column header data in the template configuration page, wherein the target column header data is all or part of the specified column header data selected in the template configuration page, and the specified column header data corresponds to the existing column header data in the database.

[0061] Configuration unit 32 is used to configure the row data corresponding to the target column header data in the target import template obtained by the first generation unit 31, so as to obtain the corresponding target import file;

[0062] The upload unit 33 is used to upload the target import file obtained by the configuration unit 32 to the server so that the server can parse the target import file and dynamically generate an entity class using reflection mechanism to import the row data in the target import file into the database.

[0063] Furthermore, such as Figure 4 As shown, the template configuration page also includes an option to add column header data; the device also includes:

[0064] The second generation unit 34 is used to generate a column header addition request based on the configuration operation of the new column header data before the first generation unit 31.

[0065] The sending unit 35 is used to send the column header addition request obtained by the second generation unit 34 to the server, so that the server can parse the column header addition request, add the new column header data in the column header addition request to the database, and update the specified column header data in the template configuration page.

[0066] Furthermore, as a response to the above Figure 1-2 The implementation of the method embodiment shown in this invention provides a data import device that makes data import more flexible and improves data import efficiency to quickly respond to user needs. The embodiment of this device corresponds to the foregoing method embodiment. For ease of reading, this embodiment will not repeat the details of the foregoing method embodiment, but it should be understood that the device in this embodiment can implement all the contents of the foregoing method embodiment. Specifically, as shown... Figure 5 As shown, the device, applied to the server side, includes:

[0067] The first parsing unit 41 is used to receive and parse the target import file uploaded by the client to obtain the corresponding target column header data and row data.

[0068] The third generation unit 42 is used to dynamically generate the entity class corresponding to the target column header data obtained by the first parsing unit 41 based on the reflection mechanism.

[0069] Import unit 43 is used to construct the mapping relationship between the entity class and the row data obtained by the third generation unit 42, and to import the row data into the database accordingly using the mapping relationship.

[0070] Furthermore, such as Figure 6 As shown, the device further includes:

[0071] Acquisition unit 44 is used to acquire existing column header data in the database before the first parsing unit 41;

[0072] The fourth generation unit 45 is used to take the existing column header data obtained by the acquisition unit 44 as selectable specified column header data and configurable new column header data options in the template configuration page, and deploy the template configuration page in the client.

[0073] Furthermore, such as Figure 6 As shown, the device further includes:

[0074] The second parsing unit 46 is used to receive and parse the column header addition request sent by the client after the fourth generation unit 45, so as to obtain the corresponding new column header data;

[0075] Processing unit 47 is used to add the newly added column header data obtained by the second parsing unit 46 to the database and update the specified column header data in the template configuration page.

[0076] Furthermore, such as Figure 6 As shown, the device further includes:

[0077] The judgment unit 48 is used to determine whether there is invalid column header data in the target column header data based on the existing column header data in the database before the third generation unit 42;

[0078] The third generation unit 42 has the function of,

[0079] If the judgment unit 48 determines that there is no invalid column header data in the target column header data, it dynamically generates the entity class corresponding to the target column header data based on the reflection mechanism.

[0080] The triggering unit 49 is used to trigger an import prompt instruction if the judgment unit 48 determines that there is invalid column header data in the target column header data, and to perform corresponding operations based on the import prompt instruction.

[0081] Furthermore, such as Figure 6 As shown, the import prompt instruction includes at least one of an import missing instruction and an import failure instruction; the triggering unit 49 is specifically used for,

[0082] When the import missing instruction is triggered, the missing prompt information generated based on the invalid column header data will be fed back to the client, and the entity class corresponding to the valid column header data other than the invalid column header data in the target column header data will be dynamically generated based on the reflection mechanism, so as to import the row data corresponding to the valid column header data into the database.

[0083] When the import failure instruction is triggered, a failure message generated based on the invalid column header data will be sent back to the client, and the data import operation will be stopped.

[0084] Furthermore, embodiments of the present invention also provide a data import system, such as... Figure 7 As shown, the system includes a server 51 and a client 52, wherein,

[0085] Client 51 can be used to execute any of the above-described data import methods applied to the client during data import.

[0086] Server 52 can be used to execute the data import method applied to the server as described above during data import. Furthermore, this embodiment of the invention also provides a storage medium for storing a computer program, wherein the computer program, when running, controls the device where the storage medium is located to execute the above-described... Figure 1-2 The data import method described in [the document].

[0087] Furthermore, embodiments of the present invention also provide a processor for running a program, wherein the program executes the above-described... Figure 1-2 The data import method described in [the document].

[0088] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0089] It is understood that the relevant features of the above methods, apparatus, and systems can be referenced interchangeably. Furthermore, the terms "first," "second," etc., in the above embodiments are used to distinguish between embodiments and do not represent the superiority or inferiority of any particular embodiment.

[0090] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0091] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The required structure for constructing such systems is apparent from the above description. Furthermore, this invention is not directed to any particular programming language. It should be understood that the contents of the invention described herein can be implemented using various programming languages, and the above description of specific languages ​​is for the purpose of disclosing the best mode of implementation of the invention.

[0092] In addition, the memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0093] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can 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, etc.) containing computer-usable program code.

[0094] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can 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, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0095] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0096] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0097] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0098] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, like read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0099] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0100] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0101] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can 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, etc.) containing computer-usable program code.

[0102] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A data import method, characterized in that, Applied to a client, the method includes: A target import template is generated based on the target column header data in the template configuration page, wherein the target column header data is all or part of the specified column header data selected in the template configuration page, and the specified column header data corresponds to the existing column header data in the database; Configure the row data corresponding to the target column header data in the target import template to obtain the corresponding target import file; The target import file is uploaded to the server so that the server can parse the target import file to obtain the target column header data, dynamically generate the entity class corresponding to the target column header data using the reflection mechanism, construct the mapping relationship between the entity class and the row data, and import the row data in the target import file into the database based on the entity class and the mapping relationship. The template configuration page also includes an option to add column header data; before generating the target import template based on the target column header data in the template configuration page, the method further includes: A column header addition request is generated based on the configuration operation of the newly added column header data option; The column header addition request is sent to the server so that the server can parse the column header addition request, add the new column header data in the column header addition request to the database, and update the specified column header data in the template configuration page.

2. A data import method, characterized in that, Applied to the server side, the method includes: Receive and parse the target import file uploaded by the client to obtain the corresponding target column header data and row data. The target import file is obtained by configuring the row data corresponding to the target column header data based on the target import template. The target column header data is all or part of the specified column header data selected in the template configuration page. The entity class corresponding to the target column header data is dynamically generated based on the reflection mechanism. Construct a mapping relationship between the entity class and the row data, and use the mapping relationship to import the row data into the database accordingly; Before receiving and parsing the target import file generated by the target import template configuration, the method further includes: Retrieve existing column header data from the database; The existing column header data is used as selectable specified column header data, and the configurable option to add new column header data is used to generate the template configuration page, and the template configuration page is deployed on the client. After deploying the template configuration page to the client, the method further includes: Receive and parse the column header addition request sent by the client to obtain the corresponding new column header data; The newly added column header data is added to the database, and the specified column header data in the template configuration page is updated.

3. The method according to claim 2, characterized in that, Before dynamically generating the entity class corresponding to the target column header data based on reflection, the process includes: Based on the existing column header data in the database, determine whether there is invalid column header data in the target column header data; If not, the entity class corresponding to the target column header data is dynamically generated based on the reflection mechanism; If so, an import prompt instruction is triggered, and corresponding operations are performed based on the import prompt instruction.

4. The method according to claim 3, characterized in that, The import prompt instruction includes at least one of an import missing instruction and an import failure instruction; triggering the import prompt instruction and performing corresponding operations based on the import prompt instruction includes: When the import missing instruction is triggered, the missing prompt information generated based on the invalid column header data will be fed back to the client, and the entity class corresponding to the valid column header data in the target column header data will be dynamically generated based on the reflection mechanism so as to import the row data corresponding to the valid column header data into the database. When the import failure instruction is triggered, a failure message generated based on the invalid column header data will be sent back to the client, and the data import operation will be stopped.

5. A data import device, characterized in that, Applied to a client, the device includes: The first generation unit is used to generate a target import template based on the target column header data in the template configuration page, wherein the target column header data is all or part of the specified column header data selected in the template configuration page, and the specified column header data corresponds to the existing column header data in the database; A configuration unit is used to configure the row data corresponding to the target column header data in the target import template obtained by the first generation unit, so as to obtain the corresponding target import file; The upload unit is used to upload the target import file obtained by the configuration unit to the server so that the server can parse the target import file to obtain the target column header data, dynamically generate the entity class corresponding to the target column header data using a reflection mechanism, construct the mapping relationship between the entity class and the row data, and import the row data in the target import file into the database based on the entity class and the mapping relationship. The template configuration page also includes an option to add column header data; the device also includes: The second generation unit is used to generate a column header addition request based on the configuration operation of the added column header data before the first generation unit; The sending unit is used to send the column header addition request obtained by the second generation unit to the server, so that the server can parse the column header addition request, add the new column header data in the column header addition request to the database, and update the specified column header data in the template configuration page.

6. A data import device, characterized in that, Applied to the server side, the device includes: The first parsing unit is used to receive and parse the target import file uploaded by the client to obtain the corresponding target column header data and row data. The target import file is obtained by configuring the row data corresponding to the target column header data based on the target import template. The target column header data is all or part of the specified column header data selected in the template configuration page. The third generation unit is used to dynamically generate the entity class corresponding to the target column header data obtained by the first parsing unit based on the reflection mechanism. The import unit is used to construct the mapping relationship between the entity class obtained by the third generation unit and the row data, and to import the row data into the database accordingly using the mapping relationship; The device further includes: The acquisition unit is used to acquire existing column header data in the database before the first parsing unit; The fourth generation unit is used to take the existing column header data obtained by the acquisition unit as selectable specified column header data and configurable new column header data options in the template configuration page, and deploy the template configuration page in the client. The device further includes: The second parsing unit is used to receive and parse the column header addition request sent by the client after the fourth generation unit, so as to obtain the corresponding new column header data; The processing unit is used to add the newly added column header data obtained by the second parsing unit to the database and update the specified column header data in the template configuration page.

7. A data import system, characterized in that, Including client and server, When the client performs data import, it executes the data import method described in claim 1; When importing data, the server executes the data import method according to any one of claims 2 to 4.

8. A storage medium, characterized in that, The storage medium includes a stored program, wherein, when the program is executed, it controls the device where the storage medium is located to perform the data import method as described in claim 1 or any one of claims 2 to 4.

9. A processor, characterized in that, The processor is used to run a program, wherein the program executes the data import method as described in claim 1 or any one of claims 2 to 4.

Citation Information

Patent Citations

  • Data batch import method and system, computer device and storable medium

    CN115718777A