Database table operation methods, devices, electronic equipment and storage media

By constructing a general database operation architecture, including general control classes and business logic classes, and using reflection to create table template class objects, the repetitive development problem when adding new tables in the database is solved, development and testing costs are reduced, and program problems are reduced.

CN114840491BActive Publication Date: 2025-12-02QINGDAO HAIER TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210301978.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-24
Publication Date
2025-12-02
Estimated Expiration
2042-03-24

AI Technical Summary

Technical Problem

The lack of universality in existing database operation architectures means that modifications are required when adding new tables, resulting in high development costs and a high likelihood of program problems.

Method used

Construct a general database operation architecture, including general control classes, general business logic classes, and database access classes. Use reflection to create table template class objects to adapt to table operation requests for each table in the database.

Benefits of technology

It reduces repetitive development work, lowers development and testing costs, and reduces the probability of program problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114840491B_ABST
    Figure CN114840491B_ABST
Patent Text Reader

Abstract

This invention provides a database table operation method, apparatus, electronic device, and storage medium. The method includes: determining a general database operation architecture, which is adapted to table operation requests for each table in the database; receiving and parsing table operation requests sent from a front end based on the general database operation architecture to obtain table names, operation instructions, and operation data; and performing table operations corresponding to the operation instructions on the table corresponding to the table name in the database based on the operation data. The method, apparatus, electronic device, and storage medium provided by this invention, by constructing a general database operation architecture, enable the completion of table operation requests for each table in the database based on the general database operation architecture. Furthermore, when adding a new table to the database, only the non-general parts of the general database operation architecture need to be developed, reducing redundant development and thus reducing program development and testing costs, while also reducing the probability of program problems caused by redundant development.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a database table operation method, apparatus, electronic device, and storage medium. Background Technology

[0002] In current web platforms, each data management page corresponds to a table in the database. When a new management page needs to be added, a new table needs to be added to the corresponding database. At the same time, corresponding table operation functions need to be developed based on the database operation architecture. In JAVA development, for each new table added to the database, template classes, control classes, business logic classes, and data access classes corresponding to that table need to be developed based on the database operation architecture to implement operations such as adding, deleting, modifying, and querying the table.

[0003] Therefore, the existing database operation architecture involves a lot of repetitive work during development and subsequent table addition, resulting in high development and testing costs and making the program prone to problems. Summary of the Invention

[0004] This invention provides a database table operation method, apparatus, electronic device, and storage medium to solve the defects in the prior art where the database operation architecture is not universal, requiring changes to the architecture after adding a new table, which leads to high development costs and easy problems.

[0005] This invention provides a database table operation method applied to a cloud server, the method comprising:

[0006] A general database operation architecture is determined; wherein, the general database operation architecture is adapted to table operation requests of each table in the database;

[0007] Based on the general database operation architecture, the system receives and parses the table operation request sent by the front end to obtain the table name, operation instruction, and operation data. Using reflection and the operation data, it creates a table template class object corresponding to the table name and uses the table template class object to perform the table operation corresponding to the operation instruction on the table corresponding to the table name in the database.

[0008] According to a database table operation method provided by the present invention, the general database operation architecture includes: a general control class, a general business logic class, and a data access class corresponding to each table in the database;

[0009] The process of receiving and parsing the table operation request sent by the front end to obtain the table name, operation instruction, and operation data, applying reflection and the operation data to create a table template class object corresponding to the table name, and applying the table template class object to execute the table operation corresponding to the operation instruction on the table corresponding to the table name in the database, includes:

[0010] Based on the general response function of the general control class, the table operation request is received and parsed to obtain the table name, the operation instruction and the operation data;

[0011] Based on the general functions in the general business logic class, using reflection and the operation data, a table template class object corresponding to the table name is created. Using reflection, a data access class object corresponding to the table name is created. Then, using the operation function corresponding to the operation instruction in the data access class object and the table template class object, the table operation corresponding to the operation instruction is executed on the table corresponding to the table name in the database.

[0012] According to a database table operation method provided by the present invention, each attribute in the table template class corresponding to the table template class object matches the fields of the table corresponding to the table in the database.

[0013] According to a database table operation method provided by the present invention, the database access class corresponding to each table in the database is a subclass of the parent data access class;

[0014] The parent data access class is built on the persistence layer framework and includes custom table operation methods and general table operation methods in the persistence layer framework.

[0015] According to a database table operation method provided by the present invention, the step of receiving and parsing the table operation request sent by the front end includes:

