Information acquisition method, device, electronic device and storage medium
By generating an extended mapping file with the same namespace in the Mybatis database framework, referring to the configuration and interfaces in the original mapping file, the user-defined operation coverage problem caused by changes in table structure is solved, and diversified operation support for database tables is achieved.
Patent Information
- Application Number
- CN202111350121.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-15
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2041-11-15
AI Technical Summary
In the Mybatis database framework, when the table structure changes, generating a new original mapping file will overwrite the defined special operation statements, resulting in user-defined operations being overwritten, which cannot meet the user's diverse operation needs for database tables.
By generating an extended map file, its namespace is the same as the original map file, ensuring that the extended map file references the configuration information and interfaces in the original map file, updates independently of the original map file, and defines the second operation statement and interface to support multi-table joint operations. Or single table non-basic operation.
It implements that changes in database table structure do not affect user-defined operations, supports more complex and diverse database operations, and avoids the impact of original mapping file updates on special operations.
Smart Images

Figure CN114201504B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of Internet technology, and in particular to an information acquisition method, device, electronic device and storage medium. Background Art
[0002] In the Mybatis database framework, the generator can be used to generate the original mapping file corresponding to the database table based on the table structure in the database. The above original mapping file can be used to generate some commonly used database table addition, deletion, modification and query operations.
[0003] When some uncommon operations need to be added to meet user needs, the operation statements corresponding to the uncommon operations can usually be defined in the original mapping file. However, when the table structure changes, a new original mapping file will be generated based on the changed table structure, which will cause the new original mapping file to overwrite the original original mapping file, thereby overwriting the operation statements corresponding to the defined uncommon operations. Summary of the invention
[0004] The present disclosure provides an information acquisition method, device, electronic device and storage medium. The technical solution of the present disclosure is as follows:
[0005] According to a first aspect of an embodiment of the present disclosure, there is provided an information acquisition method, comprising:
[0006] Obtaining an operation request; the operation request includes an identification of an operation statement and execution parameters;
[0007] Determine the target operation statement corresponding to the identifier based on the extended mapping file; the namespace of the extended mapping file is the same as the namespace of the original mapping file; the namespace of the original mapping file is modified based on the namespace of the extended mapping file;
[0008] Gets information about execution parameters based on the target operation statement.
[0009] In some possible embodiments, before determining the target operation statement corresponding to the identifier based on the extended mapping file, the method further includes:
[0010] Generate an original mapping file based on the table structure; the original mapping file includes an original configuration file and an original interface file; the original configuration file includes a first operation statement; the original interface file includes a first interface;
[0011] Generate extension mapping file;
[0012] Modify the namespace of the original mapping file to the namespace of the extended mapping file;
[0013] Generate extension configuration files and extension interface files in the extension mapping file;
[0014] The same namespace of the extended mapping file and the original mapping file is used to ensure that the extended mapping file references the first operation statement and the first interface of the original mapping file.
[0015] In some possible embodiments, the method further includes:
[0016] defining a second operation statement in the extended configuration file to obtain an updated extended configuration file;
[0017] Define a second interface in the extended interface file to obtain an updated extended interface file;
[0018] An updated extension mapping file is obtained based on the updated extension configuration file and the updated extension interface file.
[0019] In some possible embodiments, the operation corresponding to the second operation statement includes a multi-table join operation or a single-table non-basic operation.
[0020] In some possible embodiments, determining the target operation statement corresponding to the identifier based on the extended mapping file includes:
[0021] The original configuration file is referenced by using the extended configuration file in the extended mapping file to determine at least one first operation statement corresponding to the identifier as a target operation statement.
[0022] In some possible embodiments, determining the target operation statement corresponding to the identifier based on the extended mapping file includes:
[0023] Generate proxy objects based on extension mapping files;
[0024] Determine the target operation statement corresponding to the identifier based on the proxy object.
[0025] In some possible embodiments, the information acquisition method is applied to the Mybatis database persistence layer framework.
[0026] According to a second aspect of an embodiment of the present disclosure, there is provided an information acquisition device, including:
[0027] The acquisition module is configured to execute an acquisition operation request; the operation request includes an identification of an operation statement and execution parameters;
[0028] An operation statement determination module is configured to execute a target operation statement corresponding to an identifier determined based on an extended mapping file; the namespace of the extended mapping file is the same as the namespace of the original mapping file; the namespace of the original mapping file is modified based on the namespace of the extended mapping file;
[0029] The information acquisition module is configured to acquire information of execution parameters based on the target operation statement.
[0030] In some possible embodiments, the device further includes:
[0031] The first file generation module is configured to generate an original mapping file based on the table structure; the original mapping file includes an original configuration file and an original interface file; the original configuration file includes a first operation statement; the original interface file includes a first interface;
[0032] A second file generation module is configured to generate an extension mapping file;
[0033] A modification module is configured to modify the namespace of the original mapping file to the namespace of the extended mapping file;
[0034] A second file generation module is configured to generate an extension configuration file and an extension interface file in the extension mapping file;
[0035] The same namespace of the extended mapping file and the original mapping file is used to ensure that the extended mapping file references the first operation statement and the first interface of the original mapping file.
[0036] In some possible embodiments, the device further includes:
[0037] An operation statement definition module is configured to execute a second operation statement defined in the extended configuration file to obtain an updated extended configuration file;
[0038] The interface definition module is configured to define a second interface in the extended interface file to obtain an updated extended interface file;
[0039] The file updating module is configured to execute to obtain an updated extension mapping file based on the updated extension configuration file and the updated extension interface file.
[0040] In some possible embodiments, the operation corresponding to the second operation statement includes a multi-table join operation or a single-table non-basic operation.
[0041] In some possible embodiments, the operation statement determination module is configured to execute:
[0042] The original configuration file is referenced by using the extended configuration file in the extended mapping file to determine at least one first operation statement corresponding to the identifier as a target operation statement.
[0043] In some possible embodiments, the operation statement determination module is configured to execute:
[0044] Generate proxy objects based on extension mapping files;
[0045] Determine the target operation statement corresponding to the identifier based on the proxy object.
[0046] In some possible embodiments, the information acquisition device is applied to the Mybatis database persistence layer framework.
[0047] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute instructions to implement a method as described in any one of the first aspects above.
[0048] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any one of the methods in the first aspect of the embodiment of the present disclosure.
[0049] According to the fifth aspect of an embodiment of the present disclosure, a computer program product is provided, the computer program product comprising a computer program, the computer program being stored in a readable storage medium, at least one processor of a computer device reading and executing the computer program from the readable storage medium, so that the computer device performs any one of the methods in the first aspect of the embodiment of the present disclosure.
[0050] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0051] An operation request is obtained, the operation request includes an identifier and execution parameters of an operation statement; a target operation statement corresponding to the identifier is determined based on an extended mapping file, the namespace of the extended mapping file is the same as the namespace of the original mapping file; the namespace of the original mapping file is modified based on the namespace of the extended mapping file, and information on the execution parameters is obtained based on the target operation statement. In an embodiment of the present application, the same namespace of the extended mapping file and the original mapping file can be used to ensure that the extended mapping file references the configuration information and interface in the original mapping file, but the references of the extended mapping file to the original mapping file are independent and will not be adversely affected by the update of the original mapping file.
[0052] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0054] Figure 1 is a schematic diagram of an application environment according to an exemplary embodiment;
[0055] Figure 2is a flow chart of an information acquisition method according to an exemplary embodiment;
[0056] Figure 3 is a flow chart showing a method for generating an extension mapping file according to an exemplary embodiment;
[0057] Figure 4 is a flow chart showing a method for generating an extension mapping file according to an exemplary embodiment;
[0058] Figure 5 is a flow chart of an information acquisition method according to an exemplary embodiment;
[0059] Figure 6 is a block diagram of an information acquisition device according to an exemplary embodiment;
[0060] Figure 7 It is a block diagram of an electronic device for information acquisition according to an exemplary embodiment. DETAILED DESCRIPTION
[0061] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0062] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar first objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0063] All user data in this application is authorized by the user.
[0064] See also Figure 1 , Figure 1 is a schematic diagram of an application environment of an information acquisition method according to an exemplary embodiment. Figure 1 As shown, the application environment may include a server 01 and a client 02. The database may be hosted on the server 01, or may be independent of the server 01 and hosted on a database server.
[0065] In some possible embodiments, the client 02 may include but is not limited to a smartphone, a desktop computer, a tablet computer, a laptop computer, a smart speaker, a digital assistant, an augmented reality (AR) / virtual reality (VR) device, a smart wearable device, etc. It may also be software running on the client, such as an application, a small program, etc. Optionally, the operating system running on the client may include but is not limited to Android system, IOS system, Linux, Windows, Unix, etc.
[0066] In some possible embodiments, the client 02 obtains an operation request, the operation request includes an identifier and execution parameters of an operation statement, determines a target operation statement corresponding to the identifier based on an extended mapping file, the namespace of the extended mapping file is the same as the namespace of the original mapping file, the namespace of the original mapping file is modified based on the namespace of the extended mapping file, and obtains information on the execution parameters based on the target operation statement.
[0067] Optionally, the server 01 may include an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The operating system running on the server may include but is not limited to Android, IOS, Linux, Windows, Unix, etc.
[0068] Figure 2 is a flow chart of an information acquisition method according to an exemplary embodiment. Figure 2 As shown, the information acquisition method can be applied to the client or other node devices, and includes the following steps:
[0069] In step S201, an operation request is obtained; the operation request includes an identifier of an operation statement and execution parameters.
[0070] In the embodiment of the present application, the client can obtain an operation request, and the operation request can be an operation request for a certain data, and the data can be located in a certain table. Therefore, the operation request can be a query operation for the content of a certain table, an addition operation for the content of a certain table, a deletion operation for the content of a certain table, or an update operation for a certain table. Among them, the above-mentioned certain table can be a table in a database. The database can exist in the client, and can also exist in another server.
[0071] Correspondingly, when the client obtains an operation request, it can parse the operation request to obtain the identifier and execution parameters of the operation statement of a certain operation. For example, assuming that a certain operation is a query operation for the information of the user "Axxxxxtt" in a certain table, the identifier of the operation statement is the identifier of the query statement, and the execution parameter can be the user name "Axxxxxtt".
[0072] In the embodiment of the present application, the above-mentioned information acquisition may be information acquisition from a database.
[0073] In step S202, a target operation statement corresponding to the identifier is determined based on the extended mapping file; the namespace of the extended mapping file is the same as the namespace of the original mapping file; and the namespace of the original mapping file is modified based on the namespace of the extended mapping file.
[0074] In the embodiment of the present application, the information acquisition method can be applied to the Mybatis database persistence layer framework. Mybatis is an excellent database persistence layer framework that can eliminate almost all Java database connection (Java Database Connectivity, JDBC) code and the work of setting parameters and obtaining result sets. It can configure and map primitive types, interfaces and simple Java objects (Plain Ordinary JavaObject, POJO) to records in the database through simple extensible markup language XML or annotations.
[0075] The native Mybatis-generator generator can be used to generate the original mapping file Mapper corresponding to the database table based on the table structure in the database. The original mapping file includes the original configuration file Mapper.xml and the original interface file Mapper.java. The above original configuration file Mapper.xml and the original interface file Mapper.java can be used to generate some commonly used database table addition, deletion, modification and query operations, but the operations are all for single table operations.
[0076] In an embodiment of the present application, the original configuration file Mapper.xml may include a first operation statement generated for a table structure in a database, a definition of a first data structure, and a definition of a first class. The original interface file Mapper.java may include a first interface generated based on a table structure in a database. Optionally, the first operation statement may be a structured query statement SQL statement.
[0077] Among them, the class corresponding to the first category mainly plays the role of encapsulating data, protecting data, and has high security. The class includes data members and member functions. And the data members are private by default, that is, they cannot be accessed from the outside, which plays a role in protecting and closing the data. The data structure corresponding to the first data structure is open, and the data inside is public by default, and there cannot be functions in the data structure.
[0078] However, with the demand for more operations in the database table, the simple table addition, deletion, modification and query operations provided by the original configuration file Mapper.xml and the original interface file Mapper.java can no longer meet user needs. Therefore, a way is needed to solve the problem that the original configuration file Mapper.xml and the original interface file Mapper.java cannot provide more operations for the table.
[0079] Figure 3 is a flow chart showing a method for generating an extension mapping file according to an exemplary embodiment. Figure 3 As shown, including:
[0080] In step S301, an original mapping file is generated based on the table structure; the original mapping file includes an original configuration file and an original interface file; the original configuration file includes a first operation statement; and the original interface file includes a first interface.
[0081] Optionally, the above table structure may be a table structure of a database. The client may use the native Mybatis-generator generator to generate an original mapping file Mapper corresponding to the database table based on the table structure in the database, wherein the original mapping file Mapper includes an original configuration file Mapper.xml and an original interface file Mapper.java.
[0082] In step S302, an extension mapping file is generated.
[0083] In an embodiment of the present application, the client can inherit the adapter PluginAdapter provided by the Mybatis-generator generator. And obtain the configuration information of the extended mapping file. Assuming that the file name of the original mapping file is Mapper, the pre-information in the configuration information of the extended mapping file can be defined as Ext, thereby determining that the file name of the extended mapping file is ExtMapper, and further, the storage information in the configuration information of the extended mapping file can be determined, and the storage information represents the storage area of the extended mapping file in the device. After obtaining the configuration information of the extended mapping file, the generation of the extended mapping file can be completed based on the configuration information.
[0084] In step S303, the namespace of the original mapping file is modified to the namespace of the extended mapping file.
[0085] Since a large project is often completed independently by several devices, different devices complete different parts respectively, and finally combine them into a complete program. Since each header file is responsible for different devices, it is possible that the same name is used to name the defined class or function in different header files, so there will be a name conflict in the program. In order to solve the naming conflict, C++ introduces namespace. The so-called namespace is a scope that can be defined by the user. Variables with the same name can be defined in different scopes without interfering with each other, and the system can distinguish them.
[0086] A namespace is a memory area named by the programmer. The programmer can specify some named space domains according to the needs, and store some global entities in each namespace, thereby separating them from other global entities. In layman's terms, each namespace is a namespace domain, and the global entities stored in the namespace domain are only valid within this namespace domain. The namespace imposes domain restrictions on global entities, thereby reasonably resolving naming conflicts.
[0087] In an embodiment of the present application, in order to enable the extended mapping file to reference the first operation statement, the definition of the first data structure, the definition of the first class and the first interface of the original mapping file, that is, the extended mapping file can inherit the original mapping file without copying the first operation statement, the definition of the first data structure, the definition of the first class and the first interface of the original mapping file to the extended mapping file, the namespace of the original mapping file can be modified to the namespace of the extended mapping file.
[0088] In step S304, an extended configuration file and an extended interface file in the extended mapping file are generated; wherein the same namespace of the extended mapping file and the original mapping file is used to ensure that the extended mapping file references the first operation statement and the first interface of the original mapping file.
[0089] Then, the client can generate an extension configuration file ExtMapper.xml and an extension interface file ExtMapper.java in the extension mapping file.
[0090] As mentioned above, the client uses the native Mybatis-generator generator to generate the original configuration file Mapper.xml and the original interface file Mapper.java corresponding to the database table based on the table structure in the database. Therefore, when the table structure in the database changes, the client will use the native Mybatis-generator generator again to generate a new original configuration file Mapper.xml and a new original interface file Mapper.java corresponding to the database table based on the table structure in the changed database. When the namespace of the original mapping file is modified to the namespace of the extended mapping file, the extended mapping file can directly apply the new original mapping file, that is, the extended configuration file can reference the first operation statement, the definition of the first data structure and the definition of the first class in the new original configuration file, and the extended interface file can apply the new original interface file. Therefore, no matter how the original configuration file Mapper.xml and the original interface file Mapper.java are updated, it will not affect the new content defined by the extended configuration file ExtMapper.xml and the extended interface file ExtMapper.java.
[0091] If, in the embodiment of the present application, the extended mapping file is only consistent with the namespace of the original mapping file, so that the extended mapping file can directly reference the first operation statement or the first data structure defined in the original mapping file, and use the first interface, then it can only implement simple and commonly used operations of adding, deleting, modifying and querying a single table in the database, which cannot meet the diverse needs of users. Based on this, Figure 4 is a flow chart showing a method for generating an extension mapping file according to an exemplary embodiment. Figure 4 As shown, including:
[0092] In step S401, a second operation statement is defined in an extended configuration file to obtain an updated extended configuration file.
[0093] In the embodiment of the present application, the operation corresponding to the second operation statement includes a multi-table joint operation or a single-table non-basic operation. Optionally, the second operation statement may be a structured query statement SQL statement.
[0094] The multi-table joint operation may be a multi-table joint query operation, a multi-table joint query operation, a multi-table joint add operation, a multi-table joint delete operation, and a multi-table joint update operation.
[0095] Among them, single-table non-basic operations can include customized operations for a certain thing, such as query operations on the title page.
[0096] In step S402, a second interface is defined in an extended interface file to obtain an updated extended interface file.
[0097] In the embodiment of the present application, the defined second interface may be an interface used to implement the operation corresponding to the above-mentioned second operation statement.
[0098] In step S403, an updated extension mapping file is obtained based on the updated extension configuration file and the updated extension interface file.
[0099] In the embodiment of the present application, the client can receive the operation statement definition instruction, and define the second operation statement in the extended configuration file according to the operation statement definition instruction to obtain the updated extended configuration file. Optionally, in addition to defining the second operation statement in the extended configuration file, a second data structure and a second class can also be defined.
[0100] In the embodiment of the present application, the client can receive an interface definition instruction, and the interface defined in the interface definition instruction can be the interface corresponding to the newly defined second operation statement. Subsequently, the second interface is defined in the extended interface file according to the interface definition instruction to obtain an updated extended interface file.
[0101] Based on the above explanation, in an optional embodiment in which a client determines a target operation statement corresponding to an identifier based on an extended mapping file, the client can use an extended configuration file in the extended mapping file to reference an original configuration file to determine at least one first operation statement corresponding to the identifier as a target operation statement.
[0102] In this way, the client can obtain an updated extension mapping file based on the updated extension configuration file and the updated extension interface file. It can not only complete basic operations by referring to the original configuration file and the original interface file in the original mapping file through the updated extension mapping file, but also complete more complex and customized operations on the table in the database through the customized second operation data and second interface in the updated extension mapping file.
[0103] In an optional embodiment, it is assumed that the client is loaded with the Mybatis database persistence layer framework, and an extended mapping file is generated based on the original mapping file, that is, the extended mapping file inherits from the original mapping file. Among them, the namespaces of the two files are the same. Then when the client initiates a data query, a request for obtaining an operation can be generated based on the user's operation, and the operation request includes the identifier and execution parameters of the operation statement. The acquisition operation request is then forwarded to a specific service service layer, which is located in the client. Subsequently, the service layer determines the target operation statement corresponding to the identifier and the mapper interface corresponding to the target operation data based on the extended mapping file, and then the service layer can call the mapper interface to obtain information about the execution parameters based on the target operation data. Specifically, the client can send an operation instruction to a database built into the client or to a server where the database is located, and the operation instruction includes execution parameters and target operation statements; the operation instruction is used to instruct the database to determine execution feedback based on the execution parameters and the target operation statement, that is, to obtain information about the execution parameters.
[0104] In an optional embodiment, in addition to the database server, a front-end device and a back-end server may be included. Among them, the back-end server carries the Mybatis database persistence layer framework, and can generate an extended mapping file based on the original mapping file, and the namespaces of the two files are the same. When the front-end device initiates a data query, an operation request can be generated based on the user's operation, and the operation request includes the identifier and execution parameters of the operation statement. The acquisition operation request is then forwarded to the back-end server, and the back-end server forwards the operation instruction to the specific service service layer. Subsequently, the service layer determines the target operation statement corresponding to the identifier and the mapper interface corresponding to the target operation data based on the extended mapping file. The service layer can call the mapper interface to send an operation instruction to the server where the database is located, and the operation instruction includes execution parameters and target operation statements; the operation instruction is used to instruct the database to determine execution feedback based on the execution parameters and the target operation statement, and the execution feedback can be information about the execution parameters.
[0105] In some possible embodiments, the interaction between the database and the client is realized through a proxy object, which is a feasible mode, and its purpose is to provide a proxy object for the real object (extension mapping file) to control the access to the real object. The proxy object is responsible for pre-processing messages for the proxied object and the real object, filtering messages and forwarding messages, and performing subsequent processing after the message is executed by the delegate class. In order to maintain consistency of behavior, the proxy object and the real object usually implement the same interface, so there is no difference between the two in the eyes of the visitor. Through the proxy object, this middle layer can effectively control direct access to the real object, and can also hide and protect the real object well, and also reserve space for implementing different control strategies, thereby obtaining greater flexibility in design.
[0106] Based on this, Figure 5 is a flow chart of an information acquisition method according to an exemplary embodiment. Figure 5 As shown, including:
[0107] In step S2021, a proxy object is generated based on the extension mapping file.
[0108] In the embodiment of the present application, the client can generate a proxy class based on the extension configuration file and the extension interface file in the extension mapping file, where the proxy class can be called a proxy object.
[0109] In step S2022, a target operation statement corresponding to the identifier is determined based on the proxy object.
[0110] In the embodiment of the present application, the client can determine the target operation statement corresponding to the identifier based on the proxy class.
[0111] In step S203, information of execution parameters is acquired based on the target operation statement.
[0112] In the embodiment of the present application, after the client determines the target operation statement, it can send an operation instruction to the client where the database is located, and the operation instruction includes execution parameters and the target operation statement. The operation instruction is used to instruct the database to determine execution feedback based on the execution parameters and the target operation statement.
[0113] After the database determines the execution feedback, the execution feedback can be sent to the client through the client. For example, after the database queries the information of "Axxxxxtt" based on the execution parameters and the target operation statement, the information of "Axxxxxtt" can be sent to the client through the service as execution feedback.
[0114] In summary, in the embodiments of the present application, the embodiments of the present application can not only complete basic table operations through the extended mapping file referencing the original configuration file and the original interface file in the original mapping file, but also complete more complex, user-defined operations on the table in the database through the customized second operation data and second interface in the extended mapping file.
[0115] Moreover, when the table structure in the database changes, the client will use the native Mybatis-generator generator to generate a new original configuration file Mapper.xml and a new original interface file Mapper.java corresponding to the database table based on the changed table structure in the database. When the namespace of the original mapping file is modified to the namespace of the extended mapping file, the extended mapping file can directly apply the new original mapping file, that is, the extended configuration file can reference the first operation statement in the new original configuration file, and the extended interface file can apply the new original interface file. Therefore, no matter how the original configuration file Mapper.xml and the original interface file Mapper.java are updated, it will not affect the new second operation data and the second interface defined by the extended configuration file ExtMapper.xml and the extended interface file ExtMapper.java.
[0116] Figure 6 is a block diagram of an information acquisition device according to an exemplary embodiment. Figure 6 The device includes an acquisition module 601, an operation statement determination module 602 and an instruction sending module 603.
[0117] The acquisition module 601 is configured to execute and acquire an operation request; the operation request includes an identification of an operation statement and execution parameters;
[0118] The operation statement determination module 602 is configured to execute a target operation statement corresponding to the identifier determined based on the extended mapping file; the namespace of the extended mapping file is the same as the namespace of the original mapping file; the namespace of the original mapping file is modified based on the namespace of the extended mapping file;
[0119] The information acquisition module 603 is configured to acquire information of execution parameters based on the target operation statement.
[0120] In some possible embodiments, the device further includes:
[0121] The first file generation module is configured to generate an original mapping file based on the table structure; the original mapping file includes an original configuration file and an original interface file; the original configuration file includes a first operation statement; the original interface file includes a first interface;
[0122] A second file generation module is configured to generate an extension mapping file;
[0123] A modification module is configured to modify the namespace of the original mapping file to the namespace of the extended mapping file;
[0124] A second file generation module is configured to generate an extension configuration file and an extension interface file in the extension mapping file;
[0125] The same namespace of the extended mapping file and the original mapping file is used to ensure that the extended mapping file references the first operation statement and the first interface of the original mapping file.
[0126] In some possible embodiments, the device further includes:
[0127] An operation statement definition module is configured to execute a second operation statement defined in the extended configuration file to obtain an updated extended configuration file;
[0128] The interface definition module is configured to define a second interface in the extended interface file to obtain an updated extended interface file;
[0129] The file updating module is configured to execute to obtain an updated extension mapping file based on the updated extension configuration file and the updated extension interface file.
[0130] In some possible embodiments, the operation corresponding to the second operation statement includes a multi-table join operation or a single-table non-basic operation.
[0131] In some possible embodiments, the operation statement determination module is configured to execute:
[0132] The original configuration file is referenced by using the extended configuration file in the extended mapping file to determine at least one first operation statement corresponding to the identifier as a target operation statement.
[0133] In some possible embodiments, the operation statement determination module is configured to execute:
[0134] Generate proxy objects based on extension mapping files;
[0135] Determine the target operation statement corresponding to the identifier based on the proxy object.
[0136] In some possible embodiments, the information acquisition device is applied to the Mybatis database persistence layer framework.
[0137] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0138] Figure 7 is a block diagram of an apparatus 700 for obtaining information according to an exemplary embodiment. For example, the apparatus 700 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0139] Reference Figure 7 , the device 700 may include one or more of the following components: a processing component 702 , a memory 704 , a power component 706 , a multimedia component 708 , an audio component 710 , an input / output (I / O) interface 712 , a sensor component 714 , and a communication component 716 .
[0140] The processing component 702 generally controls the overall operation of the device 700, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 702 may include one or more processors 720 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 702 may include one or more modules to facilitate the interaction between the processing component 702 and other components. For example, the processing component 702 may include a multimedia module to facilitate the interaction between the multimedia component 708 and the processing component 702.
[0141] The memory 704 is configured to store various types of data to support operations on the device 700. Examples of such data include instructions for any application or method operating on the device 700, contact data, phone book data, messages, pictures, videos, etc. The memory 704 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0142] The power supply component 706 provides power to the various components of the device 700. The power supply component 706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 700.
[0143] The multimedia component 708 includes a screen that provides an output interface between the device 700 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 708 includes a front camera and / or a rear camera. When the device 700 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0144] The audio component 710 is configured to output and / or input audio signals. For example, the audio component 710 includes a microphone (MIC), and when the device 700 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 704 or sent via the communication component 716. In some embodiments, the audio component 710 also includes a speaker for outputting audio signals.
[0145] I / O interface 712 provides an interface between processing component 702 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0146] The sensor assembly 714 includes one or more sensors for providing various aspects of status assessment for the device 700. For example, the sensor assembly 714 can detect the open / closed state of the device 700, the relative positioning of components, such as the display and keypad of the device 700, and the sensor assembly 714 can also detect the position change of the device 700 or a component of the device 700, the presence or absence of user contact with the device 700, the orientation or acceleration / deceleration of the device 700, and the temperature change of the device 700. The sensor assembly 714 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 714 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 714 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0147] The communication component 716 is configured to facilitate wired or wireless communication between the device 700 and other devices. The device 700 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 716 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 716 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0148] In an exemplary embodiment, the apparatus 700 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above methods.
[0149] In an exemplary embodiment, a storage medium including instructions is also provided, such as a memory 704 including instructions, and the instructions can be executed by a processor 720 of the device 700 to complete the above method. Optionally, the storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
Claims
1. A method for obtaining information, It is characterized in that include: Obtaining an operation request; the operation request includes an identification of an operation statement and execution parameters; Determine a target operation statement corresponding to the identifier based on the extended mapping file; The namespace of the extended mapping file is the same as the namespace of the original mapping file; the namespace of the original mapping file is modified based on the namespace of the extended mapping file; the same namespace of the extended mapping file and the original mapping file is used to ensure that the extended mapping file references the operation statements and interfaces of the original mapping file; The information of the execution parameter is acquired based on the target operation statement.
2. The information acquisition method according to claim 1, It is characterized in that Before determining the target operation statement corresponding to the identifier based on the extended mapping file, the method further includes: Generate the original mapping file based on the table structure; the original mapping file includes an original configuration file and an original interface file; the original configuration file includes a first operation statement; the original interface file includes a first interface; Generate the extended mapping file; Modify the namespace of the original mapping file to the namespace of the extended mapping file; Generate an extended configuration file and an extended interface file in the extended mapping file; The same namespace of the extended mapping file and the original mapping file is used to ensure that the extended mapping file references the first operation statement and the first interface of the original mapping file.
3. The information acquisition method according to claim 2, It is characterized in that The method further comprises: defining a second operation statement in the extended configuration file to obtain an updated extended configuration file; Define a second interface in the extended interface file to obtain an updated extended interface file; An updated extension mapping file is obtained based on the updated extension configuration file and the updated extension interface file.
4. The information acquisition method according to claim 3, It is characterized in that The operation corresponding to the second operation statement includes a multi-table joint operation or a single-table non-basic operation.
5. The information acquisition method according to claim 3, It is characterized in that Determining the target operation statement corresponding to the identifier based on the extended mapping file includes: The original configuration file is referenced by using the extended configuration file in the extended mapping file to determine at least one first operation statement corresponding to the identifier as the target operation statement.
6. The information acquisition method according to claim 1, It is characterized in that Determining the target operation statement corresponding to the identifier based on the extended mapping file includes: Generate a proxy object based on the extended mapping file; A target operation statement corresponding to the identifier is determined based on the proxy object.
7. The information acquisition method according to any one of claims 1 to 6, It is characterized in that The information acquisition method is applied to the Mybatis database persistence layer framework.
8. An information acquisition device, It is characterized in that include: An acquisition module is configured to execute an acquisition operation request; the operation request includes an identification of an operation statement and execution parameters; An operation statement determination module is configured to execute a target operation statement corresponding to the identifier determined based on an extended mapping file; the namespace of the extended mapping file is the same as the namespace of the original mapping file; the namespace of the original mapping file is modified based on the namespace of the extended mapping file; the same namespace of the extended mapping file and the original mapping file is used to ensure that the extended mapping file references the operation statement and interface of the original mapping file; The information acquisition module is configured to acquire the information of the execution parameters based on the target operation statement.
9. The information acquisition device according to claim 8, It is characterized in that The device also includes: A first file generation module is configured to generate the original mapping file based on the table structure; the original mapping file includes an original configuration file and an original interface file; the original configuration file includes a first operation statement; the original interface file includes a first interface; A second file generating module is configured to generate the extension mapping file; A modification module, configured to modify the namespace of the original mapping file to the namespace of the extended mapping file; The second file generation module is configured to generate an extension configuration file and an extension interface file in the extension mapping file; The same namespace of the extended mapping file and the original mapping file is used to ensure that the extended mapping file references the first operation statement and the first interface of the original mapping file.
10. The information acquisition device according to claim 9, It is characterized in that The device also includes: an operation statement definition module, configured to execute a second operation statement defined in the extended configuration file to obtain an updated extended configuration file; An interface definition module is configured to execute the definition of a second interface in the extended interface file to obtain an updated extended interface file; The file updating module is configured to execute the process of obtaining an updated extension mapping file based on the updated extension configuration file and the updated extension interface file.
11. The information acquisition device according to claim 10, It is characterized in that The operation corresponding to the second operation statement includes a multi-table joint operation or a single-table non-basic operation.
12. The information acquisition device according to claim 10, It is characterized in that The operation statement determination module is configured to execute: The original configuration file is referenced by using the extended configuration file in the extended mapping file to determine at least one first operation statement corresponding to the identifier as the target operation statement.
13. The information acquisition device according to claim 8, It is characterized in that The operation statement determination module is configured to execute: Generate a proxy object based on the extended mapping file; A target operation statement corresponding to the identifier is determined based on the proxy object.
14. The information acquisition device according to any one of claims 8 to 13, It is characterized in that The information acquisition device is applied to the Mybatis database persistence layer framework.
15. An electronic device, It is characterized in that include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the information acquisition method as described in any one of claims 1 to 7.
16. A computer-readable storage medium, It is characterized in that When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the information acquisition method as claimed in any one of claims 1 to 7.
17. A computer program product, It is characterized in that The computer program product comprises a computer program, which is stored in a readable storage medium. At least one processor of a computer device reads and executes the computer program from the readable storage medium, so that the computer device executes the information acquisition method according to any one of claims 1 to 7.
