A method, system and operation method for implementing SQL statement processing

Through the parsing tool of the encapsulation interface and JPA framework protocol, direct operation of entity classes is realized, the inefficiency problem caused by handwriting of SQL statements is solved, and the convenience and efficiency of database query are improved.

CN109739872BActive Publication Date: 2025-08-19AISPEECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN201811613476.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-12-27
Publication Date
2025-08-19
Estimated Expiration
2038-12-27

AI Technical Summary

Technical Problem

In the prior art, the handwriting implementation of SQL statements leads to low operational efficiency, affecting system performance and user experience.

Method used

By creating encapsulation interfaces and encapsulation classes, using the object type conditional parameters for SQL query, and parsing them in combination with the JPA framework protocol to realize direct operation of entity classes and avoid handwriting SQL statements.

Benefits of technology

It lowers the threshold for querying database operations, improves efficiency and convenience, and meets different query needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN109739872B_ABST
    Figure CN109739872B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for implementing SQL statement processing, comprising the following steps: creating an encapsulation interface for encapsulating query conditional statements, wherein the input parameters of the encapsulation interface are defined as conditional parameters of an object type; defining a first encapsulation class and a parsing tool; implementing the first encapsulation class to include an encapsulation function corresponding one-to-one to the encapsulation interface, wherein the encapsulation function is implemented to store the received conditional parameters in an internal container; and implementing the parsing tool to obtain the conditional parameters of the first encapsulation class and parse them to obtain an encapsulated data type output that complies with the JPA framework protocol. The present invention also discloses a system for processing SQL statements. According to the system and method disclosed in the present invention, by encapsulating database query statements, the purpose of directly operating entity classes is achieved, avoiding the need for manually writing statements for operation, lowering the threshold for querying database operations, and being efficient and convenient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of statement processing, and in particular to an implementation method, system and operation method for SQL statement processing. Background Art

[0002] SQL (Structured Query Language) is a database query and programming language used to access data, as well as query, update, and manage relational database systems. Currently, SQL or HQL queries require handwritten statements. However, executing certain SQL statements can be time-consuming and inefficient, significantly slowing down system performance, slowing page response times, and impacting user experience. Summary of the Invention

[0003] To address this issue, the inventors devised a method to encapsulate attributes in entity classes, replacing handwritten statements. This allows database table queries to be performed through attribute manipulation. By encapsulating database query statements, direct manipulation of entity classes is achieved, eliminating the need for handwritten statements. This lowers the barrier to entry for database query operations and provides increased efficiency and convenience.

[0004] According to a first aspect of the present invention, a method for implementing SQL statement processing is provided, comprising the following steps:

[0005] Create an encapsulation interface for encapsulating query condition statements. The input parameters of the encapsulation interface are defined as condition parameters of object type.

[0006] Construct a first encapsulation class, implement the first encapsulation class to include an encapsulation function corresponding one-to-one to the encapsulation interface, and implement the encapsulation function to store the received conditional parameters in an internal container;

[0007] A parsing tool is constructed and implemented to obtain conditional parameters of the first encapsulation class for parsing, and obtain an encapsulation data type output that complies with the JPA (Java Persistence API) framework protocol.

[0008] According to a second aspect of the present invention, there is provided a SQL statement processing system, comprising:

[0009] An encapsulation interface for encapsulating query conditional statements, wherein the input parameters of the encapsulation interface are defined as conditional parameters of object type;

[0010] The first encapsulation class includes encapsulation functions corresponding one-to-one to the encapsulation interfaces, and the encapsulation functions are implemented to store received conditional parameters into an internal container;

[0011] Parsing tool, used to obtain conditional parameters from the first encapsulation class for parsing and generate encapsulated data type output that complies with the JPA framework protocol

[0012] According to a third aspect of the present invention, there is provided a method for implementing SQL operations using the above-mentioned SQL statement processing system, comprising the following steps:

[0013] Create an object instance of the first encapsulated class;

