CN108897897B - Data processing method and device - Google Patents

Data processing method and device Download PDF

Info

Publication number
CN108897897B
CN108897897B CN201810819845.1A CN201810819845A CN108897897B CN 108897897 B CN108897897 B CN 108897897B CN 201810819845 A CN201810819845 A CN 201810819845A CN 108897897 B CN108897897 B CN 108897897B
Authority
CN
China
Prior art keywords
embedded model
data processing
embedded
data
parameter
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
CN201810819845.1A
Other languages
Chinese (zh)
Other versions
CN108897897A (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.)
Appeon Technology Shenzhen Co ltd
Original Assignee
Appeon Technology Shenzhen 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 Appeon Technology Shenzhen Co ltd filed Critical Appeon Technology Shenzhen Co ltd
Priority to CN201810819845.1A priority Critical patent/CN108897897B/en
Publication of CN108897897A publication Critical patent/CN108897897A/en
Application granted granted Critical
Publication of CN108897897B publication Critical patent/CN108897897B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention belongs to the technical field of software development, and discloses a data processing method and a data processing device, which are applied to an ORM framework, wherein the ORM framework is provided with an embedded model established according to a data table, the embedded model forms a hierarchical structure through embedded model attributes and embedded model attributes, and the method receives a data processing interface instruction; acquiring a specific label in the embedded model corresponding to the data processing interface instruction; executing operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label; and obtaining an operation result. Because the embedded model with the hierarchical structure is adopted in the invention, when the server side operates, only the embedded model needs to be operated relatively, and the related data of other data tables which have the relationship with the data table corresponding to the embedded model can be automatically acquired, thereby greatly reducing the operation steps and the code compiling quantity.

Description