[0016] The table operation request sent by the front end is received based on the preset route, and the table operation request is parsed.

[0017] The preset route is adapted to the transmission of table operation requests for each table in the database.

[0018] This invention also provides a database table operation method, applied to a front-end, the method comprising:

[0019] Determine the table name, operation command, and operation data to be operated;

[0020] Generate a table operation request, wherein the table operation request carries the table name, the operation instruction, and the operation data;

[0021] The table operation request is sent to the server based on a preset route. The server then parses the obtained table operation request based on a general database operation architecture to obtain the table name, the operation instruction, and the operation data. Based on the operation data, the server executes the table operation of the operation instruction on the table corresponding to the table name in the database. The general database operation architecture is adapted to the table operation requests of each table in the database. The preset route is adapted to the transmission of the table operation requests of each table in the database.

[0022] According to a database table operation method provided by the present invention, the table name to be operated on, the operation instruction, and the operation data are obtained based on the following steps:

[0023] Identify the user-triggered action event;

[0024] Based on the operation event, determine the current value of each control on the page, the table name, and the operation instruction;

[0025] The operation data is determined based on the current values ​​of each control.

[0026] The present invention also provides a database table operation device for use in a cloud server, the device comprising:

[0027] An acquisition unit is used to determine a general database operation architecture; wherein the general database operation architecture is adapted to table operation requests of each table in the database;

[0028] The operation unit is configured to receive and parse table operation requests sent by the front end based on the general database operation architecture, obtain the table name, operation instructions and operation data, apply reflection mechanism and the operation data to create a table template class object corresponding to the table name, and apply the table template class object to execute the table operation corresponding to the operation instructions on the table corresponding to the table name in the database.

[0029] The present invention also provides a database table operation device, applied to a front end, wherein the method includes:

[0030] The determination unit is used to determine the table name, operation instruction, and operation data to be operated on;

[0031] An operation generation unit is used to generate a table operation request, wherein the table operation request carries the table name, the operation instruction, and the operation data;

[0032] An operation request unit is used to send the table operation request to the server based on a preset route, so that the server can parse the obtained table operation request based on a general database operation architecture to obtain the table name, the operation instruction and the operation data, and execute the table operation of the operation instruction on the table corresponding to the table name in the database based on the operation data. The general database operation architecture is adapted to the table operation requests of each table in the database; the preset route is adapted to the transmission of the table operation requests of each table in the database.

[0033] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the database table operation method as described above.

[0034] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the database table operation method as described above.

[0035] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the database table operation method as described above.

[0036] The database table operation method, apparatus, electronic device, and storage medium provided by this invention, by constructing a general database operation architecture, enable the completion of table operation requests for each table in the database based on the general database operation architecture. Furthermore, when adding table operations to tables in the database, only the non-general parts of the general database operation architecture need to be developed, reducing the amount of redundant development, thereby reducing the cost of program development and testing, and also reducing the probability of program problems caused by redundant development. Attached Figure Description

[0037] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0038] Figure 1 This is one of the database table operation methods provided by the present invention;

[0039] Figure 2 This is a flowchart illustrating the database table operation method provided by the present invention;

[0040] Figure 3 This is the second database table operation method provided by the present invention;

[0041] Figure 4 This is one of the structural schematic diagrams of the database table operation device provided by the present invention;

[0042] Figure 5 This is the second schematic diagram of the structure of the database table operation device provided by the present invention;

[0043] Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0044] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0045] The embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples. The following examples are for illustrative purposes only and should not be construed as limiting the scope of the invention.

[0046] In the description of the embodiments of the present invention, it should be noted that the terms "upper," "lower," "front," "rear," "left," and "right," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing the embodiments of the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the embodiments of the present invention. In addition, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0047] In the description of the embodiments of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "class" and "class object," "parent class" and "child class" have the same interpretation as in object-oriented programming. A "class object" is an instance of a "class," and a "class object" is obtained through the instantiation of a "class." For example, a control class object is an instance of control class A, and a business logic class object is an instance of business logic class A. Furthermore, "functions in class objects" and "functions in classes" have the same meaning. For example, a response function in a control class object represents the response function in the control class corresponding to the control class object, and an operation function in a data access class object represents the operation function in the data access class corresponding to the data access class object. The terms "parent class" and "child class" have the same interpretation as in object-oriented programming.