[0014] Call the corresponding encapsulation function of the first encapsulation class through the object instance and set the conditional parameters;

[0015] Invoking a parsing tool to parse the object instance of the first encapsulation class to obtain encapsulation type data;

[0016] A third-party JPA framework is called to perform SQL operations on the encapsulated type data to obtain processing results.

[0017] According to a fourth aspect of the present invention, an electronic device is provided, 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 instructions are executed by the at least one processor to enable the at least one processor to perform the steps of the above method.

[0018] According to a fifth aspect of the present invention, there is provided a storage medium having a computer program stored thereon, which implements the steps of the above method when executed by a processor.

[0019] According to the device and method provided by the present invention, the purpose of directly operating entity classes can be achieved, avoiding the need to operate through handwritten statements, lowering the threshold for querying database operations, and being efficient and convenient. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 This is a principle block diagram of a method for implementing SQL statement processing according to one embodiment of the present invention;

[0021] Figure 2 A method for processing SQL statements according to another embodiment of the present invention is provided;

[0022] Figure 3 Another embodiment of the present invention is a method for implementing SQL statement processing;

[0023] Figure 4 A system block diagram of SQL statement processing according to an embodiment of the present invention;

[0024] Figure 5 A system block diagram of SQL statement processing according to another embodiment of the present invention;

[0025] Figure 6 A flow chart of a method for implementing SQL operations using an SQL statement processing system according to an embodiment of the present invention;

[0026] Figure 7 This is a block diagram of an electronic device according to one embodiment of the present invention. DETAILED DESCRIPTION

[0027] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.

[0028] It should be noted that, unless there is any conflict, the embodiments and features in the embodiments of this application can be combined with each other.

[0029] The present invention may be described in the general context of computer-executable instructions, such as program modules, executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. The present invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media, including storage devices.

[0030] In the present invention, "module", "device", "system" and the like refer to related entities applied to a computer, such as hardware, a combination of hardware and software, software or software in execution, etc. Specifically, for example, an element can be, but is not limited to, a process running on a processor, a processor, an object, an executable element, an execution thread, a program and / or a computer. In addition, an application or script program running on a server, or a server can all be an element. One or more elements can be in an execution process and / or thread, and an element can be localized on a computer and / or distributed between two or more computers, and can be run by various computer-readable media. An element can also communicate through local and / or remote processes based on a signal having one or more data packets, for example, a signal from a data packet interacting with another element in a local system, a distributed system, and / or a signal from a network on the Internet that interacts with other systems via signals.

[0031] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "include" and "comprise" include not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article or device. In the absence of further limitations, the elements defined by the phrase "include..." do not exclude the presence of other identical elements in the process, method, article or device that includes the elements.

[0032] The present invention will be further described in detail below with reference to the accompanying drawings.

[0033] Figure 1 The following schematically shows a flow chart of a method for implementing SQL statement processing according to an embodiment of the present invention. Figure 1 As shown, this embodiment includes the following steps:

[0034] Step S101: Create an encapsulation interface for encapsulating query conditional statements, with the input parameters of the encapsulation interface defined as object-type conditional parameters. Encapsulate the SQL query statement into a call interface based on the query condition, and set the input parameters of the encapsulated call interface as object-type conditional parameters. This allows developers to implement SQL query operations based on the properties of the operation object during the development process without having to manually write SQL statements. For example, the created encapsulation interface may include the following types: isnull implementation, isnotnull implementation, eq implementation, ne implementation, and like implementation.

[0035] Step S102: Construct a first encapsulation class, and define the first encapsulation class as including encapsulation functions that correspond one-to-one to the encapsulation interfaces. For example, define the first encapsulation class SpecParam as follows:

[0036]

[0037] The encapsulation function in the defined class SpecParam is implemented to store the received conditional parameters in an internal container (ie, memory), that is, param1, param2, . . . are stored in the internal container.