Data processing method and device
Technical Field
The present invention relates to the field of software development technologies, and in particular, to a data processing method and apparatus.
Background
With the development of cloud computing technology, a multi-layer architecture (n-tier) gradually replaces a client-server architecture (c/s) to become a mainstream architecture for relational database application development. The multi-layer architecture may include an application structure having multiple layers, for example, a data access layer, a service logic layer, and a presentation layer.
In the data access layer, an Object-relational mapping (ORM) framework is a common development framework.
Because the tables in the relational database are data tables with a two-dimensional structure, namely, data tables with a structure of rows and columns, the models created by using the data tables corresponding to the ORM frame are usually also of the two-dimensional structure, but the model with the two-dimensional structure has poor flexibility, and when a server side programs, if a plurality of data tables have relevance, the plurality of data tables need to be respectively established and written with codes, so that the workload is high, the calling is more complicated, and the processing efficiency is not high.
Disclosure of Invention
In view of this, the embodiment of the present invention discloses a data processing method and apparatus, so as to extend the functions of the conventional ORM framework, and in the case of complex situations, only one model needs to be operated, thereby simplifying the processing flow.
In order to achieve the above purpose, the embodiments of the present invention disclose the following:
the invention discloses a data processing method, which is applied to an ORM framework, wherein the ORM framework is provided with an embedded model which is established according to a data sheet, the embedded model forms a hierarchical structure through an embedded model attribute and an embedded model attribute, and the embedded model attribute comprises data of at least one other data sheet which has the same specific field with the data sheet corresponding to the embedded model; the embedded model attribute comprises a specific label, and the specific label is used for realizing the association operation of the embedded model attribute and the embedded model attribute, and the method comprises the following steps:
receiving a data processing interface instruction;
acquiring a specific label in the embedded model corresponding to the data processing interface instruction;
executing operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label;
and obtaining an operation result.
Optionally, the method further includes:
adding a parameter to be updated into an update list and associating the parameter to be updated with the attribute of the corresponding embedded model according to a calling programming interface instruction; wherein, the update list belongs to a part of the ORM framework and is used for storing data to be updated;
when an instruction for executing the updating list is received, sequentially acquiring the attributes of the embedded models corresponding to the data to be updated in the updating list;
generating a plurality of database updating sentences corresponding to the acquired attributes of the embedded model according to the acquired attributes of the embedded model;
and sequentially operating a plurality of database updating sentences to update the database.
Optionally, the embedded model attribute includes an automatic assignment specific label and an embedded model state specific label;
the automatic assignment specific labels comprise embedded model attributes used for representing data sources, embedded model attributes used for representing filling targets and assignment strategies;
the embedded model state specific label comprises a first parameter for characterizing the type of the embedded model, a second parameter for characterizing the source of the parameter when the embedded model queries in a cascade, a third parameter for characterizing that the embedded model can realize cascade addition and a fourth parameter for characterizing that the embedded model can realize cascade deletion.
Optionally, the data processing interface instruction is a query interface instruction;
executing the operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label specifically comprises:
determining an embedded model corresponding to the query interface instruction;
acquiring an embedded model state specific label of a relation between an embedded model and an embedded model in the embedded model defined by a user;
acquiring a parameter value corresponding to the embedded model attribute according to the second parameter;
querying a plurality of data tables associated with the embedded model using the parameter values as query parameters.
Optionally, the data processing interface instruction is an interface increasing instruction;
executing the operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label specifically comprises:
determining an embedded model corresponding to the interface adding instruction;
acquiring an automatic assignment specific label in the embedded model defined by a user;
and storing the parameter values in the interface increasing instruction into the attributes of the embedded model, and assigning the attributes of the embedded model to the attributes of the embedded model according to the assignment strategy in the automatic assignment specific label.
Optionally, the data processing interface instruction is a delete interface instruction;
executing the operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label specifically comprises:
determining an embedded model corresponding to the interface deleting instruction;
acquiring a specific label of an embedded model in the embedded model;
and deleting the embedded model attribute corresponding to the fourth parameter in the embedded model according to the fourth parameter.
Optionally, the data processing interface instruction is a modify interface instruction;
executing the operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label specifically comprises:
determining an embedded model corresponding to the interface modification instruction;
obtaining an automatic assignment specific label in the embedded model;
and modifying the attribute of the embedded model according to the parameter value in the modification interface instruction, and assigning the attribute of the embedded model to the attribute of the embedded model according to the assignment strategy in the automatic assignment specific label.
The invention discloses a data processing device, which is applied to an ORM framework, wherein the ORM framework is provided with an embedded model established according to a data sheet, the embedded model forms a hierarchical structure through an embedded model attribute and an embedded model attribute, and the embedded model attribute comprises data of at least one other data sheet which has the same specific field with the data sheet corresponding to the embedded model; the embedded model attribute comprises a specific label, and the specific label is used for realizing the association operation of the embedded model attribute and the embedded model attribute, and the method comprises the following steps:
a receiving unit for receiving a data processing interface instruction;
the acquisition unit is used for acquiring a specific label in the embedded model corresponding to the data processing interface instruction;
the execution unit is used for executing the operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label; and obtaining an operation result.
Optionally, the method further includes:
the adding list unit is used for adding the parameters to be updated into the updating list and associating the parameters to be updated with the attributes of the corresponding embedded models according to the calling programming interface instruction; wherein, the update list belongs to a part of the ORM framework and is used for storing data to be updated;
the updating list unit is used for sequentially acquiring the attributes of the embedded models corresponding to the data to be updated in the updating list when receiving an instruction for executing the updating list;
the sentence generating unit is used for generating a plurality of database updating sentences corresponding to the obtained attributes of the embedded model according to the obtained attributes of the embedded model;
and the database updating unit is used for sequentially operating a plurality of database updating sentences to update the database.
Optionally, the embedded model attribute includes an automatic assignment specific label and an embedded model state specific label;
the automatic assignment specific labels comprise embedded model attributes used for representing data sources, embedded model attributes used for representing filling targets and assignment strategies;
the embedded model state specific label comprises a first parameter for characterizing the type of the embedded model, a second parameter for characterizing the source of the parameter when the embedded model queries in a cascade, a third parameter for characterizing that the embedded model can realize cascade addition and a fourth parameter for characterizing that the embedded model can realize cascade deletion.
It can be seen from the above solutions that the embodiments of the present invention disclose a data processing method and apparatus, which are applied to an ORM framework, where the ORM framework has an embedded model built according to a data table, the embedded model forms a hierarchical structure by an embedded model attribute and an embedded model attribute, and the embedded model attribute includes data of at least one other data table having the same specific field as the data table corresponding to the embedded model; the embedded model attribute comprises a specific label, the specific label is used for realizing the association operation of the embedded model attribute and the embedded model attribute, and the method receives a data processing interface instruction; acquiring a specific label in the embedded model corresponding to the data processing interface instruction; executing operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label; and obtaining an operation result. Because the embedded model with the hierarchical structure is adopted in the invention, when the server side operates, only the embedded model needs to be operated relatively, and the related data of other data tables which have the relationship with the data table corresponding to the embedded model can be automatically acquired, thereby greatly reducing the operation steps, reducing the code quantity and improving the software development efficiency.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a schematic structural diagram of an order embedded data model disclosed in an embodiment of the present invention;
FIG. 2 is a flow chart of a data processing method provided in an embodiment of the present invention;
fig. 3 is another schematic flow chart of a data processing method provided in the embodiment of the present invention;
fig. 4 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention is mainly applied to the development of a data access layer in a multi-layer architecture in software development and is mainly applied to an ORM framework. To simplify the complexity and execution steps of the server-side programming.
In the technical solution of the present invention, an embedded model is built, which is different from a traditional model in that the embedded model in the present invention is hierarchical, for example, in the traditional technical solution, a typical order usually corresponds to three different data tables, which are an order header, an order detail and a person-fixed salesman, and therefore, three two-dimensional models of "OrderHeader, OrderDetail and SalesPerson" need to be built to correspond to the three two-dimensional models. In the technical scheme of the application, the built embedded model is based on an Order header as a base, and then a specific field, such as an Order id, associated with the three data tables is used as a specific key to embed the Order detail and data in the person-to-person salesman, namely an Order detail set and a SalesPerson field, into the attributes of the Order model, so that the Order model is changed from a two-dimensional structure into a hierarchical structure in which the Order detail set and the SalesPerson field are embedded. As shown in fig. 1, fig. 1 is a schematic structural diagram of an order embedded data model in an embodiment of the present invention. As can be seen from fig. 1, the embedded model can reflect the nature of real services more naturally and directly.
It should be noted that the data transmitted from the client is still a two-dimensional data structure, and therefore, the embedded model in the present application can be used after conversion is performed in advance.
In this regard, embodiments of the present invention convert data incoming from a client into a data structure that is efficiently accessible. Under the ORM framework, a specific data structure ModelEntry is employed to identify data rows and states, and a development interface is provided to obtain the state of a row, the original value of a column, and the latest value. The state of the row includes unmodified, modified and newly added.
In practical use, taking the data in the JSON format used by the client as an example, the data incoming from the client is assumed to include:
[
{“id”:1,“name”:”John1”,age:30,__ROWSTATE:”NEW”},
{“id”:2,“id_org”:2,“name”:”John2”,“name_org”:”John0”,“age”:30,“age_org”:18,“__ROWSTATE”:”MODIFIED”}
]
then, the server will use JSON parser to read the data and store it in the ModelEntry to create two ModelEntry instances. Wherein each row of data is stored using a Map (key-value pair), and each ModelEntry instance has a Map (key-value pair) storing a row. When the get original value interface (GetOriginalValue ("age")) of the second ModelEntry instance needs to be called, the ModelEntry will take out the value corresponding to the key "age _ org" from the internal Map and return the value to the caller; similarly, calling the getdataline state interface (GetRowState ()) of the second modeentry instance, the modeentry will fetch the value corresponding to the key "__ rowstation" from the internal Map and return it to the caller.
In this way, data and its state can be obtained through the efficiently accessible data structure without regard to a specific format.
It should be noted that the essence of the embedded data model in the present invention is that one or more two-dimensional structure data models or their sets are embedded in one two-dimensional structure data model, and when the server is programmed, only the operation of the embedded model is needed to realize the automatic relevant operation of the embedded model or its set.
The following describes in detail embodiments of the present invention.
Referring to fig. 2, fig. 2 is a schematic flow chart of a data processing method disclosed in the embodiment of the present invention.
The invention discloses a data processing method, which is applied to an ORM framework, wherein the ORM framework is provided with an embedded model which is established according to a data sheet, the embedded model forms a hierarchical structure through an embedded model attribute and an embedded model attribute, and the embedded model attribute comprises data of at least one other data sheet which has the same specific field with the data sheet corresponding to the embedded model; the embedded model attribute comprises a specific label, and the specific label is used for realizing the association operation of the embedded model attribute and the embedded model attribute, and the method comprises the following steps:
s101, receiving a data processing interface instruction;
in the embodiment of the invention, when the data processing interface instruction is received, operations such as addition, deletion, check and modification are carried out on the embedded model. The data processing interface instruction comprises an interface inquiring instruction, an interface adding instruction, an interface deleting instruction and an interface modifying instruction. The embedded model automatic modifying system comprises a query interface instruction, an adding interface instruction, a deleting interface instruction, a modifying interface instruction and a modifying interface instruction, wherein the query interface instruction is used for calling a query related interface to perform query operation on an embedded model to obtain a query result, the adding interface instruction is used for calling an adding related interface to perform adding operation on the embedded model to automatically complete the adding operation of the embedded model, the deleting interface instruction is used for calling a deleting related interface to perform deleting operation on the embedded model to automatically complete the deleting operation of the embedded model, and the modifying interface instruction is used for calling a modifying related interface to perform modifying operation on the embedded model to automatically complete. The specific process is described in detail later.
S102, acquiring a specific label in the embedded model corresponding to the data processing interface instruction;
in the embodiment of the invention, the specific label in the embedded model is obtained according to the data processing interface instruction.
The embedded model attribute comprises an automatic assignment specific label and an embedded model state specific label;
the automatic assignment specific labels comprise embedded model attributes used for representing data sources, embedded model attributes used for representing filling targets and assignment strategies;
the embedded model state specific label comprises a first parameter for characterizing the type of the embedded model, a second parameter for characterizing the source of the parameter when the embedded model queries in a cascade, a third parameter for characterizing that the embedded model can realize cascade addition and a fourth parameter for characterizing that the embedded model can realize cascade deletion.
In actual use, the automatically assigned labels are added to the attributes corresponding to the embedded model or the attributes of the embedded model.
The automatic assignment labels can be expressed as: SetValue (string source, string target, SetValueTractetragystratey, ModelSelectorSelectorSelector).
The string source is used for specifying a source of the data value, the string target is used for specifying a filling target, automatic assignment and marking are used for specifying the source of the data value and the filling target, the source is an attribute embedded in the model, and the filling target is an attribute embedded in the model.
Setvaluestetrateystratgy is used to specify assignment conditions, including: after an embedded model is newly added, the value is assigned, after the embedded model is modified, the value is assigned, and after the embedded model is newly added and modified, the value is assigned.
ModelSelectorSelector is used for appointing the choice condition of the model or its collection of being embedded, the choice condition includes: all, Changed Only-assigns the state to the newly added and modified embedded model, and Unchanged Only-assigns the state to the unmodified embedded model.
The embedded model state specific label represents the relationship between the embedded model and the embedded model, and is used for specifying the type of the embedded model, a parameter source during cascading query, a cascading increase mark and a cascading deletion mark.
In actual use, the embedded model state-specific labels characterizing the embedded model versus embedded model relationships corresponding to the OrderDetail set in the Order model in the above example can be expressed as:
ModelEmbedded(typeof(OrderDetail),ParamValu=”OrderId”,CascadeCreate=true,CascadeDelete=true)。
where typeof (orderdetail) is the first parameter, indicating the type of embedded pattern, paramvalue ═ OrderId is the second parameter, indicating the source of the parameters in the cascade query, and commas are used to separate the parameters if there are multiple parameters. The cascade create-true parameter is a third parameter used for representing that data corresponding to the newly added embedded model is automatically cascaded after the data corresponding to the embedded model is newly added, and the cascade delete-true parameter is a fourth parameter used for representing that the data corresponding to the embedded model is automatically cascaded and deleted before the data corresponding to the embedded model is deleted.
In practical use, the embedded model state specific label corresponding to SalesPerson in the Order model used in the above example for characterizing the relationship between the embedded model and the embedded model can be expressed as:
ModelEmbedded(typeof(SalesPerson),ParamValu=”OrderId”)。
since SalesPerson corresponds to the SalesPerson data table, and each SalesPerson in the SalesPerson data table may correspond to a plurality of orders, the third parameter and the fourth parameter are not set.
S103, executing operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label;
in the embodiment of the present invention, the operation matching the type of the data processing interface instruction is executed according to the type of the data processing interface instruction and the specific label.
The data processing interface instruction is a query interface instruction;
executing the operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label specifically comprises:
determining an embedded model corresponding to the query interface instruction;
acquiring an embedded model state specific label of a relation between an embedded model and an embedded model in the embedded model defined by a user;
it will be appreciated that the embedded model state specific annotations are defined by the user according to actual business needs.
Acquiring a parameter value corresponding to the embedded model attribute according to the second parameter;
querying a plurality of data tables associated with the embedded model using the parameter values as query parameters.
Taking the above example as an example, in the present invention, the query correlation interface is called to automatically query the embedded model set, and the automatic query is embedded and combined with anderdetail and the embedded model SalesPerson.
The process of searching the order for the order in the Orderid in the invention comprises the following steps:
and retrieving data from a data table corresponding to the Order model by taking the Orderid transmitted by the client as a parameter, and filling the data into the Order model.
And then defining a source of the query parameter according to the labeled ParamValue corresponding to the OrderDetail set, acquiring the query parameter and querying a data set in a data table corresponding to the OrderDetail by using the acquired parameter value.
The resulting data collection is then added to the attributes of the Order model.
Similarly, defining the source of the query parameter according to the labeled ParamValue corresponding to SalesPerson, acquiring the query parameter, querying a corresponding data table to retrieve related data, and adding the retrieved related data to the attribute of the Order model.
The process comprises the steps of firstly retrieving data from a data table corresponding to a retrieval embedded model to the embedded model, then obtaining parameter values from the embedded model according to parameter sources defined by the embedded model on the attribute corresponding to each embedded model and ParamValue on a set definition label of the embedded model, and then retrieving data from the data table corresponding to the embedded model by using the obtained parameter values to complete interaction of the embedded model and real data.
The data processing interface instruction is an interface increasing instruction;
executing the operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label specifically comprises:
determining an embedded model corresponding to the interface adding instruction;
acquiring an automatic assignment specific label in the embedded model defined by a user;
and storing the parameter values in the interface increasing instruction into the attributes of the embedded model, and assigning the attributes of the embedded model to the attributes of the embedded model according to the assignment strategy in the automatic assignment specific label.
The data processing interface instruction is a delete interface instruction;
executing the operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label specifically comprises:
determining an embedded model corresponding to the interface deleting instruction;
acquiring a specific label of an embedded model in the embedded model;
and deleting the embedded model attribute corresponding to the fourth parameter in the embedded model according to the fourth parameter.
The data processing interface instruction is a modification interface instruction;
executing the operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label specifically comprises:
determining an embedded model corresponding to the interface modification instruction;
obtaining an automatic assignment specific label in the embedded model;
and modifying the attribute of the embedded model according to the parameter value in the modification interface instruction, and assigning the attribute of the embedded model to the attribute of the embedded model according to the assignment strategy in the automatic assignment specific label.
And S104, obtaining an operation result.
And finally, obtaining an operation result. The results of the operation may be utilized to return to a particular target or to perform other operations.
The embodiment of the invention discloses a data processing method, which is applied to an ORM framework, wherein the ORM framework is provided with an embedded model established according to a data sheet, the embedded model forms a hierarchical structure through an embedded model attribute and an embedded model attribute, and the embedded model attribute comprises data of at least one other data sheet which has the same specific field as the data sheet corresponding to the embedded model; the embedded model attribute comprises a specific label, the specific label is used for realizing the association operation of the embedded model attribute and the embedded model attribute, and the method receives a data processing interface instruction; acquiring a specific label in the embedded model corresponding to the data processing interface instruction; executing operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label; and obtaining an operation result. Because the embedded model with the hierarchical structure is adopted in the invention, when the server side operates, only the embedded model needs to be operated relatively, and the related data of other data tables which have the relationship with the data table corresponding to the embedded model can be automatically acquired, thereby greatly reducing the operation steps, reducing the code quantity and improving the software development efficiency.
Referring to fig. 3, fig. 3 is another schematic flow chart of a data processing method according to an embodiment of the present invention.
After step S104, the method further includes:
s105, adding the parameters to be updated into an update list according to a calling programming interface instruction, and associating the parameters to be updated with the attributes of the corresponding embedded models; wherein, the update list belongs to a part of the ORM framework and is used for storing data to be updated;
s106, when an instruction for executing the updating list is received, sequentially acquiring the attributes of the embedded models corresponding to the data to be updated in the updating list;
s107, generating a plurality of database updating sentences corresponding to the acquired attributes of the embedded model according to the acquired attributes of the embedded model;
and S108, sequentially operating a plurality of database updating sentences to update the database.
In the embodiment of the invention, a data interface is also provided to update the data in the update list to the database.
In an embodiment of the present invention, at least three data interfaces are provided for performing related operations.
Specifically, in the embodiment of the present invention, an addentry (model entry) is provided, where the interface is used to update the embedded model, add the entry to the update list, and automatically associate the entry with the corresponding embedded model, and in the above example, the corresponding embedded model is Order.
Addembeddedrentry (ModelEntry), which is used to update the embedded model, add the entry to the update list, and automatically associate the entry with the corresponding embedded model, which in the above example is SalesPerson, and then assign the embedded model to the property represented by the property in the embedded model.
Addembed entries (model entry), which is used to update the embedded model, add a collection of entries to the update list, and automatically associate the collection of entries with a corresponding collection of embedded models, which is then assigned to the property represented by the property in the embedded model, in the above example, the corresponding set of embedded models is OrderDetail.
And then generating a corresponding model according to the data to be updated in the update list, and automatically generating a database update statement according to the model to update the data. The specific process of automatically generating the database update statement according to the model to update the data may refer to the related technology of generating the SQL statement according to the model in the prior art, as long as the specific process can be implemented, and this process is not considered in the present application and is not repeated.
In actual use, the above example is taken as an example. The process of saving the newly added order can comprise the following processes:
generating a new statement of a data table corresponding to the Order according to the data state in the ModlEntry corresponding to the Order, executing the new statement, reading a SetValue label in the attribute of the embedded model, obtaining a value of the attribute corresponding to the Source in the standard, filling the value into the attribute corresponding to the embedded model or the set thereof, specifically, the SetValue label Target, judging whether a third parameter, namely a cascade increase mark, is set in the definition label of the embedded model set corresponding to the OrderDetail, if the third parameter is set, generating the new statement of the data table corresponding to the OrderDetail according to the data state in the ModlEntry set corresponding to the OrderDetail set, and executing. It should be noted that, the process of generating the new added sentence refers to the mature technology in the prior art, and is not described in detail in this application.
The process of saving the delete order may include the following processes:
if the fourth parameter is set in the Order model, namely the embedded model set definition label corresponding to OrderDetail sets a cascade deletion mark, generating a deletion statement of relevant data in a data table corresponding to the OrderDetail model set associated with the OrderId according to the OrderId transmitted by the client, and executing the deletion statement. Generating a deletion statement of the relevant data in the data table corresponding to the OrderId-associated Order model according to the OrderId transmitted by the client, and executing
The step of saving the modified order comprises the following steps:
generating a modification statement of a data table corresponding to the Order according to the data state in the ModelEntry corresponding to the Order, and executing the modification statement; filling the value into the corresponding attribute of the embedded model or the set thereof according to the value of the attribute corresponding to the Source in the SetValue label, specifically the Target labeled by the SetValue; and generating new adding, deleting or modifying statements of the data table corresponding to the OrderDetail according to the data state in the ModelEntry set corresponding to the OrderDetail set, and executing.
It should be noted that the above process of generating and executing a statement belongs to the prior art, and is not described herein again as long as it can be implemented.
It can be seen that the embodiment of the invention realizes the update of the database by operating the embedded model, and the process only needs to operate the embedded model, thereby simplifying the programming flow and the execution steps.
Corresponding to the above data processing method, the present invention also discloses a data processing apparatus, and referring to fig. 4, fig. 4 is a schematic structural diagram of the data processing apparatus disclosed in the present invention.
The invention discloses a data processing device, which is applied to an ORM framework, wherein the ORM framework is provided with an embedded model established according to a data sheet, the embedded model forms a hierarchical structure through an embedded model attribute and an embedded model attribute, and the embedded model attribute comprises data of at least one other data sheet with the same specific field as the data sheet corresponding to the embedded model; the embedded model attribute comprises a specific label, and the specific label is used for realizing the association operation of the embedded model attribute and the embedded model attribute, and the method comprises the following steps:
the receiving unit 1 is used for receiving a data processing interface instruction;
the acquisition unit 2 is used for acquiring a specific label in the embedded model corresponding to the data processing interface instruction;
the execution unit 3 is used for executing the operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label; and obtaining an operation result.
Preferably, the method further comprises the following steps:
the adding list unit is used for adding the parameters to be updated into the updating list and associating the parameters to be updated with the attributes of the corresponding embedded models according to the calling programming interface instruction; wherein, the update list belongs to a part of the ORM framework and is used for storing data to be updated;
the updating list unit is used for sequentially acquiring the attributes of the embedded models corresponding to the data to be updated in the updating list when receiving an instruction for executing the updating list;
the sentence generating unit is used for generating a plurality of database updating sentences corresponding to the obtained attributes of the embedded model according to the obtained attributes of the embedded model;
and the database updating unit is used for sequentially operating a plurality of database updating sentences to update the database.
Preferably, the embedded model attribute comprises an automatic assignment specific label and an embedded model state specific label;
the automatic assignment specific labels comprise embedded model attributes used for representing data sources, embedded model attributes used for representing filling targets and assignment strategies;
the embedded model state specific label comprises a first parameter for characterizing the type of the embedded model, a second parameter for characterizing the source of the parameters when the embedded model is queried in a cascade, a third parameter for characterizing whether the embedded model can be added or not and a fourth parameter for characterizing whether the embedded model can be deleted or not.
The data processing interface instruction is a query interface instruction;
executing the operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label specifically comprises:
determining an embedded model corresponding to the query interface instruction;
acquiring an embedded model state of a relation between an embedded model and an embedded model in the embedded model defined by a user;
acquiring a parameter value corresponding to the embedded model attribute according to the second parameter;
querying a plurality of data tables associated with the embedded model using the parameter values as query parameters.
The data processing interface instruction is an interface increasing instruction;
executing the operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label specifically comprises:
determining an embedded model corresponding to the interface adding instruction;
acquiring an automatic assignment specific label in the embedded model defined by a user;
and storing the parameter values in the interface increasing instruction into the attributes of the embedded model, and assigning the attributes of the embedded model to the attributes of the embedded model according to the assignment strategy in the automatic assignment specific label.
The data processing interface instruction is a delete interface instruction;
executing the operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label specifically comprises:
determining an embedded model corresponding to the interface deleting instruction;
acquiring a specific label of an embedded model in the embedded model;
and deleting the embedded model attribute corresponding to the fourth parameter in the embedded model according to the fourth parameter.
The data processing interface instruction is a modification interface instruction;
executing the operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label specifically comprises:
determining an embedded model corresponding to the interface modification instruction;
obtaining an automatic assignment specific label in the embedded model;
and modifying the attribute of the embedded model according to the parameter value in the modification interface instruction, and assigning the attribute of the embedded model to the attribute of the embedded model according to the assignment strategy in the automatic assignment specific label.
It should be noted that, a data apparatus in this embodiment may implement the functions of each module by using a data processing method in the foregoing method embodiment, to implement all technical solutions in the foregoing method embodiment, the functions of each module may be specifically implemented according to the method in the foregoing method embodiment, and a specific implementation process of the function may refer to relevant descriptions in the foregoing embodiment, which is not described herein again.
The embodiment of the invention discloses a data processing device, which is applied to an ORM framework, wherein the ORM framework is provided with an embedded model established according to a data sheet, the embedded model forms a hierarchical structure through an embedded model attribute and an embedded model attribute, and the embedded model attribute comprises data of at least one other data sheet which has the same specific field as the data sheet corresponding to the embedded model; the embedded model attribute comprises a specific label, the specific label is used for realizing the association operation of the embedded model attribute and the embedded model attribute, and the method receives a data processing interface instruction; acquiring a specific label in the embedded model corresponding to the data processing interface instruction; executing operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label; and obtaining an operation result. Because the embedded model with the hierarchical structure is adopted in the invention, when the server side operates, only the embedded model needs to be operated relatively, and the related data of other data tables which have the relationship with the data table corresponding to the embedded model can be automatically acquired, thereby greatly reducing the operation steps, reducing the code quantity and improving the software development efficiency.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (8)