[0048] Currently, when developing and maintaining a web platform using Java, each new management page requires adding a corresponding table to the database. Furthermore, it necessitates developing corresponding template classes (Model), controller classes (Controller), business logic classes (Service), and data access classes (Mapper) based on the database operation architecture. This results in a significant amount of repetitive development work, leading to high development and testing costs. It also causes program problems due to repetitive development work.

[0049] Therefore, how to reduce repetitive development work when developing table operation functions for each table in a database and when developing table operation functions for adding new tables later is a technical problem that urgently needs to be solved by those skilled in the art.

[0050] To address the aforementioned technical problems, embodiments of the present invention provide a database table operation method. Figure 1 This is one of the database table operation methods provided by this invention. For example... Figure 1 As shown, the method includes:

[0051] Step 110: Determine the general database operation architecture; wherein, the general database operation architecture adapts to the table operation requests of each table in the database;

[0052] Step 120: Based on the general database operation architecture, receive and parse the table operation request sent by the front end to obtain the table name and operation instructions. Apply reflection mechanism and operation data to create a table template class object corresponding to the table name, and apply the table template class object to execute the table operation corresponding to the operation instructions on the table corresponding to the table name in the database.

[0053] Considering the need to reduce repetitive development work based on the database operation architecture during the development of various management pages on the Web platform or when adding new management pages later, i.e. when adding table operations to tables in the database, this embodiment of the invention constructs a general database operation architecture. In the general database operation architecture, one or more of the control class, business logic class, and data access class are common. That is, when adding table operations to tables in the database, the common class does not need to be developed accordingly, reducing development costs and program testing costs, while also reducing program problems caused by repetitive development work.

[0054] Specifically, a generic database operation architecture is first constructed that can adapt to table operation requests from various tables in the database. Then, when the generic database operation architecture receives a table operation request from the front end, it parses the parameters in the request to obtain the table name, operation command, and operation data. It then uses Java reflection to create a table template class object corresponding to the table name and initializes it with the operation data. Finally, based on this table template class object, it executes the table operation corresponding to the operation command on the table corresponding to the table name in the database. Here, table operation refers to CRUD operations on individual tables in the database or custom single-table operations.

[0055] It should be noted that the control classes in the general database operation architecture can be constructed into a general control class. In this case, the front-end response function in the general control class, after receiving and parsing the table operation request sent by the front end to obtain the table name, operation instructions, and operation data, uses Java's reflection mechanism to create a table template class object corresponding to the table name. It then initializes the table template class object using the operation data and, based on the table name combined with the preset business logic class suffix, obtains the business logic class name. For example, if the service module suffix is ​​"Service", and the table name is "Table1", then the business logic class name is "Table1Service"; if the table name is "Table2", then the business logic class name is "Table2Service". "Serve" uses Java reflection and operation instructions to obtain the operation function in the business logic class object corresponding to the business logic class name. The business logic class object contains the corresponding database access class object, and the operation function in the business logic class object has a corresponding database operation function in the database access class object. The table template class object is passed as a parameter to the operation function in the business logic class object. The corresponding database operation function in the database access class object performs the table operation corresponding to the operation instruction on the table with the table name in the database according to the table template class object, and returns the operation result, so that the front-end response function in the general control class can return the operation result to the front end.

[0056] The business logic classes in the general database operation architecture can be further constructed into general business logic classes. Then, the front-end response function in the general control class, after receiving and parsing the table operation request sent by the front end to obtain the table name and operation instructions, calls the general function in the general business logic class object. After the general function in the business logic class object is called, Java reflection can be used to create a table template class object corresponding to the table name, and the table template class object is initialized using operation data. Based on the table name and the preset data access class suffix, the data access class name is obtained. For example, if the data access class suffix is ​​"Mapper", and the table name is "Table1Mapper" if the table name is "Table1", and "Table2Mapper" if the table name is "Table2", the operation function in the data access class object corresponding to the data access class name is obtained using Java reflection and the operation instructions. This operation function, based on the table template class object, executes the table operation corresponding to the operation instructions on the table corresponding to the table name in the database, and returns the operation result, which is then returned to the front end by the front-end response function in the general control class.

[0057] Furthermore, a parent data access class that provides general methods for multiple table operations can be constructed within the general database operation architecture. Each data access class corresponding to a table is a subclass of this parent data access class, thereby enabling each data access class to access and operate on its corresponding table in the database. The general methods for table operations can be implemented using Java's generics and reflection mechanisms, or they can be implemented based on a persistence layer framework, such as the MyBatis framework or the MyBatis Plus framework. This embodiment of the invention does not impose any limitations on this.

