CN114385142A - Data storage method and device, electronic equipment and storage medium - Google Patents

Data storage method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114385142A
CN114385142A CN202111651777.0A CN202111651777A CN114385142A CN 114385142 A CN114385142 A CN 114385142A CN 202111651777 A CN202111651777 A CN 202111651777A CN 114385142 A CN114385142 A CN 114385142A
Authority
CN
China
Prior art keywords
target
configuration
configuration item
data
item
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111651777.0A
Other languages
Chinese (zh)
Inventor
石磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guahao Net Hangzhou Technology Co Ltd
Original Assignee
Guahao Net Hangzhou Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guahao Net Hangzhou Technology Co Ltd filed Critical Guahao Net Hangzhou Technology Co Ltd
Priority to CN202111651777.0A priority Critical patent/CN114385142A/en
Publication of CN114385142A publication Critical patent/CN114385142A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages

Abstract

The embodiment of the invention discloses a data storage method and device, electronic equipment and a storage medium. The method comprises the following steps: acquiring configuration content information corresponding to each configuration item in a target configuration page; generating a target program code corresponding to a target configuration page according to each configuration item, corresponding configuration content information and a target reflection mechanism; and determining a target data packet based on the target program code, and storing each configuration item in the target data packet and configuration content corresponding to the configuration item to a target storage position. The problem of low development efficiency caused by writing parameters into a program in a hard coding mode in the prior art is solved, automatic code generation is realized, and the effects of improving code development efficiency and reducing development cost are achieved.

Description