[0038] Step S103: Construct a parsing tool, which is implemented to obtain input parameters for parsing and obtain an encapsulated data type output that complies with the JPA framework protocol. In this embodiment, the parsing tool is also implemented in the form of a class. For example, a class SpecUtil is defined as a parsing tool as follows:

[0039] SpecUtil{

[0040] public static Specification spec(SpecParam param1){...}; ...

[0042] }

[0043] The function spec in the defined class SpecUtil is implemented to parse the input parameter param1 according to the protocol of the adopted JPA framework, converting the parameter into an encapsulated data type that conforms to the JPA framework protocol and outputting it. For example, the adopted JPA framework may be the Hibernate framework. In a specific implementation example, the input parameter may be a conditional parameter of the first encapsulated class.

[0044] The method according to this embodiment can achieve the purpose of querying the data table by directly operating the entity class through encapsulating the database query statement, avoiding the need to operate through handwritten statements, lowering the threshold for querying the database operation, and being efficient and convenient.

[0045] Figure 2 A flowchart of a method for processing SQL statements according to another embodiment of the present invention is schematically shown. Figure 2 As shown:

[0046] The implementation method of step S201 to step S202 can refer to the implementation method of step S101 to step S102.

[0047] Step S203: Construct a second encapsulation class, and implement the second encapsulation class to include setting field properties. For example, define the second encapsulation class SpecProperty as follows:

[0048]

[0049]

[0050] The field properties in the defined class SpecProperty are the field parameters that need to be queried. This method can be used to limit the query conditions and meet different query requirements.

[0051] Step S204: When calling the encapsulation function of the first encapsulation class, determine whether the currently called encapsulation function needs to query all fields. When all fields do not need to be queried, set the set field attributes of the second encapsulation class according to the conditional parameters. The judgment method can be implemented as follows: the first method is to directly check the current function type and determine whether it is a query of all fields based on different function type functions; the second method is to match the obtained conditional parameters based on preset keywords to determine whether the processing corresponding to the current conditional parameters is a processing that requires querying all fields. When the judgment result is a processing that does not query all fields, obtain the field content that needs to be queried from the conditional parameters, and set the value of the set field attribute to the field content that needs to be queried.

[0052] In this embodiment, after the second encapsulation class is set, the instance object of the second encapsulation class will be used as an input parameter to parse the instance object of the second encapsulation class using the parsing tool. That is, in this case, the input parameter passed into the parsing tool is the instance object corresponding to the second encapsulation class. At this time, the parsing tool will obtain the set field attributes of the second encapsulation class for parsing, and obtain the encapsulation data type output that complies with the JPA framework protocol.

[0053] The method of this embodiment can achieve the purpose of querying data tables by directly manipulating entity classes through the encapsulation of database query statements, eliminating the need for manually written statements, lowering the threshold for database query operations, and providing efficiency and convenience. Furthermore, the method of this embodiment uses a second encapsulation class to set and filter conditions, and then performs database operations based on the filtered conditions, meeting different application needs and scenarios.

[0054] Figure 3 A flowchart of a method for implementing SQL statement processing according to another embodiment of the present invention is schematically shown. Figure 3 As shown, the method includes the following steps:

[0055] The implementation method of step S301: can refer to the implementation method of step S101.

[0056] The implementation method of step S302 may refer to the implementation method of step S202.

[0057] Step S303: This implementation is basically the same as the implementation of step S203, except that in this implementation example the second encapsulation class is implemented to also include an aggregation type attribute, wherein the value of the aggregation type attribute is also set according to the input conditional parameters.

[0058] Step S304: When it is determined that the currently called encapsulation function is not for querying all fields and the conditional parameters include the aggregation type, the set field attributes of the second encapsulation class are set according to the conditional parameters. The implementation method of this step is basically the same as that of step S204, except that, when the judgment result is for processing that is not for querying all fields, it is also determined according to the conditional parameters whether the parameters corresponding to the aggregation type attribute are included. When the parameters corresponding to the aggregation type are included, the corresponding field content is also obtained from the conditional parameters, and the value of the aggregation type attribute is set to the corresponding field content. Exemplarily, the aggregation type parameter can be a statistical parameter such as count, a sorting parameter such as groupby, etc., and the content of the conditional parameter can be judged based on keyword matching.