1. A data processing method is characterized in that the method is applied to an ORM framework, the ORM framework is provided with an embedded model which is established according to a data table, the embedded model forms a hierarchical structure through an embedded model attribute and an embedded model attribute, and the embedded model attribute comprises data of at least one other data table which has the same specific field with the data table corresponding to the embedded model; the embedded model attributes comprise specific labels, the specific labels are used for realizing the association operation of the embedded model attributes and the embedded model attributes, the specific labels represent the relationship between the embedded model and are used for specifying the type of the embedded model, a parameter source during cascade query, a cascade increase mark and a cascade deletion mark, and the specific labels comprise automatic assignment specific labels and embedded model state specific labels; the embedded model state specific label comprises a first parameter for characterizing the type of the embedded model, a second parameter for characterizing the source of the parameter when the embedded model queries in a cascade, a third parameter for characterizing the embedded model to realize cascade addition and a fourth parameter for characterizing the embedded model to realize cascade deletion, and the method comprises the following steps:
receiving a data processing interface instruction;
acquiring a specific label in the embedded model corresponding to the data processing interface instruction;
executing operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label;
and obtaining an operation result.
2. The method of claim 1, further comprising:
adding a parameter to be updated into an update list and associating the parameter to be updated with the attribute of the corresponding embedded model according to a calling programming interface instruction; wherein, the update list belongs to a part of the ORM framework and is used for storing data to be updated;
when an instruction for executing the updating list is received, sequentially acquiring the attributes of the embedded models corresponding to the data to be updated in the updating list;
generating a plurality of database updating sentences corresponding to the acquired attributes of the embedded model according to the acquired attributes of the embedded model;
and sequentially operating a plurality of database updating sentences to update the database.
3. The method of claim 1, wherein the data processing interface instruction is a query interface instruction;
executing the operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label specifically comprises:
determining an embedded model corresponding to the query interface instruction;
acquiring a state specific label of an embedded model in the embedded model;
acquiring a parameter value corresponding to the embedded model attribute according to the second parameter;
querying a plurality of data tables associated with the embedded model using the parameter values as query parameters.
4. The method of claim 1, wherein the data processing interface instruction is an add interface instruction;
executing the operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label specifically comprises:
determining an embedded model corresponding to the interface adding instruction;
obtaining an automatic assignment specific label in the embedded model;
and storing the parameter values in the interface increasing instruction into the attributes of the embedded model, and assigning the attributes of the embedded model to the attributes of the embedded model according to the assignment strategy in the automatic assignment specific label.
5. The method of claim 1, wherein the data processing interface command is a delete interface command;
executing the operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label specifically comprises:
determining an embedded model corresponding to the interface deleting instruction;
acquiring an embedded model state specific label of a relation between an embedded model and an embedded model in the embedded model defined by a user;
and deleting the embedded model attribute corresponding to the fourth parameter in the embedded model according to the fourth parameter.
6. The method of claim 1, wherein the data processing interface instruction is a modify interface instruction;
executing the operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label specifically comprises:
determining an embedded model corresponding to the interface modification instruction;
acquiring an automatic assignment specific label in the embedded model defined by a user;
and modifying the attribute of the embedded model according to the parameter value in the modification interface instruction, and assigning the attribute of the embedded model to the attribute of the embedded model according to the assignment strategy in the automatic assignment specific label.
7. A data processing device is applied to an ORM framework, the ORM framework is provided with an embedded model which is established according to a data table, the embedded model forms a hierarchical structure through an embedded model attribute and an embedded model attribute, and the embedded model attribute comprises data of at least one other data table which has the same specific field with the data table corresponding to the embedded model; the embedded model attributes comprise specific labels, the specific labels are used for realizing the association operation of the embedded model attributes and the embedded model attributes, the specific labels represent the relationship between the embedded model and are used for specifying the type of the embedded model, a parameter source during cascade query, a cascade increase mark and a cascade deletion mark, and the specific labels comprise automatic assignment specific labels and embedded model state specific labels; the embedded model state specific label comprises a first parameter for characterizing the type of the embedded model, a second parameter for characterizing the source of the parameter when the embedded model queries in a cascade, a third parameter for characterizing the embedded model to realize cascade addition and a fourth parameter for characterizing the embedded model to realize cascade deletion, and the device comprises:
a receiving unit for receiving a data processing interface instruction;
the acquisition unit is used for acquiring a specific label in the embedded model corresponding to the data processing interface instruction;
the execution unit is used for executing the operation matched with the type of the data processing interface instruction according to the type of the data processing interface instruction and the specific label; and obtaining an operation result.
8. The apparatus of claim 7, further comprising:
the adding list unit is used for adding the parameters to be updated into the updating list and associating the parameters to be updated with the attributes of the corresponding embedded models according to the calling programming interface instruction; wherein, the update list belongs to a part of the ORM framework and is used for storing data to be updated;
the updating list unit is used for sequentially acquiring the attributes of the embedded models corresponding to the data to be updated in the updating list when receiving an instruction for executing the updating list;
the sentence generating unit is used for generating a plurality of database updating sentences corresponding to the obtained attributes of the embedded model according to the obtained attributes of the embedded model;
and the database updating unit is used for sequentially operating a plurality of database updating sentences to update the database.
CN201810819845.1A 2018-07-24 2018-07-24 Data processing method and device Active CN108897897B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810819845.1A CN108897897B (en) 2018-07-24 2018-07-24 Data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810819845.1A CN108897897B (en) 2018-07-24 2018-07-24 Data processing method and device