[0058] The embodiments of the present invention do not limit the implementation method of the above-described general database operation architecture.

[0059] Furthermore, the non-generic parts of the general database operation architecture are implemented in the same way as the corresponding parts of the existing database operation architecture. For example, if the table template class is non-generic, then its implementation is the same as that of the table template class in the existing database operation architecture.

[0060] The database table operation method provided in this embodiment of the invention, by constructing a general database operation architecture, enables the completion of table operation requests for each table in the database based on the general database operation architecture. Therefore, when adding table operations to tables in the database, only the non-general parts of the general database operation architecture need to be developed, reducing the amount of redundant development, thereby reducing the cost of program development and testing, and also reducing the probability of program problems caused by redundant development.

[0061] Based on the above embodiments, the general database operation architecture includes: a general control class and a general business logic class. Figure 2 This is a flowchart illustrating the database table operation method provided by the present invention.

[0062] like Figure 2 As shown, step 120 includes:

[0063] Step 121: Based on the general response function of the general control class, receive and parse the table operation request to obtain the table name, operation instruction and operation data;

[0064] Step 122: Based on the general functions in the general business logic class, apply reflection and operation data to create a table template class object corresponding to the table name, apply reflection to create a data access class object corresponding to the table name, and apply the operation function corresponding to the operation instruction in the data access class object, as well as the table template class object, to perform the table operation corresponding to the operation instruction on the table corresponding to the table name in the database.

[0065] Considering that constructing the control classes and business logic classes in a general database operation architecture into general control classes and general business logic classes can reduce repetitive development work when adding tables to various database tables, this embodiment of the invention constructs general control classes and general business logic classes in a general database operation architecture.

[0066] Specifically, the general part of the general database operation architecture includes a general control class and a general business logic class. The general control class can access the general functions in the general business logic class. For example, a general business logic class object can be a member object of the general control class, or it can be dynamically created by the general control class. This embodiment of the invention does not limit this.

[0067] Upon receiving a table operation request from the front end, the general response function of the general control class parses the request information to obtain the table name, operation instructions, and operation data. These parameters are then passed to a general function within the general business logic class object. When invoked, this general function uses Java reflection to generate a table template class object based on the table name. It initializes the template object with the operation data, then uses the table name combined with a predefined data access class suffix to obtain a data access class name. Java reflection is then used to generate a data access class object with that name. Finally, the corresponding operation function within this data access class object is called based on the operation instructions. After this operation function is invoked, the table operation corresponding to the operation instructions is executed on the table in the database corresponding to the table name, and the operation result is returned. This result is then sent back to the front end by the front end response function in the general control class.

[0068] It should be noted that each data access class can implement its own operations on the corresponding tables in the database; alternatively, a parent data access class that provides general methods for multiple table operations can be built in the general database operation architecture, and the data access classes corresponding to each table are all subclasses of the parent data access class, so as to realize the access and operation of each data access class on its corresponding table in the database. This embodiment of the invention does not impose any restrictions on this.

[0069] In addition, the generic response function of the general control class can represent the use of the generic response function to handle various table operation requests sent by the front end; the generic function in the business logic class object can represent the use of the function to call subsequent database table operations.

[0070] The database table operation method provided in this embodiment of the invention reduces the repetitive development work of the corresponding control class and business logic class when adding table operations to the database by constructing a general control class and a general business logic class in the database operation architecture, thereby reducing development costs and program testing costs, and reducing the probability of program errors.

[0071] Based on the above embodiments, the present invention provides a preferred embodiment in which the attributes in the table template class corresponding to the table template class object in any of the above embodiments match the fields of the table corresponding to the table template class in the database.

[0072] Considering that the data access class can support methods provided by persistence layer frameworks, such as MyBatis or MyBatis Plus, it is necessary to match each attribute in the table template class with the corresponding table fields in the database according to the requirements of the persistence layer framework. Furthermore, it is also necessary to map each attribute in the table template class to the corresponding table fields in the database to facilitate later maintenance. Therefore, this embodiment of the invention matches each attribute in the table template class with the corresponding table fields in the database.

[0073] Based on the above embodiments, the present invention provides a preferred embodiment, wherein the database access class corresponding to each table in the database in any of the above embodiments is a subclass of the parent data access class;