[0059] Step S305: Construct a statistical tool, implementing the statistical tool as an aggregate function encapsulation process based on the attribute values of the second encapsulation class. Specifically, the type of aggregate function to be used is determined based on the aggregate type field, illustratively based on the value of the specType, to obtain an encapsulated data type output that complies with the JPA framework protocol. Preferably, the statistical tool can be implemented in the form of a class. For example, a class CountUtil is defined as the statistical tool as follows:

[0060]

[0061] The function spec in the defined class CountUtil is implemented to parse the input parameter param1 according to the protocol of the adopted JPA framework, converting the parameter into an encapsulated data type that conforms to the JPA framework protocol and outputting it. For example, the adopted JPA framework can be the Hibernate framework. In the specific implementation example, the input parameter is an instance object of the second encapsulated class.

[0062] According to this embodiment, by encapsulating database query statements, it is possible to directly operate entity classes to perform data table query operations, avoiding the need for manually writing statements, lowering the threshold for database query operations, and achieving efficiency and convenience. In addition, the method of this embodiment, by designing a second encapsulation class to set specific field attributes and constructing a statistical tool to encapsulate aggregate functions, can not only implement SQL query operations, but also other types of SQL operations such as statistics and sorting.

[0063] Figure 4 A block diagram of a SQL statement processing system according to an embodiment of the present invention is schematically shown. Figure 4 As shown,

[0064] The SQL statement processing system includes an encapsulation interface 401 , a first encapsulation class 402 and a parsing tool 403 .

[0065] The encapsulation interface 401 is used to encapsulate the query condition statement, wherein the input parameter of the encapsulation interface 401 is defined as a condition parameter of the object type;

[0066] The first encapsulation class 402 includes an encapsulation function corresponding to the encapsulation interface 401, and the encapsulation function is implemented to store the received conditional parameters into an internal container;

[0067] The parsing tool 403 is used to obtain conditional parameters from input parameters for parsing and generate an encapsulated data type output that complies with the JPA framework protocol, wherein the input parameters of the parsing tool include the instance object of the first encapsulated class.

[0068] According to the system of this embodiment, the purpose of querying the data table by directly operating the entity class can be achieved by encapsulating the database query statement, avoiding the need to operate through handwritten statements, lowering the threshold for querying the database operation, and being efficient and convenient.

[0069] Figure 5 A block diagram of an SQL statement processing system according to another embodiment of the present invention is schematically shown. Figure 5 As shown, the system Figure 4 The system shown also includes

[0070] The second encapsulation class 404 includes setting field attributes and aggregation type attributes, wherein the values of the setting field attributes and aggregation type attributes are set according to the input setting condition parameters; the input setting condition parameters can be the condition parameter values of the object instance corresponding to the first encapsulation class.

[0071] The statistical tool 405 is configured to perform aggregate function encapsulation processing based on the input parameter values to obtain an encapsulated data type output that complies with the JPA framework protocol. In a specific embodiment, the input parameter values may be instance objects of a second encapsulation class, which include set field attribute values and aggregate type attributes. The statistical tool performs aggregate function encapsulation processing based on the input set field attribute values and aggregate type attribute values.

[0072] In this embodiment, the input parameter of the parsing tool can be either an instance object of the first encapsulation class or an instance object of the second encapsulation class.

[0073] The system according to this embodiment can implement conditional setting and filtering by designing a second encapsulation class, and perform database operations based on the filtered conditions to meet different application requirements and scenarios. Furthermore, the second encapsulation class can be designed to set specific field attributes, and statistical tools can be built to encapsulate aggregate functions, enabling not only SQL query operations but also other types of SQL operations such as statistics and sorting.

[0074] Figure 6 The flowchart of the method for implementing SQL operations using the SQL statement processing system according to one embodiment of the present invention is schematically shown. Figure 6 As shown, this embodiment includes the following steps:

[0075] Step S601: Create an object instance of the first encapsulation class. Exemplarily, create the object instance specParam of the first encapsulation class SpecParam in the following manner:

[0076] SpecParam <t>specParam=new SpecParam<>();

[0077] Step S602: Call the corresponding encapsulation function of the first encapsulation class through the object instance and set the conditional parameters. For example, taking the encapsulation function called as eq as an example, the implementation is as follows:

[0078] specParam.eq("name","aaaaa").like("info","bbbb");

[0079] In this way, the two encapsulated functions eq and like can be called, and when calling, the conditional parameters can be set to "name", "aaaaa", and "info", "bbbb" respectively.

[0080] Step S603: Determine whether all fields are to be queried. If it is determined that all fields are not to be queried, execute step S604. If it is determined that all fields are to be queried, execute step S605.

[0081] Step S604: Create an object instance of the second encapsulation class, and set attribute values for the object instance of the second encapsulation class according to the conditional parameters. Then proceed to step S606.

[0082] SpecProperty productIdProperty=SpecProperty.forName("productId");

[0083] Step S605: Calling a parsing tool to parse the object instance of the first encapsulation class to obtain encapsulation type data. Exemplarily, calling the parsing tool is implemented in the following manner:

[0084] Specification sp=SpecUtil.spec(specParam);

[0085] After obtaining the encapsulation type data, the process of step S606 is performed.

[0086] Step S606: Call the third-party JPA framework to perform SQL operations on the encapsulated data and obtain the processing results. Taking the third-party JPA framework implemented as Hibernate as an example, the processing results can be obtained in the following way:

[0087] T details=repository.findAll(sp);

[0088] It can be seen that when performing SQL operations through this operation method, there is no need to set up and write SQL statements. You only need to call according to the class object to get the processing results, which improves processing efficiency and reduces development difficulty.

[0089] Figure 7 A flowchart of a method for implementing SQL operations using an SQL statement processing system according to another embodiment of the present invention is schematically shown. Figure 7 As shown, the method steps of this embodiment are Figure 6 The steps of the method shown are basically the same, except that Figure 7 The processing in step S704 of the illustrated embodiment is implemented as follows:

[0090] Step S704: Create an object instance of the second encapsulated class and set attribute values for the object instance of the second encapsulated class based on the conditional parameters. Next, determine whether the conditional parameters of the instance object of the second encapsulated class include an aggregation type parameter. If so, invoke a statistical tool to perform aggregation function encapsulation processing on the object instance of the second encapsulated class to obtain encapsulation type data. If not, invoke a parsing tool to parse the object instance of the second encapsulated class to obtain encapsulation type data. After obtaining the encapsulation type data, proceed to step S706.

[0091] In some embodiments, an embodiment of the present invention provides a non-volatile computer-readable storage medium, which stores one or more programs including execution instructions. The execution instructions can be read and executed by an electronic device (including but not limited to a computer, a server, or a network device, etc.) to execute any one of the above-mentioned SQL statement processing implementation methods of the present invention.

[0092] In some embodiments, an embodiment of the present invention further provides a computer program product, which includes a computer program stored on a non-volatile computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes any one of the above-mentioned SQL statement processing implementation methods.

[0093] In some embodiments, an embodiment of the present invention also provides an electronic 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 instructions are executed by the at least one processor to enable the at least one processor to execute an implementation method for SQL statement processing.

[0094] In some embodiments, an embodiment of the present invention further provides a storage medium having a computer program stored thereon, wherein the computer program is characterized in that when the program is executed by a processor, it implements a method for processing SQL statements.

[0095] The SQL statement processing system of the embodiment of the present invention described above can be used to execute the implementation method of the SQL statement processing of the embodiment of the present invention, and accordingly achieve the technical effects achieved by the implementation method of the SQL statement processing of the embodiment of the present invention described above, which will not be described in detail here. In the embodiment of the present invention, the relevant functional modules can be implemented by a hardware processor.