Publications (2)

Publication Number Publication Date
CN108897897A CN108897897A (en) 2018-11-27
CN108897897B true CN108897897B (en) 2021-01-05

Family

ID=64351474

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810819845.1A Active CN108897897B (en) 2018-07-24 2018-07-24 Data processing method and device

Country Status (1)

Country Link
CN (1) CN108897897B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101067814A (en) * 2007-05-10 2007-11-07 浪潮集团山东通用软件有限公司 Mapping conversion method between data access level Xml format data and relational data
CN106649457A (en) * 2016-09-26 2017-05-10 天津海量信息技术股份有限公司 Data processing frame based on object relation mapping technology
CN107391529A (en) * 2017-03-28 2017-11-24 阿里巴巴集团控股有限公司 A kind of method and device for realizing Object Relation Mapping ORM

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8260824B2 (en) * 2009-05-05 2012-09-04 Rocket Software, Inc. Object-relational based data access for nested relational and hierarchical databases

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101067814A (en) * 2007-05-10 2007-11-07 浪潮集团山东通用软件有限公司 Mapping conversion method between data access level Xml format data and relational data
CN106649457A (en) * 2016-09-26 2017-05-10 天津海量信息技术股份有限公司 Data processing frame based on object relation mapping technology
CN107391529A (en) * 2017-03-28 2017-11-24 阿里巴巴集团控股有限公司 A kind of method and device for realizing Object Relation Mapping ORM