Data storage method and device, electronic equipment and storage medium
Technical Field
The present invention relates to computer processing technologies, and in particular, to a data storage method and apparatus, an electronic device, and a storage medium.
Background
Most of the existing java development methods usually write parameter values into a program in a hard coding mode, if the parameter is changed next time, the code needs to be changed manually, and then the system is tested and released again.
Disclosure of Invention
The embodiment of the invention provides a data storage method, a data storage device, electronic equipment and a storage medium, which are used for realizing automatic generation of codes and achieving the technical effects of improving the code development efficiency and reducing the development cost.
In a first aspect, an embodiment of the present invention provides a data storage method, where the method includes:
acquiring configuration content information corresponding to each configuration item in a target configuration page;
generating a target program code corresponding to the target configuration page according to each configuration item, corresponding configuration content information and a target reflection mechanism;
and determining a target data packet based on the target program code, and storing each configuration item in the target data packet and configuration content corresponding to the configuration item to a target storage position.
In a second aspect, an embodiment of the present invention further provides a data storage apparatus, including:
the configuration content information acquisition module is used for acquiring configuration content information corresponding to each configuration item in the target configuration page;
the target program code generating module is used for generating a target program code corresponding to the target configuration page according to each configuration item, corresponding configuration content information and a target reflection mechanism;
and the target data packet determining module is used for determining a target data packet based on the target program code and storing each configuration item in the target data packet and the configuration content corresponding to the configuration item to a target storage position.
In a third aspect, an embodiment of the present invention further provides an electronic device, where the electronic device includes:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the data storage method according to any one of the embodiments of the present invention.
In a fourth aspect, the embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the data storage method according to any one of the embodiments of the present invention.
The technical scheme of the embodiment of the invention generates the target program code corresponding to the target configuration page by acquiring the configuration content information corresponding to each configuration item in the target configuration page, according to each configuration item, the corresponding configuration content information and the target reflection mechanism, determines the target data packet based on the target program code, and stores each configuration item in the target data packet and the configuration content corresponding to the configuration item to the target storage position, solves the problem of low development efficiency caused by writing parameters into a program in a hard coding mode in the prior art, realizes that the configuration content information corresponding to the required configuration item is input in the target configuration page, and further performs reflection processing on the configuration content information corresponding to the configuration item based on the target reflection mechanism, automatically generates the target program code, and simultaneously packs the target program code into the target data packet, therefore, a user can introduce the target data packet into the project, obtain each configuration item in the target data packet and the configuration content corresponding to the configuration item, apply the configuration items, improve the efficiency of code development and achieve the technical effect of reducing the development cost.
Drawings
In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, a brief description is given below of the drawings used in describing the embodiments. It should be clear that the described figures are only views of some of the embodiments of the invention to be described, not all, and that for a person skilled in the art, other figures can be derived from these figures without inventive effort.
Fig. 1 is a flowchart of a data storage method according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a data storage method according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a data storage method according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a data storage method according to an embodiment of the present invention;
fig. 5 is a flowchart of a data storage method according to a second embodiment of the present invention;
fig. 6 is a schematic flowchart of a data storage method according to a third embodiment of the present invention;
FIG. 7 is a block diagram of a data storage device according to a fourth embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device according to a fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of a data storage method according to a first embodiment of the present invention, where the present embodiment is applicable to a case of automatically packaging object program codes, and the method may be executed by a data storage device according to an embodiment of the present invention, where the data storage device may be implemented in a software and/or hardware manner, and optionally, the data storage device may be implemented by an electronic device, and the electronic device may be a mobile terminal, a PC terminal, a server terminal, or the like. The apparatus may be configured in a computing device, and the data storage method provided in this embodiment specifically includes the following steps:
s110, configuration content information corresponding to each configuration item in the target configuration page is obtained.
It should be noted that the technical solution can be applied to the situation of automatically generating code in the field of software development, and can also be applied to any situation in which code needs to be automatically generated. It should be further noted that, a corresponding system for automatically generating codes may be developed based on the present technical solution, and then corresponding tasks are processed based on the system, so as to perform automatic code generation. For example, in a software development scenario, based on configuration information filled by a user in a background configuration page, the system may automatically generate a code corresponding to the configuration information based on the configuration information transmitted in the background.
In practical applications, a user may fill in corresponding configuration content in an edit box of a configuration item in a background configuration page by using an input device, for example, the configuration item may include a configuration item name, a configuration item description, a form control, and the like. Configuration content filled by a user can be submitted to a background system by using an interface, and when the system detects uploaded data, configuration content information corresponding to each configuration item in a target configuration page can be considered to be received.
It should be noted that each configuration item information included in the target configuration page may be determined according to the functional requirements of the actual project, for example, each configuration item information may be divided into multiple levels according to the requirements, and if a first-level configuration item information and a second-level configuration item information are divided, where the first-level configuration item information may be a main item name, the second-level configuration item information may be used as a functional project under the main item, so as to implement planning of a multi-level service function.
Optionally, the obtaining configuration content information corresponding to each configuration item in the target configuration page includes: when a control triggering the target configuration page is detected, displaying the target configuration page; the target configuration page comprises a first-level configuration item; when detecting that a newly added configuration item control is triggered, displaying a secondary configuration item and a tertiary configuration item in a target configuration page; if the newly-added configuration item control is detected to be triggered again, popping up a configuration information adding page; the added configuration information page comprises a first-level configuration item, a second-level configuration item, a third-level configuration item and configuration content information corresponding to the configuration items in the target configuration page, keys corresponding to the fourth-level configuration item and the fourth-level configuration item, and values corresponding to the fifth-level configuration item and the fifth-level configuration item; and when the trigger submission control is detected, acquiring a target configuration page and configuration content information corresponding to each configuration item in the target configuration page.
In this embodiment, when the user clicks a control for entering the target configuration page on the platform page, it is considered that the operation for entering the target configuration page is triggered, and when the system receives an entry request corresponding to the triggering operation, the target configuration page is displayed. The user can fill in the corresponding configuration item content, such as the name of the filling item, in the edit box corresponding to the primary configuration item in the target configuration page. Illustratively, referring to fig. 2, the content corresponding to the primary configuration item is py, which may be represented as an item name. The user may also click a newly added configuration item control in the page, at this time, the system may receive a trigger operation corresponding to the newly added configuration item, the target configuration page may display the second-level configuration item, and correspondingly, the user may also fill and write corresponding configuration item content in an edit box corresponding to the second-level configuration item, for example, continuing with fig. 2, where the content corresponding to the second-level configuration item is md _ add _ data, and may be represented as a function name. The user may also click a newly added configuration item control in the page, the target configuration page may display the third-level configuration item, and accordingly, the user may also fill and write corresponding configuration item content in an edit box corresponding to the third-level configuration item, for example, continuing with fig. 2, the content corresponding to the third-level configuration item is hos _ no. If the user clicks the newly added configuration item control in the page again, the configuration information adding page may be popped up, and at this time, the configuration information adding page includes the first-level configuration item, the second-level configuration item, the third-level configuration item, the configuration content information corresponding to each configuration item, the key corresponding to the fourth-level configuration item, and the value corresponding to the fifth-level configuration item in the target configuration page, for example, see fig. 3. The service parameter information, such as age, can be filled in the edit box corresponding to the key corresponding to the four-level configuration item in the added configuration information page. The value corresponding to the age, such as 18, may be filled in the edit box corresponding to the value corresponding to the added five-level configuration item. When the user clicks the submission control in the added configuration information page, the submission operation may be considered to be triggered, and at this time, the system may receive each configuration item and the configuration content information corresponding to each configuration item in the target configuration page, so that the code is automatically generated based on the configuration item and the corresponding configuration content information in the following.
And S120, generating a target program code corresponding to the target configuration page according to each configuration item, corresponding configuration content information and a target reflection mechanism.
Wherein, the target reflection mechanism may be a java reflection mechanism.
In practical application, after the system acquires each configuration item and corresponding configuration content information, the information can be processed by using a java reflection mechanism, and a code, namely an object program code, is automatically generated.
It should be noted that, when each configuration item and corresponding configuration content information are submitted to the system, the information received by the system exists in a storage manner of a jar package, and at this time, an algorithm needs to be used to analyze the jar package, so that the system can read the configuration item and the corresponding configuration content information in the jar package, and further generate a corresponding target program code based on the information.
Optionally, generating a target program code corresponding to the target configuration page according to each configuration item, the corresponding configuration content information, and the target reflection mechanism, includes: analyzing and processing each configuration item and corresponding configuration content information based on a target reflection mechanism to obtain a target analysis result; the target analysis result comprises a first-level configuration item, a second-level configuration item, a third-level configuration item, a fourth-level configuration item, a fifth-level configuration item and configuration content information corresponding to the configuration items; and generating target program codes based on the target analysis result.
It should be noted that, the target reflection mechanism may be used to analyze each configuration item and the corresponding configuration content information to obtain a corresponding analysis result, and the java reflection mechanism may be used to reflect the analysis result to generate the target program code corresponding to each configuration item and the corresponding configuration content information. For example, after the user creates project information such as project name, remark, and version number in the configuration page, a specific configuration item may be added under the project in the configuration page, and the configuration item may be divided into five levels. The first, second and third levels are configuration item names, the fourth level is a specific configuration item, and the fifth level is a value corresponding to the specific configuration item. After each configuration item is created in the configuration page, the automatic packaging function can package each configuration item and corresponding configuration content information, send the packaged configuration items and the corresponding configuration content information to the system, and analyze the information and generate automatic codes by using a java reflection mechanism. For example, the primary configuration item is code1, the secondary configuration item is code2, the tertiary configuration item is code3_1, the key corresponding to the quaternary configuration item is service biz _ id, and the value is value 1. The method comprises the steps of firstly determining a first-level configuration, a second-level configuration and a third-level configuration by utilizing an algorithm, then searching content data matched with the first-level configuration, the second-level configuration and the third-level configuration in a database through the third-level configuration, and respectively generating corresponding class classes for the first-level configuration, the second-level configuration and the third-level configuration through a java reflection mechanism. Wherein, the class of the second-level configuration is the attribute of the class of the first-level configuration. The third-level configuration class is the attribute of the second-level configuration class, the fourth-level configuration is the attribute of the third-level configuration class, and the fifth-level configuration is the value of the corresponding attribute in the third-level class, and accordingly, the corresponding target program code can be generated. For example, see fig. 4. The automatic code generation process can ensure that the attributes and the corresponding values can be obtained by a java code mode when the user uses the configuration, and the learning difficulty of the user is greatly reduced.
S130, determining a target data packet based on the target program code, and storing each configuration item in the target data packet and configuration content corresponding to the configuration item to a target storage position.
In practical application, in order to improve development convenience, after the object program code is acquired, the object program code may be packaged by using an algorithm to generate a code packet, i.e., an object data packet, optionally, a jar packet. The configuration items in the target data packet and the configuration contents corresponding to the configuration items can be stored to a certain preset position to serve as a target storage position, so that a user can call the target data packet from the position and introduce the target data packet into a project when developing, and the corresponding value can be found through keys through interfaces exposed by jar in the project.
It should be noted that, in order to improve the search efficiency of the program and reduce the memory burden of the database, after the user creates project information such as project names, remarks, and version numbers, the project information may be stored in a certain preset storage location, and after a specific configuration item is added under the project, the configuration item information may be stored in another preset storage location, so that during the search, data may be retrieved from different preset storage locations, thereby improving the search efficiency.
Optionally, the target storage location includes a first data table and a second data table; determining a target data packet based on the target program code, and storing each configuration item in the target data packet and configuration content corresponding to the configuration item to a target storage location, wherein the method comprises the following steps: generating a target data packet based on the target program code; and storing a first-level configuration item, a second-level configuration item and a third-level configuration item in each configuration item in the target data packet into a first data table, and storing the first-level configuration item, the second-level configuration item, the third-level configuration item, the fourth-level configuration item and the fifth-level configuration item into a second data table.
Specifically, the target program code may be packaged by using an algorithm to generate a target data packet, and further, a first-level configuration item, a second-level configuration item, and a third-level configuration item of each configuration item in the target data packet may be stored in a first data table, for example, an item code in fig. 4: wtree-example. The first level configuration item, the second level configuration item, the third level configuration item, the fourth level configuration item, and the fifth level configuration item are stored to a second data table, such as code1, code2, code3_1, service id, value1 in fig. 4. The field values in the corresponding data table are also subsequently opened in the background configuration page. When the user adds the configuration, the user can write the corresponding value according to the own use habit and mode, and when the user clicks and submits after adding the configuration, the system can automatically add the corresponding configuration field to the corresponding data table.
It should be noted that each configuration item in the target data packet and the configuration content corresponding to the configuration item are stored in the target storage location at the same time. Optionally, the contents in the second data table may be cached in the target cache. Wherein, the target cache can be redis. The benefits of this arrangement are: when searching, the searching efficiency of the program is improved, and the value corresponding to the key can be quickly searched from the redis.
The technical scheme of the embodiment of the invention generates the target program code corresponding to the target configuration page by acquiring the configuration content information corresponding to each configuration item in the target configuration page, according to each configuration item, the corresponding configuration content information and the target reflection mechanism, determines the target data packet based on the target program code, and stores each configuration item in the target data packet and the configuration content corresponding to the configuration item to the target storage position, solves the problem of low development efficiency caused by writing parameters into a program in a hard coding mode in the prior art, realizes that the configuration content information corresponding to the required configuration item is input in the target configuration page, and further performs reflection processing on the configuration content information corresponding to the configuration item based on the target reflection mechanism, automatically generates the target program code, and simultaneously packs the target program code into the target data packet, therefore, a user can introduce the target data packet into the project, obtain each configuration item in the target data packet and the configuration content corresponding to the configuration item, apply the configuration items, improve the efficiency of code development and achieve the technical effect of reducing the development cost.
Example two
Fig. 5 is a flowchart of a data storage method according to a second embodiment of the present invention, and based on the foregoing embodiment, after storing each configuration item and configuration content corresponding to the configuration item in a target data packet to a target storage location, when a data retrieval request for retrieving data is received, a target entity in a target data class may be determined, and a target configuration entity corresponding to the target entity is further obtained, so as to obtain a value corresponding to a five-level configuration item. The specific implementation manner can be referred to the technical scheme of the embodiment. The technical terms that are the same as or corresponding to the above embodiments are not repeated herein.
As shown in fig. 5, the method specifically includes the following steps:
s210, configuration content information corresponding to each configuration item in the target configuration page is obtained.
S220, generating a target program code corresponding to the target configuration page according to each configuration item, corresponding configuration content information and a target reflection mechanism.
And S230, determining a target data packet based on the target program code, and storing each configuration item in the target data packet and configuration content corresponding to the configuration item to a target storage position.
S240, when a data calling request for calling data is received, acquiring a target data class in the data calling request.
It should be noted that after storing each configuration item in the target data packet and the configuration content corresponding to the configuration item to the target storage location, during development, the target data packet may be introduced into the project, and then the configuration data stored in the database may be dynamically read through an interface exposed in the target data packet in the project, and a corresponding value is found through a key (key), and then a code is automatically generated according to a value (String type) of a field, for example, referring to fig. 2, a biz _ id _01 corresponding to a service id is a configuration key. The specific use is as follows: the value1 corresponding to the key can be found from the database by using biz _ id _01 as the key.
In practical application, when the system receives a data retrieval request for obtaining a value corresponding to a key, a target data class may be obtained by using an interface, for example, the target data class may be a class generated by configuring the first, second, and third levels, respectively.
And S250, determining a target entity in the target data class by analyzing and processing the target data class.
In this embodiment, the target data class may be analyzed by using an algorithm to find the target entity in the target data class, for example, referring to fig. 4, the target data class is a class configured in three levels, and the target entity is a service id: the biz _ id _01 is the key corresponding to the four-level configuration item.
S260, acquiring a target configuration entity corresponding to the target entity based on the target entity, the first data table, the second data table and the target cache.
The target configuration entity corresponds to the configuration value corresponding to the five-level configuration item.
In this embodiment, after the target entity is found, the interface may be utilized to find the configuration value corresponding to the target entity, that is, the target configuration entity, in the first data table, the second data table, and the target cache. For example, with continued reference to FIG. 4, the configuration value corresponding to biz _ id _01 is value 1.
It should be noted that, when the target configuration entity corresponding to the target entity is searched in the target cache based on the target entity, the first data table, the second data table, and the target configuration entity, the search may be performed from the second data table, or may be performed from the target cache. It should be noted that, in order to improve the search efficiency, if the target configuration entity is searched in the target cache redis, repeated search in the second data table may not be needed. It should be noted that, in order to further improve the search accuracy, correspondingly, data adapted to the target entity may also be searched from the first data table, and further verification is performed to determine whether the target entity is included in the first data table.
Optionally, obtaining a target configuration entity corresponding to the target entity based on the target entity, the first data table, the second data table, and the target cache includes: acquiring target data to be used from a second data table or a target cache based on the target entity; the target data to be used comprises a first-level configuration item, a second-level configuration item, a third-level configuration item, a fourth-level configuration item and a fifth-level configuration item; acquiring data to be matched from a first data table based on a target entity; the data to be matched comprises a first-level configuration item, a second-level configuration item and a third-level configuration item; and determining a target configuration entity corresponding to the target entity according to the target data to be used and the data to be matched.
In this embodiment, after the target entity is obtained, the pre-stored configuration item data adapted to the target entity may be found from the second data table or the target cache as the target data to be used, such as the class corresponding to the first-level configuration item, the second-level configuration item, the third-level configuration item, the key corresponding to the fourth-level configuration item, and the value corresponding to the fifth-level configuration item. And finding out pre-stored configuration item data matched with the target entity from the first data table as data to be matched, such as class classes corresponding to the first-level configuration item, the second-level configuration item and the third-level configuration item. Further, the target data to be used and the data to be matched are verified by using an algorithm, and a target configuration entity corresponding to the target entity, namely, a value corresponding to the five-level configuration item is determined.
It should be noted that, in order to improve the accuracy of data search, after determining the target data to be used and the data to be matched, the searched data may be verified, for example, it is determined whether the primary configuration item, the secondary configuration item, and the tertiary configuration item in the target data to be used and the data to be matched are the same, if so, it may be indicated that the verification is successful, so as to accurately find the target configuration entity corresponding to the target entity.
Optionally, determining a target configuration entity corresponding to the target entity according to the target data to be used and the data to be matched includes: and if the primary configuration item, the secondary configuration item and the tertiary configuration item in the target data to be used are the same as the primary configuration item, the secondary configuration item and the tertiary configuration item in the data to be matched, taking the data corresponding to the five-level configuration item in the target data to be used as a target configuration entity.
Specifically, the target data to be used and the data to be matched may be compared by using an algorithm, and if the first-level configuration item, the second-level configuration item, and the third-level configuration item in the target data to be used are the same as the first-level configuration item, the second-level configuration item, and the third-level configuration item in the data to be matched, the data corresponding to the fifth-level configuration item in the target data to be used may be used as a target configuration entity, and the value corresponding to the key is found correspondingly.
The technical scheme of the embodiment of the invention generates the target program code corresponding to the target configuration page by acquiring the configuration content information corresponding to each configuration item in the target configuration page, according to each configuration item, the corresponding configuration content information and the target reflection mechanism, determines the target data packet based on the target program code, and stores each configuration item in the target data packet and the configuration content corresponding to the configuration item to the target storage position, solves the problem of low development efficiency caused by writing parameters into a program in a hard coding mode in the prior art, realizes that the configuration content information corresponding to the required configuration item is input in the target configuration page, and further performs reflection processing on the configuration content information corresponding to the configuration item based on the target reflection mechanism, automatically generates the target program code, and simultaneously packs the target program code into the target data packet, therefore, a user can introduce the target data packet into the project, obtain each configuration item in the target data packet and the configuration content corresponding to the configuration item, apply the configuration items, improve the efficiency of code development and achieve the technical effect of reducing the development cost.
EXAMPLE III
As an alternative embodiment of the foregoing embodiment, fig. 6 is a schematic flowchart of a data storage method according to a third embodiment of the present invention. Specifically, the following details can be referred to.
For example, referring to fig. 6, the development user creates project information corresponding to the primary configuration item on the target configuration page, and may store the project information in the target storage location. And then, content information corresponding to the second-level configuration item and the third-level configuration item is newly added in the target configuration page, and further, content information corresponding to the fourth-level configuration item and the fifth-level configuration item can be newly added in the configuration information adding page. And generating a target program code corresponding to the configuration content information corresponding to each configuration item in the target configuration page by using a target reflection mechanism, namely realizing automatic code generation. And packaging the target program codes to generate a target data packet, and automatically uploading the target data packet (jar packet). For example, after the first-level, second-level and third-level configuration items are created on the background page, java codes can be automatically generated through an automatic packaging function provided by the background, and the java codes are automatically packaged into jar according to the input version number. For the user to introduce into his own project. The user can find out the corresponding value in the project through the interface exposed in jar by using key. That is to say, the five-level configuration item value corresponding to the four-level configuration item key can be obtained by calling the local interface provided by jar, and the specific implementation manner is as follows: the method comprises the steps of determining values of first-stage configuration, second-stage configuration and third-stage configuration, searching data matched with the first-stage configuration, the second-stage configuration and the third-stage configuration in a database through the first-stage configuration, the second-stage configuration and the third-stage configuration, and generating corresponding class classes through java reflection mechanisms. Wherein the class of the secondary configuration is an attribute of the class of the primary configuration. The third-level configuration class is the attribute of the second-level configuration class, the fourth-level configuration is the attribute of the third-level configuration class, and the fifth-level configuration is the value of the corresponding attribute in the third-level class. The user can write corresponding values in the edit boxes corresponding to the configuration items opened in the system configuration page according to own use habits and modes, and after the values are added, the system can automatically add corresponding fields to the corresponding configuration table when the configuration items are clicked and submitted. Correspondingly, the user can also delete the corresponding configuration table and add the corresponding field automatically through the configuration deleting operation on the system configuration page.
The technical scheme of the embodiment of the invention generates the target program code corresponding to the target configuration page by acquiring the configuration content information corresponding to each configuration item in the target configuration page, according to each configuration item, the corresponding configuration content information and the target reflection mechanism, determines the target data packet based on the target program code, and stores each configuration item in the target data packet and the configuration content corresponding to the configuration item to the target storage position, solves the problem of low development efficiency caused by writing parameters into a program in a hard coding mode in the prior art, realizes that the configuration content information corresponding to the required configuration item is input in the target configuration page, and further performs reflection processing on the configuration content information corresponding to the configuration item based on the target reflection mechanism, automatically generates the target program code, and simultaneously packs the target program code into the target data packet, therefore, a user can introduce the target data packet into the project, obtain each configuration item in the target data packet and the configuration content corresponding to the configuration item, apply the configuration items, improve the efficiency of code development and achieve the technical effect of reducing the development cost.
Example four
Fig. 7 is a block diagram of a data storage device according to a fourth embodiment of the present invention. The device includes: a configuration content information acquisition module 310, an object program code generation module 320, and an object data packet determination module 330.
The configuration content information obtaining module 310 is configured to obtain configuration content information corresponding to each configuration item in the target configuration page; a target program code generating module 320, configured to generate a target program code corresponding to the target configuration page according to each configuration item, corresponding configuration content information, and a target reflection mechanism; the target data packet determining module 330 is configured to determine a target data packet based on the target program code, and store each configuration item in the target data packet and configuration content corresponding to the configuration item to a target storage location.
The technical scheme of the embodiment of the invention generates the target program code corresponding to the target configuration page by acquiring the configuration content information corresponding to each configuration item in the target configuration page, according to each configuration item, the corresponding configuration content information and the target reflection mechanism, determines the target data packet based on the target program code, and stores each configuration item in the target data packet and the configuration content corresponding to the configuration item to the target storage position, solves the problem of low development efficiency caused by writing parameters into a program in a hard coding mode in the prior art, realizes that the configuration content information corresponding to the required configuration item is input in the target configuration page, and further performs reflection processing on the configuration content information corresponding to the configuration item based on the target reflection mechanism, automatically generates the target program code, and simultaneously packs the target program code into the target data packet, therefore, a user can introduce the target data packet into the project, obtain each configuration item in the target data packet and the configuration content corresponding to the configuration item, apply the configuration items, improve the efficiency of code development and achieve the technical effect of reducing the development cost.
On the basis of the foregoing apparatus, optionally, the configuration content information obtaining module 310 includes: a target short message template determining unit and a target short message slice type determining unit.
The target configuration page display unit is used for displaying the target configuration page when detecting a control triggering the target configuration page; wherein, the target configuration page comprises a first-level configuration item;
the configuration item display unit is used for displaying a secondary configuration item and a tertiary configuration item in the target configuration page when detecting that a newly-added configuration item control is triggered;
the added configuration information page display unit is used for popping up an added configuration information page if the newly-added configuration item control is detected to be triggered again; the added configuration information page comprises a first-level configuration item, a second-level configuration item, a third-level configuration item and configuration content information corresponding to the configuration items in the target configuration page, keys corresponding to the fourth-level configuration item and the fourth-level configuration item, a fifth-level configuration item and values corresponding to the fifth-level configuration item;
and the configuration content information acquisition unit is used for acquiring the target configuration page and the configuration content information corresponding to each configuration item in the target configuration page when the trigger submission control is detected.
On the basis of the foregoing apparatus, optionally, the object code generating module 320 includes an object analysis result determining unit and an object code generating unit.
The target analysis result determining unit is used for analyzing and processing each configuration item and corresponding configuration content information based on the target reflection mechanism to obtain a target analysis result; the target analysis result comprises a first-level configuration item, a second-level configuration item, a third-level configuration item, a fourth-level configuration item, a fifth-level configuration item and configuration content information corresponding to the configuration items;
and the target program code generating unit is used for generating the target program code based on the target analysis result.
On the basis of the above device, optionally, the target storage location includes a first data table and a second data table; the destination packet determining module 330 includes a destination packet generating unit and a configuration item storing unit.
A target packet generation unit configured to generate the target packet based on the target program code;
a configuration item storage unit, configured to store a first-level configuration item, a second-level configuration item, and a third-level configuration item of the configuration items in the target data packet into a first data table, and store the first-level configuration item, the second-level configuration item, the third-level configuration item, the fourth-level configuration item, and the fifth-level configuration item into a second data table.
On the basis of the above device, optionally, the device further includes: and a content caching module.
And the content caching module is used for caching the content in the second data table into a target cache.
On the basis of the above device, optionally, the device further includes: and a target configuration entity determination module. The target configuration entity determining module comprises a target data class acquiring unit, a target entity determining unit and a target configuration entity acquiring unit.
The data calling device comprises a target data class acquisition unit, a data calling unit and a data calling unit, wherein the target data class acquisition unit is used for acquiring a target data class in a data calling request when the data calling request for calling data is received;
a target entity determining unit, configured to determine a target entity in the target data class by performing parsing on the target data class;
a target configuration entity obtaining unit, configured to obtain a target configuration entity corresponding to the target entity based on the target entity, the first data table, the second data table, and the target cache;
wherein the target configuration entity corresponds to the configuration value corresponding to the five-level configuration item.
On the basis of the foregoing apparatus, optionally, the target configuration entity obtaining unit includes: the target data acquisition subunit to be used, the data acquisition subunit to be matched and the target configuration entity determine the subunits.
A target data to be used acquiring subunit, configured to acquire target data to be used from the second data table or the target cache based on the target entity; the target data to be used comprises a first-level configuration item, a second-level configuration item, a third-level configuration item, a fourth-level configuration item and a fifth-level configuration item;
the data to be matched acquisition subunit is used for acquiring data to be matched from the first data table based on the target entity; the data to be matched comprises the first-level configuration item, the second-level configuration item and the third-level configuration item;
and the target configuration entity determining subunit is used for determining a target configuration entity corresponding to the target entity according to the target data to be used and the data to be matched.
On the basis of the foregoing apparatus, optionally, the determining a subunit by the target configuration entity includes: the target configuration entity determines the cell.
And the target configuration entity determining small unit is used for taking the data corresponding to the five-level configuration item in the target data to be used as the target configuration entity if the first-level configuration item, the second-level configuration item and the third-level configuration item in the target data to be used are the same as the first-level configuration item, the second-level configuration item and the third-level configuration item in the data to be matched.
The data storage device provided by the embodiment of the invention can execute the data storage method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
It should be noted that, the units and modules included in the apparatus are merely divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the embodiment of the invention.
EXAMPLE five
Fig. 8 is a schematic structural diagram of an electronic device according to a fifth embodiment of the present invention. FIG. 8 illustrates a block diagram of an exemplary electronic device 40 suitable for use in implementing embodiments of the present invention. The electronic device 40 shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 8, electronic device 40 is embodied in the form of a general purpose computing device. The components of electronic device 40 may include, but are not limited to: one or more processors or processing units 401, a system memory 402, and a bus 403 that couples the various system components (including the system memory 402 and the processing unit 401).
Bus 403 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic device 40 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by electronic device 40 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 402 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)404 and/or cache memory 405. The electronic device 40 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 406 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 8, and commonly referred to as a "hard drive"). Although not shown in FIG. 8, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 403 by one or more data media interfaces. Memory 402 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 408 having a set (at least one) of program modules 407 may be stored, for example, in memory 402, such program modules 407 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 407 generally perform the functions and/or methods of the described embodiments of the invention.
The electronic device 40 may also communicate with one or more external devices 409 (e.g., keyboard, pointing device, display 410, etc.), with one or more devices that enable a user to interact with the electronic device 40, and/or with any devices (e.g., network card, modem, etc.) that enable the electronic device 40 to communicate with one or more other computing devices. Such communication may be through input/output (I/O) interface 411. Also, the electronic device 40 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 412. As shown, the network adapter 412 communicates with the other modules of the electronic device 40 over the bus 403. It should be appreciated that although not shown in FIG. 4, other hardware and/or software modules may be used in conjunction with electronic device 40, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 401 executes various functional applications and data processing by executing programs stored in the system memory 402, for example, to implement a data storage method provided by an embodiment of the present invention.
EXAMPLE six
An embodiment of the present invention also provides a storage medium containing computer-executable instructions, which when executed by a computer processor, perform a data storage method. The method comprises the following steps:
acquiring configuration content information corresponding to each configuration item in a target configuration page;
generating a target program code corresponding to the target configuration page according to each configuration item, corresponding configuration content information and a target reflection mechanism;
and determining a target data packet based on the target program code, and storing each configuration item in the target data packet and configuration content corresponding to the configuration item to a target storage position.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for embodiments of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A method of storing data, comprising:
acquiring configuration content information corresponding to each configuration item in a target configuration page;
generating a target program code corresponding to the target configuration page according to each configuration item, corresponding configuration content information and a target reflection mechanism;
and determining a target data packet based on the target program code, and storing each configuration item in the target data packet and configuration content corresponding to the configuration item to a target storage position.
2. The method according to claim 1, wherein the obtaining configuration content information corresponding to each configuration item in the target configuration page includes:
when a control triggering the target configuration page is detected, displaying the target configuration page; wherein, the target configuration page comprises a first-level configuration item;
when detecting that a newly added configuration item control is triggered, displaying a secondary configuration item and a tertiary configuration item in the target configuration page;
if the newly-added configuration item control is detected to be triggered again, popping up a configuration information adding page; the added configuration information page comprises a first-level configuration item, a second-level configuration item, a third-level configuration item and configuration content information corresponding to the configuration items in the target configuration page, keys corresponding to the fourth-level configuration item and the fourth-level configuration item, a fifth-level configuration item and values corresponding to the fifth-level configuration item;
and when the trigger submission control is detected, acquiring the target configuration page and configuration content information corresponding to each configuration item in the target configuration page.
3. The method of claim 2, wherein generating the target program code corresponding to the target configuration page according to the configuration items and the corresponding configuration content information and the target reflection mechanism comprises:
analyzing and processing each configuration item and corresponding configuration content information based on the target reflection mechanism to obtain a target analysis result; the target analysis result comprises a first-level configuration item, a second-level configuration item, a third-level configuration item, a fourth-level configuration item, a fifth-level configuration item and configuration content information corresponding to the configuration items;
and generating the target program code based on the target analysis result.
4. The method of claim 1, wherein the target storage location comprises a first data table and a second data table; the determining a target data packet based on the target program code and storing each configuration item in the target data packet and configuration content corresponding to the configuration item to a target storage location includes:
generating the target data packet based on the target program code;
storing a first-level configuration item, a second-level configuration item and a third-level configuration item in each configuration item in the target data packet into a first data table, and storing the first-level configuration item, the second-level configuration item, the third-level configuration item, the fourth-level configuration item and the fifth-level configuration item into a second data table;
and caching the contents in the second data table into a target cache.
5. The method of claim 4, further comprising:
when a data calling request for calling data is received, acquiring a target data class in the data calling request;
determining a target entity in the target data class by analyzing and processing the target data class;
acquiring a target configuration entity corresponding to the target entity based on the target entity, the first data table, the second data table and the target cache;
wherein the target configuration entity corresponds to the configuration value corresponding to the five-level configuration item.
6. The method of claim 5, wherein obtaining the target configuration entity corresponding to the target entity based on the target entity, the first data table, the second data table, and the target cache comprises:
acquiring target data to be used from the second data table or the target cache based on the target entity; the target data to be used comprises a first-level configuration item, a second-level configuration item, a third-level configuration item, a fourth-level configuration item and a fifth-level configuration item;
acquiring data to be matched from the first data table based on the target entity; the data to be matched comprises the first-level configuration item, the second-level configuration item and the third-level configuration item;
and determining a target configuration entity corresponding to the target entity according to the target data to be used and the data to be matched.
7. The method according to claim 1, wherein the determining a target configuration entity corresponding to the target entity according to the target data to be used and the data to be matched comprises:
and if the primary configuration item, the secondary configuration item and the tertiary configuration item in the target data to be used are the same as the primary configuration item, the secondary configuration item and the tertiary configuration item in the data to be matched, taking the data corresponding to the five-level configuration item in the target data to be used as the target configuration entity.
8. A data storage device, comprising:
the configuration content information acquisition module is used for acquiring configuration content information corresponding to each configuration item in the target configuration page;
the target program code generating module is used for generating a target program code corresponding to the target configuration page according to each configuration item, corresponding configuration content information and a target reflection mechanism;
and the target data packet determining module is used for determining a target data packet based on the target program code and storing each configuration item in the target data packet and the configuration content corresponding to the configuration item to a target storage position.
9. An electronic device, characterized in that the device comprises:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement a data storage method as claimed in any one of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the data storage method of any one of claims 1 to 7.
CN202111651777.0A 2021-12-30 2021-12-30 Data storage method and device, electronic equipment and storage medium Pending CN114385142A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111651777.0A CN114385142A (en) 2021-12-30 2021-12-30 Data storage method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111651777.0A CN114385142A (en) 2021-12-30 2021-12-30 Data storage method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114385142A true CN114385142A (en) 2022-04-22

