Data processing method and device
By generating and updating the binary identification values of business data, the high storage and loading costs caused by the data marking method in the prior art are solved, and the personalized data marking needs and cost reduction are achieved.
Patent Information
- Application Number
- CN202010603593.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-29
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2040-06-29
AI Technical Summary
In the case of a large number of business data, the data marking method leads to excessive storage costs and loading costs for identification.
After receiving the data marking request, determine the unique identification of the pending service data and the business fields to be marked, generate a binary form of business identification value, convert it into decimal form, and update the business identification field value in the data table. .
Meet the personalized data marking needs of business systems, reducing the identification storage cost and loading cost of business data.
Smart Images

Figure CN113742334B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a data processing method and device. Background Art
[0002] With the development of Internet technology, people are increasingly relying on various network service platforms, such as e-commerce platforms, social platforms, and so on. Network service platforms usually include multiple business systems. In different business scenarios, each business system often has personalized and customized data requirements. In order to meet the personalized and customized data requirements of each business system, we often need to set identifiers (label) for business data. For example, in an e-commerce platform, there is often a scenario where a master data supports multiple business systems, and the business system has customized data requirements. For example, some fields in the business data table corresponding to the business system need to be synchronized with the master data for changes, and some fields need personalized maintenance. This requires us to set identifiers such as "mark" to indicate whether each field in the business data table needs to be updated with the master data.
[0003] In the prior art, data marking is mainly performed by adding a new service identification table in the database, wherein a row in the service identification table is used to mark a piece of service data in the original service data table.
[0004] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art: as the demand for marking business data increases, the amount of identification data stored continues to increase; in scenarios with a large amount of business data, the existing data labeling methods have the problem of excessively high identification storage costs and subsequent data loading costs. Summary of the invention
[0005] In view of this, the present invention provides a data processing method and device, which can meet the personalized data labeling requirements of the business system and reduce the identification storage cost and loading cost of the business data.
[0006] To achieve the above objective, according to one aspect of the present invention, a data processing method is provided.
[0007] The data processing method of the present invention includes: after receiving a data marking request, determining the unique identifier of the business data to be processed in the first data table and the business field to be marked; wherein a row in the first data table is used to store a piece of business data, and the business data includes the values of each business field and a business identification field value used to mark the business field; generating a first business identification value represented in binary form according to the business field to be marked, and converting the first business identification value into a second business identification value represented in decimal form; and updating the business identification field value in the business data corresponding to the unique identifier in the first data table according to the second business identification value.
[0008] Optionally, generating a first business identification value expressed in binary form based on the business field to be marked includes: obtaining a business identification field value in the business data corresponding to the unique identifier in a first data table; converting the obtained business identification field value into a binary identification array; querying configuration information based on the business field to be marked to determine the position of the business field to be marked in the binary identification array; and updating the value of the position of the business field to be marked in the binary identification array to obtain the first business identification value.
[0009] Optionally, updating the business identification field value in the business data corresponding to the unique identifier in the first data table according to the second business identification value includes: when performing the update operation according to the second business identification value, updating the business identification field value in the business data corresponding to the unique identifier in the first data table using an optimistic locking method.
[0010] Optionally, the service identification field is used to indicate whether each service field in the first data table needs to be updated together with the second data table.
[0011] Optionally, updating the value of the position of the business field to be marked in the binary identification array includes: when the business field to be marked is a field that needs to be updated together with the second data table, updating the value of the position of the business field to be marked in the binary identification array to a first Boolean value; when the business field to be marked is a field that does not need to be updated together with the second data table, updating the value of the position of the business field to be marked in the binary identification array to a second Boolean value.
[0012] Optionally, the method further includes: after receiving the second data table change message, determining the change details of the second data table; and updating the values of the business fields in the first data table that need to be updated together with the second data table according to the change details of the second data table.
[0013] Optionally, the change details of the second data table include: a unique identifier of the changed data, and a business field value in the changed data; updating the value of the business field in the first data table that needs to be updated together with the second data table according to the change details of the second data table includes: assembling the first data object according to the unique identifier of the changed data and the business field value in the changed data; obtaining the business identifier field value in the business data in the first data table corresponding to the unique identifier of the changed data; converting the obtained business identifier field value into a fifth business identifier value represented in binary form, and determining the business field in the first data table that needs to be updated together with the second data table according to the fifth business identifier value; assembling the second data object according to the unique identifier of the changed data and the business field in the first data table that needs to be updated together with the second data table; assigning a value to the second data object according to the first data object; and updating the first data table according to the assigned second data object.
[0014] To achieve the above objective, according to another aspect of the present invention, a data processing device is provided.
[0015] The data processing device of the present invention includes: a determination module, which is used to determine the unique identifier of the business data to be processed in the first data table and the business field to be marked after receiving a data marking request; wherein a row in the first data table is used to store a piece of business data, and the business data includes the values of each business field and the business identification field value used to mark the business field; a generation module, which is used to generate a first business identification value expressed in binary form according to the business field to be marked, and convert the first business identification value into a second business identification value expressed in decimal form; an update module, which is used to update the business identification field value in the business data corresponding to the unique identifier in the first data table according to the second business identification value.
[0016] To achieve the above objective, according to another aspect of the present invention, an electronic device is provided.
[0017] The electronic device of the present invention comprises: one or more processors; and a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the data processing method of the present invention.
[0018] To achieve the above objective, according to yet another aspect of the present invention, a computer readable medium is provided.
[0019] The computer-readable medium of the present invention stores a computer program thereon, and when the program is executed by a processor, the data processing method of the present invention is implemented.
[0020] An embodiment of the above invention has the following advantages or beneficial effects: after receiving a data labeling request, determining the unique identifier of the business data to be processed in the first data table and the business field to be marked, generating a first business identification value expressed in binary form according to the business field to be marked, and converting the first business identification value into a second business identification value expressed in decimal form, and updating the business identification field value in the business data corresponding to the unique identifier in the first data table according to the second business identification value. These steps can meet the personalized data labeling requirements of the business system and reduce the identification storage cost and loading cost of the business data.
[0021] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0023] Figure 1 is a schematic diagram of the main flow of a data processing method according to a first embodiment of the present invention;
[0024] Figure 2 is a schematic diagram of the main flow of a data processing method according to a second embodiment of the present invention;
[0025] Figure 3 is a schematic diagram of a synchronous update process of a business field in a data processing method according to a third embodiment of the present invention;
[0026] Figure 4 is a schematic diagram of main modules of a data processing device according to a fourth embodiment of the present invention;
[0027] Figure 5 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0028] Figure 6 It is a schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0030] It should be pointed out that the various embodiments of the present invention and the technical features in the embodiments may be combined with each other without affecting the implementation of the present invention.
[0031] First embodiment
[0032] Figure 1 FIG. 1 is a schematic diagram of the main flow of the data processing method according to the first embodiment of the present invention. Figure 1 As shown, the data processing method of the embodiment of the present invention includes:
[0033] Step S101: after receiving a data marking request, determining a unique identifier of the business data to be processed in a first data table and a business field to be marked.
[0034] The data marking request may also be referred to as a “business data marking request” or a “request for setting a business identifier for business data” or the like.
[0035] In an optional example, the data marking request may carry a unique identifier of the business data to be processed in the first data table, and a business field to be marked. In this optional example, the unique identifier of the business data to be processed in the first data table and the business field to be marked carried by the data marking request can be obtained from the data marking request. For example, a data marking request includes the following request parameters {id:1,syncField:wareStatus}, where "id:1" indicates that the unique identifier of the business data to be processed in the first data table (for example, it is specifically an auto-increment primary key) is "1", and "syncField:wareStatus" indicates that the business field to be marked in the first data table is "wareStatus".
[0036] In another optional example, the data marking request may not carry the unique identifier of the business data to be processed and the business field to be marked in the first data table. In this optional example, the unique identifier of the business data to be processed and the business field to be marked corresponding thereto may be queried according to the information carried in the data marking request.
[0037] A row in the first data table is used to store a piece of business data, and the business data includes the value of each business field and the value of the business identification field used to mark the business field. For example, a piece of business data in the first data table includes the value of business field A, the value of business field B, the value of business field C, and the value of the business identification field "mark" used to mark business fields A, B, and C.
[0038] Furthermore, in order to save storage space, the data type used for the business identification field value in the first data table is a decimal value type, such as bigint, or int. Bigint is an integer data type supported by common relational databases, and its storage space is generally 8 bytes; int is an integer data type, and its storage space is generally 4 bytes. After the business identification field value is converted from decimal to binary in the memory, the business identification field value obtained in binary form has the following meaning: a business field in the first data table corresponds to a position in the business identification field value represented in binary form, and the value of the position represents the tag value of the business field, specifically the first Boolean value or the second Boolean value. In specific implementation, if the first Boolean value is set to 1, the second Boolean value is 0; if the first Boolean value is set to 0, the second Boolean value is 1. For example, assuming that the business identification field value expressed in binary form is 01011, and there are five business fields A to E in the first data table, the value of the first position of the business identification field value from left to right can represent the tag value of business field A, the value of the second position represents the tag value of business field B, the value of the third position represents the tag value of business field C, the value of the fourth position represents the tag value of business field D, and the value of the fifth position represents the tag value of business field E.
[0039] Step S102: Generate a first service identification value expressed in binary form according to the service field to be marked.
[0040] Among them, the business field to be marked may specifically be a business field to be marked as a first Boolean value, and / or a business field to be marked as a second Boolean value. In different business scenarios, the marking values of business fields have different practical meanings. Exemplarily, in a certain business scenario, the marking value of a business field is a first Boolean value, indicating that the business field needs to be updated together with the master data, and the marking value of the business field is a second Boolean value, indicating that the business field does not need to be updated together with the master data. Furthermore, in this example, the business field to be marked may specifically be a business field that needs to be updated together with the master data, and / or a business field that does not need to be updated together with the master data.
[0041] Step S103: Convert the first service identification value into a second service identification value expressed in decimal form.
[0042] Step S104: updating the service identification field value in the service data corresponding to the unique identification in the first data table according to the second service identification value.
[0043] Further, after obtaining the second business identification value expressed in decimal, in order to prevent data confusion caused by concurrent modification, the business identification field value in the business data corresponding to the unique identifier in the first data table can be updated by optimistic locking. In an optional implementation, the business identification field value can be updated based on the unique identifier of the business data to be processed carried by the data marking request and the original business identification field value in the first data table. For example, the following database update statement can be used: Update ware set mark=#newmark whereid=#id and mark=#oldmark. Among them, "#newmark" represents the second business identification value, "#id" represents the unique identifier of the business data to be processed, and "#oldmark" represents the business field identification value in the database before modification.
[0044] In an embodiment of the present invention, after receiving a data labeling request, the unique identifier of the business data to be processed in the first data table and the business field to be labeled are determined, a first business identification value expressed in binary form is generated according to the business field to be labeled, and the first business identification value is converted into a second business identification value expressed in decimal form, and the business identification field value in the business data corresponding to the unique identifier in the first data table is updated according to the second business identification value. These steps can meet the personalized data labeling requirements of the business system and reduce the identification storage cost and loading cost of the business data.
[0045] Second embodiment
[0046] Figure 2 FIG. 2 is a schematic diagram of the main flow of the data processing method according to the second embodiment of the present invention. Figure 2 As shown, the data processing method of the embodiment of the present invention includes:
[0047] Step S201: receiving a data marking request.
[0048] Step S202: Determine the unique identifier of the business data to be processed and the business field to be marked in the first data table according to the data marking request.
[0049] In an optional example, the data marking request may carry a unique identifier of the business data to be processed in the first data table, and a business field to be marked. In this optional example, the unique identifier of the business data to be processed in the first data table and the business field to be marked carried by the data marking request can be obtained from the data marking request. For example, a data marking request includes the following request parameters {id:1,syncField:wareStatus}, where "id:1" indicates that the unique identifier of the business data to be processed in the first data table (for example, it is specifically an auto-increment primary key) is "1", and "syncField:wareStatus" indicates that the business field to be marked in the first data table is "wareStatus".
[0050] A row in the first data table is used to store a piece of business data, and the business data includes the value of each business field and the value of the business identification field used to mark the business field. For example, a piece of business data in the first data table includes the value of business field A, the value of business field B, the value of business field C, and the value of the business identification field "mark" used to mark business fields A, B, and C.
[0051] Furthermore, in order to save storage space, the data type used by the business identifier field value in the first data table is a decimal value type, such as bigint or int, etc. Bigint is an integer data type supported by common relational databases, which generally occupies 8 bytes of storage space; int is an integer data type, which generally occupies 4 bytes of storage space.
[0052] Step S203: Obtain the service identifier field value in the service data corresponding to the unique identifier in the first data table.
[0053] In this step, the first data table can be queried according to the unique identifier of the business data to be processed to obtain the business identifier field value in the corresponding business data. For example, assuming that the unique identifier of the business data to be processed satisfies "id=1" and the business identifier field is represented by "mark", the following database query statement can be used: select id, mark from warewhere id=1.
[0054] Step S204: converting the obtained service identification field value into a binary identification array.
[0055] In this step, a decimal-to-binary conversion operation can be performed on the service identification field value obtained from the first data table in the memory to obtain a service identification field value represented in binary form, specifically a binary identification array. Among them, a service field in the first data table corresponds to a position in the binary identification array, and the value of the position represents the tag value of the service field, specifically a first Boolean value or a second Boolean value. In specific implementation, if the first Boolean value is 1, the second Boolean value is 0; if the first Boolean value is 0, the second Boolean value is 1.
[0056] Step S205: query configuration information according to the service field to be marked to determine the position of the service field to be marked in the binary identification array.
[0057] In the embodiment of the present invention, the correspondence between each business field in the first data table and a specific position in the binary identification array can be preconfigured. For example, assuming that there are five business fields A to E in the first data table, and the binary identification array includes five positions in total, the following information can be configured: the first position from left to right in the binary array corresponds to business field A, the second position corresponds to business field B, the third position corresponds to business field C, the fourth position corresponds to business field D, and the fifth position corresponds to business field E. Further, assuming that the business field to be marked is business field C, its third position in the binary identification array can be determined by querying the configuration information.
[0058] Step S206: updating the value of the position of the service field to be marked in the binary identification array to obtain a first service identification value represented in binary form.
[0059] Among them, the business field to be marked may specifically be a business field to be marked as a first Boolean value, and / or a business field to be marked as a second Boolean value. In different business scenarios, the marking value of the business field has different practical meanings. Exemplarily, in a certain business scenario, the marking value of the business field is a first Boolean value, indicating that the business field needs to be updated together with the second data table, and the marking value of the business field is a second Boolean value, indicating that the business field does not need to be updated together with the second data table. Furthermore, in this example, the business field to be marked may specifically be a business field that needs to be updated together with the second data table, and / or a business field that does not need to be updated together with the second data table.
[0060] Further, when the business field to be marked is specifically a business field that needs to be updated together with the second data table, step S206 specifically includes: updating the value of the position of the business field to be marked in the binary identification array to the first Boolean value. For example, assuming that the first Boolean value is 1 and the second Boolean value is 0, the business field to be marked is the business field C that needs to be updated synchronously, and its position in the binary identification array "01011" is the third position from left to right, then the third position "0" is replaced with 1, thereby obtaining the first business identification value "01111".
[0061] When the business field to be marked is specifically a business field that needs to be updated together with the master data, and a field that does not need to be updated together with the second data table, step S206 specifically includes: when the business field to be marked is a field that needs to be updated together with the second data table, the value of the position of the business field to be marked in the binary identification array is updated to the first Boolean value; when the business field to be marked is a field that does not need to be updated together with the second data table, the value of the position of the business field to be marked in the binary identification array is updated to the second Boolean value. For example, assuming that the first Boolean value is 1 and the second Boolean value is 0, the business field to be marked is the business field C that needs to be updated synchronously, and the field B that does not need to be updated synchronously, and the positions of the business fields B and C in the binary identification array "01011" are the second and third positions from left to right, respectively, then the "1" of the second position is replaced by 0, and the "0" of the third position is replaced by 1, so as to obtain the first business identification value "00111".
[0062] In the embodiment of the present invention, steps S203 to S206 are Figure 1 An optional implementation of step S202 in the embodiment shown. In specific implementation, Figure 1 Step S102 in the illustrated embodiment may also adopt other optional implementations.
[0063] Step S207: Convert the first service identification value into a second service identification value expressed in decimal form.
[0064] In this step, the second service identification value can be obtained by performing a binary-to-decimal operation on the first service identification value.
[0065] In an embodiment of the present invention, by storing the business identification field value in decimal form in a database table, and performing a decimal-to-binary conversion operation in memory to obtain a business identification value in binary form, it is not only convenient to modify the identification of the business data, but also helps to save the storage space required for storing the identification of the business data in the database, thereby reducing the storage cost and loading cost of the business data identification.
[0066] Step S208: updating the service identification field value in the service data corresponding to the unique identification in the first data table according to the second service identification value.
[0067] Further, after obtaining the second business identification value expressed in decimal, in order to prevent data confusion caused by concurrent modification, the business identification field value in the business data corresponding to the unique identifier in the first data table can be updated by optimistic locking. In an optional implementation, the business identification field value can be updated based on the unique identifier of the business data to be processed carried by the data marking request and the original business identification field value in the first data table. For example, the following database update statement can be used: Update ware set mark=#newmark whereid=#id and mark=#oldmark. Among them, "#newmark" represents the second business identification value, "#id" represents the unique identifier of the business data to be processed, and "#oldmark" represents the business field identification value in the database before modification.
[0068] In the embodiment of the present invention, the above steps can meet the personalized data labeling requirements of the business system and reduce the identification storage cost and loading cost of the business data.
[0069] Third embodiment
[0070] The business scenarios applicable to the data processing methods of the embodiments of the present invention are described as follows: In e-commerce platforms, due to business development, there is often a scenario in which a master data set supports other businesses. Because existing business scenarios have customized data requirements, some business fields stored in the first data table need to synchronize changes with the master data (specifically, the data in the second data table), and some business fields need to be personalized. In this business scenario, the mark value of the business field is the first Boolean value, indicating that the business field needs to be updated together with the second data table, and the mark value of the business field is the second Boolean value, indicating that the business field does not need to be updated together with the second data table. Figure 2 In addition to the data marking process shown, the data processing method of the embodiment of the present invention also includes a business field synchronization update process.
[0071] Figure 3 FIG. 1 is a schematic diagram of a synchronous update process of a business field in a data processing method according to a third embodiment of the present invention. Figure 3 As shown in the figure, the business field synchronization update process includes:
[0072] Step S301: after receiving the second data table change message, determine the change details of the second data table.
[0073] In an optional example, the second data table change message carries the change details of the second data table. In this optional example, the second data table change details can be obtained from the second data table change message.
[0074] The change details of the second data table may include: the unique identifier of the changed data, and the business field value in the changed data. For example, a second data table change message includes the following parameters: {id:1,wareStatus:1}. "id:1" indicates that the unique identifier of the changed data is "1", and "wareStatus:1" indicates that the value of the business field wareStatus in the changed data is 1.
[0075] In another optional example, the second data table change message does not carry the change details of the second data table. In this optional example, the change details of the second data table can be queried according to the relevant parameters carried in the second data table change message.
[0076] Step S302: updating the values of the business fields in the first data table that need to be updated together with the second data table according to the change details of the second data table.
[0077] In an optional example, step S302 specifically includes: step a1 to step a5.
[0078] Step a1: Assembling a first data object according to the unique identifier of the changed data and the business field value in the changed data.
[0079] Exemplarily, the first data object may be a map object. A map object is an object that maps keys to values. In step a1, the unique identifier of the change data may be used as the key of the map object, and the business field value in the change data may be used as the value of the map object to construct the first data object.
[0080] Step a2: Obtain the business identifier field value in the business data corresponding to the unique identifier of the changed data in the first data table.
[0081] In this step, the first data table can be queried according to the change data unique identifier to obtain the business identifier field value in the business data corresponding to the change data unique identifier. For example, assuming that the change data unique identifier satisfies "id=2" and the business identifier field is represented by "mark", the following database query statement can be used: select id, mark fromware where id=2.
[0082] Step a3: converting the obtained service identification field value into a fifth service identification value represented in binary form, and determining the service field in the first data table that needs to be updated together with the second data table according to the fifth service identification value.
[0083] In this step, the decimal-to-binary conversion operation can be performed on the service identification field value obtained from the first data table in the memory to obtain the fifth service identification value represented in binary form. After obtaining the fifth service identification value, all positions in the fifth service identification value whose values are the first Boolean value (such as 1) can be traversed, and the service fields corresponding to these positions can be determined by querying the configuration information, so as to determine which service fields in the first data table need to be updated together with the second data table. For example, assuming that the fifth identification value is "01110", the positions with values of 1 in the fifth identification value are the second, third, and fourth positions, respectively. By querying the configuration information, it can be known that the service fields corresponding to these positions are service field B, service field C, and service field D, and then it can be determined that the service fields in the first data table that need to be updated together with the second data table are service field B, service field C, and service field D.
[0084] Step a4: Assemble the second data object according to the unique identifier of the changed data and the business fields in the first data table that need to be updated together with the second data table.
[0085] In this step, the unique identifier of the changed data may be used as a key, and the business field value in the first data table that needs to be updated together with the second data table may be used as a value to construct a second data object.
[0086] Step a5: assigning a value to the second data object according to the first data object; and updating the first data table according to the assigned second data object.
[0087] In an optional embodiment, assigning a value to the second data object based on the first data object includes: for each business field in the first data object, determining whether it exists in the second data object; if so, assigning the value of the business field to the second data object; if not, traversing the next business field in the first data object until all business fields in the first data object have been traversed.
[0088] Furthermore, after obtaining the assigned second data object, in order to prevent data confusion caused by concurrent modification, the business field value in the first data table may be updated by using an optimistic lock.
[0089] In the embodiment of the present invention, the above steps implement the synchronous update process of the business fields, meet the personalized data requirements of the business system, and help save the storage space of the business data identifier.
[0090] Fourth embodiment
[0091] Figure 4 FIG. 4 is a schematic diagram of the main modules of a data processing device according to a fourth embodiment of the present invention. Figure 4 As shown, the data processing device 400 of the embodiment of the present invention includes: a determination module 401, a generation module 402, and an update module 403.
[0092] The determination module 401 is used to determine the unique identifier of the business data to be processed and the business field to be marked in the first data table after receiving the data marking request.
[0093] In an optional example, the data marking request may carry a unique identifier of the business data to be processed in the first data table, and a business field to be marked. In this optional example, the determination module 401 may obtain the unique identifier of the business data to be processed in the first data table carried by the data marking request, and the business field to be marked. For example, a data marking request includes the following request parameters {id:1,syncField:wareStatus}, where "id:1" indicates that the unique identifier of the business data to be processed in the first data table (for example, it is specifically an auto-increment primary key) is "1", and "syncField:wareStatus" indicates that the business field to be marked in the first data table is "wareStatus".
[0094] In another optional example, the data marking request may not carry the unique identifier of the business data to be processed and the business field to be marked in the first data table. In this optional example, the determination module 401 can query the unique identifier of the business data to be processed and the business field to be marked corresponding to it according to the information carried in the data marking request.
[0095] A row in the first data table is used to store a piece of business data, and the business data includes the value of each business field and the value of the business identification field used to mark the business field. For example, a piece of business data in the first data table includes the value of business field A, the value of business field B, the value of business field C, and the value of the business identification field "mark" used to mark business fields A, B, and C.
[0096] Furthermore, in order to save storage space, the data type used for the business identification field value in the first data table is a decimal value type, such as bigint, or int. Bigint is an integer data type supported by common relational databases, and its storage space is generally 8 bytes; int is an integer data type, and its storage space is generally 4 bytes. After the business identification field value is converted from decimal to binary in the memory, the business identification field value obtained in binary form has the following meaning: a business field in the first data table corresponds to a position in the business identification field value represented in binary form, and the value of the position represents the tag value of the business field, specifically the first Boolean value or the second Boolean value. In specific implementation, if the first Boolean value is set to 1, the second Boolean value is 0; if the first Boolean value is set to 0, the second Boolean value is 1. For example, assuming that the business identification field value expressed in binary form is 01011, and there are five business fields A to E in the first data table, the value of the first position of the business identification field value from left to right can represent the tag value of business field A, the value of the second position represents the tag value of business field B, the value of the third position represents the tag value of business field C, the value of the fourth position represents the tag value of business field D, and the value of the fifth position represents the tag value of business field E.
[0097] The generating module 402 is used to generate a first service identification value expressed in binary form according to the service field to be marked, and convert the first service identification value into a second service identification value expressed in decimal form.
[0098] Among them, the business field to be marked may specifically be a business field to be marked as a first Boolean value, and / or a business field to be marked as a second Boolean value. In different business scenarios, the marking values of business fields have different practical meanings. Exemplarily, in a certain business scenario, the marking value of a business field is a first Boolean value, indicating that the business field needs to be updated together with the master data, and the marking value of the business field is a second Boolean value, indicating that the business field does not need to be updated together with the master data. Furthermore, in this example, the business field to be marked may specifically be a business field that needs to be updated together with the master data, and / or a business field that does not need to be updated together with the master data.
[0099] In an optional example, the generation module 402 generates a first business identification value expressed in binary form according to the business field to be marked, including: the generation module 402 obtains the business identification field value in the business data corresponding to the unique identifier in the first data table; the generation module 402 converts the obtained business identification field value into a binary identification array; the generation module 402 queries the configuration information according to the business field to be marked to determine the position of the business field to be marked in the binary identification array; the generation module 402 updates the value of the position of the business field to be marked in the binary identification array to obtain the first business identification value.
[0100] The updating module 403 is used to update the service identification field value in the service data corresponding to the unique identification in the first data table according to the second service identification value.
[0101] In an optional example, after obtaining the second business identification value expressed in decimal, in order to prevent data confusion caused by concurrent modification, the update module 403 can use an optimistic lock to update the business identification field value in the business data corresponding to the unique identification in the first data table. In an optional implementation, the update module 403 can update the business identification field value based on the unique identification of the business data to be processed carried by the data marking request and the original business identification field value in the first data table. For example, the following database update statement can be used: Update ware set mark=#newmark where id=#id and mark=#oldmark. Among them, "#newmark" represents the second business identification value, "#id" represents the unique identification of the business data to be processed, and "#oldmark" represents the business field identification value in the database before modification.
[0102] In the device of the embodiment of the present invention, after receiving the data marking request, the determination module determines the unique identifier of the business data to be processed in the first data table and the business field to be marked, generates a first business identification value expressed in binary form according to the business field to be marked through the generation module, and converts the first business identification value into a second business identification value expressed in decimal form, and updates the business identification field value in the business data corresponding to the unique identifier in the first data table according to the second business identification value through the update module, which can meet the personalized data marking requirements of the business system and reduce the identification storage cost and loading cost of the business data.
[0103] Figure 5 An exemplary system architecture 500 is shown to which the data processing method or data processing device according to the embodiment of the present invention can be applied.
[0104] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0105] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0106] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0107] The server 505 may be a server that provides various services, such as a background management server that provides support for data marking requests issued by users using the terminal devices 501, 502, and 503. After receiving the data marking request, the background management server may perform a data marking operation and return the data marking result to the terminal device.
[0108] It should be noted that the data processing method provided in the embodiment of the present invention can be executed by the server 505 , and accordingly, the data processing device is set in the server 505 .
[0109] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0110] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of an electronic device suitable for implementing an embodiment of the present invention. Figure 6 The computer system shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0111] like Figure 6As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0112] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0113] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.
[0114] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0115] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0116] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a determination module, a generation module and an update module. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the update module may also be described as a "module for updating the first data table".
[0117] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device executes the following process: after receiving a data marking request, determine the unique identifier of the business data to be processed in the first data table and the business field to be marked; wherein a row in the first data table is used to store a piece of business data, and the business data includes the values of each business field and the business identification field value used to mark the business field; generate a first business identification value represented in binary form according to the business field to be marked, and convert the first business identification value into a second business identification value represented in decimal form; update the business identification field value in the business data corresponding to the unique identifier in the first data table according to the second business identification value.
[0118] According to the technical solution of the embodiment of the present invention, it is possible to meet the personalized data labeling requirements of the business system and reduce the identification storage cost and loading cost of the business data.
[0119] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A data processing method, characterized in that: The method comprises: After receiving the data marking request, determine the unique identifier of the business data to be processed in the first data table and the business field to be marked; wherein a row in the first data table is used to store a piece of business data, the business data includes the value of each business field and the business identification field value used to mark the business field; the data type used by the business identification field value in the first data table is a decimal value type; Generating a first service identification value expressed in binary form according to the service field to be marked, and converting the first service identification value into a second service identification value expressed in decimal form; The service identification field value in the service data corresponding to the unique identification in the first data table is updated according to the second service identification value.
2. The method according to claim 1, characterized in that The generating a first service identification value represented in binary form according to the service field to be marked comprises: Obtain a business identification field value in the business data corresponding to the unique identifier in the first data table; convert the obtained business identification field value into a binary identification array; query configuration information according to the business field to be marked to determine the position of the business field to be marked in the binary identification array; update the value of the position of the business field to be marked in the binary identification array to obtain the first business identification value.
3. The method according to claim 1, characterized in that The updating of the service identification field value in the service data corresponding to the unique identification in the first data table according to the second service identification value comprises: When an update operation is performed according to the second service identification value, an optimistic lock is used to update the service identification field value in the service data corresponding to the unique identification in the first data table.
4. The method according to claim 2, characterized in that: The service identification field is used to indicate whether each service field in the first data table needs to be updated together with the second data table.
5. The method according to claim 4, characterized in that The updating of the value of the position of the service field to be marked in the binary identification array comprises: When the business field to be marked is a field that needs to be updated together with the second data table, the value of the position of the business field to be marked in the binary identification array is updated to a first Boolean value; when the business field to be marked is a field that does not need to be updated together with the second data table, the value of the position of the business field to be marked in the binary identification array is updated to a second Boolean value.
6. The method according to claim 4, characterized in that The method further comprises: After receiving the second data table change message, the change details of the second data table are determined; and the values of the business fields in the first data table that need to be updated together with the second data table are updated according to the change details of the second data table.
7. The method according to claim 5, characterized in that The change details of the second data table include: a unique identifier of the changed data, and a business field value in the changed data; and updating the value of the business field in the first data table that needs to be updated together with the second data table according to the change details of the second data table includes: Assemble a first data object according to the change data unique identifier and the business field value in the change data; obtain the business identifier field value in the business data corresponding to the change data unique identifier in the first data table; convert the obtained business identifier field value into a fifth business identifier value represented in binary form, and determine the business field in the first data table that needs to be updated together with the second data table according to the fifth business identifier value; assemble a second data object according to the change data unique identifier and the business field in the first data table that needs to be updated together with the second data table; assign a value to the second data object according to the first data object; and update the first data table according to the assigned second data object.
8. A data processing device, characterized in that: The device comprises: A determination module, configured to determine, after receiving a data marking request, a unique identifier of the business data to be processed in the first data table and a business field to be marked; wherein a row in the first data table is used to store a piece of business data, the business data including values of each business field and a business identification field value used to mark the business field; the data type adopted by the business identification field value in the first data table is a decimal value type; A generating module, configured to generate a first service identification value expressed in binary form according to the service field to be marked, and convert the first service identification value into a second service identification value expressed in decimal form; An updating module is used to update the service identification field value in the service data corresponding to the unique identification in the first data table according to the second service identification value.
9. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Generation method and device of unique identifier in distributed environment and computer equipment
CN109740120A
Object-orientation marking method
CN1996308A