[0096] The above-mentioned product can execute the method provided in the embodiment of this application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the method provided in the embodiment of this application.

[0097] The electronic devices of the embodiments of the present application exist in various forms, including but not limited to:

[0098] (1) Mobile communication devices: These devices are characterized by their mobile communication capabilities and are primarily designed to provide voice and data communications. These terminals include smartphones (e.g., iPhones), multimedia phones, feature phones, and low-end phones.

[0099] (2) Ultra-mobile personal computer devices: These devices fall under the category of personal computers, have computing and processing capabilities, and generally also have mobile Internet access. These terminals include PDAs, MIDs, and UMPCs, such as the iPad.

[0100] (3) Vehicle-mounted devices: These devices are used during vehicle driving and can be connected to other auxiliary systems of the vehicle.

[0101] (4) Server: A device that provides computing services. The server consists of a processor, hard disk, memory, system bus, etc. The server is similar to a general computer architecture, but because it needs to provide highly reliable services, it has higher requirements in terms of processing power, stability, reliability, security, scalability, and manageability.

[0102] (5) Other electronic devices with data interaction functions.

[0103] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.

[0104] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a general hardware platform, or of course, by hardware. Based on this understanding, the above technical solution, in essence, or the part that contributes to the relevant technology, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiment.

[0105] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.< / t>

Claims

1. A method for implementing SQL operations, characterized in that: The steps include: Creating an object instance of a first encapsulation class, wherein the first encapsulation class is pre-constructed to include an encapsulation function corresponding one-to-one to a pre-created encapsulation interface for encapsulating a query conditional statement, wherein an input parameter of the encapsulation interface is defined as a conditional parameter of an object type, and the encapsulation function is implemented to store the received conditional parameter in an internal container; Calling the corresponding encapsulation function of the first encapsulation class through the object instance and setting conditional parameters; Invoking a pre-built parsing tool to parse the object instance of the first encapsulated class to obtain encapsulated type data, wherein the parsing tool is implemented to obtain input parameters for parsing and obtain an output of an encapsulated data type that complies with the JPA framework protocol, wherein the input parameters of the parsing tool include the instance object of the first encapsulated class; A third-party JPA framework is called to perform SQL operations on the encapsulated type data to obtain processing results.

2. The method for implementing SQL operations according to claim 1, wherein: The input parameters of the parsing tool also include an instance object of the second encapsulation class, and after calling the corresponding encapsulation function of the first encapsulation class through the object instance and setting the conditional parameters, the following is also included: Determine whether to query all fields based on the called encapsulation function and the set condition parameters; When determining that not all fields are being queried, perform the following operations: Creating an object instance of a second encapsulation class, wherein the second encapsulation class is pre-constructed to include a set field attribute, wherein a value of the set field attribute is set to a value of the input conditional parameter; Setting attribute values for the object instance of the second encapsulation class according to the conditional parameters; Invoking a parsing tool to parse the object instance of the second encapsulation class to obtain encapsulation type data; Calling a third-party JPA framework to perform SQL operations on the encapsulated type data and obtain processing results; When all fields are determined to be queried, perform the following operations: Invoking a parsing tool to parse the object instance of the first encapsulation class to obtain encapsulation type data; A third-party JPA framework is called to perform SQL operations on the encapsulated type data to obtain processing results.

3. The method for implementing SQL operations according to claim 2, wherein: The second encapsulation class is implemented to further include an aggregation type attribute, the value of which is set according to the input condition parameter; When the attribute value set for the object instance of the second encapsulation class includes an aggregate type, before calling the third-party JPA framework to perform SQL operation processing on the encapsulation type data and obtaining the processing result, the following is further included: The statistical tool is called to perform aggregate function encapsulation processing according to the aggregate type value of the object instance of the second encapsulation class to obtain encapsulation type data, wherein the statistical tool is defined to perform aggregate function encapsulation processing according to the attribute value of the second encapsulation class to obtain encapsulation data type output that complies with the JPA framework protocol.