[0074] The parent data access class is built on the persistence layer framework and includes: custom table operation methods and general database table operation methods in the persistence layer framework.

[0075] Considering that if each database access class in the database were to perform table operations on its respective table, a large amount of repetitive development work would still be generated, resulting in high development and testing costs. Therefore, this embodiment of the invention reduces repetitive development work by constructing a single database access class that can operate on the parent data of each table.

[0076] Specifically, a parent data access class is constructed based on the persistence layer framework. This parent data access class is a generic class and includes common database table operation methods and custom table operation methods from the persistence layer framework. The table template classes corresponding to each table in the database serve as generic parameters of the parent data access class. The database access classes corresponding to each table in the database inherit from the parent data access class, becoming its subclasses. The persistence layer framework can be MyBatis Plus, but this invention does not limit its implementation. For example, the parent data access class could be `class MyBaseMapper`. <t>The class `{}` inherits from `BaseMapper` in the MyBatis+ framework. Given a table template class named `Table1`, the data access class `Class Table1Mapper extends MyBaseMapper` is defined as follows: <table1>At this point, the data access class Table1Mapper can perform table operations on the Table1 table in the database. These table operations represent the operations corresponding to the operation interfaces provided by the parent data access class, such as adding, deleting, modifying, and querying tables.

[0077] Based on the above embodiments, this invention provides a preferred embodiment, which receives and parses a table operation request sent by the front end, including:

[0078] The system receives table operation requests sent by the front end based on a preset route and parses the table operation requests; the preset route adapts to the transmission of table operation requests for each table in the database.

[0079] Figure 3 This is the second database table operation method provided by the present invention. For example... Figure 3 As shown, this embodiment of the invention provides a database table operation method, which includes:

[0080] Step 310: Determine the table name, operation command, and operation data to be operated;

[0081] Step 320: Generate a table operation request, wherein the table operation request carries the table name, operation instructions and operation data;

[0082] Step 330: A table operation request is sent to the server based on a preset route. The server then uses a general database operation architecture to parse the obtained table operation request, obtain the table name, operation instructions, and operation data, and executes the table operation instructions on the table corresponding to the table name in the database based on the operation data. The general database operation architecture adapts to the table operation requests of each table in the database; the preset route adapts to the transmission of table operation requests of each table in the database.

[0083] Specifically, when a front-end management page initiates a table operation on a corresponding table, it assembles the table name, the triggered operation command, and the operation data into a URL using a pre-defined route. This URL is then sent to the server via POST or GET. The server, with its general database operation architecture adapted to table operation requests from various tables in the database, receives and parses the request, obtaining the table name, operation command, and operation data. Based on the operation data, it executes the table operation corresponding to the operation command on the table corresponding to the specified table name in the database. All table operation requests in the database are transmitted via pre-defined routes.

[0084] It should be noted that the request address in the URL is a preset route, which points to the response function of the control class in the general database operation architecture of the server. The table name, the triggered operation command, and the operation data are the operation parameters carried in the URL. The operation data can be in string format or JSON format; this embodiment of the invention does not impose any restrictions on this.

[0085] The database table operation method provided in this embodiment of the invention constructs a database table operation request through the front end and sends the request to the response function of the control class in the general database operation architecture on the server side. This enables table operations on each table in the database to be completed through a unified route, thereby reducing the development workload of constructing different routes for different operations on the front end, further reducing the cost of program development and testing, and also reducing the probability of program problems caused by repeated development.

[0086] Based on the above embodiments, the present invention provides a method for obtaining the table name to be operated on, the operation instruction, and the operation data, the method comprising:

[0087] Step 311: Determine the user-triggered operation event;

[0088] Step 312: Based on the operation events, determine the current value, table name, and operation command of each control on the page;

[0089] Step 313: Determine the operation data based on the current values ​​of each control.

[0090] Specifically, after receiving an operation event triggered by a user on a certain management page, the system can know the table in the database corresponding to the current management page, i.e., the table name to be operated on, as well as the operation instruction corresponding to the operation event, and obtain the operation data based on the current values ​​of each control on the current page.

[0091] Based on any of the above embodiments, the present invention also provides a preferred embodiment, which provides a database table operation method, including:

[0092] Step 1: Determine the general database operation architecture. The general database architecture includes a general control class (controller), a general business logic class (service), a parent data access class (MyBaseMapper), and table template classes (model_n) and data access classes (mapper_n) corresponding to each table in the database. The data access classes for each table in the database are subclasses of the parent data access class. The parent data access class inherits from BaseMapper in the Mybatis Plus framework and can add custom methods that are common to all tables in the database, such as batch insert, batch update, or batch delete. The general business logic class is a member variable within the general control class.

[0093] Step 2: When the front-end request and response function in the general control class receives an operation request from the front end based on the general URL, it parses the operation request to obtain the table name, operation instruction, and operation data, and then passes the table name, operation instruction, and operation data into the general function of the general business logic class.

[0094] Step 3: After receiving the table name, operation instructions, and operation data, the general function of the general business logic class uses Java's reflection mechanism to generate a table template class object corresponding to the table name based on the table name and operation data; based on the table name and the suffix of the preset data access class, it obtains the data access class name corresponding to the table template class, and uses Java's reflection mechanism to reflect the data access class name to generate a data access class object; and calls the operation function corresponding to the operation instruction in the data access class object according to the operation instruction, and inputs the table template class object into the operation function.

[0095] Step four: Upon receiving the table template class object, the operation function in the data access class object, based on the operation interface developed by the parent data access class using the Mybatis Plus framework and corresponding to the operation instruction, performs the table operation of the table corresponding to the table name in the database, and returns the operation result to the general control layer. The general control layer then returns the result to the front-end response function.

[0096] The database table operation device provided by the present invention is described below. The database table operation device described below can be referred to in correspondence with the database table operation method described above.

[0097] Figure 4 This is one of the structural schematic diagrams of the database table operation device provided by the present invention. For example... Figure 4 As shown, the device is applied to a cloud server and includes a determining unit 410 and an operating unit 420.

[0098] in,

[0099] The determining unit 410 is used to determine the general database operation architecture; wherein, the general database operation architecture adapts to the table operation requests of each table in the database;

[0100] The operation unit 420 is used to receive and parse the table operation request sent by the front end based on a general database operation architecture, obtain the table name, operation instruction and operation data, apply the reflection mechanism and operation data to create a table template class object corresponding to the table name, and apply the table template class object to execute the table operation corresponding to the operation instruction on the table corresponding to the table name in the database.

[0101] In this embodiment of the invention, an acquisition unit is used to determine a general database operation architecture, which is adapted to table operation requests for each table in the database. An operation unit is used to receive and parse table operation requests sent from the front end based on the general database operation architecture, obtain the table name, operation instructions, and operation data, apply reflection and the operation data to create a table template class object corresponding to the table name, and apply the table template class object to execute the table operation corresponding to the operation instructions on the table corresponding to the table name in the database. This enables the completion of table operation requests for each table in the database based on the general database operation architecture. Furthermore, when adding table operations to tables in the database, only the non-general parts of the general database operation architecture need to be developed, reducing redundant development and thus reducing the cost of program development and testing, while also reducing the probability of program problems caused by redundant development.

[0102] Based on any of the above embodiments, the general part of the general database operation architecture in the operation unit 420 includes: a general control class and a general business logic class, and the operation unit 420 includes:

[0103] A general control subunit is used to receive and parse table operation requests based on a general response function of a general control class to obtain the table name, operation instructions and operation data;

[0104] The general business logic subunit is used to create a table template class object corresponding to the table name based on the general functions in the general business logic class, using reflection and operation data, to create a data access class object corresponding to the table name, and to perform table operations corresponding to the operation instructions on the table corresponding to the table name in the database using operation data, operation functions corresponding to the operation instructions in the data access class object, and the table template class object.

[0105] Based on any of the above embodiments, the attributes of the table template class object in the reflection-generated class object subunit match the fields of the corresponding table in the database.

[0106] Based on any of the above embodiments, the database access class corresponding to each table in the database in the general data access subunit is a subclass of the parent data access class; the parent data access class is built based on the persistence layer framework, and the parent data access class includes general table operation methods and custom table operation methods in the persistence layer framework.

[0107] Based on any of the above embodiments, the operation unit 420 includes:

[0108] The receiving and parsing subunit is used to receive table operation requests sent by the front end based on a preset route and parse the table operation requests.

[0109] The preset route adapts to the transmission of table operation requests for each table in the database.

[0110] Figure 5 This is the second structural schematic diagram of the database table operation device provided by the present invention. For example... Figure 5 As shown, the device includes: a determination unit 510, an operation generation unit 520, and an operation request unit 530.

[0111] in,

[0112] The determining unit 510 is used to determine the table name, operation instruction and operation data to be operated;