Family

ID=81200189

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111651777.0A Pending CN114385142A (en) 2021-12-30 2021-12-30 Data storage method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114385142A (en)

Similar Documents

Publication Publication Date Title
US8626786B2 (en) Dynamic language checking
CN109558525B (en) Test data set generation method, device, equipment and storage medium
CN109656815B (en) Test statement writing method, device and medium with configuration file and electronic equipment
US11144437B2 (en) Pre-populating continuous delivery test cases
CN113204345A (en) Page generation method and device, electronic equipment and storage medium
CN111241496B (en) Method and device for determining small program feature vector and electronic equipment
CN111694561A (en) Interface management method, device, equipment and storage medium
CN115599386A (en) Code generation method, device, equipment and storage medium
CN112363753A (en) Data verification method and device, electronic equipment and storage medium
CN111913922B (en) Binary structured log generation method, device, equipment and storage medium
CN115237805A (en) Test case data preparation method and device
CN111241180A (en) Information processing method, device, equipment and storage medium
CN113760894A (en) Data calling method and device, electronic equipment and storage medium
CN112799760A (en) Form rendering method and device
CN110175128B (en) Similar code case acquisition method, device, equipment and storage medium
CN109684207B (en) Method and device for packaging operation sequence, electronic equipment and storage medium
CN114385142A (en) Data storage method and device, electronic equipment and storage medium
CN111447268B (en) File structure conversion method, device, equipment and storage medium
US11842165B2 (en) Context-based image tag translation
CN111400623B (en) Method and device for searching information
CN111753548A (en) Information acquisition method and device, computer storage medium and electronic equipment
CN112445790B (en) Report data storage method, device, equipment and medium
CN115134322B (en) File secure transmission method and device, cloud mobile phone platform and storage medium
US11429789B2 (en) Natural language processing and candidate response identification
CN109815325B (en) Answer extraction method, device, server and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination