CN114528338B - Method, device, equipment and medium for dynamically exporting field - Google Patents

Method, device, equipment and medium for dynamically exporting field Download PDF

Info

Publication number
CN114528338B
CN114528338B CN202210059248.XA CN202210059248A CN114528338B CN 114528338 B CN114528338 B CN 114528338B CN 202210059248 A CN202210059248 A CN 202210059248A CN 114528338 B CN114528338 B CN 114528338B
Authority
CN
China
Prior art keywords
attribute
dynamic
control class
preset
attributes
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.)
Active
Application number
CN202210059248.XA
Other languages
Chinese (zh)
Other versions
CN114528338A (en
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.)
Chaozhou Zhuoshu Big Data Industry Development Co Ltd
Original Assignee
Chaozhou Zhuoshu Big Data Industry Development 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 Chaozhou Zhuoshu Big Data Industry Development Co Ltd filed Critical Chaozhou Zhuoshu Big Data Industry Development Co Ltd
Priority to CN202210059248.XA priority Critical patent/CN114528338B/en
Publication of CN114528338A publication Critical patent/CN114528338A/en
Application granted granted Critical
Publication of CN114528338B publication Critical patent/CN114528338B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the specification discloses a method, a device, equipment and a medium for dynamically exporting fields, belongs to the technical field of computers, and is used for solving the problem of too low speed when exporting multiple data volume fields. The method comprises the following steps: receiving an object of a client by using a control class, and obtaining a control class object required by the client; the control class object is a corresponding field in a preset data table; sequentially acquiring object attribute sets of each appointed object in the control class objects based on a preset reflection mechanism; determining a dynamic data group corresponding to each appointed object according to the attribute value corresponding to each attribute in the object attribute set; acquiring a dynamic attribute set of each appointed object based on the dynamic data set; acquiring attribute names corresponding to all object attributes in the dynamic attribute set, so as to derive the corresponding attributes according to the attribute names, and finishing dynamic derivation of the attributes; wherein the attribute corresponds to information of a corresponding field in a preset data table.

Description

Method, device, equipment and medium for dynamically exporting field
Technical Field
The present disclosure relates to the field of service development technologies, and in particular, to a method, an apparatus, a device, and a medium for dynamically exporting a field.
Background
With the rapid development of the domestic internet technology industry, a multipurpose application platform is generated, and the data analysis and information storage with large batch diversification are the main use modes of the current management platform. Data export is one of the more important functions among them.
At present, common data export modes include a mode of fixing data in the background, namely a mode of directly fixing data needing to be exported and then exporting all the data. This approach can lead to problems of too slow data export, timeout and even memory overflow when the amount of data is large or the amount of fields is too large. The other mode is a front-end screening mode, the demand parameters are transmitted into the background together when the parameters are transmitted, and the data meeting the conditions are searched in the database as the conditions after the data are received in the background. This approach also causes problems of timeout and memory overflow when the field size is large.
Therefore, there is a need for a method that can achieve fast export of multiple data volume fields.
Disclosure of Invention
One or more embodiments of the present disclosure provide a method, apparatus, device, and medium for dynamically exporting a field, which are configured to solve the following technical problems: how to provide a method for realizing rapid export of a plurality of fields.
One or more embodiments of the present disclosure adopt the following technical solutions:
one or more embodiments of the present specification provide a method of dynamically exporting a field, the method comprising:
Receiving an object of a client by using a control class, and obtaining a control class object required by the client; wherein, the control class object is a corresponding field in a preset data table;
sequentially acquiring object attribute sets of each appointed object in the control class object based on a preset reflection mechanism;
Determining a dynamic data group corresponding to each appointed object according to the attribute value corresponding to each attribute in the object attribute set;
acquiring a dynamic attribute set of each specified object based on the dynamic data set;
acquiring attribute names corresponding to all object attributes in the dynamic attribute set, and exporting corresponding attributes according to the attribute names to complete dynamic export of the attributes; wherein the attribute corresponds to information of a corresponding field in the preset data table.
In one or more embodiments of the present disclosure, the method further includes, before the receiving, using the control class, the object of the client and obtaining the control class object required by the client:
The client displays the composition fields in the preset table, so as to determine the fields meeting the user requirements in the preset table according to the composition fields, and set attribute values corresponding to the fields meeting the user requirements and other fields, so that a background control class receives the object of the client.
In one or more embodiments of the present disclosure, the determining, according to the attribute value corresponding to each attribute in the object attribute set, a dynamic data set corresponding to each specified object specifically includes:
determining attribute values corresponding to all object attributes in the object attribute set according to the fields meeting the user requirements and the attribute values corresponding to other fields;
Judging whether the attribute value corresponding to each object attribute is empty or not, and obtaining a corresponding judging result;
If the corresponding attribute value is determined not to be null based on the judging result, writing the object attribute and the corresponding attribute value into the corresponding dynamic data group of each appointed object;
And if the corresponding attribute value is determined to be null based on the judging result, screening out the object attribute and the corresponding attribute value.
In one or more embodiments of the present disclosure, the acquiring, in order, the object attribute set of each specified object in the control class object based on a preset reflection mechanism specifically includes:
Sequentially acquiring each appointed object in the control class objects;
Acquiring corresponding fields of the specified objects based on a member acquisition mode of the preset reflection mechanism;
And determining field information of the corresponding field so as to form an object attribute set of each specified object according to the field information.
In one or more embodiments of the present disclosure, before the obtaining an attribute name corresponding to each object attribute in the dynamic attribute set to derive an attribute corresponding to the attribute according to the attribute name to complete dynamic derivation of the attribute, the method further includes:
Generating header data of a preset table corresponding to the dynamic attribute set, and storing attribute names corresponding to all object attributes in the dynamic attribute set into a preset container according to the header data; wherein the header data corresponds to the attribute value in the form of a key value;
and acquiring attribute names corresponding to each object data in the header data according to the attribute values so as to dynamically export the attributes to a preset table.
In one or more embodiments of the present disclosure, the deriving the attribute corresponding to the attribute name to complete the dynamic derivation of the attribute specifically includes:
Acquiring a target row corresponding to the attribute name in the preset data table and data in a target column corresponding to the target row;
And determining key value pair data according to the data in the target column and the position identification of the cell where the data is located, so that the attribute name derives the corresponding attribute to the preset data table based on the key value pair data, and the dynamic derivation of the attribute is completed.
In one or more embodiments of the present disclosure, before the deriving the corresponding attribute to the preset data table, the method further includes:
determining a cell area to be imported with the attribute in the preset data table;
If the target row corresponding to the attribute name exists in the cell area, writing the attribute into a corresponding cell of the column in the cell area under the target row based on the attribute and the key value pair data;
If the target row corresponding to the attribute name does not exist in the cell area, constructing the target row in the preset data table, and writing the attribute into a corresponding cell of the column in the cell area under the target row based on the attribute and the key value pair data.
One or more embodiments of the present specification provide an apparatus for dynamically exporting a field, the apparatus comprising:
The first acquisition module is used for receiving the object of the client by using the control class and acquiring the control class object required by the client; wherein, the control class object is a corresponding field in a preset data table;
the second acquisition module is used for sequentially acquiring object attribute sets of each appointed object in the control class object based on a preset reflection mechanism;
the determining module is used for determining a dynamic data set corresponding to each appointed object according to the attribute value corresponding to each attribute in the object attribute set;
The third acquisition module is used for acquiring the dynamic attribute set of each specified object based on the dynamic data set;
The export module is used for acquiring attribute names corresponding to all object attributes in the dynamic attribute set so as to export the corresponding attributes according to the attribute names, thereby completing dynamic export of the attributes; wherein the attribute corresponds to information of a corresponding field in the preset data table.
One or more embodiments of the present specification provide an apparatus for dynamically exporting a field, comprising:
at least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to:
Receiving an object of a client by using a control class, and obtaining a control class object required by the client; wherein, the control class object is a corresponding field in a preset data table;
sequentially acquiring object attribute sets of each appointed object in the control class object based on a preset reflection mechanism;
Determining a dynamic data group corresponding to each appointed object according to the attribute value corresponding to each attribute in the object attribute set;
acquiring a dynamic attribute set of each specified object based on the dynamic data set;
acquiring attribute names corresponding to all object attributes in the dynamic attribute set, and exporting corresponding attributes according to the attribute names to complete dynamic export of the attributes; wherein the attribute corresponds to information of a corresponding field in the preset data table.
One or more embodiments of the present specification provide a non-volatile computer storage medium storing computer-executable instructions configured to:
Receiving an object of a client by using a control class, and obtaining a control class object required by the client; wherein, the control class object is a corresponding field in a preset data table;
sequentially acquiring object attribute sets of each appointed object in the control class object based on a preset reflection mechanism;
Determining a dynamic data group corresponding to each appointed object according to the attribute value corresponding to each attribute in the object attribute set;
acquiring a dynamic attribute set of each specified object based on the dynamic data set;
acquiring attribute names corresponding to all object attributes in the dynamic attribute set, and exporting corresponding attributes according to the attribute names to complete dynamic export of the attributes; wherein the attribute corresponds to information of a corresponding field in the preset data table.
The above-mentioned at least one technical scheme that this description embodiment adopted can reach following beneficial effect:
And the corresponding attribute is derived according to the attribute name, so that the operation of manually screening the derived information by a user is reduced, the derived time is shortened, and the overtime is avoided. The dynamic data set of each appointed object is determined based on the object attribute set, dynamic flexible export of data is realized based on reflection and a mechanism, accurate field inquiry is realized, the problems of overtime and memory overflow caused by a large number of data inquiry can be effectively avoided, and the complicated data editing and processing process is avoided.
Drawings
In order to more clearly illustrate the embodiments of the present description or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some of the embodiments described in the present description, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art. In the drawings:
Fig. 1 is a flowchart of a method for dynamically exporting a field according to an embodiment of the present disclosure;
Fig. 2 is a schematic flow chart of a reflection mechanism analysis object generating data in an application scenario according to an embodiment of the present disclosure;
fig. 3 is a schematic diagram of an internal structure of a device for dynamically exporting a field according to an embodiment of the present disclosure;
Fig. 4 is a schematic diagram of an internal structure of a device for dynamically exporting a field according to an embodiment of the present disclosure;
Fig. 5 is a schematic diagram of an internal structure of a nonvolatile storage medium according to an embodiment of the present disclosure.
Detailed Description
The embodiment of the specification provides a method, a device, equipment and a medium for dynamically exporting a field.
In order to make the technical solutions in the present specification better understood by those skilled in the art, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only some embodiments of the present specification, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, shall fall within the scope of the present disclosure.
As shown in FIG. 1, one or more embodiments of the present description provide a method of dynamically exporting a field.
The scheme is applied to various application fields needing large-batch diversified data analysis, such as library summarization systems needing book statistics, meeting and recording fields needing to derive various expenses, and the like, and is executed by a background server or execution units of a system in each field needing to derive data. As can be seen from fig. 1, the method comprises the steps of:
S101: receiving an object of a client by using a control class, and obtaining a control class object required by the client; the control class object is a corresponding field in a preset data table.
With the arrival of big data age and the rapid development of internet technology, various business systems of practical application contain a large amount of business report data, and often have the requirement that business related reports export Excel forms. The current common data export mode mainly comprises the following two cases:
The method is characterized in that the data is fixed in the background, namely the data needing to be exported is directly fixed according to the product design, and then all the data are exported. In the case of a small number of data fields, the derivation is too slow, and the time-out and even the overflow are caused, so that the requirements of users cannot be met.
And secondly, a front-end screening mode and when parameters are transmitted, the required parameters are transmitted into a background together, and the background receives the required parameters and then uses the required parameters as conditions to search the database for data meeting the conditions. The method is a screening means commonly used at present, and can meet the query requirement of users. However, the derived data template is fixed, that is, the user cannot control the derived fields according to the own needs, if the derived fields are derived from all the fields, the conditions of overtime and memory overflow can be caused when the derived fields are large, and meanwhile, the user needs to manually screen the data required by the user, so that the workload is increased. When a plurality of classes are exported, the service codes are required to be written according to different classes, and the service is repeated and is not replaceable, so that the codes are redundant, difficult to comb and cannot be flexibly changed.
In order to solve the problems, a way for realizing rapid export of multiple data fields is provided, and the scheme can directly cope with export of different classes and different conditions based on an object and a reflection mechanism, so that repetitive work in a service processing process is greatly reduced, and rapid export of multiple data fields is realized by simplifying codes. And the first and second stations use the control class to receive the crying short object, and obtain the control class object required by the client. In order to realize that the field is exported to the corresponding preset data table, namely Excel, the control class object is the corresponding field in the preset table.
In one or more embodiments of the present disclosure, a control class is used to receive an object of a client, and before obtaining a control class object required by the client, the client needs to transmit the object to a background, and the method includes the following steps:
And the client displays all field information of the composition fields in the preset table, so that the fields meeting the user requirements in the preset table are determined according to the composition fields. And setting the fields meeting the requirements of the user and attribute values corresponding to other fields, so that the background control class receives the object of the client. At this time, it should be noted that the correspondence between the front end and the client and the object attribute of the background is ensured to correctly derive the required field.
In an application scenario, a method comprises: after the client displays all the field information in the preset data table, the user can selectively check the required fields according to the requirements. An initial value is then set for the selected desired field, while the undesired field may be set to null, with the field as the object to enable the background to receive the selected object.
S102: and sequentially acquiring object attribute sets of each appointed object in the control class object based on a preset reflection mechanism.
The reflection mechanism is a powerful tool in java, which can make it convenient to create flexible code that can be assembled during re-execution without source code links between components. Attributes, methods, construction methods, etc. of Java objects can be accessed through a reflection mechanism. Therefore, according to a preset reflection mechanism, the appointed object in the control class can be acquired according to a getclass method in Java language, so that the appointed class is used as a parent class to traverse based on fields contained in the appointed class acquired by reflection, and an object attribute set corresponding to each appointed object is acquired.
S103: and determining a dynamic data group corresponding to each specified object according to the attribute value corresponding to each attribute in the object attribute set.
As can be seen from the above step S101, the object received in the background includes the fields meeting the user 'S requirements and other fields not meeting the user' S requirements. In order to reduce manual screening to realize flexible export information, the attribute in each specified object needs to be screened according to the attribute value so as to obtain the field which is required by the preset data table and meets the requirement of the user, and flexible export of the field is realized. As shown in fig. 2, in one or more embodiments of the present disclosure, a flow chart of a reflection mechanism analysis object generation array in an application scenario is provided. As can be seen from fig. 2, in one or more embodiments of the present disclosure, determining a dynamic data set corresponding to each specified object according to an attribute value corresponding to each attribute in an object attribute set specifically includes the following steps:
Firstly, according to the fields meeting the user requirements and the attribute values corresponding to other fields set in the step S101, determining the attribute values corresponding to the object attributes in the object attribute set. And then judging whether the attribute value corresponding to each object attribute is empty or not, and obtaining a corresponding judging result. And if the corresponding attribute value is determined not to be null according to the judging result, writing the object attribute and the corresponding attribute value into the corresponding dynamic data group of each appointed object. And if the corresponding attribute value is determined to be null according to the judging result, screening out the object attribute and the corresponding attribute value. It is understood that, when the attribute value is null, the field is not needed, and when the attribute value is not null, the field is needed to be exported.
S104: and acquiring a dynamic attribute set of each specified object based on the dynamic data set.
After the dynamic data set corresponding to each specified object is obtained according to the step S103, in order to meet different export requirements of different classes, the export attribute set required by each object is directly obtained. In one or more embodiments of the present disclosure, a dynamic attribute set of each specified object in a control class object is sequentially acquired based on a preset reflection mechanism, which specifically includes the following steps: firstly, each appointed object in the control class object is obtained, and then, corresponding fields of each appointed object are obtained according to a member obtaining mode of a preset reflection mechanism. And then determining field information of fields corresponding to the specified objects, and combining the determined field information to form an object attribute set required to be exported by the specified objects.
S105: acquiring attribute names corresponding to all object attributes in the dynamic attribute set, and exporting corresponding attributes according to the attribute names to complete dynamic export of the attributes; wherein the attribute corresponds to information of a corresponding field in the preset data table.
In order to flexibly derive a large number of fields into a corresponding preset data table, the problems of overtime and memory overflow caused by a large number of data inquiry are effectively avoided. In one or more embodiments of the present disclosure, before obtaining an attribute name corresponding to each object attribute in the dynamic attribute set to derive an attribute corresponding to the attribute according to the attribute name and complete dynamic derivation of the attribute, the method further includes:
and generating header data of a preset table corresponding to the dynamic attribute set while generating the dynamic attribute set. And storing attribute names corresponding to the attributes of each object in the dynamic attribute set into a preset container according to the header data. Wherein, it should be noted that the header data corresponds to the attribute value in the form of a key value. And when judging the attribute value, acquiring the attribute name corresponding to each object data in the header data according to the attribute value so as to dynamically export the attribute to a preset table. Wherein, the preset container is Map, and the Map exists in the following manner: userName, user name, which is mainly used for the user to generate the attribute name of the corresponding value while acquiring the attribute set, and filling the header when deriving excel.
Specifically, in one or more embodiments of the present disclosure, the deriving the attribute corresponding to the attribute name to complete the dynamic derivation of the attribute specifically includes: the method comprises the steps of firstly obtaining a target row corresponding to an attribute name in a preset data table and data in a target column corresponding to the target row. And then determining the key value pair data according to the data in the target column and the position identification of the cell where the data is located. So that the attribute names are based on the key value pair data, the corresponding attributes are exported to a preset data table, and the dynamic export of the attributes is completed.
In order to ensure that a required field can be exported to a preset data table, in one or more embodiments of the present disclosure, before exporting a corresponding attribute to the preset data table, it needs to be determined whether there is a location in the preset data table where the field can be stored, where the specific method includes the following steps: determining a cell area to be imported with the attribute in the preset data table, and if a target row corresponding to the attribute name exists in the cell area of the preset data table, writing the attribute into a corresponding cell of the cell area and a column under the target row according to the attribute and the key value pair data. And if the target row corresponding to the attribute name does not exist in the cell area, constructing the target row in the preset data table, and writing the attribute into a corresponding cell of the cell area and a column under the target row based on the attribute and the key value pair data.
In one or more embodiments of the present disclosure, the object attribute set obtained by reflection may be directly used to fill the query structured language SQL, to implement a partial query, and the accurate field query returns a data set that consumes less resources than all queries, so as to effectively reduce the time of data retrieval. And directly obtaining an object attribute set for export through a reflection class tool, and filling a header set and a precision query sql field of a preset data table. If headers is set as the type, the name and the address, the book taking time and the number of the confetti are set according to the attribute value key of each field, the corresponding header data can be obtained. Table data derived in an application scenario is shown in table 1 below. The process effectively reduces the integration process of processing data due to the one-to-one correspondence between the attributes and the fields.
TABLE 1 Table data exported in an application scenario
As shown in fig. 3, in one or more embodiments of the present description, an internal structural diagram of an apparatus for dynamically exporting fields is provided.
As can be seen from fig. 3, the device comprises:
A first obtaining module 301, configured to receive an object of a client using a control class, and obtain a control class object required by the client; wherein, the control class object is a corresponding field in a preset data table;
A second obtaining module 302, configured to sequentially obtain an object attribute set of each specified object in the control class object based on a preset reflection mechanism;
a determining module 303, configured to determine a dynamic data set corresponding to each specified object according to attribute values corresponding to each attribute in the object attribute set;
a third obtaining module 304, configured to obtain a dynamic attribute set of each specified object based on the dynamic data set;
The export module 305 is configured to obtain attribute names corresponding to the object attributes in the dynamic attribute set, so as to export the corresponding attributes according to the attribute names, so as to complete dynamic export of the attributes; wherein the attribute corresponds to information of a corresponding field in the preset data table.
In one or more embodiments of the present description, the apparatus further comprises: a display module;
the display module is used for displaying the composition fields in the preset table by the client so as to determine the fields meeting the user requirements in the preset table according to the composition fields, and set attribute values corresponding to the fields meeting the user requirements and other fields so that the background control class can receive the objects of the client.
In one or more embodiments of the present specification, the determining module specifically includes: the device comprises an attribute determining module, a judging module, a first writing module and a screening module;
the attribute determining module is configured to determine an attribute value corresponding to each object attribute in the object attribute set according to the field meeting the user requirement and attribute values corresponding to the other fields;
The judging module is used for judging whether the attribute value corresponding to each object attribute is empty or not, and obtaining a corresponding judging result;
The first writing module is configured to write the object attribute and the corresponding attribute value into the corresponding dynamic data set of each specified object if the corresponding attribute value is determined not to be null based on the determination result;
And the screening module is used for screening out the object attribute and the corresponding attribute value if the corresponding attribute value is determined to be empty based on the judging result.
In one or more embodiments of the present disclosure, the second obtaining module specifically includes: the fourth acquisition module, the fifth acquisition module and the forming module;
the fourth acquisition module is used for sequentially acquiring each appointed object in the control class objects;
The fifth obtaining module is configured to obtain corresponding fields of the specified objects based on a member obtaining manner of the preset reflection mechanism;
the composing module is configured to determine field information of the corresponding field, so as to compose an object attribute set of each specified object according to the field information.
In one or more embodiments of the present disclosure, the third obtaining module specifically includes: the device comprises a generation module and a name acquisition module;
The generation module is used for generating header data of a preset table corresponding to the dynamic attribute set so as to store attribute names corresponding to all object attributes in the dynamic attribute set into a preset container according to the header data; wherein the header data corresponds to the attribute value in the form of a key value;
The name acquisition module is used for acquiring the attribute names corresponding to the object data in the header data according to the attribute values so as to dynamically export the attributes to a preset table.
In one or more embodiments of the present disclosure, the deriving module specifically includes: a sixth acquisition module and a key value determination module;
The sixth obtaining module is configured to obtain a target row corresponding to the attribute name in the preset data table, and data in a target column corresponding to the target row;
And the key value determining module is used for determining key value pair data according to the data in the target column and the position identification of the cell where the data is located, so that the attribute name is based on the key value pair data, the corresponding attribute is exported to the preset data table, and the dynamic export of the attribute is completed.
In one or more embodiments of the present description, the apparatus further comprises: the device comprises a region determining module, a second writing module and a third writing module;
The region determining module is used for determining a cell region to be imported with the attribute in the preset data table;
the second writing module is configured to, if a target row corresponding to the attribute name exists in the cell area, write the attribute into a corresponding cell of a column in the cell area under the target row based on the attribute and the key pair data;
And the third writing module is configured to construct the target row in the preset data table if the target row corresponding to the attribute name does not exist in the cell area, and write the attribute into a corresponding cell of the cell area and a column under the target row based on the attribute and the key value pair data.
As shown in fig. 4, in one or more embodiments of the present disclosure, a schematic diagram of an internal structure of a device for dynamically exporting a field is provided.
As can be seen from fig. 4, the apparatus comprises:
At least one processor 401; and
A memory 402 communicatively coupled to the at least one processor 401; wherein,
The memory 402 stores instructions executable by the at least one processor 401, the instructions being executable by the at least one processor 401 to enable the at least one processor 401 to:
Receiving an object of a client by using a control class, and obtaining a control class object required by the client; wherein, the control class object is a corresponding field in a preset data table;
sequentially acquiring object attribute sets of each appointed object in the control class object based on a preset reflection mechanism;
Determining a dynamic data group corresponding to each appointed object according to the attribute value corresponding to each attribute in the object attribute set;
acquiring a dynamic attribute set of each specified object based on the dynamic data set;
acquiring attribute names corresponding to all object attributes in the dynamic attribute set, and exporting corresponding attributes according to the attribute names to complete dynamic export of the attributes; wherein the attribute corresponds to information of a corresponding field in the preset data table.
As shown in fig. 5, in one or more embodiments of the present specification, a schematic internal structure of a nonvolatile storage medium is provided.
As can be seen from fig. 5, a non-volatile storage medium stores computer executable instructions 501, the executable instructions 501 comprising:
Receiving an object of a client by using a control class, and obtaining a control class object required by the client; wherein, the control class object is a corresponding field in a preset data table;
sequentially acquiring object attribute sets of each appointed object in the control class object based on a preset reflection mechanism;
Determining a dynamic data group corresponding to each appointed object according to the attribute value corresponding to each attribute in the object attribute set;
acquiring a dynamic attribute set of each specified object based on the dynamic data set;
acquiring attribute names corresponding to all object attributes in the dynamic attribute set, and exporting corresponding attributes according to the attribute names to complete dynamic export of the attributes; wherein the attribute corresponds to information of a corresponding field in the preset data table.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for apparatus, devices, non-volatile computer storage medium embodiments, the description is relatively simple, as it is substantially similar to method embodiments, with reference to the section of the method embodiments being relevant.
The foregoing describes specific embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
The foregoing is merely one or more embodiments of the present description and is not intended to limit the present description. Various modifications and alterations to one or more embodiments of this description will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, or the like, which is within the spirit and principles of one or more embodiments of the present description, is intended to be included within the scope of the claims of the present description.

Claims (10)

1. A method of dynamically exporting a field, the method comprising:
Receiving an object of a client by using a control class, and obtaining a control class object required by the client; wherein, the control class object is a corresponding field in a preset data table;
sequentially acquiring object attribute sets of each appointed object in the control class object based on a preset reflection mechanism;
Determining a dynamic data group corresponding to each appointed object according to the attribute value corresponding to each attribute in the object attribute set;
acquiring a dynamic attribute set of each specified object based on the dynamic data set;
acquiring attribute names corresponding to all object attributes in the dynamic attribute set, and exporting corresponding attributes according to the attribute names to complete dynamic export of the attributes; wherein the attribute corresponds to information of a corresponding field in the preset data table.
2. The method of claim 1, wherein the receiving the object of the client using the control class, before obtaining the control class object required by the client, further comprises:
The client displays the composition fields in the preset data table, so as to determine the fields meeting the user requirements in the preset data table according to the composition fields, and set attribute values corresponding to the fields meeting the user requirements and other fields, so that a background control class receives the object of the client.
3. The method for dynamically exporting a field according to claim 2, wherein the determining the dynamic data group corresponding to each specified object according to the attribute value corresponding to each attribute in the object attribute set specifically includes:
determining attribute values corresponding to all object attributes in the object attribute set according to the fields meeting the user requirements and the attribute values corresponding to other fields;
Judging whether the attribute value corresponding to each object attribute is empty or not, and obtaining a corresponding judging result;
If the corresponding attribute value is determined not to be null based on the judging result, writing the object attribute and the corresponding attribute value into the corresponding dynamic data group of each appointed object;
And if the corresponding attribute value is determined to be null based on the judging result, screening out the object attribute and the corresponding attribute value.
4. The method for dynamically exporting a field according to claim 1, wherein the sequentially obtaining, based on a preset reflection mechanism, an object attribute set of each specified object in the control class object specifically includes:
Sequentially acquiring each appointed object in the control class objects;
Acquiring corresponding fields of the specified objects based on a member acquisition mode of the preset reflection mechanism;
And determining field information of the corresponding field so as to form an object attribute set of each specified object according to the field information.
5. The method according to claim 1, wherein before obtaining an attribute name corresponding to each object attribute in the dynamic attribute set to derive an attribute corresponding to the attribute name to complete dynamic derivation of the attribute, the method further comprises:
Generating header data of a preset data table corresponding to the dynamic attribute set, and storing attribute names corresponding to all object attributes in the dynamic attribute set into a preset container according to the header data; wherein the header data corresponds to the attribute value in the form of a key value;
And acquiring attribute names corresponding to each object data in the header data according to the attribute values so as to dynamically export the attributes to a preset data table.
6. The method for dynamically exporting a field according to claim 1, wherein the exporting an attribute corresponding to the attribute name to complete the dynamic exporting of the attribute specifically includes:
Acquiring a target row corresponding to the attribute name in the preset data table and data in a target column corresponding to the target row;
And determining key value pair data according to the data in the target column and the position identification of the cell where the data is located, so that the attribute name derives the corresponding attribute to the preset data table based on the key value pair data, and the dynamic derivation of the attribute is completed.
7. The method of claim 6, wherein before said deriving the corresponding attribute to the preset data table, the method further comprises:
determining a cell area to be imported with the attribute in the preset data table;
If the target row corresponding to the attribute name exists in the cell area, writing the attribute into a corresponding cell of the column in the cell area under the target row based on the attribute and the key value pair data;
If the target row corresponding to the attribute name does not exist in the cell area, constructing the target row in the preset data table, and writing the attribute into a corresponding cell of the column in the cell area under the target row based on the attribute and the key value pair data.
8. An apparatus for dynamically exporting a field, the apparatus comprising:
The first acquisition module is used for receiving the object of the client by using the control class and acquiring the control class object required by the client; wherein, the control class object is a corresponding field in a preset data table;
the second acquisition module is used for sequentially acquiring object attribute sets of each appointed object in the control class object based on a preset reflection mechanism;
the determining module is used for determining a dynamic data set corresponding to each appointed object according to the attribute value corresponding to each attribute in the object attribute set;
The third acquisition module is used for acquiring the dynamic attribute set of each specified object based on the dynamic data set;
The export module is used for acquiring attribute names corresponding to all object attributes in the dynamic attribute set so as to export the corresponding attributes according to the attribute names, thereby completing dynamic export of the attributes; wherein the attribute corresponds to information of a corresponding field in the preset data table.
9. An apparatus for dynamically exporting a field, the apparatus comprising:
at least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to:
Receiving an object of a client by using a control class, and obtaining a control class object required by the client; wherein, the control class object is a corresponding field in a preset data table;
sequentially acquiring object attribute sets of each appointed object in the control class object based on a preset reflection mechanism;
Determining a dynamic data group corresponding to each appointed object according to the attribute value corresponding to each attribute in the object attribute set;
acquiring a dynamic attribute set of each specified object based on the dynamic data set;
acquiring attribute names corresponding to all object attributes in the dynamic attribute set, and exporting corresponding attributes according to the attribute names to complete dynamic export of the attributes; wherein the attribute corresponds to information of a corresponding field in the preset data table.
10. A non-volatile storage medium storing computer-executable instructions, the computer-executable instructions comprising:
Receiving an object of a client by using a control class, and obtaining a control class object required by the client; wherein, the control class object is a corresponding field in a preset data table;
sequentially acquiring object attribute sets of each appointed object in the control class object based on a preset reflection mechanism;
Determining a dynamic data group corresponding to each appointed object according to the attribute value corresponding to each attribute in the object attribute set;
acquiring a dynamic attribute set of each specified object based on the dynamic data set;
acquiring attribute names corresponding to all object attributes in the dynamic attribute set, and exporting corresponding attributes according to the attribute names to complete dynamic export of the attributes; wherein the attribute corresponds to information of a corresponding field in the preset data table.
CN202210059248.XA 2022-01-19 2022-01-19 Method, device, equipment and medium for dynamically exporting field Active CN114528338B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210059248.XA CN114528338B (en) 2022-01-19 2022-01-19 Method, device, equipment and medium for dynamically exporting field

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210059248.XA CN114528338B (en) 2022-01-19 2022-01-19 Method, device, equipment and medium for dynamically exporting field

Publications (2)

Publication Number Publication Date
CN114528338A CN114528338A (en) 2022-05-24
CN114528338B true CN114528338B (en) 2024-05-10

Family

ID=81621208

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210059248.XA Active CN114528338B (en) 2022-01-19 2022-01-19 Method, device, equipment and medium for dynamically exporting field

Country Status (1)

Country Link
CN (1) CN114528338B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103077185A (en) * 2012-12-18 2013-05-01 厦门雅迅网络股份有限公司 Object-based user-defined information-expanding method
CN111240739A (en) * 2020-01-21 2020-06-05 烽火通信科技股份有限公司 Dynamic concurrent distribution method and system for associated attributes of objects
CN111367976A (en) * 2020-02-28 2020-07-03 平安医疗健康管理股份有限公司 Method and device for exporting EXCEL file data based on JAVA reflection mechanism
CN113239106A (en) * 2021-06-04 2021-08-10 平安科技(深圳)有限公司 Excel file export method and device, electronic equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9934258B2 (en) * 2014-03-31 2018-04-03 Oracle International Corporation Dynamic generation of database views and class objects for providing access to repository data

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103077185A (en) * 2012-12-18 2013-05-01 厦门雅迅网络股份有限公司 Object-based user-defined information-expanding method
CN111240739A (en) * 2020-01-21 2020-06-05 烽火通信科技股份有限公司 Dynamic concurrent distribution method and system for associated attributes of objects
CN111367976A (en) * 2020-02-28 2020-07-03 平安医疗健康管理股份有限公司 Method and device for exporting EXCEL file data based on JAVA reflection mechanism
CN113239106A (en) * 2021-06-04 2021-08-10 平安科技(深圳)有限公司 Excel file export method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN114528338A (en) 2022-05-24

Similar Documents

Publication Publication Date Title
CN110210731A (en) Reminding task distribution method, device, computer equipment and storage medium
CA2497742A1 (en) Real-time aggregation of data within an enterprise planning environment
CN105574052A (en) Database query method and apparatus
CN110543303A (en) Visual business platform
CN111026670B (en) Test case generation method, test case generation device and storage medium
Fekete Progressivis: A toolkit for steerable progressive analytics and visualization
CN110597842A (en) Service data query method and system
CN112286934A (en) Database table importing method, device, equipment and medium
CN111126019A (en) Report generation method and device based on mode customization and electronic equipment
CN110198327B (en) Data transmission method and related equipment
CN114594927A (en) Low code development method, device, system, server and storage medium
CN114090760B (en) Data processing method of table question and answer, electronic equipment and readable storage medium
CN111666344A (en) Heterogeneous data synchronization method and device
CN112162982B (en) Data query method, device, equipment and medium
US20170132195A1 (en) Method and Apparatus Providing Contextual Suggestion in Planning Spreadsheet
CN114528338B (en) Method, device, equipment and medium for dynamically exporting field
US12056446B2 (en) Method and system for improved spreadsheet analytical functioning
CN112306420B (en) Data read-write method, device and equipment based on storage pool and storage medium
CN115617338A (en) Method and device for quickly generating service page and readable storage medium
CN113254455B (en) Dynamic configuration method and device of database, computer equipment and storage medium
CN115586988A (en) Method and device for recovering data, electronic equipment and storage medium
CN114968917A (en) Method and device for rapidly importing file data
CN114356403A (en) Configuration data processing method, device and system based on low-code application development
CN111767044A (en) Software development working platform interface visualization method
CN112632115A (en) BI-based data query method and system

Legal Events

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