Data access system, method and computer device
Through the design of the data access system, including the general application adaptation layer, request type determination layer, conversion layer and data operation service implementation layer, the problems of high development cost and low efficiency in the MyBatis model are solved, and the reusability and efficiency improvement of iterative development of business data are achieved.
Patent Information
- Application Number
- CN202011085777.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-12
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2040-10-12
AI Technical Summary
The data access mode based on MyBatis in the existing technology leads to high development costs, low business development efficiency, and inability to effectively reuse codes and interface files.
A data access system is adopted, including a general application adaptation layer, a general request type determination layer, a conversion layer, a general data operation service implementation layer and a general data access layer. Through these layers, the mutual conversion between the reusable components of business data and the reusable components of the general data access layer is realized. The reusable components and the reusable data access framework are combined to improve the efficiency of business iterative development.
By introducing reusable components and a reusable data access framework, the problems of high development cost and low efficiency in existing technologies are solved, the efficiency of database-based business iterative development is improved, and development pressure is alleviated.
Smart Images

Figure CN114356953B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and in particular to a data access system, method and computer equipment. Background Art
[0002] Massive data is generally stored in a database. When users access data, if there are different business data to access, the existing technology is based on mybatis and provides a way to access the database. Specifically, when each new business data development requirement is added, the mybatis interface mapping file (xml file) is defined to correspond to the business data table, and the Java Mapper interface file is defined to map with the mybatis file to implement operations such as adding, deleting, modifying, and querying business data. Different data corresponds to different interface files and codes. Each new data access operation requires the creation of a new interface file and code. Therefore, this data access mode based on mybatis has a high development cost and low business development efficiency because the code and interface files are not reusable. Summary of the Invention
[0003] Therefore, the technical problem to be solved by the present invention is to overcome the defects of high development cost and low business development efficiency in the prior art, thereby providing a data access system, method and computer device.
[0004] According to a first aspect, an embodiment of the present invention provides a data access system, comprising: a general application adaptation layer, a general request type determination layer, a conversion layer, a general data operation service implementation layer and a general data access layer, wherein the general application adaptation layer is used to obtain access parameters and business data access operations, and generate a general data request based on the access parameters and the business data access operations; the general request type determination layer is used to determine the type of the general data request, and the types include: general new addition request, general modification request, general deletion request, general conditional query request and general paging query request; the conversion layer is used to obtain reusable components of business data based on the general data request, and convert the reusable components of the business data into reusable components of the general data access layer; the general data operation service implementation layer is used to call the general table-level data operation interface of the general data access layer, and implement the business data access operation based on the reusable components of the general data access layer.
[0005] In combination with the first aspect, in the first embodiment of the first aspect, the general table-level data operation interface specifically includes: an SQL automatic generator and an SQL execution engine, wherein: the SQL automatic generator is used to obtain reusable components of the general data access layer and generate SQL statements based on the reusable components of the general data access layer; the SQL execution engine is used to implement business data access operations based on the SQL statements generated by the SQL automatic generator.
[0006] In combination with the first aspect, in the second implementation of the first aspect, the general data operation service implementation layer is also used to: verify whether the business data meets the operation requirements based on the general data request; when the business data meets the operation requirements, execute the general table-level data operation interface of the general data access layer, and implement the business data access operation steps based on the reusable components of the general data access layer.
[0007] In combination with the second implementation of the first aspect, in the third implementation of the first aspect, when the business data does not meet the operation requirements, the business data access operation fails to execute.
[0008] In combination with the first aspect, in a fourth implementation of the first aspect, the conversion layer is further used to obtain reusable components of the universal data access layer, and convert and generate reusable components of business data based on the reusable components of the universal data access layer.
[0009] According to the second aspect, an embodiment of the present invention provides a data access method, including: obtaining access parameters and business data access operations, and generating a general data request based on the access parameters and the business data access operations; determining the type of the general data request, the types including: general new addition request, general modification request, general deletion request, general conditional query request and general paging query request; obtaining reusable components of business data based on the general data request, and converting the reusable components of the business data to generate reusable components of the general data access layer; and implementing the business data access operation based on the reusable components of the general data access layer.
[0010] In combination with the second aspect, in the first implementation of the second aspect, the business data access operation is implemented based on the reusable components of the universal data access layer, specifically including: obtaining the reusable components of the universal data access layer, generating SQL statements based on the reusable components of the universal data access layer; and implementing the business data access operation based on the SQL statements.
[0011] In combination with the second aspect, in the second implementation of the second aspect, the method also includes: verifying whether the business data meets the operation requirements based on the general data request; when the business data meets the operation requirements, implementing the business data access operation based on the reusable components of the general data access layer.
[0012] In combination with the second embodiment of the second aspect, in the third embodiment of the second aspect, the method further includes: when the business data does not meet the operation requirements, the business data access operation fails to execute.
[0013] In combination with the second aspect, in a second implementation of the second aspect, the method further includes: obtaining reusable components of a universal data access layer; and converting and generating reusable components of business data based on the reusable components of the universal data access layer.
[0014] According to the third aspect, an embodiment of the present invention provides a computer device, comprising: at least one processor and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the processor executes the data access method as described in the second aspect or any embodiment of the second aspect by executing the instructions.
[0015] According to a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the data access method as described in the second aspect or any embodiment of the second aspect.
[0016] At least one technical solution provided by the present invention has the following advantages:
[0017] The present invention provides a data access system, method and computer device, wherein the system includes: a general application adaptation layer, a general request type determination layer, a conversion layer, a general data operation service implementation layer and a general data access layer; specifically, through the general application adaptation layer, business data access operations and access parameters are obtained and converted into general data requests; through the general request type determination layer, the types of different business data operations obtained are determined, and the above types include: new requests, modification requests, deletion requests, conditional query requests and paging query requests; through the conversion layer, reusable components of business data are converted into reusable components of the general data access layer, and the general table-level data operation interface is called through the general data operation service implementation layer to implement business data access operations. By implementing the present invention, the existing technology solves the defects of the data access mode based on MyBatis, which has a heavy development cost and thus leads to low business development efficiency. By combining reusable components, the efficiency of business iterative development based on the database can be improved, and the development pressure can be alleviated. For the same type of data operations, the reusable components and the reusable data access framework are introduced to achieve the reusability of business data iterative development. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1 A structural block diagram of a data access system according to an embodiment of the present invention;
[0020] Figure 2 A schematic diagram of a specific example of a data access system according to an embodiment of the present invention;
[0021] Figure 3 A flowchart of a data access method according to an embodiment of the present invention;
[0022] Figure 4 The figure is a structural block diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0023] The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0024] In the description of the present invention, it should be noted that the terms "first", "second" and "third" are only used for descriptive purposes and should not be understood as indicating or implying relative importance.
[0025] In the description of the present invention, it should be noted that, unless otherwise expressly specified or limited, the term "connection" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium; it can also be internal communication between two components; it can be a wireless connection or a wired connection. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to the specific circumstances.
[0026] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0027] The embodiment of the present invention provides a data access system that can be applied to specific application scenarios in which financial institutions operate on user business data, such as Figure 1 As shown, the system includes: a general application adaptation layer 10, a general request type determination layer 20, a conversion layer 30, a general data operation service implementation layer 40 and a general data access layer 50, wherein:
[0028] The general application adaptation layer 10 is used to obtain access parameters and business data access operations, and generate general data requests based on these access parameters and business data access operations. In this embodiment, the general meaning of the general application adaptation layer 10 is that it can be applied to a certain range of application scenarios, such as application scenarios where users access data through business interfaces. Specifically, it can be application scenarios where one or more operations such as adding, deleting, modifying, conditional querying, and paging querying are performed on data.
[0029] Exemplarily, the general application adaptation layer 10 is used to obtain business data access operations and access parameters; based on the obtained business data access operations and access parameters, a general data request is converted and generated; in this embodiment, external business data access operations and access parameters can be obtained through a business interface, and converted into a general request through generics within this unit, that is, based on the access operations for different types of data, the access parameters and context are encapsulated and adapted into a general request. Specifically, the context can refer to other data related to the current business data, which can be the data type identification information corresponding to the current business interface, or the host IP information currently performing the modification, addition, deletion, and query operations, or the computer room information where the above host is located; for example, addPerson() is an internal call to add() in the business interface to access the number of users, thereby implementing the operation of adding user A to the original user list. When using add person, it can be known that the business data type called through the business interface at this time is person.
[0030] Exemplarily, the general application adaptation layer 10 may include multiple business interfaces for obtaining business data access operations and access parameters; in this embodiment, the business interface is an externally exposed interface for receiving business data and business operations outside the system. The general application adaptation layer 10 has multiple business interfaces, and different interfaces may correspond to different types of data, for example, business data A is accessed through business interface 1; business data B is accessed through business interface 2; or different business interfaces may correspond to different types of business operations, for example, data addition operations are performed on business data through business interface 1; and data deletion operations are performed on business data through business interface 2.
[0031] The general application adaptation layer 10 may also include an adaptation unit for generating a general data request based on the access parameters and the business data access operation; in this embodiment, external business data access operations and access parameters are obtained through the business interface, and the above operations and parameters are converted into general requests through generics in this unit, that is, according to the access operations on different types of data, the access parameters and context encapsulation are adapted into general requests.
[0032] The general request type determination layer 20 is used to determine the type of the general data request, which includes: a general addition request, a general modification request, a general deletion request, a general conditional query request, and a general paging query request. In this embodiment, the general request type determination layer, that is, the general request layer, can determine the business operation type based on the received general data request. Specifically, the general data request is generated based on access parameters, and the access parameters include identifier information of the general data request. The operation type information of the general data request can be determined based on the identifier information. Since the business data access operation corresponding to the general data request can come from different business interfaces, and different business interfaces can correspond to different operation types, the identifier information of the general data request can be parsed and generated based on the access parameters in the general data request, and then the operation type of the general data request can be determined.
[0033] Specifically, the operation types may include new operations, modification operations, deletion requests, query operations, and paging query operations. Specifically, the new operation may be to fill in information into the initial database / data table. For example, the added information may be information that records the user's shopping behavior after the user generates a shopping behavior; it may also be the user's identity authentication information; similarly, the information in other types of operations is similar and will not be repeated here. The present invention does not specifically limit the type of information to be operated, and those skilled in the art may make specific determinations based on actual conditions.
[0034] For example, a general new data request specifically includes information such as business data, business data type, and new operator; that is, the location where the new data is added; a general modification request specifically includes information such as new business data, the identity information of the original data, and the modification operator; a general deletion request specifically includes information such as data identity information and deletion operator; a general conditional query request specifically includes business data entities, that is, access to the data the user wants to query; a general paging query request specifically includes business data entities, current page, and page size. Specifically, paging query refers to accessing data stored in auxiliary memory through main memory. For example, data in auxiliary memory is partitioned into fixed-size blocks, called "pages"; when the system no longer needs this data, the pages are moved from main memory to auxiliary memory; when the system needs this data, the data is retrieved and loaded into main memory.
[0035] The conversion layer 30 is used to obtain reusable components of business data based on general data requests, and convert the reusable components of business data into reusable components of the general data access layer. In this embodiment, for the same business data A, there can be two types of reusable components (Java Beans), namely business Java Beans and data access layer (DATA ACCESS LAYER, DAL) Java Beans.
[0036] For example, business data is external-facing and visible to users who call the data. Specifically, external refers to the part outside the database; the DAL layer Java Bean is oriented towards the data table inside the database. When the business data Java Bean is obtained based on the business data, it cannot be directly connected to the data table storing the business data. At this time, the business Java Bean needs to be converted into a DAL layer Java Bean before it can be connected to the DAL layer to realize business data operations.
[0037] The general data operation service implementation layer 40 (DATA ACCESS SERVICE, DAS) is used to call the general table-level data operation interface of the general data access layer 50, and implement business data access operations based on the reusable components of the general data access layer 50. In this embodiment, there may be a general data operation service implementation, which may specifically include a general new data operation implementation, a general data modification operation implementation, a general data deletion operation implementation, a general conditional query operation implementation, and a general paging query operation implementation.
[0038] For example, a general data addition operation can be implemented by validating the data before adding it, for example, checking whether the data already exists. The validation logic varies for different business data. For example, to add a user's identity information, the original data table can be checked to see if the user exists, and the specific identity information of the user to be added exists. If the validation fails, the data addition operation fails. If the validation passes, the general data addition operation interface of the DAL layer can be called to specifically insert the table data.
[0039] For example, a general data modification operation can be implemented by verifying the data before modification, for example, whether the data to be modified exists. The verification logic varies for different business data. For example, if you want to change user A's identity information (ID: 95588) to 96688, you can verify whether the ID in user A's identity information is the data to be modified (96688). If the verification fails, the modification operation fails. If the verification passes, the general data modification operation interface of the DAL layer is called to implement the table data modification.
[0040] Exemplarily, the implementation of the general data deletion operation can be to verify the data before deletion, or to verify whether the data to be deleted exists; specifically, if you want to delete the shopping record information of user A within the target time period, the target time period can be one hour, one day, etc. In this embodiment, it can be one day, for example, 2020.01.20-2020.01.21. At this time, you can first verify whether user A has any shopping operations within the target time period. When the verification fails, that is, there is no shopping operation within the target time period, the deletion operation fails; if the verification passes, call the general data deletion operation interface of the DAL layer to implement table data deletion.
[0041] For example, the general condition query data operation is implemented by calling the general condition query operation interface of the DAL layer to implement the table data condition query; the general paging query data operation is implemented by calling the general paging query operation interface of the DAL layer to implement the table data paging query, and the paging query includes the query conditions.
[0042] The embodiment of the present invention provides a data access system, comprising: a general application adaptation layer, a general request type determination layer, a conversion layer, a general data operation service implementation layer and a general data access layer; specifically, through the general application adaptation layer, business data access operations and access parameters are obtained and converted into general data requests; through the general request type determination layer, the types of different business data operations obtained are determined, and the above types include: new requests, modification requests, deletion requests, conditional query requests and paging query requests; through conversion into a reusable component for implementing business data and the mutual conversion of the reusable component of the general data access layer, and through the general data operation service implementation layer calling the general table-level data operation interface, the business data access operation is implemented. By implementing the present invention, the existing technology solves the defect that the data access mode based on mybatis has a heavy development cost and the business development efficiency is low. By combining the reusable components, the efficiency of business iterative development based on the database can be improved, the development pressure is relieved, and for the same type of data operations, the reusability of business data iterative development is achieved by introducing reusable components and a reusable data access framework.
[0043] As an optional embodiment of the present invention, the data access system also includes: multiple business data access operations can be obtained at the same time. First, the multiple business data access operations and corresponding access parameters obtained are converted through the general application adaptation layer 10 to generate multiple general data requests; then, in the general request type determination layer 20, the identifier information of each general data request is parsed and generated according to the access parameters corresponding to each general data request, and then the operation type of each general data request is determined; in the conversion layer 30, the reusable components of the corresponding business data are obtained according to different operation type information, and are converted and generated into reusable components of the general data access layer; then, in the general data operation service implementation layer 40, the general table-level data operation interface of the general data access layer 50 is called, and different operation types correspond to different general table-level data operation interfaces; business data access operations of different operation types are implemented according to the corresponding reusable components of the general data access layer.
[0044] Specifically, when, based on the acquired business data access operations A1, A2, A3, and A4, the general request type determination layer determines that the business data access operations A1, A2, and A3 are general addition requests, and the business data access operation A4 is a general modification request:
[0045] On the one hand, in the conversion layer, the reusable components of the first business data can be obtained according to the operation type information of the general new addition request, and converted to generate reusable components of the first general data access layer; then in the general data operation service implementation layer, the first general table-level data operation interface of the general data access layer is called to implement the data addition operation.
[0046] On the other hand, in the conversion layer, the reusable components of the second business data can be obtained according to the operation type information of the general modification request, and converted to generate reusable components of the second general data access layer; then in the general data operation service implementation layer, the second general table-level data operation interface of the general data access layer is called to implement the data modification operation.
[0047] It should be noted that, since the general data requests of different operation types call different reusable components of business data in the conversion layer, the general table-level data operation interfaces of the general data access layer called are also different. Therefore, the above steps can be executed in parallel without interfering with each other. A data access system provided by an embodiment of the present invention can simultaneously execute business data access operations of different operation types for multiple business data access operations received. In combination with reusable components, the efficiency of iterative business development based on the database is improved, and the development pressure is alleviated. For the same type of data operations, the reusable iterative development of business data is achieved by introducing reusable components and a reusable data access framework.
[0048] As an optional embodiment of the present invention, the universal table-level data operation interface specifically includes: an SQL automatic generator and an SQL execution engine, wherein:
[0049] The SQL automatic generator 5011 is used to obtain reusable components of the universal data access layer 50 and generate SQL statements based on the reusable components of the universal data access layer 50. In this embodiment, SQL statements can be generated within the interface. Specifically, the SQL statements can be generated based on the reflection mechanism and Java Bean. For example, when adding new data, the universal new data operation interface is called to insert the new data into the data table. The specific implementation can be:
[0050] int insert(T bizObj);
[0051] Insert into
[0052]
[0053]
[0054]
[0055]
[0056]
[0057] Figure 2
[0058]
[0059]
[0060]
[0061]
[0062] Figure 3
[0063]
[0064]
[0065]
[0066]
[0067]
[0068]
[0069]
[0070]
[0071]
[0072]
[0073]
[0074]
[0075] Figure 4
[0076] Figure 1 Figure 3
[0077]
[0078]
[0079]
[0080]
[0081] (field1, field2, ...) values (value1, value2, ...). Wherein, T is a generic type, and the field list and value list can be obtained from bizObj according to the reflection mechanism, that is, the names and values of all fields are obtained through the reflection mechanism, and then the generated SQL is converted. The delete, modify, and query operations can also be converted into SQL, which will not be repeated here. Exemplarily, the SQL execution engine 5012 is used to implement business data access operations based on the SQL statements generated by the SQL automatic generator. As an optional embodiment of the present invention, the general data operation service implementation layer 40 is also used to: verify whether the business data meets the operation requirements according to the general data request; when the business data meets the operation requirements, execute the general table-level data operation interface of the general data access layer 50, and implement the steps of the business data access operation according to the reusable components of the general data access layer 50. As an optional embodiment of the present invention, the general data operation service implementation layer 40 is also used to: when the business data does not meet the operation requirements, the business data access operation fails to execute. As an optional embodiment of the present invention, the conversion layer 30 is further configured to obtain reusable components of the universal data access layer 50 and convert and generate reusable components for business data based on the reusable components of the universal data access layer 50. During data query, the DAL layer Java Bean needs to be converted into a business Java Bean, and the queried data information is displayed to the user through the generated business Java Bean after conversion. The following describes the specific functions of the above-mentioned data access system in detail with reference to a schematic diagram. As shown, the system includes: a universal application adaptation layer 10, a universal request type determination layer 20, a conversion layer 30, a universal data operation service implementation layer 40, and a universal data access layer 50. The universal application adaptation layer 10 may include multiple business interfaces, such as business interface 1, business interface 2, business interface 3, and business interface N. Different business interfaces may correspond to different user access operations on the database, such as adding data, deleting data, modifying data, and querying data. The above-mentioned data query operations may include paging query operations and conditional query operations. Users input different data access operations through the business interface. The general application adaptation layer converts the received business data access operations into general data requests based on the received business data access operations and access parameters. The general request type determination layer 20 is used to determine the type of general data request based on the general data request. For example, the types include: general add request, general modify request, general delete request, general conditional query request, and general paging query request.The above-mentioned conversion layer 30 is used to obtain reusable components of business data according to the general data request, and convert the reusable components of the business data into reusable components of the general data access layer 50; the above-mentioned general data operation service implementation layer 40 is used to call the general table-level data operation interface of the general data access layer 50, and implement the business data access operation according to the reusable components of the general data access layer; for example, to implement operations such as adding new data, deleting data, modifying data, conditional query data, and paging query data; and then perform corresponding operations on the data in the database db through the general data access layer, specifically, obtain the reusable components of the general data access layer, generate SQL statements according to the reusable components of the general data access layer; and implement business data access operations according to the SQL statements generated by the SQL automatic generator. An embodiment of the present invention provides a data access method for use in a specific application scenario where a financial institution operates on a user's business data. As shown, the method comprises: Step S11: Obtaining access parameters and a business data access operation, and generating a general data request based on the access parameters and the business data access operation; for detailed implementation details, refer to the description of the general application adaptation layer in the aforementioned system embodiment. Step S12: Determining the type of the general data request, which includes: a general add request, a general modify request, a general delete request, a general conditional query request, and a general paging query request; for detailed implementation details, refer to the description of the general request type determination layer in the aforementioned system embodiment. Step S13: Obtaining reusable components of the business data based on the general data request, and converting the reusable components of the business data into reusable components of the general data access layer; for detailed implementation details, refer to the description of the conversion layer in the aforementioned system embodiment. Step S14: Implementing the business data access operation based on the reusable components of the general data access layer; for detailed implementation details, refer to the description of the general data operation service implementation layer and the general data access layer in the aforementioned system embodiment. A data access method provided by an embodiment of the present invention includes: obtaining business data access operations and access parameters, and converting them into general data requests; then determining the types of different business data operations obtained, the above types including: new addition requests, modification requests, deletion requests, conditional query requests and paging query requests; implementing business data access operations by converting into reusable components that implement business data and reusable components of a general data access layer, and calling a general table-level data operation interface.By implementing the present invention, the defects of the prior art, that is, the data access mode based on mybatis has a heavy development cost, which leads to low efficiency of business development, are solved. By combining with reusable components, the efficiency of business iterative development based on the database can be improved, and the development pressure can be alleviated. For the same type of data operations, the reusable development of business data iterative development is achieved by introducing reusable components and a reusable data access framework. As an optional implementation method of the present application, step S14, according to the reusable components of the universal data access layer, in the process of implementing the business data access operation, specifically includes: first, obtaining the reusable components of the universal data access layer, and generating SQL statements according to the reusable components of the universal data access layer; for detailed implementation content, please refer to the relevant description of the universal data operation service implementation layer and the universal data access layer in the above-mentioned system embodiment. Secondly, according to the SQL statement, the business data access operation is implemented. For detailed implementation content, please refer to the relevant description of the universal data operation service implementation layer and the universal data access layer in the above-mentioned system embodiment. As an optional implementation of the present application, the method further includes: first, based on the general data request, verifying whether the business data meets the operation requirements; second, when the business data meets the operation requirements, implementing the business data access operation based on the reusable components of the general data access layer. As an optional implementation of the present application, the method further includes: obtaining the reusable components of the general data access layer; based on the reusable components of the general data access layer, converting and generating reusable components of the business data. For detailed implementation content, please refer to the relevant description of the general data operation service implementation layer and the general data access layer in the above system embodiment. Exemplarily, whether it is necessary to verify whether the business data meets the operation requirements is determined based on the specific circumstances of the data information. That is to say, for some data, it is possible to determine whether the business data requirements are met without verification. When the operation type is a new data operation, when the newly added data information is specifically the user's shopping record information, since the user's shopping record information is generated based on the user's shopping behavior, the user's shopping record will not be stored in the database / table in advance. Therefore, when the user's shopping record information is added, an SQL statement can be directly generated without verification to insert the shopping record information into the database / table. Among them, the above steps of "verifying whether the business data meets the operation requirements according to the general data request" and "obtaining the reusable components of the business data according to the general data request, and converting the reusable components of the business data into reusable components of the general data access layer" are not in the same order, or they can be processed simultaneously.An embodiment of the present invention provides a computer device 31, as shown, comprising: at least one processor 311; and a memory 312 communicatively connected to the at least one processor 311. The memory 312 stores instructions executable by the at least one processor 311. Upon receiving data information, the memory 312 causes the at least one processor 311 to execute the data access method shown. For example, one processor, processor 311, and the memory 312 are connected via a bus. The memory 312, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the data access method in the embodiment of the present invention. By executing the non-transitory software programs, instructions, and modules stored in the memory 312, the processor 311 executes various server functional applications and data processing, thereby implementing the data access method in the embodiment of the method described above. The memory 312 can include a program storage area and a data storage area. The program storage area can store an operating system and application programs required for at least one function; the data storage area can store data generated by the processing device of the server. In addition, the memory 312 may include a high-speed random access memory and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 312 may optionally include a memory remotely located relative to the processor 311, and these remote memories may be connected to a network connection device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. One or more modules are stored in the memory 312, and when executed by one or more processors 311, the method described in any one of the above embodiments is executed. An embodiment of the present invention also provides a non-transitory computer-readable medium, a non-transitory computer-readable storage medium storing computer instructions, and the computer instructions are used to cause a computer to execute a data access method as described in any one of the above embodiments, wherein the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory (Flash Memory), a hard disk (Hard Disk Drive, abbreviated: HDD) or a solid-state drive (SSD), etc.; the storage medium may also include a combination of the above-mentioned types of memory. Obviously, the above embodiments are merely examples for clarity of explanation and are not intended to limit the implementation methods. Those skilled in the art will readily appreciate that other variations or modifications based on the above descriptions are possible. It is not necessary and impossible to enumerate all implementation methods here. Obvious variations or modifications arising therefrom remain within the scope of protection of the present invention.
Claims
1. A data access system, characterized in that: include: General application adaptation layer, general request type determination layer, conversion layer, general data operation service implementation layer and general data access layer, among which, The general application adaptation layer is used to obtain access parameters and business data access operations, and generate a general data request according to the access parameters and the business data access operations; The general request type determination layer is used to determine the type of the general data request, which includes: a general addition request, a general modification request, a general deletion request, a general conditional query request, and a general paging query request; The conversion layer is used to obtain reusable components of business data according to the general data request, and convert the reusable components of the business data into reusable components of the general data access layer. It is also used to obtain reusable components of the general data access layer and convert the reusable components of the general data access layer into reusable components of business data. General data requests of different operation types call different reusable components of business data in the conversion layer, and the general table-level data operation interfaces of the general data access layer that are called are also different. The general data operation service implementation layer is used to call the general table-level data operation interface of the general data access layer and implement the business data access operation according to the reusable components of the general data access layer.
2. The system according to claim 1, wherein: The general table-level data operation interface specifically includes: an SQL automatic generator and an SQL execution engine, wherein: The SQL automatic generator is used to obtain the reusable components of the universal data access layer and generate SQL statements according to the reusable components of the universal data access layer; The SQL execution engine is used to implement business data access operations based on the SQL statements generated by the SQL automatic generator.
3. The system according to claim 1, wherein: The general data operation service implementation layer is also used to: verify whether the business data meets the operation requirements based on the general data request; when the business data meets the operation requirements, execute the step of calling the general table-level data operation interface of the general data access layer, and implement the business data access operation based on the reusable components of the general data access layer.
4. The system according to claim 3, characterized in that The general data operation service implementation layer is further configured to: fail to execute the business data access operation when the business data does not meet the operation requirements.
5. A data access method, characterized in that: include: Obtaining access parameters and business data access operations, and generating a general data request based on the access parameters and the business data access operations; Determine the type of the general data request, the type including: general addition request, general modification request, general deletion request, general condition query request and general paging query request; According to the general data request, reusable components of business data are obtained, and the reusable components of the business data are converted into reusable components of the general data access layer. Reusable components of the general data access layer are obtained, and according to the reusable components of the general data access layer, reusable components of business data are converted into reusable components. General data requests of different operation types call different reusable components of business data in the conversion layer, and the general table-level data operation interfaces of the general data access layer called are also different. The general table-level data operation interface of the general data access layer is called, and the business data access operation is implemented according to the reusable components of the general data access layer.
6. The method according to claim 5, characterized in that Implementing the business data access operation according to the reusable components of the universal data access layer specifically includes: Obtaining reusable components of the universal data access layer, and generating SQL statements according to the reusable components of the universal data access layer; According to the SQL statement, the business data access operation is implemented.
7. The method according to claim 5, characterized in that The method further includes: Verifying whether the business data meets the operational requirements according to the general data request; When the business data meets the operation requirements, the business data access operation is implemented according to the reusable components of the universal data access layer.
8. The method according to claim 7, characterized in that The method further includes: When the business data does not meet the operation requirements, the business data access operation fails.
9. A computer device, characterized in that: include: At least one processor and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the processor executes the data access method according to any one of claims 5 to 8 by executing the instructions.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the data access method according to any one of claims 5 to 8 are implemented.
Citation Information
Patent Citations
Method and system for separation of data persistence layers
CN104461495A
Multi-service multiplexing processing method, apparatus and system
CN106919590A
Interface control file data storage method and system
CN110597827A