CN115599787A - Level sub-metering method and device, electronic equipment and storage medium - Google Patents

Level sub-metering method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115599787A
CN115599787A CN202211314103.6A CN202211314103A CN115599787A CN 115599787 A CN115599787 A CN 115599787A CN 202211314103 A CN202211314103 A CN 202211314103A CN 115599787 A CN115599787 A CN 115599787A
Authority
CN
China
Prior art keywords
sub
service
data
index value
tables
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211314103.6A
Other languages
Chinese (zh)
Inventor
黄晓铭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank 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 Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202211314103.6A priority Critical patent/CN115599787A/en
Publication of CN115599787A publication Critical patent/CN115599787A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems

Landscapes

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

Abstract

The invention discloses a horizontal sub-metering method, a horizontal sub-metering device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring the service types of all data of a service table, and performing horizontal sub-table operation on the service table according to the service types to obtain a plurality of sub-tables; establishing an implementation class of each sub-table and an index value corresponding to the implementation class according to the service type of each sub-table, and storing the implementation class of each sub-table into an spr ng container, wherein each implementation class shares a data access object interface; and associating the index value with a preset proxy interface, and enabling the proxy interface to inherit a data access object interface in the spr i ng container so as to find a corresponding implementation class of the sub-table in the spr i ng container through the index value. The invention solves the technical problems of high repeated code quantity and redundant code quantity and low code flexibility in the process of table division at present.

Description