[0113] Operation generation unit 520 generates table operation requests, wherein the table operation requests carry table name, operation instructions and operation data;

[0114] The operation request unit 530 is used to send table operation requests to the server based on a preset route. The server, based on a general database operation architecture, parses the obtained table operation request to obtain the table name, operation instructions, and operation data. It then uses reflection and the operation data to create a table template class object corresponding to the table name and applies the table template class object to execute the table operation instructions on the table corresponding to the table name in the database. The general database operation architecture adapts to the table operation requests of each table in the database; the preset route adapts to the transmission of table operation requests of each table in the database.

[0115] In this embodiment of the invention, a determining unit is used to determine the table name, operation instruction, and operation data to be operated on; an operation generation unit is used to generate a table operation request, wherein the table operation request carries the table name, operation instruction, and operation data; and an operation request unit is used to send the table operation request to the server based on a preset route, so that the server, based on a general database operation architecture, parses the obtained table operation request to obtain the table name, operation instruction, and operation data, applies a reflection mechanism and the operation data to create a table template class object corresponding to the table name, and applies the table template class object to execute the table operation instruction on the table corresponding to the table name in the database. The general database operation architecture adapts to the table operation requests of each table in the database; the preset route adapts to the transmission of table operation requests of each table in the database, realizing the completion of table operations on each table in the database through a unified route, thereby reducing the development workload of building different routes for different operations on the front end, further reducing the cost of program development and testing, and also reducing the probability of program problems caused by repeated development.

[0116] Based on any of the above embodiments, the determining unit 510 includes:

[0117] The event trigger sub-unit is used to determine the user-triggered operation event;

[0118] The operation event parsing subunit is used to determine the current value, table name, and operation command of each control on the page based on the operation event;

[0119] The operation data generation sub-unit is used to determine the operation data based on the current value of each control.

[0120] Figure 6 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 6 As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630, and a communication bus 640, wherein the processor 610, the communication interface 620, and the memory 630 communicate with each other through the communication bus 640. The processor 610 can call logical instructions in the memory 630 to execute database table operation methods. These methods include: determining a general database operation architecture that adapts to table operation requests for each table in the database; receiving and parsing table operation requests sent from the front end based on the general database operation architecture to obtain table names and operation instructions, and executing the table operation corresponding to the operation instructions on the table corresponding to the table name in the database; or including: determining the table name, operation instructions, and operation data to be operated on; generating a table operation request based on the table name, operation instructions, and operation data; and sending the table operation request to the server, so that the server, based on the general database operation architecture, parses the obtained table operation request to obtain the table name, operation instructions, and operation data, and executes the table operation of the operation instructions on the table corresponding to the table name in the database based on the operation data. The general database operation architecture adapts to table operation requests for each table in the database.

[0121] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0122] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the database table operation methods provided by the above methods. The method includes: determining a general database operation architecture, which is adapted to table operation requests of various tables in the database; receiving and parsing table operation requests sent by the front end based on the general database operation architecture to obtain table names and operation instructions, and performing table operations corresponding to the operation instructions on the table corresponding to the table name in the database; or including: determining the table name, operation instructions, and operation data to be operated on; generating a table operation request based on the table name, operation instructions, and operation data; and sending the table operation request to the server, so that the server can parse the obtained table operation request based on the general database operation architecture to obtain the table name, operation instructions, and operation data, and perform the operation instructions on the table corresponding to the table name in the database. The general database operation architecture is adapted to various types of table operation information.

[0123] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the database table operation methods provided by the above methods. The method includes: determining a general database operation architecture, the general database operation architecture being adapted to table operation requests for each table in the database; based on the general database operation architecture, receiving and parsing table operation requests sent by a front end to obtain table names and operation instructions, and performing table operations corresponding to the operation instructions on the table corresponding to the table name in the database; or including: determining the table name to be operated on, operation instructions, and operation data; generating a table operation request based on the table name, operation instructions, and operation data; and sending the table operation request to a server, so that the server, based on the general database operation architecture, parses the obtained table operation request to obtain the table name, operation instructions, and operation data, and performs table operations corresponding to the operation instructions on the table corresponding to the table name in the database based on the operation data, wherein the general database operation architecture is adapted to table operation requests for each table in the database.

[0124] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0125] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0126] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. < / t>

Claims