4. The method for implementing SQL operations according to any one of claims 1 to 3, characterized in that: The JPA framework is the Hibernate framework.

5. A SQL statement processing system, characterized in that: The system comprises: An encapsulation interface for encapsulating query conditional statements, wherein the input parameters of the encapsulation interface are defined as conditional parameters of object type; A first encapsulation class includes an encapsulation function corresponding one-to-one to the encapsulation interface, and the encapsulation function is implemented to store the received conditional parameters into an internal container; A parsing tool, configured to obtain conditional parameters from input parameters for parsing and generate an encapsulated data type output that complies with the JPA framework protocol, wherein the input parameters of the parsing tool include an instance object of the first encapsulated class; The system is configured to implement SQL operations in the following manner: Create an object instance of the first encapsulated class; Calling the corresponding encapsulation function of the first encapsulation class through the object instance and setting conditional parameters; Invoking a parsing tool to parse the object instance of the first encapsulation class to obtain encapsulation type data; A third-party JPA framework is called to perform SQL operations on the encapsulated type data to obtain processing results.

6. A SQL statement processing system, characterized in that: The system comprises: An encapsulation interface for encapsulating query conditional statements, wherein the input parameters of the encapsulation interface are defined as conditional parameters of object type; A first encapsulation class includes an encapsulation function corresponding one-to-one to the encapsulation interface, and the encapsulation function is implemented to store the received conditional parameters into an internal container; A parsing tool, configured to obtain conditional parameters from input parameters for parsing and generate an encapsulated data type output that complies with the JPA framework protocol, wherein the input parameters of the parsing tool include an instance object of the first encapsulated class; The second encapsulation class includes setting field attributes and aggregation type attributes, wherein the values of the setting field attributes and aggregation type attributes are set according to the input setting condition parameters; Wherein, the input parameters of the parsing tool also include an instance object of the second encapsulation class; The system is configured to implement SQL operations in the following manner: Create an object instance of the first encapsulated class; Calling the corresponding encapsulation function of the first encapsulation class through the object instance and setting conditional parameters; Determine whether to query all fields based on the called encapsulation function and the set condition parameters; When determining that not all fields are being queried, perform the following operations: Create an object instance of the second encapsulation class; Setting attribute values for the object instance of the second encapsulation class according to the conditional parameters; Invoking a parsing tool to parse the object instance of the second encapsulation class to obtain encapsulation type data; Calling a third-party JPA framework to perform SQL operations on the encapsulated type data and obtain processing results; When all fields are determined to be queried, perform the following operations: Invoking a parsing tool to parse the object instance of the first encapsulation class to obtain encapsulation type data; A third-party JPA framework is called to perform SQL operations on the encapsulated type data to obtain processing results.

7. The SQL statement processing system according to claim 6, characterized in that: The system further comprises: A statistical tool for performing aggregate function encapsulation processing based on the set field attribute value and the aggregate type attribute value of the second encapsulation class to obtain an encapsulated data type output that complies with the JPA framework protocol; The system is further configured to, when implementing an SQL operation, if the attribute value set for the object instance of the second encapsulation class includes an aggregate type, then before calling a third-party JPA framework to perform an SQL operation on the encapsulation type data and obtaining the processing result, further include: The statistical tool is called to perform aggregate function encapsulation processing according to the aggregate type value of the object instance of the second encapsulation class to obtain encapsulation type data.

8. The SQL statement processing system according to any one of claims 6 to 7, characterized in that: The JPA framework is the Hibernate framework.

Citation Information

Patent Citations

  • Universal API table query method

    CN106708946A

  • Data mapping method and system based on Hibernate

    CN107992566A

  • Configurable data windows for archived relations

    US20160103882A1

  • Database operation method and device

    CN105447051A

  • Method for querying appointed field data of data table under simplified JAVA program, multi-table conjunctive query method under simplified JAVA program and statistical query method under simplified JAVA program

    CN105653277A