Level sub-metering method and device, electronic equipment and storage medium
Technical Field
The invention relates to the technical field of data processing, in particular to a horizontal sub-table method and device, electronic equipment and a storage medium.
Background
When the single-table data increment is too fast or reaches the data volume of tens of millions or even hundreds of millions, the database has performance bottleneck, and a large amount of requests are blocked, SQL operation is slow, and storage is problematic. However, if the storage bottleneck does not occur in the single database storage at this time, and the database hierarchical table splitting operation is not required, how to implement the database horizontal table splitting operation by means of the application layer capability is implemented, so as to ensure that the generation of a large table is avoided, and the system complexity is not increased.
The general solution is: and dividing the data into a plurality of tables according to the specific function level, wherein each table has a corresponding mapper mapping layer and a corresponding DAO layer, and calling a corresponding JavaBean interface class operation object when the service logic layer operates the DML of the database.
However, as more tables and more redundant codes of the DAO layer are used, especially when a whole table needs to be queried, readability and maintainability of the codes are worse (when a large table is used, only one table needs to be operated, and a plurality of tables need to be operated).
The problems associated with the prior art are apparent and are particularly pointed out
The first problem is that: a large amount of hard codes exist in a plurality of DAO layer interfaces brought by horizontal tabulation, and the flexibility is poor;
the second problem is that: code maintenance difficulties due to redundant code;
the third problem is that: the change of the original code business logic layer is large.
Therefore, a table-division method capable of reducing the amount of repetitive codes and the amount of redundant codes and improving the flexibility of codes is needed.
Disclosure of Invention
The present invention is directed to overcome the above technical deficiencies, and provides a horizontal table splitting method, apparatus, electronic device and storage medium applied to the financial technology or other related technical fields, which solve the technical problems of high amount of repeated codes and redundant codes and low flexibility of codes in table splitting in the prior art.
In order to achieve the technical purpose, the invention adopts the following technical scheme:
in a first aspect, the present invention provides a horizontal tabling method, comprising the steps of:
acquiring the service types of all data of a service table, and performing horizontal sub-table operation on the service table according to the service types to obtain a plurality of sub-tables;
establishing an implementation class of each sub-table and an index value corresponding to the implementation class according to the service type of each sub-table, and storing the implementation class of each sub-table into a spring container, wherein each implementation class shares a data access object interface;
and associating the index value with a preset proxy class interface, and enabling the proxy class interface to inherit a data access object interface in the spring container so as to find the corresponding implementation class of the sub-table in the spring container through the index value.
In some embodiments, the obtaining the service types of all data of the service table, and performing horizontal table division operation on the service table according to the service types to obtain a plurality of tables includes:
acquiring attribute tags of all data in the service table, and determining service types of all data in the service table according to the attribute tags;
and distributing the data with the same service type to the same sub-table according to a preset sub-database and sub-table principle to obtain a plurality of sub-tables in which different service type data are stored.
In some embodiments, allocating data with the same service type to the same sub-table according to a preset sub-base sub-table principle to obtain a plurality of sub-tables storing data with different service types, includes:
generating a database-dividing and table-dividing script according to a preset database-dividing and table-dividing principle;
and running the sub-database sub-table scripts to distribute the data with the same service type to the same sub-table to obtain a plurality of sub-tables storing different service type data.
In some embodiments, the establishing, according to the service type of each sub-table, an implementation class of each sub-table and an index value corresponding to the implementation class, and storing the implementation class of each sub-table in a spring container includes:
according to the number of each sub-table, establishing an index value with the same number as the sub-tables, and distributing the index value to each sub-table;
establishing an implementation class of the sub-table according to the service type of the sub-table, and associating the implementation class with the index value;
and storing the implementation classes of the sub-tables into a preset spring container.
In some embodiments, the index values are unique, and each index value corresponds to a unique implementation class.
In some embodiments, the index value is an enumerated class associated with the traffic type.
In some embodiments, the horizontal tabbing method further comprises:
and updating the service table, judging whether new service type data is added in the service table, if so, establishing a new sub-table, a realization class of the sub-table and an index value corresponding to the realization class according to the newly added service type, storing the realization class into a spring container, and associating the newly added index value with a preset proxy interface.
In a second aspect, the present invention provides a horizontal sub-meter device, comprising:
the table dividing module is used for acquiring the service types of all data of a service table and performing horizontal table dividing operation on the service table according to the service types to obtain a plurality of tables;
the establishing module is used for establishing the implementation classes of the sub-tables and the index values corresponding to the implementation classes according to the service types of the sub-tables, and storing the implementation classes of the sub-tables into a spring container, wherein the implementation classes share one data access object interface;
and the association module is used for associating the index value with a preset proxy class interface, enabling the proxy class interface to inherit a data access object interface in the spring container, and finding a corresponding implementation class of the sub-table in the spring container through the index value.
In a third aspect, the present invention also provides an electronic device, including: a processor and a memory;
the memory having stored thereon a computer program executable by the processor;
the processor, when executing the computer program, implements the steps in the horizontal spreadsheet method as described above.
In a fourth aspect, the present invention also provides a computer readable storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement the steps in the horizontal sub-table method as described above.
Compared with the prior art, according to the horizontal table dividing method, the horizontal table dividing device, the electronic equipment and the storage medium, firstly, the service types of all data of a service table are obtained, the service table is subjected to horizontal table dividing operation according to the service types to obtain a plurality of sub tables, then, according to the service types of the sub tables, the implementation classes of the sub tables and the index values corresponding to the implementation classes are established, the implementation classes of the sub tables are stored in a spring container, finally, the index values are associated with the preset proxy class interfaces, the proxy class interfaces inherit the data access object interfaces in the spring container, and the implementation classes of the corresponding sub tables are found in the spring container through the index values. The horizontal sub-table is realized by combining the DB layer and the application layer, so that the problem that a plurality of service scenes need to be compiled for a plurality of times is solved. Compared with the traditional table dividing method, the repeated code amount and the redundant code amount are greatly reduced, and the flexibility of the code is improved.
Drawings
FIG. 1 is a flow chart of a horizontal tabbing method provided by an embodiment of the present invention;
fig. 2 is a flowchart of step S100 in the horizontal spreadsheet method according to the embodiment of the present invention;
fig. 3 is a flowchart of step S200 in the horizontal table dividing method according to the embodiment of the present invention;
FIG. 4 is a functional block diagram of a horizontal sub-meter apparatus according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic flow chart of a horizontal table splitting method according to an embodiment of the present invention, which can be used in a database horizontal table splitting in financial fields such as banks to reduce the amount of repeated codes and redundant codes generated during table splitting and improve the flexibility of codes. The horizontal sub-metering method can be executed by an electronic device, the electronic device can receive or send data and the like, and the electronic device can be various electronic devices which have display screens and support webpage browsing, including but not limited to smart phones, tablet computers, portable computers, desktop servers and the like. As shown in fig. 1, the method specifically includes the following steps S100 to S300.
S100, obtaining the service types of all data of a service table, and performing horizontal table division operation on the service table according to the service types to obtain a plurality of tables.
In the embodiment, after the private recruitment, the service platform needs to send a large number of short messages, weChat messages and intranet mails to clients and financial managers every day, and the used short message tables, weChat tables and mail tables are large tables, so that the performance bottleneck of the database can be caused when the service platform is used.
Illustratively, taking a horizontal split short message table as an example, the short message summary table is split into 7 tables according to the service scene level, which are respectively a product announcement report short message table (XpSmsInfoCpggbgDAOImpl), a product open-day short message table (xpsmlnfocpkfrfdaoimpl), an asset due take-over short message table (xpsminfodqjddaoimpl), a product due short message table (xpsminfodqdaoimpl), a ticket refund short message table (xpsminfotdaompl), a product early due short message table (xpsminfotdqdaoimpl) and an industry reward calculation short message table (xpsminfoyjbcjdaompoll), and the short message summary table is divided according to the service scene of each data to achieve the purpose of the horizontal split table.
S200, establishing an implementation class of each sub-table and an index value corresponding to the implementation class according to the service type of each sub-table, and storing the implementation class of each sub-table into a spring container, wherein each implementation class shares one data access object interface.
In the embodiment, the application object support interface class of Spring is introduced to be combined with the polymorphism design proxy class of java to realize horizontal table division processing, so that the performance bottleneck of a large table is solved, and the flexibility, the readable line and the maintainability of the code are improved. Specifically, in this embodiment, the DAOs of multiple sub-tables are injected into a Spring container, and the DAOs of the multiple sub-tables implement the same interface xpssmsinfobasedao, so that all implementation classes of the interface can be obtained through the following codes:
Map<String,XpSmsInfoBaseDao>smsProcessors=applicationContext.getBeansOfType(XpSmsInfoBaseDao.class);
in addition, in this embodiment, the obtained multiple implementation classes are placed in a proxy global variable (Map) xpssmsinfobasedaoiempls, and the service layer can obtain the implementation class of the DAO only by introducing a corresponding index value, so as to achieve the purpose of indirectly operating the DAO implementation class.
S300, associating the index value with a preset proxy interface, and enabling the proxy interface to inherit a data access object interface in the spring container so as to find a corresponding implementation class of the sub-table in the spring container through the index value.
In the embodiment, the proxy agent class depended by the service logic layer inherits the interface class of the short message DAO layer, and obtains the DAO realization class of the short message table corresponding to the service scene from the Spring container according to the index value, so that a large amount of redundant codes caused by horizontal table division are solved.
The invention realizes the invariance of the final purpose of the horizontal sub-table by combining the DB layer and the application layer, namely, the burden of a database is reduced, the query time is shortened, the designed proxy type realizes the DML operation of the short message table, a large number of redundant codes caused by the horizontal sub-table are solved, the readability and the maintainability of the codes are improved, the operation of the database by the proxy is the same as that of the conventional large operation table, the business logic layer does not need to pay attention to the data to which table to read and write, and the tidiness of the codes is kept.
The method comprises the steps of firstly obtaining service types of all data of a service table, carrying out horizontal table division operation on the service table according to the service types to obtain a plurality of sub tables, then establishing implementation classes of the sub tables and index values corresponding to the implementation classes according to the service types of the sub tables, storing the implementation classes of the sub tables into a spring container, and finally associating the index values with preset proxy class interfaces to enable the proxy class interfaces to inherit data access object interfaces in the spring container so as to find the implementation classes of the corresponding sub tables in the spring container through the index values. The horizontal sub-table is realized by combining the DB layer and the application layer, so that the problem that a plurality of service scenes need to be compiled for a plurality of times is solved. Compared with the traditional table dividing method, the repeated code amount and the redundant code amount are greatly reduced, and the flexibility of the code is improved.
In some embodiments, referring to fig. 2, the step S200 specifically includes:
s210, obtaining attribute labels of all data in the service table, and determining service types of all data in the service table according to the attribute labels;
and S220, distributing the data with the same service type to the same sub-table according to a preset sub-base sub-table principle to obtain a plurality of sub-tables storing different service type data.
In this embodiment, all data in the business table are analyzed first to obtain attribute tags, where the attribute tags are used to identify the business types to which the business table belongs, such as product announcement reports, product open dates, asset expiration support, product expiration, ticket refund, product expiration in advance, performance reward program, and the like, and all data in the business table can be classified quickly through the attribute tags.
After the attribute labels are obtained, the table division operation can be carried out according to a preset database and table division principle, and data with the same service type are distributed to the same table division, so that the table division purpose is achieved.
The database sub-table principle can be customized by a user, and only data meeting the same service type are distributed to the same sub-table. For example, the database-based and table-dividing principle performs table-dividing operation based on the attribute tags, that is, performs table-dividing operation according to the time fields in the attribute tags, for example, when performing table division, data of the same service type is allocated to the same table, then the data in the table is sorted according to the time fields, and the data in the table can be sorted according to the chronological order represented by the time fields, so as to obtain a neatly-sorted table.
In some embodiments, the step S220 specifically includes:
generating a database-dividing and table-dividing script according to a preset database-dividing and table-dividing principle;
and running the sub-database sub-table scripts to distribute the data with the same service type to the same sub-table to obtain a plurality of sub-tables storing different service type data.
In this embodiment, a library-splitting table-splitting script is generated according to a preset library-splitting table-splitting principle, where the library-splitting table-splitting script is a file for executing library-splitting table-splitting operation, and the library-splitting table-splitting script can identify an attribute tag of file data and extract a time field and a service type therein, and then perform library-splitting table-splitting operation according to the service type and the time field to obtain a sub table required by a user.
In some embodiments, referring to fig. 3, the step S300 specifically includes:
s310, establishing index values with the same number as the sub-tables according to the number of the sub-tables, and distributing the index values to the sub-tables;
s320, establishing an implementation class of the sub-table according to the service type of the sub-table, and associating the implementation class with the index value;
s330, storing the implementation classes of the sub-tables into a preset spring container.
In this embodiment, an ApplicationObjectSupport interface class introducing Spring is combined with a polymorphic design proxy class of java to implement horizontal table splitting processing, first, in order to quickly find an implementation class of a sub-table, an unique index value is corresponding to each implementation class of the sub-table, and the corresponding implementation class can be quickly found through the unique shared data access object interface of each implementation class by using the index value, so that query operation is implemented. The index value can be set according to the requirements of the user, and only the purpose of convenient query is needed to be met.
In some embodiments, the index values are unique, and each index value corresponds to a unique implementation class.
In this embodiment, in order to avoid finding multiple implementation classes with the same index value, the implementation classes are set to be unique, and each index value corresponds to only one implementation class, so that when a unique index value is input by the service logic layer, only the implementation class of the unique sub-table is found, thereby facilitating query of a user. Of course, in other embodiments, the index value may not be set to be unique, that is, one index value may search for multiple implementation classes, but at this time, the user is required to manually filter the required implementation classes.
In some embodiments, the index value is an enumerated class associated with the traffic type.
Illustratively, for a service logic layer, a DAO operation database is indirectly called through proxy, the use mode is similar to that of a large-table DAO operation, and the DAO operation can be realized only by adding one more service scene enumeration value. The following code is shown:
entry. Setbyzscene (bizscene enum. Cpkfr); v/set up a business scenario enumeration,
the level sub-table is realized by combining the DB layer and the application layer, the design idea is similar to spring AOP tangent plane programming, and the problem that a plurality of service scenes need to be compiled for a plurality of times is solved.
In some embodiments, the horizontal tabbing method further comprises:
and updating the service table, judging whether new service type data is added in the service table, if so, establishing a new sub-table, a realization class of the sub-table and an index value corresponding to the realization class according to the new service type, storing the realization class into a spring container, and associating the new index value with a preset proxy interface.
In this embodiment, when a corresponding sub-table needs to be created even under a newly added service scenario, the implementation can be achieved only by entering an enumeration value of one more service scenario, and a developer only needs to create a database table and an sqlmpaper.
According to the technical scheme provided by the invention, firstly, the service types of all data of a service table are obtained, the service table is subjected to horizontal table division operation according to the service types to obtain a plurality of sub tables, then the implementation classes of the sub tables and the index values corresponding to the implementation classes are established according to the service types of the sub tables, the implementation classes of the sub tables are stored in a spring container, and finally the index values are associated with a preset proxy class interface, so that the proxy class interface inherits a data access object interface in the spring container, and the corresponding implementation classes of the sub tables are searched in the spring container through the index values. The horizontal sub-table is realized by combining the DB layer and the application layer, so that the problem that a plurality of service scenes need to be compiled for a plurality of times is solved. Compared with the traditional table division method, the repeated code amount and the redundant code amount are greatly reduced, and the flexibility of the code is improved.
Referring to fig. 4, the horizontal table classifying device according to another embodiment of the present invention includes a code table classifying module 11, an establishing module 12, and an associating module 13.
The table dividing module 11 is configured to obtain service types of all data of a service table, and perform a horizontal table dividing operation on the service table according to the service types to obtain a plurality of tables.
The establishing module 12 is configured to establish an implementation class of each sub-table and an index value corresponding to the implementation class according to a service type of each sub-table, and store the implementation class of each sub-table in a spring container, where each implementation class shares a data access object interface.
The association module 13 is configured to associate the index value with a preset proxy class interface, and enable the proxy class interface to inherit a data access object interface in the spring container, so as to find a corresponding implementation class of the sub-table in the spring container through the index value.
The method comprises the steps of firstly obtaining service types of all data of a service table, carrying out horizontal table division operation on the service table according to the service types to obtain a plurality of sub tables, then establishing implementation classes of the sub tables and index values corresponding to the implementation classes according to the service types of the sub tables, storing the implementation classes of the sub tables into a spring container, and finally associating the index values with preset proxy class interfaces to enable the proxy class interfaces to inherit data access object interfaces in the spring container so as to find the implementation classes of the corresponding sub tables in the spring container through the index values. The horizontal sub-table is realized by combining the DB layer and the application layer, and the problem that a plurality of service scenes need to be compiled for a plurality of times is solved. Compared with the traditional table division method, the repeated code amount and the redundant code amount are greatly reduced, and the flexibility of the code is improved.
It should be noted that the modules referred to in the present invention refer to a series of computer program instruction segments capable of performing specific functions, and are more suitable for describing the execution process of metadata completeness detection than a program.
In some embodiments, the sub-table module 11 includes an attribute tag obtaining unit and an assigning unit.
The attribute tag obtaining unit is used for obtaining the attribute tags of all the data in the service table and determining the service types of all the data in the service table according to the attribute tags.
The distribution unit is used for distributing the data with the same service type to the same sub-table according to a preset sub-base sub-table principle so as to obtain a plurality of sub-tables in which different service type data are stored.
In some embodiments, the allocation unit is specifically configured to:
generating a database and table dividing script according to a preset database and table dividing principle;
and running the sub-database sub-table scripts to distribute the data with the same service type to the same sub-table to obtain a plurality of sub-tables storing different service type data.
In some embodiments, the establishing module 12 includes an index value creating unit, an implementation class creating unit, and a storage unit.
The index value creating unit is used for creating index values with the same quantity as the sub-tables according to the quantity of the sub-tables and distributing the index values to the sub-tables.
The realization type creating unit is used for creating the realization type of the sub-table according to the service type of the sub-table and associating the realization type with the index value.
The storage unit is used for storing the implementation classes of the sub-tables into a preset spring container.
In some embodiments, the index values are unique, and each index value corresponds to a unique implementation class.
In some embodiments, the index value is an enumerated class associated with the traffic type.
In some embodiments, the horizontal table splitting device further includes an updating module, configured to update the service table, determine whether to add data of a new service type to the service table, if so, establish a new table splitting, an implementation class of the table splitting, and an index value corresponding to the implementation class according to the new service type, store the implementation class in a spring container, and associate the new index value with a preset proxy class interface.
Another embodiment of the present invention provides an electronic device, as shown in fig. 5, the electronic device 10 includes:
one or more processors 110 and a memory 120, where one processor 110 is illustrated in fig. 5, the processor 110 and the memory 120 may be connected by a bus or other means, and where fig. 5 illustrates a connection by a bus.
The processor 110 is used to implement various control logic for the electronic device 10, which may be a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), a single chip microcomputer, an ARM (Acorn RISC Machine) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components. Also, the processor 110 may be any conventional processor, microprocessor, or state machine. The processor 110 may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP, and/or any other such configuration.
The memory 120, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as program instructions corresponding to the horizontal sub-table method in the embodiments of the present invention. The processor 110 executes various functional applications and data processing of the electronic device 10, i.e., implements the horizontal sub-table method in the above-described method embodiments, by executing the nonvolatile software programs, instructions, and units stored in the memory 120.
The memory 120 may include a storage program area and a storage data area, wherein the storage program area may store an application program required for operating the platform, at least one function; the storage data area may store data created from use of the electronic device 10, and the like. Further, the memory 120 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, the memory 120 optionally includes memory located remotely from the processor 110, which may be connected to the electronic device 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
One or more units are stored in memory 120, which when executed by one or more processors 110, perform the horizontal sub-table method in any of the method embodiments described above, e.g., performing method steps S100-S300 in fig. 1 described above.
Another embodiment of the present invention provides a computer-readable storage medium storing computer-executable instructions for execution by one or more processors, for example, to perform steps S100 to S300 of the method of fig. 1 described above.
By way of example, a computer-readable storage medium can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically erasable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM), which acts as external cache memory. By way of illustration and not limitation, RAM is available in many forms such as Synchronous RAM (SRAM), dynamic RAM, (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The disclosed memory components or memory of the operating environment described herein are intended to comprise one or more of these and/or any other suitable types of memory.
In summary, according to the horizontal table splitting method, the horizontal table splitting device, the electronic device, and the storage medium provided by the present invention, first, the service types of all data of the service table are obtained, the service table is subjected to a horizontal table splitting operation according to the service types to obtain a plurality of sub tables, then, according to the service types of the sub tables, the implementation classes of the sub tables and the index values corresponding to the implementation classes are established, the implementation classes of the sub tables are stored in the spring container, and finally, the index values are associated with the preset proxy class interfaces, and the proxy class interfaces inherit the data access object interfaces in the spring container, so as to find the implementation classes of the corresponding sub tables in the spring container through the index values. The horizontal sub-table is realized by combining the DB layer and the application layer, so that the problem that a plurality of service scenes need to be compiled for a plurality of times is solved. Compared with the traditional table dividing method, the repeated code amount and the redundant code amount are greatly reduced, and the flexibility of the code is improved.
The above-described embodiments of the present invention should not be construed as limiting the scope of the present invention. Any other corresponding changes and modifications made according to the technical idea of the present invention should be included in the protection scope of the claims of the present invention.

Claims (10)

1. A horizontal tabling method is characterized by comprising the following steps:
acquiring the service types of all data of a service table, and performing horizontal table division operation on the service table according to the service types to obtain a plurality of tables;
establishing an implementation class of each sub-table and an index value corresponding to the implementation class according to the service type of each sub-table, and storing the implementation class of each sub-table into a spring container, wherein each implementation class shares one data access object interface;
and associating the index value with a preset proxy interface, and enabling the proxy interface to inherit a data access object interface in the spring container so as to find a corresponding implementation class of the sub-table in the spring container through the index value.
2. The method of claim 1, wherein the obtaining the service types of all data in the service table, and performing a horizontal table splitting operation on the service table according to the service types to obtain a plurality of tables comprises:
acquiring attribute tags of all data in the service table, and determining service types of all data in the service table according to the attribute tags;
and distributing the data with the same service type to the same sub-table according to a preset sub-database sub-table principle so as to obtain a plurality of sub-tables storing different service type data.
3. The method of claim 2, wherein the step of distributing data with the same service type to the same sub-table according to a preset sub-base sub-table principle to obtain a plurality of sub-tables storing data with different service types comprises:
generating a database-dividing and table-dividing script according to a preset database-dividing and table-dividing principle;
and running the sub-database sub-table scripts to distribute the data with the same service type to the same sub-table to obtain a plurality of sub-tables storing different service type data.
4. The method according to claim 1, wherein the establishing an implementation class of each sub-table and an index value corresponding to the implementation class according to a service type of each sub-table, and storing the implementation class of each sub-table in a spring container includes:
according to the number of each sub-table, establishing an index value with the same number as the sub-tables, and distributing the index value to each sub-table;
establishing an implementation class of the sub-table according to the service type of the sub-table, and associating the implementation class with the index value;
and storing the implementation classes of the sub-tables into a preset spring container.
5. The method of claim 4, wherein the index values are unique and each index value corresponds to a unique implementation class.
6. The method of claim 1, wherein the index value is an enumerated class associated with the traffic type.
7. The method of claim 1, further comprising:
and updating the service table, judging whether new service type data is added in the service table, if so, establishing a new sub-table, a realization class of the sub-table and an index value corresponding to the realization class according to the newly added service type, storing the realization class into a spring container, and associating the newly added index value with a preset proxy interface.
8. A horizontal spread-chart apparatus, comprising:
the table dividing module is used for acquiring the service types of all data of a service table and performing horizontal table dividing operation on the service table according to the service types to obtain a plurality of tables;
the establishing module is used for establishing the implementation classes of all the sub-tables and the index values corresponding to the implementation classes according to the service types of all the sub-tables, and storing the implementation classes of all the sub-tables into a spring container, wherein all the implementation classes share one data access object interface;
and the association module is used for associating the index value with a preset proxy class interface, enabling the proxy class interface to inherit a data access object interface in the spring container, and finding a corresponding implementation class of the sub-table in the spring container through the index value.
9. An electronic device, comprising: a processor and a memory;
the memory having stored thereon a computer program executable by the processor;
the processor when executing the computer program realizes the steps in the horizontal spreadsheet method of any of claims 1-7.
10. A computer readable storage medium, storing one or more programs, the one or more programs being executable by one or more processors for performing the steps in the horizontal sub-table method of any of claims 1-7.
CN202211314103.6A 2022-10-25 2022-10-25 Level sub-metering method and device, electronic equipment and storage medium Pending CN115599787A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211314103.6A CN115599787A (en) 2022-10-25 2022-10-25 Level sub-metering method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211314103.6A CN115599787A (en) 2022-10-25 2022-10-25 Level sub-metering method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115599787A true CN115599787A (en) 2023-01-13

Family

ID=84848469

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211314103.6A Pending CN115599787A (en) 2022-10-25 2022-10-25 Level sub-metering method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115599787A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110674152A (en) * 2019-09-24 2020-01-10 京东数字科技控股有限公司 Data synchronization method and device, storage medium and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110674152A (en) * 2019-09-24 2020-01-10 京东数字科技控股有限公司 Data synchronization method and device, storage medium and electronic equipment
CN110674152B (en) * 2019-09-24 2023-06-23 京东科技控股股份有限公司 Data synchronization method and device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN111310427A (en) Service data configuration processing method and device, computer equipment and storage medium
CN110633296A (en) Data query method, device, medium and electronic equipment
CN111858615A (en) Database table generation method, system, computer system and readable storage medium
CN102880683A (en) Automatic network generation system for feasibility study report and generation method thereof
US20140136578A1 (en) Techniques to manage virtual files
CN115599787A (en) Level sub-metering method and device, electronic equipment and storage medium
CN113569257B (en) User authority management method and device in gray level release
CN114138781A (en) Policy data updating method and device, computer equipment and readable storage medium
Choi et al. Improving database system performance by applying NoSQL
CN108108392B (en) Commodity data management method, commodity data management device, computer equipment and storage medium
CN109977317B (en) Data query method and device
WO2023078078A1 (en) Unified data security labeling framework
US11182144B2 (en) Preventing database package updates to fail customer requests and cause data corruptions
CN112491943A (en) Data request method, device, storage medium and electronic equipment
US9286330B2 (en) Migration of data objects
CN114168595A (en) Data analysis method and device
US10114864B1 (en) List element query support and processing
CN114115796A (en) Data processing method and device, computer readable medium and electronic equipment
CN113064928A (en) Report data query method and device, electronic equipment and storage medium
CN112231377A (en) Data mapping method, system, device, server and storage medium
CN110728584B (en) Information processing method and device, readable storage medium and electronic equipment
CN115526731A (en) Task batch processing method and device, computer equipment and storage medium
CN110019442A (en) Access method and device
CN116186098A (en) HIVE data access control method and device, electronic equipment and storage medium
CN114385630A (en) Blood relationship combing method, apparatus, device, storage medium, and program product

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