1. A method for manipulating database tables, characterized in that, Applied to cloud servers, the method includes: A general database operation architecture is determined; wherein, the general database operation architecture is adapted to table operation requests of each table in the database; Based on the general database operation architecture, the system receives and parses the table operation request sent by the front end to obtain the table name, operation instruction and operation data. It then applies the reflection mechanism and the operation data to create a table template class object corresponding to the table name and applies the table template class object to perform the table operation corresponding to the operation instruction on the table corresponding to the table name in the database. The general database operation architecture includes: a general control class, a general business logic class, and data access classes corresponding to each table in the database; wherein, the data access classes corresponding to each table in the database are subclasses of a generic parent data access class, and the parent data access class is built based on the persistence layer framework and includes custom batch operation methods and general table operation methods in the persistence layer framework. The process of receiving and parsing the table operation request sent by the front end to obtain the table name, operation instruction, and operation data, applying reflection and the operation data to create a table template class object corresponding to the table name, and applying the table template class object to execute the table operation corresponding to the operation instruction on the table corresponding to the table name in the database, includes: parsing the table operation request based on the general response function of the general control class to obtain the table name, the operation instruction, and the operation data; creating a table template class object corresponding to the table name based on the general function in the general business logic class, applying reflection and the operation data; creating a data access class object corresponding to the table name, applying the operation function corresponding to the operation instruction in the data access class object, and applying the table template class object to execute the table operation corresponding to the operation instruction on the table corresponding to the table name in the database.

2. The database table operation method according to claim 1, characterized in that, The attributes in the table template class corresponding to the table template class object match the fields of the table corresponding to the table in the database.

3. The database table operation method according to claim 1 or 2, characterized in that, The database access class corresponding to each table in the database is a subclass of the parent data access class; The parent data access class is built on the persistence layer framework and includes custom table operation methods and general table operation methods in the persistence layer framework.

4. The database table operation method according to any one of claims 1 to 2, characterized in that, The process of receiving and parsing the table operation request sent by the front end includes: The table operation request sent by the front end is received based on the preset route, and the table operation request is parsed. The preset route is adapted to the transmission of table operation requests for each table in the database.

5. A method for manipulating database tables, characterized in that, Applied to the front end, the method includes: Determine the table name, operation command, and operation data to be operated; Generate a table operation request, wherein the table operation request carries the table name, the operation instruction, and the operation data; The table operation request is sent to the server based on a preset route. The server, based on a general database operation architecture, parses the obtained table operation request to obtain the table name, the operation instruction, and the operation data. Using reflection and the operation data, it creates a table template class object corresponding to the table name and applies the table template class object to execute the table operation of the operation instruction on the table corresponding to the table name in the database. The general database operation architecture adapts to table operation requests for each table in the database. The preset route adapts to the transmission of table operation requests for each table in the database. The preset route is a unified route shared by all table operation requests, and the server's general architecture parses the table name, operation instruction, and operation data carried by the route. The table name, operation instruction, and operation data to be operated on are obtained based on the following steps: determining the operation event triggered by the user; determining the current value of each control on the page, the table name, and the operation instruction based on the operation event; and determining the operation data based on the current value of each control.

6. A database table operation device, characterized in that, The device, applied to a cloud server, includes: An acquisition unit is used to determine a general database operation architecture; wherein, the general database operation architecture adapts to table operation requests of each table in the database; the general database operation architecture includes: a general control class, a general business logic class, and data access classes corresponding to each table in the database; wherein, the data access classes corresponding to each table in the database are subclasses of a generic parent data access class, and the parent data access class is built based on a persistence layer framework and includes custom batch operation methods and general table operation methods in the persistence layer framework; An operation unit is configured to, based on the general database operation architecture, receive and parse table operation requests sent by the front end to obtain the table name, operation instructions, and operation data; apply a reflection mechanism and the operation data to create a table template class object corresponding to the table name; and apply the table template class object to execute the table operation corresponding to the operation instructions on the table corresponding to the table name in the database. This includes: parsing the table operation request based on the general response function of the general control class to obtain the table name, the operation instructions, and the operation data; creating a table template class object corresponding to the table name based on the general function in the general business logic class, applying a reflection mechanism and the operation data; creating a data access class object corresponding to the table name; and applying the operation function corresponding to the operation instructions in the data access class object, as well as the table template class object, to execute the table operation corresponding to the operation instructions on the table corresponding to the table name in the database.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the database table operation method as described in any one of claims 1 to 5.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the database table operation method as described in any one of claims 1 to 5.