Also Published As

Publication number Publication date
CN108897897A (en) 2018-11-27

Similar Documents

Publication Publication Date Title
US10831753B2 (en) Query plan generation and execution in a relational database management system with a temporal-relational database
CN108052321B (en) Method for automatically generating intelligent contract of block chain based on configuration information
TWI710919B (en) Data storage device, translation device and data inventory acquisition method
US5850544A (en) System and method for efficient relational query generation and tuple-to-object translation in an object-relational gateway supporting class inheritance
RU2400803C2 (en) Long-term storage of types and copies of net data
CN103064875B (en) A kind of spatial service data distributed enquiring method
US8356029B2 (en) Method and system for reconstruction of object model data in a relational database
CN105989150B (en) A kind of data query method and device based on big data environment
US7979456B2 (en) Method of managing and providing parameterized queries
US20050154745A1 (en) Method and system for supporting multivalue attributes in a database system
CN102426582B (en) Data manipulation management devices and data manipulation management method
KR20060045622A (en) Extraction, transformation and loading designer module of a computerized financial system
CN105320680A (en) Data synchronization method and device
CN107679071B (en) Relational database-oriented general data service customized packaging method
US20080263078A1 (en) Runtime class database operation
CN110134681B (en) Data storage and query method and device, computer equipment and storage medium
CN108431766A (en) Method and system for object-oriented/functional language to be mapped to database language
EP4155965A1 (en) System and method for facilitating metadata identification and import
US8041728B2 (en) Utilization of display profiles with abstract queries
CN116795859A (en) Data analysis method, device, computer equipment and storage medium
CN110019306A (en) A kind of SQL statement lookup method and system based on XML format file
CN101719162A (en) Multi-version open geographic information service access method and system based on fragment pattern matching
CN108897897B (en) Data processing method and device
CN116501938A (en) Data acquisition method, device, equipment and storage medium
CN112181996B (en) Unified data access middleware method and system for relational database

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