WO2023029752A1 - Data query method and apparatus, server, and computer-readable storage medium - Google Patents
Data query method and apparatus, server, and computer-readable storage medium Download PDFInfo
- Publication number
- WO2023029752A1 WO2023029752A1 PCT/CN2022/104789 CN2022104789W WO2023029752A1 WO 2023029752 A1 WO2023029752 A1 WO 2023029752A1 CN 2022104789 W CN2022104789 W CN 2022104789W WO 2023029752 A1 WO2023029752 A1 WO 2023029752A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- query
- data
- data query
- request
- condition
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 59
- 230000006870 function Effects 0.000 claims abstract description 64
- 230000007246 mechanism Effects 0.000 claims abstract description 12
- 238000005538 encapsulation Methods 0.000 claims abstract description 4
- 238000004590 computer program Methods 0.000 claims description 26
- 238000013507 mapping Methods 0.000 claims description 17
- 238000005516 engineering process Methods 0.000 claims description 11
- 238000012545 processing Methods 0.000 claims description 9
- 238000011161 development Methods 0.000 abstract description 4
- 239000008186 active pharmaceutical agent Substances 0.000 description 35
- 230000008569 process Effects 0.000 description 8
- 238000010586 diagram Methods 0.000 description 7
- 230000004044 response Effects 0.000 description 4
- 230000009286 beneficial effect Effects 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000006243 chemical reaction Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000000712 assembly Effects 0.000 description 1
- 238000000429 assembly Methods 0.000 description 1
- 239000002131 composite material Substances 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000012905 input function Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
- G06F16/24564—Applying rules; Deductive queries
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2458—Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
- G06F16/2468—Fuzzy queries
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/248—Presentation of query results
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/25—Integrating or interfacing systems involving database management systems
- G06F16/252—Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/62—Protecting access to data via a platform, e.g. using keys or access control rules
- G06F21/6218—Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
Definitions
- the present application belongs to the technical field of data query, and in particular relates to a data query method, device, server and computer-readable storage medium.
- an object-relational mapping (Object Relational Mapping, ORM) technology is usually applied.
- ORM Object Relational Mapping
- the embodiments of the present application provide a data query method, device, server, and readable storage medium, which can solve the problems of complex operations, heavy workload, inflexibility, and low data query efficiency of related data methods.
- the embodiment of the present application provides a data query method applied to the client, including:
- Encapsulating the preset API interface so as to send the query request and the user information to the server through the preset API interface;
- the query result is displayed.
- the embodiment of the present application provides a data query method applied to the server, including:
- the data query result is serialized to obtain a serialized result, and the serialized result is sent to the client.
- the user information includes a user ID
- the determining the permission control query condition corresponding to the query request according to the user information includes:
- an authority control query condition corresponding to the query request is determined.
- the query request carries query request parameters
- the determining of query conditions and data query functions based on the query request includes:
- the determining the query statement based on the authority control query condition, the query condition and the data query function includes:
- the query statement is obtained by combining the permission control query condition, the query condition and the data query function based on a preset combination rule.
- performing data query based on the query statement to obtain a data query result includes:
- Object-relational mapping is performed on the fields through object-relational mapping technology to obtain corresponding objects as data query results.
- the embodiment of the present application provides a data query device applied to the client, including:
- the first obtaining module is used to obtain query requests and user information
- An encapsulation module configured to encapsulate a preset API interface, so as to send the query request and the user information to the server through the preset API interface;
- the display module is configured to display the query result when receiving the query result corresponding to the query request returned by the server.
- the embodiment of the present application provides a data query device applied to the server, including:
- the second obtaining module is used to call the preset API interface to obtain the query request and user information sent by the client;
- a first calling module configured to determine the permission control query condition corresponding to the query request according to the user information
- a second calling module configured to determine query conditions and data query functions based on the query request
- a determining module configured to determine a query statement based on the authority control query condition, the query condition and the data query function
- a query module configured to perform data query based on the query statement to obtain a data query result
- the serialization processing module is used to serialize the data query result, obtain the serialization result, and send the serialization result to the client.
- the user information includes a user ID
- the first calling module includes:
- a first parsing unit configured to determine a user type according to the user ID
- a determining unit configured to determine the permission control query condition corresponding to the query request according to the user type.
- the query request carries query request parameters
- the second calling module includes:
- a conversion unit configured to convert the query request parameters carried by the query request into an object through an object reflection mechanism
- the second parsing unit is configured to parse the attribute value of the object to obtain corresponding query conditions and data query functions.
- the determining module is specifically configured to combine the permission control query condition, the query condition and the data query function based on a preset combination rule to obtain a query statement.
- the query module includes:
- a query unit configured to perform data query based on the query statement to obtain a corresponding field
- the third parsing unit is configured to perform object-relational mapping on the fields through object-relational mapping technology to obtain corresponding objects as data query results.
- the embodiment of the present application provides a server, including a memory, a processor, and a computer program stored in the memory and operable on the processor, and the computer program is implemented when the processor executes the computer program.
- a server including a memory, a processor, and a computer program stored in the memory and operable on the processor, and the computer program is implemented when the processor executes the computer program.
- an embodiment of the present application provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any one of the above-mentioned first/second aspects is implemented.
- the data query method described in the item is not limited to:
- the embodiment of the present application provides a computer program product, which, when the computer program product runs on the server, causes the server to execute the data query method described in any one of the first and second aspects above.
- the embodiment of the present application has the following beneficial effects: the client encapsulates the preset API interface, sends the query request and user information to the server and receives the corresponding query results, and the server based on the query request and user information Information determines authority control query conditions, invokes object reflection mechanism to determine query conditions and query functions based on query requests, determines query statements based on authority control query conditions, query conditions and query functions, performs data query based on query statements to obtain data query results, and performs serialization Processing and sending to the client, it can perform corresponding packaging operations on the preset API based on the user's complex and diverse query requests, and can realize the query function of different business needs through the general preset API interface.
- the operation is simple and flexible, which improves the Data query efficiency and development efficiency.
- FIG. 1 is a schematic flow diagram of a data query method provided in Embodiment 1 of the present application;
- Fig. 2 is another schematic flow chart of the data query method provided in Embodiment 2 of the present application.
- FIG. 3 is a schematic flowchart of step 202 of the data query method provided in Embodiment 3 of the present application;
- FIG. 4 is a schematic flowchart of step 203 of the data query method provided in Embodiment 3 of the present application.
- FIG. 5 is a schematic structural diagram of a data query device provided in Embodiment 4 of the present application.
- FIG. 6 is another schematic structural diagram of the data query device provided in Embodiment 5 of the present application.
- FIG. 7 is a schematic structural diagram of a server provided in Embodiment 6 of the present application.
- the term “if” may be construed, depending on the context, as “when” or “once” or “in response to determining” or “in response to detecting “.
- the phrase “if determined” or “if [the described condition or event] is detected” may be construed, depending on the context, to mean “once determined” or “in response to the determination” or “once detected [the described condition or event] ]” or “in response to detection of [described condition or event]”.
- references to "one embodiment” or “some embodiments” or the like in the specification of the present application means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application.
- appearances of the phrases “in one embodiment,” “in some embodiments,” “in other embodiments,” “in other embodiments,” etc. in various places in this specification are not necessarily All refer to the same embodiment, but mean “one or more but not all embodiments” unless specifically stated otherwise.
- the terms “including”, “comprising”, “having” and variations thereof mean “including but not limited to”, unless specifically stated otherwise.
- the data query method provided by the embodiment of the present application can be applied to terminal devices such as mobile phones, tablet computers, vehicle-mounted devices, notebook computers, ultra-mobile personal computers (ultra-mobile personal computer, UMPC), personal digital assistants (personal digital assistant, PDA), etc.
- terminal devices such as mobile phones, tablet computers, vehicle-mounted devices, notebook computers, ultra-mobile personal computers (ultra-mobile personal computer, UMPC), personal digital assistants (personal digital assistant, PDA), etc.
- UMPC ultra-mobile personal computer
- PDA personal digital assistant
- FIG. 1 shows a schematic flowchart of a data query method provided by the present application.
- the method can be applied to a client of a notebook computer.
- the query request parameters corresponding to various business requirements input by the user are respectively obtained through multiple plug-ins of the client, and the query request is obtained, and the user information of the user is obtained at the same time.
- query request parameters include but not limited to public parameters and private parameters.
- Public parameters are generally generic parameters
- private parameters are generally composite parameters.
- Table 1 Schematic table of query request parameters.
- the query request parameters that can be obtained by the preset API interface include but are not limited to the current page number pageNumber, the number of entries per page pageSize, whether the total number of entries is neededTotalNumbers, the filter condition parameter filterConds, and the search condition parameter searchConds and sort by orderBy.
- the pre-set client includes a search box plug-in and a filter box plug-in.
- the search box plug-in refers to an input box, which can obtain query request parameters of various business requirements at the same time.
- the search box plug-in calls the API method searchAssem (used to obtain query request parameters to determine the search/filter condition serachConds: that is, to obtain user input paras, command cmd, domain list args...); for example, the user input function command parameters are "%%", when the domain list is customName, the user enters paras Zhang, when the domain list is contactName, the user enters paras Zhang, then the corresponding filter condition is: through full fuzzy matching query to determine that the user name contains "Zhang” or the customer contact contains "Zhang” "The data. For example, the user inputs the function instruction parameter "%%", and the user enters paras123 when the domain list is account_id; the corresponding search condition is the data whose user ID is 123 determined through full fuzzy matching query.
- searchAssem used to obtain query request parameters to determine the search/filter condition serachConds: that is, to obtain user input paras, command cmd, domain list args...
- the user input function command parameters are "%%
- the filter box plug-in is a multi-field input box or selection box, which is used to determine the operation options according to different business needs, obtain the parameters input by the user, and determine the corresponding search/filter conditions/data query functions.
- the business requirement is the data within the query range
- the corresponding operation option is ⁇ >
- the obtained user input parameters are 100, 200.
- S102 Encapsulate a preset API interface, so as to send the query request and the user information to a server through the preset API interface.
- the preset API interface is encapsulated based on the query request through the above-mentioned multiple plug-ins, so that the encapsulated preset API interface can realize data query operations corresponding to various business requirements, and the query request is sent based on the preset API interface to the server side.
- the preset API interface is a preset general API interface composed of multiple plug-in assemblies.
- the above query result is displayed through the display interface.
- the client obtains query requests corresponding to a variety of different business requirements, and encapsulates the preset API interface, so as to send the query request and user information to the server and receive the corresponding query results, so as to realize a general-purpose preset API
- the interface sends various query services to the server for processing, which simplifies the data query operation process and improves the efficiency of data query.
- FIG. 2 shows a schematic flowchart of the data query method provided by the present application.
- the method can be applied to a server end of a notebook computer.
- the information determines the data query authority of the above-mentioned user as the authority control query condition corresponding to the query request.
- the query request includes query request parameters
- the query request parameters include but not limited to search condition parameters and filter condition parameters
- the corresponding query conditions include search conditions and filter conditions.
- the query request parameter also includes a function instruction parameter, which is used to determine the data query function operation.
- the data query function includes but not limited to one or more of fuzzy query, set query, matching query, range query and comparison query.
- Table 2 Schematic table of function instruction parameters.
- the query request can also be parsed by invoking the object reflection mechanism to obtain the current page number pageNumber corresponding to the query request parameters carried in the query request, the pageSize of the number of items per page, whether the total number of items neededTotalNumbers, and the sorting method are obtained orderBy etc.
- a query statement is obtained by combining query conditions based on authority control, query conditions, and data query functions.
- the determining the query statement based on the authority control query condition, the query condition and the data query function includes:
- the query statement is obtained by combining the permission control query condition, the query condition and the data query function based on a preset combination rule.
- preset combination rules for query statements are preset, and based on the preset combination rules, authority control query conditions, search conditions, filter conditions, data query functions, and sorting methods orderBy are combined to obtain query statements.
- the preset combination rule is to combine the access control query conditions, search conditions, filter conditions, data query functions and sorting methods in order to obtain the query statement;
- Data each page is 20, the total number of entries needs to be displayed, the search condition is accounts with IDs from 81231 to 82451, the data query function is full fuzzy matching query, and the filter condition is that the user name is "Zhang" or the customer contact is "Zhang” ", and the sorting method is updateTime desc, when sorting by update time:
- the data query is performed through the ORM based on the query statement, and a data query result is obtained.
- performing data query based on the query statement to obtain a data query result includes:
- Object-relational mapping is performed on the fields through object-relational mapping technology to obtain corresponding objects as data query results.
- Object Relational Mapping technology Object Relational Mapping, referred to as ORM, or O/RM, or O/R mapping
- ORM Object Relational Mapping
- O/RM O/R mapping
- the data query operation is performed based on the combination of determined query statements to obtain the corresponding fields, and the object-relational mapping is performed on the above-mentioned fields through the object-relational mapping technology ORM to obtain the corresponding objects as the data query result.
- the API interface can perform data query operations based on multiple different business requirements, correspondingly, multiple objects can be obtained, that is, the data query result is a query result set including a list of objects.
- the objects contained in the data query result (including multiple objects, specifically stored in the form of object list) are serialized to obtain a serialized result, and the serialized result is sent to the client.
- This embodiment obtains the query request and user information sent by the client by calling the preset API interface, determines the query conditions for authority control, calls the object reflection mechanism to determine the query conditions and query functions based on the query request, and controls the query conditions, query conditions and query based on the authority.
- Function determine the query statement, perform data query based on the query statement, and obtain the data query result, that is, realize the query function of different business needs through the general preset API interface. The operation is simple and flexible, and the efficiency of data query and development is improved.
- determining the permission control query conditions corresponding to the query request according to the user information in this embodiment includes:
- the user information includes but is not limited to a user ID, and the user type of the user can be determined according to the user ID.
- User types include, but are not limited to, regular account users, premium account users, or administrative users. Different user types have different data query permissions.
- the user's data query authority is determined according to the user type as the authority control query condition corresponding to the query request input by the user.
- the query request includes the query request parameter "account”: "()81231, 82451", the user information is user ID: 123, and it is determined that the user type of user ID 123 is a general account user, and the data query authority of the general account user is not Including the relevant data of the advanced account user whose ID is 81432, set the permission control query condition corresponding to the query request as new DaoEntity[] ⁇ new DaoEntity("user_id", "123") ⁇ or new DaoEntity[] ⁇ new DaoEntity("account_id", DaoSqlWhereSymbol. NotEqual, "81432") ⁇ .
- the relevant data of the user whose ID is 81432 cannot be queried, but only the relevant data of the user whose ID is from 81231 to 81431 and the user whose ID is from 81433 to 82451 can be queried.
- the query request carries query request parameters
- the determining of query conditions and data query functions based on the query request includes:
- the query request parameters carried in the query request are converted into objects through the object reflection mechanism, the attribute value of each object is determined, and the corresponding query conditions and data query functions are obtained.
- convert the filter condition parameter in the query request parameter into an object and obtain its attribute value as "customName: Zhang”, “contactName: Zhang”, convert the function instruction parameter in the query request parameter into an object, and obtain its attribute value as "%%”, corresponding to the determined data query function is fuzzy query LIKE, and the query condition is to filter the data whose user name is "Zhang” or customer contact person is "Zhang".
- FIG. 5 shows a structural block diagram of the data query device 100 provided by the embodiment of the present application. For the convenience of description, only the parts related to the embodiment of the present application are shown.
- the data query device 100 includes:
- the first obtaining module 101 is used to obtain query requests and user information
- An encapsulation module 102 configured to encapsulate a preset API interface, so as to send the query request and the user information to the server through the preset API interface;
- the display module 103 is configured to display the query result when receiving the query result corresponding to the query request returned by the server.
- This example obtains query requests corresponding to various business requirements through the client, encapsulates the preset API interface, sends the query request and user information to the server and receives the corresponding query results, and implements a general-based preset API interface
- a variety of query services are sent to the server for processing, which simplifies the data query operation process and improves the efficiency of data query.
- FIG. 6 shows a structural block diagram of a data query device provided by the embodiment of the present application. For the convenience of description, only the parts related to the embodiment of the present application are shown.
- the data query device 200 includes:
- the second obtaining module 201 is used to call the preset API interface to obtain the query request and user information sent by the client;
- the first calling module 202 is configured to determine the permission control query condition corresponding to the query request according to the user information
- the second calling module 203 is configured to determine query conditions and data query functions based on the query request;
- a determining module 204 configured to determine a query statement based on the authority control query condition, the query condition and the data query function
- Query module 205 configured to perform data query based on the query statement to obtain a data query result
- the serialization processing module 206 is configured to serialize the data query result, obtain a serialized result, and send the serialized result to the client.
- the user information includes a user ID
- the first calling module includes:
- a first parsing unit configured to determine a user type according to the user ID
- a determining unit configured to determine the permission control query condition corresponding to the query request according to the user type.
- the query request carries query request parameters
- the second calling module includes:
- a conversion unit configured to convert the query request parameters carried by the query request into an object through an object reflection mechanism
- the second parsing unit is configured to parse the attribute value of the object to obtain corresponding query conditions and data query functions.
- the determining module is specifically configured to combine the permission control query condition, the query condition and the data query function based on a preset combination rule to obtain a query statement.
- the query module includes:
- a query unit configured to perform data query based on the query statement to obtain a corresponding field
- the third parsing unit is configured to perform object-relational mapping on the fields through object-relational mapping technology to obtain corresponding objects as data query results.
- This embodiment calls the preset API interface to obtain the query request and user information sent by the client, and then determines the permission control query condition, calls the object reflection mechanism to determine the query condition and query function based on the query request, and controls the query condition, query condition and query based on the permission Function, determine the query statement, perform data query based on the query statement, and obtain the data query result, that is, realize the query function of different business needs through the general preset API interface.
- the operation is simple and flexible, and the efficiency of data query and development is improved.
- FIG. 7 is a schematic structural diagram of a server provided in this embodiment.
- the server 7 of this embodiment includes: at least one processor 70 (only one is shown in Figure 7 ), a memory 71 and stored in the memory 71 and can be stored on the at least one processor 70 A running computer program 72, when the processor 70 executes the computer program 72, it realizes the steps in any of the above embodiments of the data query method.
- the server 7 may be computing devices such as desktop computers, notebooks, palmtop computers, and cloud servers.
- the server may include, but not limited to, a processor 70 and a memory 71 .
- FIG. 7 is only an example of the server 7, and does not constitute a limitation to the server 7. It may include more or less components than shown in the illustration, or combine certain components, or different components, such as It may also include input and output devices, network access devices, etc.
- the so-called processor 70 can be a central processing unit (Central Processing Unit, CPU), and the processor 70 can also be other general processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit) , ASIC), off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
- a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
- the storage 71 may be an internal storage unit of the server 7 in some embodiments, such as a hard disk or memory of the server 7 .
- the memory 71 may also be an external storage device of the server 7 in other embodiments, such as a plug-in hard disk equipped on the server 7, a smart memory card (Smart Media Card, SMC), a secure digital card ( Secure Digital, SD), flash memory card (Flash Card), etc.
- the storage 71 may also include both an internal storage unit of the server 7 and an external storage device.
- the memory 71 is used to store operating system, application program, boot loader (BootLoader), data and other programs, such as the program code of the computer program.
- the memory 71 can also be used to temporarily store data that has been output or will be output.
- the embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in each of the foregoing method embodiments can be realized.
- An embodiment of the present application provides a computer program product.
- the computer program product When the computer program product is run on a mobile terminal, the mobile terminal can implement the steps in the foregoing method embodiments when executed.
- the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the procedures in the methods of the above embodiments in the present application can be completed by instructing related hardware through computer programs, and the computer programs can be stored in a computer-readable storage medium.
- the computer program When executed by a processor, the steps in the above-mentioned various method embodiments can be realized.
- the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form.
- the computer-readable medium may at least include: any entity or device capable of carrying computer program codes to a photographing device/server, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), electrical carrier signals, telecommunication signals, and software distribution media.
- ROM read-only memory
- RAM random access memory
- electrical carrier signals and telecommunication signals are not permitted on computer readable media under legislation and patent practice.
- the disclosed device/network device and method may be implemented in other ways.
- the device/network device embodiments described above are only illustrative.
- the division of the modules or units is only a logical function division.
- the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
- the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Software Systems (AREA)
- Computational Linguistics (AREA)
- Mathematical Physics (AREA)
- Fuzzy Systems (AREA)
- Health & Medical Sciences (AREA)
- Computer Security & Cryptography (AREA)
- Computer Hardware Design (AREA)
- Automation & Control Theory (AREA)
- General Health & Medical Sciences (AREA)
- Bioethics (AREA)
- Probability & Statistics with Applications (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The present application applies to the technical field of data query, and provides a data query method and apparatus, a server, and a computer-readable storage medium. The method comprises: a client encapsulates a preset API interface, sends a query request and user information to a server, and receives a corresponding query result; and the server determines a permission control query condition on the basis of the query request and the user information, calls an object reflection mechanism, determines a query condition and a query function on the basis of the query request, determines a query statement on the basis of the permission control query condition, the query condition and the query function, performs data query on the basis of the query statement to obtain a data query result, and serializes and sends the data query result to the client. The present application can perform an encapsulation operation on the preset API corresponding to complex and diverse query requests by the user, can realize query functions related to different business requirements by using the universal preset API interface, has simple operations and high flexibility, and improves the data query efficiency and the development efficiency.
Description
本申请要求于2021年8月31日在中国专利局提交的、申请号为202111015394.4的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to Chinese Patent Application No. 202111015394.4 filed at the China Patent Office on August 31, 2021, the entire contents of which are incorporated herein by reference.
本申请属于数据查询技术领域,尤其涉及一种数据查询方法、装置、服务器及计算机可读存储介质。The present application belongs to the technical field of data query, and in particular relates to a data query method, device, server and computer-readable storage medium.
在基于面向对象的程序语言的程序设计中,通常会应用到一项对象关系映射(Object Relational Mapping,ORM)技术。在基于上述技术进行前后端开发业务时,客户端通常会具有多种不同的数据查询需求,对应设定出复杂多变的查询条件。In programming based on an object-oriented programming language, an object-relational mapping (Object Relational Mapping, ORM) technology is usually applied. When developing front-end and back-end services based on the above technologies, the client usually has a variety of different data query requirements, and correspondingly sets complex and changeable query conditions.
现有的数据查询方法通常是选取多个API根据复杂多变的查询条件进行数据查询,得到数据查询结果。上述方法具有操作复杂,工作量大,不够灵活,数据查询效率低。Existing data query methods usually select multiple APIs to perform data query according to complex and changeable query conditions, and obtain data query results. The above method has the advantages of complex operation, heavy workload, inflexibility, and low data query efficiency.
本申请实施例提供了一种数据查询方法、装置、服务器及可读存储介质,可以解决相关的数据方法具有的操作复杂,工作量大,不够灵活,数据查询效率低的问题。The embodiments of the present application provide a data query method, device, server, and readable storage medium, which can solve the problems of complex operations, heavy workload, inflexibility, and low data query efficiency of related data methods.
第一方面,本申请实施例提供了一种数据查询方法,应用于客户端,包括:In the first aspect, the embodiment of the present application provides a data query method applied to the client, including:
获取查询请求和用户信息;Obtain query requests and user information;
对预设API接口进行封装,以通过所述预设API接口将所述查询请求和所述用户信息发送到服务器端;Encapsulating the preset API interface, so as to send the query request and the user information to the server through the preset API interface;
在接收到服务器端返回与所述查询请求对应的查询结果时,显示所述查询结果。When the query result corresponding to the query request returned by the server is received, the query result is displayed.
第二方面,本申请实施例提供了一种数据查询方法,应用于服务器端,包括:In the second aspect, the embodiment of the present application provides a data query method applied to the server, including:
调用预设API接口获取客户端发送的查询请求和用户信息;Call the preset API interface to obtain the query request and user information sent by the client;
根据所述用户信息确定与所述查询请求对应的权限控制查询条件;determining an authority control query condition corresponding to the query request according to the user information;
基于所述查询请求确定查询条件和数据查询功能;determining query conditions and data query functions based on the query request;
基于所述权限控制查询条件、所述查询条件和所述数据查询功能,确定查询语句;Determine a query statement based on the authority control query condition, the query condition and the data query function;
基于所述查询语句进行数据查询,得到数据查询结果;performing data query based on the query statement to obtain a data query result;
对所述数据查询结果进行序列化,得到序列化结果,并将所述序列化结果发送至客户端。The data query result is serialized to obtain a serialized result, and the serialized result is sent to the client.
在一个实施例中,所述用户信息包括用户ID;In one embodiment, the user information includes a user ID;
所述根据所述用户信息确定与所述查询请求对应的权限控制查询条件,包括:The determining the permission control query condition corresponding to the query request according to the user information includes:
根据所述用户ID确定用户类型;determining a user type according to the user ID;
根据所述用户类型,确定与所述查询请求对应的权限控制查询条件。According to the user type, an authority control query condition corresponding to the query request is determined.
在一个实施例中,所述查询请求携带查询请求参数;In one embodiment, the query request carries query request parameters;
所述基于所述查询请求确定查询条件和数据查询功能,包括:The determining of query conditions and data query functions based on the query request includes:
通过对象反射机制将所述查询请求携带的查询请求参数转换为对象;converting the query request parameter carried by the query request into an object through an object reflection mechanism;
解析所述对象的属性值,得到对应的查询条件和数据查询功能。Analyzing the attribute value of the object to obtain the corresponding query condition and data query function.
在一个实施例中,所述基于所述权限控制查询条件、所述查询条件和所述数据查询功能,确定查询语句,包括:In one embodiment, the determining the query statement based on the authority control query condition, the query condition and the data query function includes:
基于预设组合规则对所述权限控制查询条件、所述查询条件和所述数据查询功能进行组合,得到查询语句。The query statement is obtained by combining the permission control query condition, the query condition and the data query function based on a preset combination rule.
在一个实施例中,所述基于所述查询语句进行数据查询,得到数据查询结果,包括:In one embodiment, performing data query based on the query statement to obtain a data query result includes:
基于所述查询语句进行数据查询,得到对应的字段;performing data query based on the query statement to obtain corresponding fields;
通过对象关系映射技术对所述字段进行对象关系映射,得到对应的对象,作为数据查询结果。Object-relational mapping is performed on the fields through object-relational mapping technology to obtain corresponding objects as data query results.
第三方面,本申请实施例提供了一种数据查询装置,应用于客户端,包括:In the third aspect, the embodiment of the present application provides a data query device applied to the client, including:
第一获取模块,用于获取查询请求和用户信息;The first obtaining module is used to obtain query requests and user information;
封装模块,用于对预设API接口进行封装,以通过所述预设API接口将所述查询请求和所述用户信息发送到服务器端;An encapsulation module, configured to encapsulate a preset API interface, so as to send the query request and the user information to the server through the preset API interface;
显示模块,用于在接收到服务器端返回与所述查询请求对应的查询结果时,显示所述查询结果。The display module is configured to display the query result when receiving the query result corresponding to the query request returned by the server.
第四方面,本申请实施例提供了一种数据查询装置,应用于服务器端,包括:In the fourth aspect, the embodiment of the present application provides a data query device applied to the server, including:
第二获取模块,用于调用预设API接口获取客户端发送的查询请求和用户信息;The second obtaining module is used to call the preset API interface to obtain the query request and user information sent by the client;
第一调用模块,用于根据所述用户信息确定与所述查询请求对应的权限控制查询条件;A first calling module, configured to determine the permission control query condition corresponding to the query request according to the user information;
第二调用模块,用于基于所述查询请求确定查询条件和数据查询功能;A second calling module, configured to determine query conditions and data query functions based on the query request;
确定模块,用于基于所述权限控制查询条件、所述查询条件和所述数据查询功能,确定查询语句;A determining module, configured to determine a query statement based on the authority control query condition, the query condition and the data query function;
查询模块,用于基于所述查询语句进行数据查询,得到数据查询结果;A query module, configured to perform data query based on the query statement to obtain a data query result;
序列化处理模块,用于对所述数据查询结果进行序列化,得到序列化结果,并将所述序列化结果发送至客户端。The serialization processing module is used to serialize the data query result, obtain the serialization result, and send the serialization result to the client.
在一个实施例中,所述用户信息包括用户ID;In one embodiment, the user information includes a user ID;
所述第一调用模块,包括:The first calling module includes:
第一解析单元,用于根据所述用户ID确定用户类型;a first parsing unit, configured to determine a user type according to the user ID;
确定单元,用于根据所述用户类型,确定与所述查询请求对应的权限控制查询条件。A determining unit, configured to determine the permission control query condition corresponding to the query request according to the user type.
在一个实施例中,所述查询请求携带查询请求参数;In one embodiment, the query request carries query request parameters;
所述第二调用模块,包括:The second calling module includes:
转换单元,用于通过对象反射机制将所述查询请求携带的查询请求参数转换为对象;A conversion unit, configured to convert the query request parameters carried by the query request into an object through an object reflection mechanism;
第二解析单元,用于解析所述对象的属性值,得到对应的查询条件和数据查询功能。The second parsing unit is configured to parse the attribute value of the object to obtain corresponding query conditions and data query functions.
在一个实施例中,所述确定模块具体用于基于预设组合规则对所述权限控制查询条件、所述查询条件和所述数据查询功能进行组合,得到查询语句。In one embodiment, the determining module is specifically configured to combine the permission control query condition, the query condition and the data query function based on a preset combination rule to obtain a query statement.
在一个实施例中,所述查询模块,包括:In one embodiment, the query module includes:
查询单元,用于基于所述查询语句进行数据查询,得到对应的字段;A query unit, configured to perform data query based on the query statement to obtain a corresponding field;
第三解析单元,用于通过对象关系映射技术对所述字段进行对象关系映射,得到对应的对象,作为数据查询结果。The third parsing unit is configured to perform object-relational mapping on the fields through object-relational mapping technology to obtain corresponding objects as data query results.
第五方面,本申请实施例提供了一种服务器,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如上述第一/二方面中任一项所述的数据查询方法。In the fifth aspect, the embodiment of the present application provides a server, including a memory, a processor, and a computer program stored in the memory and operable on the processor, and the computer program is implemented when the processor executes the computer program. The data query method described in any one of the first and second aspects above.
第六方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现如上述第一/二方面中任一项所述的数据查询方法。In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any one of the above-mentioned first/second aspects is implemented. The data query method described in the item.
第七方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在服务器上运行时,使得服务器执行上述第一/二方面中任一项所述的数据查询方法。In the seventh aspect, the embodiment of the present application provides a computer program product, which, when the computer program product runs on the server, causes the server to execute the data query method described in any one of the first and second aspects above.
本申请实施例与现有技术相比存在的有益效果是:客户端对预设API接口进行封装,将查询请求和用户信息发送至服务器端并接收对应的查询结果,服务器端基于查询请求和用户信息确定权限控制查询条件,调用对象反射机制基于查询请求确定查询条件和查询功能,基于权限控制查询条件、查询条件和查询功能确定查询语句,基于查询语句进行数据查询得到数据查询结果,进行序列化处理并发送至客户端,能够基于用户复杂多样的查询请求对预设API进行对应的封装操作,可通过通用的预设API接口实现不同业务需求的查询功能,操作简单且灵活性高,提高了数据查询效率以及开发效率。Compared with the prior art, the embodiment of the present application has the following beneficial effects: the client encapsulates the preset API interface, sends the query request and user information to the server and receives the corresponding query results, and the server based on the query request and user information Information determines authority control query conditions, invokes object reflection mechanism to determine query conditions and query functions based on query requests, determines query statements based on authority control query conditions, query conditions and query functions, performs data query based on query statements to obtain data query results, and performs serialization Processing and sending to the client, it can perform corresponding packaging operations on the preset API based on the user's complex and diverse query requests, and can realize the query function of different business needs through the general preset API interface. The operation is simple and flexible, which improves the Data query efficiency and development efficiency.
可以理解的是,上述第二方面至第七方面的有益效果可以参见上述第一方面中的相关描述,在此不再赘述。It can be understood that, for the beneficial effects of the above-mentioned second aspect to the seventh aspect, reference can be made to the relevant description in the above-mentioned first aspect, and details are not repeated here.
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图 获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the accompanying drawings that need to be used in the descriptions of the embodiments or the prior art will be briefly introduced below. Obviously, the accompanying drawings in the following description are only for the present application For some embodiments, those of ordinary skill in the art can also obtain other drawings based on these drawings without any creative effort.
图1是本申请实施例一提供的数据查询方法的流程示意图;FIG. 1 is a schematic flow diagram of a data query method provided in Embodiment 1 of the present application;
图2是本申请实施例二提供的数据查询方法的另一流程示意图;Fig. 2 is another schematic flow chart of the data query method provided in Embodiment 2 of the present application;
图3是本申请实施例三提供的数据查询方法步骤202的流程示意图;FIG. 3 is a schematic flowchart of step 202 of the data query method provided in Embodiment 3 of the present application;
图4是本申请实施例三提供的数据查询方法步骤203的流程示意图;FIG. 4 is a schematic flowchart of step 203 of the data query method provided in Embodiment 3 of the present application;
图5是本申请实施例四提供的数据查询装置的结构示意图;FIG. 5 is a schematic structural diagram of a data query device provided in Embodiment 4 of the present application;
图6是本申请实施例五提供的数据查询装置的另一结构示意图;FIG. 6 is another schematic structural diagram of the data query device provided in Embodiment 5 of the present application;
图7是本申请实施例六提供的服务器的结构示意图。FIG. 7 is a schematic structural diagram of a server provided in Embodiment 6 of the present application.
以下描述中,为了说明而不是为了限定,提出了诸如特定***结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的***、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。In the following description, specific details such as specific system structures and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
应当理解,当在本申请说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and/or components, but does not exclude one or more other Presence or addition of features, wholes, steps, operations, elements, components and/or collections thereof.
还应当理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。It should also be understood that the term "and/or" used in the description of the present application and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
如在本申请说明书和所附权利要求书中所使用的那样,术语“如果”可以依据上下文被解释为“当...时”或“一旦”或“响应于确定”或“响应于检测到”。类似地,短语“如果确定”或“如果检测到[所描述条件或事件]”可以依据上下文被解释为意指“一旦确定”或“响应于确定”或“一旦检测到[所描述条件或事件]”或“响应于检测到[所描述条件或事件]”。As used in this specification and the appended claims, the term "if" may be construed, depending on the context, as "when" or "once" or "in response to determining" or "in response to detecting ". Similarly, the phrase "if determined" or "if [the described condition or event] is detected" may be construed, depending on the context, to mean "once determined" or "in response to the determination" or "once detected [the described condition or event] ]” or “in response to detection of [described condition or event]”.
另外,在本申请说明书和所附权利要求书的描述中,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。In addition, in the description of the specification and appended claims of the present application, the terms "first", "second", "third" and so on are only used to distinguish descriptions, and should not be understood as indicating or implying relative importance.
在本申请说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。Reference to "one embodiment" or "some embodiments" or the like in the specification of the present application means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in other embodiments," etc. in various places in this specification are not necessarily All refer to the same embodiment, but mean "one or more but not all embodiments" unless specifically stated otherwise. The terms "including", "comprising", "having" and variations thereof mean "including but not limited to", unless specifically stated otherwise.
本申请实施例提供的数据查询方法可以应用于手机、平板电脑、车载设备、笔记本电 脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、个人数字助理(personal digital assistant,PDA)等终端设备上,本申请实施例对终端设备的具体类型不作任何限制。The data query method provided by the embodiment of the present application can be applied to terminal devices such as mobile phones, tablet computers, vehicle-mounted devices, notebook computers, ultra-mobile personal computers (ultra-mobile personal computer, UMPC), personal digital assistants (personal digital assistant, PDA), etc. Above, the embodiment of the present application does not impose any limitation on the specific type of the terminal device.
实施例一Embodiment one
图1示出了本申请提供的数据查询方法的示意性流程图,作为示例而非限定,该方法可以应用于笔记本电脑的客户端中。FIG. 1 shows a schematic flowchart of a data query method provided by the present application. As an example but not a limitation, the method can be applied to a client of a notebook computer.
S101、获取查询请求和用户信息。S101. Obtain a query request and user information.
具体地,通过客户端的多个插件分别获取用户输入的多种不同业务需求对应的查询请求参数,得到查询请求,同时获取该用户的用户信息。Specifically, the query request parameters corresponding to various business requirements input by the user are respectively obtained through multiple plug-ins of the client, and the query request is obtained, and the user information of the user is obtained at the same time.
其中,查询请求参数的类型包括但不限于公有参数和私有参数。公有参数一般为泛型参数,私有参数一般为复合型参数。Wherein, the types of query request parameters include but not limited to public parameters and private parameters. Public parameters are generally generic parameters, and private parameters are generally composite parameters.
表1 查询请求参数的示意表。Table 1 Schematic table of query request parameters.
根据表1可以看出,一般情况下,预设API接口可获取的查询请求参数包括但不限于当前页码pageNumber、每页条数pageSize、是否需要总条数needTotalNumbers、筛选条件参数filterConds、搜索条件参数searchConds和排序方式orderBy。According to Table 1, it can be seen that in general, the query request parameters that can be obtained by the preset API interface include but are not limited to the current page number pageNumber, the number of entries per page pageSize, whether the total number of entries is neededTotalNumbers, the filter condition parameter filterConds, and the search condition parameter searchConds and sort by orderBy.
具体地,预先设定客户端包括搜索框插件和过滤框插件,搜索框插件是指一个输入框,可以同时获取多种业务需求的查询请求参数。Specifically, the pre-set client includes a search box plug-in and a filter box plug-in. The search box plug-in refers to an input box, which can obtain query request parameters of various business requirements at the same time.
例如,搜索框插件中通过调用API方法searchAssem(用于获取查询请求参数来确定搜索/筛选条件serachConds:即获取用户输入的paras,指令cmd,域列表args…);例如,用户输入功能指令参数为“%%”,域列表为customName时用户输入paras张,域列表为contactName时用户输入paras张,则对应筛选条件为:通过全模糊匹配查询确定用户 名包含“张”或客户联系人包含“张”的数据。例如,用户输入功能指令参数“%%”,域列表为account_id时用户输入paras123;对应搜索条件为通过全模糊匹配查询确定用户ID为123的数据。For example, the search box plug-in calls the API method searchAssem (used to obtain query request parameters to determine the search/filter condition serachConds: that is, to obtain user input paras, command cmd, domain list args...); for example, the user input function command parameters are "%%", when the domain list is customName, the user enters paras Zhang, when the domain list is contactName, the user enters paras Zhang, then the corresponding filter condition is: through full fuzzy matching query to determine that the user name contains "Zhang" or the customer contact contains "Zhang" "The data. For example, the user inputs the function instruction parameter "%%", and the user enters paras123 when the domain list is account_id; the corresponding search condition is the data whose user ID is 123 determined through full fuzzy matching query.
其中,过滤框插件为一个多字段的输入框或选择框,用于根据不同的业务需求确定操作选项,获取用户输入的参数,确定对应的搜索/筛选条件/数据查询功能。例如,业务需求为查询区间内的数据,对应操作选项为<>,获取的用户输入的参数为100,200。对应需搜索区间在<100,200>内的数据。Among them, the filter box plug-in is a multi-field input box or selection box, which is used to determine the operation options according to different business needs, obtain the parameters input by the user, and determine the corresponding search/filter conditions/data query functions. For example, the business requirement is the data within the query range, the corresponding operation option is <>, and the obtained user input parameters are 100, 200. Corresponds to the data that needs to be searched within the interval <100, 200>.
S102、对预设API接口进行封装,以通过所述预设API接口将所述查询请求和所述用户信息发送到服务器端。S102. Encapsulate a preset API interface, so as to send the query request and the user information to a server through the preset API interface.
具体地,通过上述多个插件基于查询请求对预设API接口进行封装,使得封装后的预设API接口能够实现多种业务需求对应的数据查询操作,基于预设API接口将所述查询请求发送到服务器端。其中,预设API接口为预先设定的由多个插件组装构成的通用API接口。Specifically, the preset API interface is encapsulated based on the query request through the above-mentioned multiple plug-ins, so that the encapsulated preset API interface can realize data query operations corresponding to various business requirements, and the query request is sent based on the preset API interface to the server side. Wherein, the preset API interface is a preset general API interface composed of multiple plug-in assemblies.
S103、在接收到服务器端返回与所述查询请求对应的查询结果时,显示所述查询结果。S103. When receiving a query result corresponding to the query request returned by the server, display the query result.
具体地,在接收到服务器端返回的与上述查询请求对应的查询结果时,通过显示界面显示上述查询结果。Specifically, when the query result corresponding to the above query request returned by the server is received, the above query result is displayed through the display interface.
本实施例通过客户端获取多种不同业务需求对应的查询请求,对预设API接口进行封装,以将查询请求和用户信息发送至服务器端并接收对应的查询结果,实现基于通用的预设API接口将多种查询业务发送到服务器端进行处理,简化了数据查询操作流程,提高了数据查询的效率。In this embodiment, the client obtains query requests corresponding to a variety of different business requirements, and encapsulates the preset API interface, so as to send the query request and user information to the server and receive the corresponding query results, so as to realize a general-purpose preset API The interface sends various query services to the server for processing, which simplifies the data query operation process and improves the efficiency of data query.
实施例二Embodiment two
图2示出了本申请提供的数据查询方法的示意性流程图,作为示例而非限定,该方法可以应用于笔记本电脑的服务器端中。FIG. 2 shows a schematic flowchart of the data query method provided by the present application. As an example but not a limitation, the method can be applied to a server end of a notebook computer.
S201、调用预设API接口获取客户端发送的查询请求和用户信息;S201. Call the preset API interface to obtain the query request and user information sent by the client;
S202、根据所述用户信息确定与所述查询请求对应的权限控制查询条件。S202. Determine an authority control query condition corresponding to the query request according to the user information.
具体地,调用封装后的预设API接口以获取客户端基于上述预设API接口发送的查询请求,以及与该查询请求对应(也即在客户端输入该查询请求)用户的用户信息,根据用户信息确定上述用户的数据查询权限,作为与该查询请求对应的权限控制查询条件。Specifically, call the encapsulated preset API interface to obtain the query request sent by the client based on the above preset API interface, and the user information of the user corresponding to the query request (that is, input the query request at the client), according to the user The information determines the data query authority of the above-mentioned user as the authority control query condition corresponding to the query request.
S203、基于所述查询请求确定查询条件和数据查询功能。S203. Determine query conditions and data query functions based on the query request.
具体地,根据实施例一详述内容可知,查询请求包括查询请求参数,查询请求参数包括但不限于搜索条件参数和筛选条件参数,对应的查询条件包括搜索条件和筛选条件。Specifically, according to the detailed description of Embodiment 1, the query request includes query request parameters, the query request parameters include but not limited to search condition parameters and filter condition parameters, and the corresponding query conditions include search conditions and filter conditions.
具体地,查询请求参数还包括功能指令参数,用于确定数据查询功能操作。其中,数据查询功能包括但不限于模糊查询、集合查询、匹配查询、区间查询和比较查询中的一项或多项。Specifically, the query request parameter also includes a function instruction parameter, which is used to determine the data query function operation. Among them, the data query function includes but not limited to one or more of fuzzy query, set query, matching query, range query and comparison query.
具体地,调用对象反射机制对查询请求进行解析,确定查询请求中携带功能指令参数、筛选条件参数和搜索条件参数,确定与功能指令参数对应的数据查询功能、搜索条件和筛选条件。Specifically, invoke the object reflection mechanism to analyze the query request, determine that the query request carries function instruction parameters, filter condition parameters, and search condition parameters, and determine the data query function, search condition, and filter condition corresponding to the function instruction parameters.
表2 功能指令参数的示意表。Table 2 Schematic table of function instruction parameters.
在一个实施例中,还可通过调用对象反射机制对查询请求进行解析,得到查询请求中携带的查询请求参数对应的当前页码pageNumber、每页条数pageSize、是否需要总条数needTotalNumbers、和排序方式orderBy等。In one embodiment, the query request can also be parsed by invoking the object reflection mechanism to obtain the current page number pageNumber corresponding to the query request parameters carried in the query request, the pageSize of the number of items per page, whether the total number of items neededTotalNumbers, and the sorting method are obtained orderBy etc.
S204、基于所述权限控制查询条件、所述查询条件和所述数据查询功能,确定查询语句。S204. Determine a query statement based on the authority control query condition, the query condition, and the data query function.
具体地,基于权限控制查询条件、查询条件和数据查询功能进行组合,得到查询语句。Specifically, a query statement is obtained by combining query conditions based on authority control, query conditions, and data query functions.
在一个实施例中,所述基于所述权限控制查询条件、所述查询条件和所述数据查询功能,确定查询语句,包括:In one embodiment, the determining the query statement based on the authority control query condition, the query condition and the data query function includes:
基于预设组合规则对所述权限控制查询条件、所述查询条件和所述数据查询功能进行组合,得到查询语句。The query statement is obtained by combining the permission control query condition, the query condition and the data query function based on a preset combination rule.
具体地,预先设定查询语句的预设组合规则,基于预设组合规则对权限控制查询条件、搜索条件、筛选条件、数据查询功能以及排序方式orderBy进行组合,得到查询语句。Specifically, preset combination rules for query statements are preset, and based on the preset combination rules, authority control query conditions, search conditions, filter conditions, data query functions, and sorting methods orderBy are combined to obtain query statements.
例如,预设组合规则为按照权限控制查询条件、搜索条件、筛选条件、数据查询功能以及排序方式的先后顺序进行组合,得到查询语句;则在权限控制查询条件为可查询页码为第1页的数据,每页条书为20,需要显示总条数,搜索条件为ID从81231到82451的账户,数据查询功能为全模糊匹配查询,筛选条件为用户名为“张”或客户联系人为“张”,且排序方式为updateTime desc,按更新时间顺序排序时:For example, the preset combination rule is to combine the access control query conditions, search conditions, filter conditions, data query functions and sorting methods in order to obtain the query statement; Data, each page is 20, the total number of entries needs to be displayed, the search condition is accounts with IDs from 81231 to 82451, the data query function is full fuzzy matching query, and the filter condition is that the user name is "Zhang" or the customer contact is "Zhang" ", and the sorting method is updateTime desc, when sorting by update time:
对应得到的查询语句为:The corresponding query statement is:
select*from t_b_custom where account_id in(81231,82451)and(custom_name like‘%张%’or contact_name like‘%张%’)order by update_time desc limit 0,20。select*from t_b_custom where account_id in (81231, 82451) and (custom_name like '% Zhang %' or contact_name like '% Zhang %') order by update_time desc limit 0, 20.
S205、基于所述查询语句进行数据查询,得到数据查询结果。S205. Perform data query based on the query statement to obtain a data query result.
具体地,基于查询语句通过ORM进行数据查询,得到数据查询结果。Specifically, the data query is performed through the ORM based on the query statement, and a data query result is obtained.
在一个实施例中,所述基于所述查询语句进行数据查询,得到数据查询结果,包括:In one embodiment, performing data query based on the query statement to obtain a data query result includes:
基于所述查询语句进行数据查询,得到对应的字段;performing data query based on the query statement to obtain corresponding fields;
通过对象关系映射技术对所述字段进行对象关系映射,得到对应的对象,作为数据查询结果。Object-relational mapping is performed on the fields through object-relational mapping technology to obtain corresponding objects as data query results.
具体地,对象关系映射技术(Object Relational Mapping,简称ORM,或O/RM,或O/R mapping),是一种程序设计技术,用于实现面向对象编程语言里不同类型***的数据之间的转换。Specifically, Object Relational Mapping technology (Object Relational Mapping, referred to as ORM, or O/RM, or O/R mapping) is a programming technology that is used to realize the data exchange between different types of systems in an object-oriented programming language. convert.
具体地,基于组合确定的查询语句进行数据查询操作,得到对应的字段,通过对象关系映射技术ORM对上述字段进行对象关系映射,得到对应的对象作为数据查询结果。Specifically, the data query operation is performed based on the combination of determined query statements to obtain the corresponding fields, and the object-relational mapping is performed on the above-mentioned fields through the object-relational mapping technology ORM to obtain the corresponding objects as the data query result.
可以理解的是,由于一般情况下API接口可基于多个不同业务需求进行数据查询操作,对应可得到多个对象,即数据查询结果为包含对象列表的查询结果集。It can be understood that, in general, the API interface can perform data query operations based on multiple different business requirements, correspondingly, multiple objects can be obtained, that is, the data query result is a query result set including a list of objects.
S206、对所述数据查询结果进行序列化,得到序列化结果,并将所述序列化结果发送至客户端。S206. Serialize the data query result to obtain a serialized result, and send the serialized result to the client.
具体地,对数据查询结果中包含的对象(包含多个对象,具体为对象列表形式存储)进行序列化,得到序列化结果,将序列化结果发送至客户端。Specifically, the objects contained in the data query result (including multiple objects, specifically stored in the form of object list) are serialized to obtain a serialized result, and the serialized result is sent to the client.
本实施例通过调用预设API接口获取客户端发送的查询请求和用户信息,确定权限控制查询条件,调用对象反射机制基于查询请求确定查询条件和查询功能,基于权限控制查询条件、查询条件和查询功能,确定查询语句,基于查询语句进行数据查询,得到数据查询结果,即通过通用的预设API接口实现不同业务需求的查询功能,操作简单且灵活性高,提高了数据查询效率以及开发效率。This embodiment obtains the query request and user information sent by the client by calling the preset API interface, determines the query conditions for authority control, calls the object reflection mechanism to determine the query conditions and query functions based on the query request, and controls the query conditions, query conditions and query based on the authority. Function, determine the query statement, perform data query based on the query statement, and obtain the data query result, that is, realize the query function of different business needs through the general preset API interface. The operation is simple and flexible, and the efficiency of data query and development is improved.
实施例三Embodiment three
本实施例是对实施例二的进一步说明,与实施例二相同或相似的地方,具体可参见实施例二的相关描述,此处不再赘述。如图3所示,本实施例中的根据所述用户信息确定与所述查询请求对应的权限控制查询条件,包括:This embodiment is a further description of Embodiment 2. For the parts that are the same as or similar to Embodiment 2, please refer to the relevant description of Embodiment 2 for details, and details will not be repeated here. As shown in FIG. 3 , determining the permission control query conditions corresponding to the query request according to the user information in this embodiment includes:
S2021、根据所述用户ID确定用户类型。S2021. Determine a user type according to the user ID.
具体地,用户信息包括但不限于用户ID,根据用户ID可以确定该用户的用户类型。用户类型包括但不限于普通账户用户、高级账户用户或管理用户。不同用户类型具有不同的数据查询权限。Specifically, the user information includes but is not limited to a user ID, and the user type of the user can be determined according to the user ID. User types include, but are not limited to, regular account users, premium account users, or administrative users. Different user types have different data query permissions.
S2022、根据所述用户类型,确定与所述查询请求对应的权限控制查询条件。S2022. Determine the permission control query condition corresponding to the query request according to the user type.
具体地,根据用户类型确定该用户的数据查询权限,作为与该用户输入的查询请求对应的权限控制查询条件。Specifically, the user's data query authority is determined according to the user type as the authority control query condition corresponding to the query request input by the user.
例如,查询请求包括查询请求参数为“account”:”()81231,82451”,用户信息为用户ID:123,确定出用户ID123的用户类型为普通账户用户,并且普通账户用户的数据查询权限不包括ID为81432的高级账户用户的相关数据,则对应设定与该查询请求对应的权限控制查询条件为new DaoEntity[]{new DaoEntity(“user_id”,“123”)}或new DaoEntity[]{new DaoEntity(“account_id”,DaoSqlWhereSymbol.NotEqual,“81432”)}。在进行数据查询时,无法查询ID为81432用户的相关数据,仅能查询ID从81231到81431和ID从81433到82451用户的相关数据。For example, the query request includes the query request parameter "account": "()81231, 82451", the user information is user ID: 123, and it is determined that the user type of user ID 123 is a general account user, and the data query authority of the general account user is not Including the relevant data of the advanced account user whose ID is 81432, set the permission control query condition corresponding to the query request as new DaoEntity[]{new DaoEntity("user_id", "123")} or new DaoEntity[]{ new DaoEntity("account_id", DaoSqlWhereSymbol. NotEqual, "81432")}. When performing data query, the relevant data of the user whose ID is 81432 cannot be queried, but only the relevant data of the user whose ID is from 81231 to 81431 and the user whose ID is from 81433 to 82451 can be queried.
如图4所示,在一个实施例中,所述查询请求携带查询请求参数;As shown in Figure 4, in one embodiment, the query request carries query request parameters;
所述基于所述查询请求确定查询条件和数据查询功能,包括:The determining of query conditions and data query functions based on the query request includes:
S2031、通过对象反射机制将所述查询请求携带的查询请求参数转换为对象;S2031. Convert the query request parameter carried by the query request into an object through an object reflection mechanism;
S2032、解析所述对象的属性值,得到对应的查询条件和数据查询功能。S2032. Analyze the attribute value of the object to obtain the corresponding query condition and data query function.
具体地,通过对象反射机制将查询请求携带的查询请求参数转换为对象,确定每个对象的属性值,得到对应的查询条件和数据查询功能。Specifically, the query request parameters carried in the query request are converted into objects through the object reflection mechanism, the attribute value of each object is determined, and the corresponding query conditions and data query functions are obtained.
例如,将查询请求参数中的筛选条件参数转换为对象,获得其属性值为“customName:张”,“contactName:张”,将查询请求参数中的功能指令参数转换为对象,获得其属性值为“%%”,对应确定数据查询功能为模糊查询LIKE,查询条件为筛选用户名为“张”或客户联系人为“张”的数据。For example, convert the filter condition parameter in the query request parameter into an object, and obtain its attribute value as "customName: Zhang", "contactName: Zhang", convert the function instruction parameter in the query request parameter into an object, and obtain its attribute value as "%%", corresponding to the determined data query function is fuzzy query LIKE, and the query condition is to filter the data whose user name is "Zhang" or customer contact person is "Zhang".
本实施例通过调用通用的预设API接口确定用户查询请求中携带的多种不同的查询业务需求参数,得到多种查询条件,并组装成的对应的查询语句,得到查询结果,简化了数据查询的操作流程和工作量,且灵活性高。In this embodiment, by calling the general preset API interface, a variety of different query service demand parameters carried in the user query request are determined, multiple query conditions are obtained, and corresponding query statements are assembled to obtain query results, which simplifies data query operation process and workload, and high flexibility.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the sequence numbers of the steps in the above embodiments do not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiment of the present application.
实施例四Embodiment four
对应于上文实施例一所述的数据查询方法,图5示出了本申请实施例提供的数据查询装置100的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。Corresponding to the data query method described in the first embodiment above, FIG. 5 shows a structural block diagram of the data query device 100 provided by the embodiment of the present application. For the convenience of description, only the parts related to the embodiment of the present application are shown.
参照图5,该数据查询装置100包括:Referring to Fig. 5, the data query device 100 includes:
第一获取模块101,用于获取查询请求和用户信息;The first obtaining module 101 is used to obtain query requests and user information;
封装模块102,用于对预设API接口进行封装,以通过所述预设API接口将所述查询请求和所述用户信息发送到服务器端;An encapsulation module 102, configured to encapsulate a preset API interface, so as to send the query request and the user information to the server through the preset API interface;
显示模块103,用于在接收到服务器端返回与所述查询请求对应的查询结果时,显示所述查询结果。The display module 103 is configured to display the query result when receiving the query result corresponding to the query request returned by the server.
本实例通过客户端获取多种不同业务需求对应的查询请求,对预设API接口进行封装,以将查询请求和用户信息发送至服务器端并接收对应的查询结果,实现基于通用的预设API接口将多种查询业务发送到服务器端进行处理,简化了数据查询操作流程,提高了数据查询的效率。This example obtains query requests corresponding to various business requirements through the client, encapsulates the preset API interface, sends the query request and user information to the server and receives the corresponding query results, and implements a general-based preset API interface A variety of query services are sent to the server for processing, which simplifies the data query operation process and improves the efficiency of data query.
实施例五Embodiment five
对应于上文实施例二所述的数据查询方法,图6示出了本申请实施例提供的数据查询装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。Corresponding to the data query method described in the second embodiment above, FIG. 6 shows a structural block diagram of a data query device provided by the embodiment of the present application. For the convenience of description, only the parts related to the embodiment of the present application are shown.
参照图6,该数据查询装置200包括:Referring to Figure 6, the data query device 200 includes:
第二获取模块201,用于调用预设API接口获取客户端发送的查询请求和用户信息;The second obtaining module 201 is used to call the preset API interface to obtain the query request and user information sent by the client;
第一调用模块202,用于根据所述用户信息确定与所述查询请求对应的权限控制查询条件;The first calling module 202 is configured to determine the permission control query condition corresponding to the query request according to the user information;
第二调用模块203,用于基于所述查询请求确定查询条件和数据查询功能;The second calling module 203 is configured to determine query conditions and data query functions based on the query request;
确定模块204,用于基于所述权限控制查询条件、所述查询条件和所述数据查询功能,确定查询语句;A determining module 204, configured to determine a query statement based on the authority control query condition, the query condition and the data query function;
查询模块205,用于基于所述查询语句进行数据查询,得到数据查询结果; Query module 205, configured to perform data query based on the query statement to obtain a data query result;
序列化处理模块206,用于对所述数据查询结果进行序列化,得到序列化结果,并将所述序列化结果发送至客户端。The serialization processing module 206 is configured to serialize the data query result, obtain a serialized result, and send the serialized result to the client.
在一个实施例中,所述用户信息包括用户ID;In one embodiment, the user information includes a user ID;
所述第一调用模块,包括:The first calling module includes:
第一解析单元,用于根据所述用户ID确定用户类型;a first parsing unit, configured to determine a user type according to the user ID;
确定单元,用于根据所述用户类型,确定与所述查询请求对应的权限控制查询条件。A determining unit, configured to determine the permission control query condition corresponding to the query request according to the user type.
在一个实施例中,所述查询请求携带查询请求参数;In one embodiment, the query request carries query request parameters;
所述第二调用模块,包括:The second calling module includes:
转换单元,用于通过对象反射机制将所述查询请求携带的查询请求参数转换为对象;A conversion unit, configured to convert the query request parameters carried by the query request into an object through an object reflection mechanism;
第二解析单元,用于解析所述对象的属性值,得到对应的查询条件和数据查询功能。The second parsing unit is configured to parse the attribute value of the object to obtain corresponding query conditions and data query functions.
在一个实施例中,所述确定模块具体用于基于预设组合规则对所述权限控制查询条件、所述查询条件和所述数据查询功能进行组合,得到查询语句。In one embodiment, the determining module is specifically configured to combine the permission control query condition, the query condition and the data query function based on a preset combination rule to obtain a query statement.
在一个实施例中,所述查询模块,包括:In one embodiment, the query module includes:
查询单元,用于基于所述查询语句进行数据查询,得到对应的字段;A query unit, configured to perform data query based on the query statement to obtain a corresponding field;
第三解析单元,用于通过对象关系映射技术对所述字段进行对象关系映射,得到对应的对象,作为数据查询结果。The third parsing unit is configured to perform object-relational mapping on the fields through object-relational mapping technology to obtain corresponding objects as data query results.
本实施例调用预设API接口获取客户端发送的查询请求和用户信息,进而确定权限控制查询条件,调用对象反射机制基于查询请求确定查询条件和查询功能,基于权限控制查询条件、查询条件和查询功能,确定查询语句,基于查询语句进行数据查询,得到数据查询结果,即通过通用的预设API接口实现不同业务需求的查询功能,操作简单且灵活性高,提高了数据查询效率以及开发效率。This embodiment calls the preset API interface to obtain the query request and user information sent by the client, and then determines the permission control query condition, calls the object reflection mechanism to determine the query condition and query function based on the query request, and controls the query condition, query condition and query based on the permission Function, determine the query statement, perform data query based on the query statement, and obtain the data query result, that is, realize the query function of different business needs through the general preset API interface. The operation is simple and flexible, and the efficiency of data query and development is improved.
需要说明的是,上述装置/单元之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。It should be noted that the information interaction and execution process between the above-mentioned devices/units are based on the same concept as the method embodiment of the present application, and its specific functions and technical effects can be found in the method embodiment section. I won't repeat them here.
实施例六Embodiment six
图7为本实施例提供的服务器的结构示意图。如图7所示,该实施例的服务器7包括:至少一个处理器70(图7中仅示出一个)、存储器71以及存储在所述存储器71中并可在所述至少一个处理器70上运行的计算机程序72,所述处理器70执行所述计算机程序72时实现上述任意各个数据查询方法实施例中的步骤。FIG. 7 is a schematic structural diagram of a server provided in this embodiment. As shown in Figure 7 , the server 7 of this embodiment includes: at least one processor 70 (only one is shown in Figure 7 ), a memory 71 and stored in the memory 71 and can be stored on the at least one processor 70 A running computer program 72, when the processor 70 executes the computer program 72, it realizes the steps in any of the above embodiments of the data query method.
所述服务器7可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。该服务器可包括,但不仅限于,处理器70、存储器71。本领域技术人员可以理解,图7仅仅是服务器7的举例,并不构成对服务器7的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如还可以包括输入输出设备、网络接入设备等。The server 7 may be computing devices such as desktop computers, notebooks, palmtop computers, and cloud servers. The server may include, but not limited to, a processor 70 and a memory 71 . Those skilled in the art can understand that FIG. 7 is only an example of the server 7, and does not constitute a limitation to the server 7. It may include more or less components than shown in the illustration, or combine certain components, or different components, such as It may also include input and output devices, network access devices, etc.
所称处理器70可以是中央处理单元(Central Processing Unit,CPU),该处理器70还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管 逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The so-called processor 70 can be a central processing unit (Central Processing Unit, CPU), and the processor 70 can also be other general processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit) , ASIC), off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
所述存储器71在一些实施例中可以是所述服务器7的内部存储单元,例如服务器7的硬盘或内存。所述存储器71在另一些实施例中也可以是所述服务器7的外部存储设备,例如所述服务器7上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字卡(Secure Digital,SD),闪存卡(Flash Card)等。进一步地,所述存储器71还可以既包括所述服务器7的内部存储单元也包括外部存储设备。所述存储器71用于存储操作***、应用程序、引导装载程序(BootLoader)、数据以及其他程序等,例如所述计算机程序的程序代码等。所述存储器71还可以用于暂时地存储已经输出或者将要输出的数据。The storage 71 may be an internal storage unit of the server 7 in some embodiments, such as a hard disk or memory of the server 7 . The memory 71 may also be an external storage device of the server 7 in other embodiments, such as a plug-in hard disk equipped on the server 7, a smart memory card (Smart Media Card, SMC), a secure digital card ( Secure Digital, SD), flash memory card (Flash Card), etc. Further, the storage 71 may also include both an internal storage unit of the server 7 and an external storage device. The memory 71 is used to store operating system, application program, boot loader (BootLoader), data and other programs, such as the program code of the computer program. The memory 71 can also be used to temporarily store data that has been output or will be output.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述***中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used for illustration. In practical applications, the above-mentioned functions can be assigned to different functional units, Completion of modules means that the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment may be integrated into one processing unit, or each unit may exist separately physically, or two or more units may be integrated into one unit, and the above-mentioned integrated units may adopt hardware It can also be implemented in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the present application. For the specific working process of the units and modules in the above system, reference may be made to the corresponding process in the foregoing method embodiments, and details will not be repeated here.
本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现可实现上述各个方法实施例中的步骤。The embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in each of the foregoing method embodiments can be realized.
本申请实施例提供了一种计算机程序产品,当计算机程序产品在移动终端上运行时,使得移动终端执行时实现可实现上述各个方法实施例中的步骤。An embodiment of the present application provides a computer program product. When the computer program product is run on a mobile terminal, the mobile terminal can implement the steps in the foregoing method embodiments when executed.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质至少可以包括:能够将计算机程序代码携带到拍照装置/服务器的任何实体或装置、记录介质、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质。例如U盘、移动硬盘、磁碟或者光盘等。在某些司法管辖区,根据立法和专利实践,计算机可读介质不可以是电载波信号和 电信信号。If the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the procedures in the methods of the above embodiments in the present application can be completed by instructing related hardware through computer programs, and the computer programs can be stored in a computer-readable storage medium. The computer program When executed by a processor, the steps in the above-mentioned various method embodiments can be realized. Wherein, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying computer program codes to a photographing device/server, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory ( RAM, Random Access Memory), electrical carrier signals, telecommunication signals, and software distribution media. Such as U disk, mobile hard disk, magnetic disk or optical disk, etc. In some jurisdictions, electrical carrier signals and telecommunication signals are not permitted on computer readable media under legislation and patent practice.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above-mentioned embodiments, the descriptions of each embodiment have their own emphases, and for parts that are not detailed or recorded in a certain embodiment, refer to the relevant descriptions of other embodiments.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those skilled in the art can appreciate that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.
在本申请所提供的实施例中,应该理解到,所揭露的装置/网络设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/网络设备实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个***,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided in this application, it should be understood that the disclosed device/network device and method may be implemented in other ways. For example, the device/network device embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units Or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-described 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 foregoing embodiments, those of ordinary skill in the art should understand that: it can still implement the foregoing embodiments Modifications to the technical solutions described in the examples, or equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the application, and should be included in the Within the protection scope of this application.
Claims (10)
- 一种数据查询方法,其特征在于,应用于客户端,包括:A data query method, characterized in that it is applied to a client, comprising:获取查询请求和用户信息;Obtain query requests and user information;对预设API接口进行封装,以通过所述预设API接口将所述查询请求和所述用户信息发送到服务器端;Encapsulating the preset API interface, so as to send the query request and the user information to the server through the preset API interface;在接收到服务器端返回与所述查询请求对应的查询结果时,显示所述查询结果。When the query result corresponding to the query request returned by the server is received, the query result is displayed.
- 一种数据查询方法,其特征在于,应用于服务器端,包括:A data query method, characterized in that it is applied to the server side, comprising:调用预设API接口获取客户端发送的查询请求和用户信息;Call the preset API interface to obtain the query request and user information sent by the client;根据所述用户信息确定与所述查询请求对应的权限控制查询条件;determining an authority control query condition corresponding to the query request according to the user information;基于所述查询请求确定查询条件和数据查询功能;determining query conditions and data query functions based on the query request;基于所述权限控制查询条件、所述查询条件和所述数据查询功能,确定查询语句;Determine a query statement based on the authority control query condition, the query condition and the data query function;基于所述查询语句进行数据查询,得到数据查询结果;performing data query based on the query statement to obtain a data query result;对所述数据查询结果进行序列化,得到序列化结果,并将所述序列化结果发送至客户端。The data query result is serialized to obtain a serialized result, and the serialized result is sent to the client.
- 如权利要求2所述的数据查询方法,其特征在于,所述用户信息包括用户ID;The data query method according to claim 2, wherein the user information includes a user ID;所述根据所述用户信息确定与所述查询请求对应的权限控制查询条件,包括:The determining the permission control query condition corresponding to the query request according to the user information includes:根据所述用户ID确定用户类型;determining a user type according to the user ID;根据所述用户类型,确定与所述查询请求对应的权限控制查询条件。According to the user type, an authority control query condition corresponding to the query request is determined.
- 如权利要求2所述的数据查询方法,其特征在于,所述查询请求携带查询请求参数;The data query method according to claim 2, wherein the query request carries a query request parameter;所述基于所述查询请求确定查询条件和数据查询功能,包括:The determining of query conditions and data query functions based on the query request includes:通过对象反射机制将所述查询请求携带的查询请求参数转换为对象;converting the query request parameter carried by the query request into an object through an object reflection mechanism;解析所述对象的属性值,得到对应的查询条件和数据查询功能。Analyzing the attribute value of the object to obtain the corresponding query condition and data query function.
- 如权利要求2所述的数据查询方法,其特征在于,所述基于所述权限控制查询条件、所述查询条件和所述数据查询功能,确定查询语句,包括:The data query method according to claim 2, wherein said determining a query statement based on said authority control query condition, said query condition and said data query function comprises:基于预设组合规则对所述权限控制查询条件、所述查询条件和所述数据查询功能进行组合,得到查询语句。The query statement is obtained by combining the permission control query condition, the query condition and the data query function based on a preset combination rule.
- 如权利要求2至5任一项所述的数据查询方法,其特征在于,所述基于所述查询语句进行数据查询,得到数据查询结果,包括:The data query method according to any one of claims 2 to 5, wherein the data query is performed based on the query statement to obtain a data query result, comprising:基于所述查询语句进行数据查询,得到对应的字段;performing data query based on the query statement to obtain corresponding fields;通过对象关系映射技术对所述字段进行对象关系映射,得到对应的对象,作为数据查询结果。Object-relational mapping is performed on the fields through object-relational mapping technology to obtain corresponding objects as data query results.
- 一种数据查询装置,其特征在于,应用于客户端,包括:A data query device, characterized in that it is applied to a client, comprising:第一获取模块,用于获取查询请求和用户信息;The first obtaining module is used to obtain query requests and user information;封装模块,用于对预设API接口进行封装,以通过所述预设API接口将所述查询请求和所述用户信息发送到服务器端;An encapsulation module, configured to encapsulate a preset API interface, so as to send the query request and the user information to the server through the preset API interface;显示模块,用于在接收到服务器端返回与所述查询请求对应的查询结果时,显示所述查询结果。The display module is configured to display the query result when receiving the query result corresponding to the query request returned by the server.
- 一种数据查询装置,其特征在于,应用于服务器端,包括:A data query device, characterized in that it is applied to a server, comprising:第二获取模块,用于调用预设API接口获取客户端发送的查询请求和用户信息;The second obtaining module is used to call the preset API interface to obtain the query request and user information sent by the client;第一调用模块,用于根据所述用户信息确定与所述查询请求对应的权限控制查询条件;A first calling module, configured to determine the permission control query condition corresponding to the query request according to the user information;第二调用模块,用于基于所述查询请求确定查询条件和数据查询功能;A second calling module, configured to determine query conditions and data query functions based on the query request;确定模块,用于基于所述权限控制查询条件、所述查询条件和所述数据查询功能,确定查询语句;A determining module, configured to determine a query statement based on the authority control query condition, the query condition and the data query function;查询模块,用于基于所述查询语句进行数据查询,得到数据查询结果;A query module, configured to perform data query based on the query statement to obtain a data query result;序列化处理模块,用于对所述数据查询结果进行序列化,得到序列化结果,并将所述序列化结果发送至客户端。The serialization processing module is used to serialize the data query result, obtain the serialization result, and send the serialization result to the client.
- 一种服务器,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1或2至6任一项所述的方法。A server, comprising a memory, a processor, and a computer program stored in the memory and operable on the processor, wherein the computer program according to claim 1 or 2 is implemented when the processor executes the computer program to the method described in any one of 6.
- 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1或2至6任一项所述的方法。A computer-readable storage medium storing a computer program, wherein the computer program implements the method according to any one of claims 1 or 2 to 6 when executed by a processor.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111015394.4A CN113704307A (en) | 2021-08-31 | 2021-08-31 | Data query method, device, server and computer readable storage medium |
CN202111015394.4 | 2021-08-31 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023029752A1 true WO2023029752A1 (en) | 2023-03-09 |
Family
ID=78658235
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/104789 WO2023029752A1 (en) | 2021-08-31 | 2022-07-11 | Data query method and apparatus, server, and computer-readable storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN113704307A (en) |
WO (1) | WO2023029752A1 (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116204136A (en) * | 2023-05-04 | 2023-06-02 | 山东浪潮科学研究院有限公司 | Data storage and query method, device, equipment and storage medium |
CN116483483A (en) * | 2023-06-21 | 2023-07-25 | 中科方德软件有限公司 | Data query method and device and electronic equipment |
CN116662376A (en) * | 2023-08-01 | 2023-08-29 | 腾讯科技(深圳)有限公司 | Data query method, device, electronic equipment and storage medium |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113704307A (en) * | 2021-08-31 | 2021-11-26 | 深圳市兆珑科技有限公司 | Data query method, device, server and computer readable storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130054630A1 (en) * | 2011-08-30 | 2013-02-28 | International Business Machines Corporation | Pre-generation of structured query language (sql) from application programming interface (api) defined query systems |
CN109739873A (en) * | 2018-12-27 | 2019-05-10 | 广州市玄武无线科技股份有限公司 | A kind of business datum querying method, device, equipment and readable storage medium storing program for executing |
CN111639078A (en) * | 2020-05-25 | 2020-09-08 | 北京百度网讯科技有限公司 | Data query method and device, electronic equipment and readable storage medium |
CN112463836A (en) * | 2020-12-15 | 2021-03-09 | 广州品唯软件有限公司 | Data query method and device based on Django framework, computer equipment and medium |
CN112835930A (en) * | 2021-03-03 | 2021-05-25 | 上海渠杰信息科技有限公司 | Database query method and device |
CN113704307A (en) * | 2021-08-31 | 2021-11-26 | 深圳市兆珑科技有限公司 | Data query method, device, server and computer readable storage medium |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109815284A (en) * | 2019-01-04 | 2019-05-28 | 平安科技(深圳)有限公司 | A kind of method and apparatus of data processing |
CN111611276A (en) * | 2020-06-05 | 2020-09-01 | 腾讯科技(深圳)有限公司 | Data query method, device and storage medium |
CN112861182A (en) * | 2021-03-29 | 2021-05-28 | 中信银行股份有限公司 | Database query method and system, computer equipment and storage medium |
-
2021
- 2021-08-31 CN CN202111015394.4A patent/CN113704307A/en active Pending
-
2022
- 2022-07-11 WO PCT/CN2022/104789 patent/WO2023029752A1/en unknown
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130054630A1 (en) * | 2011-08-30 | 2013-02-28 | International Business Machines Corporation | Pre-generation of structured query language (sql) from application programming interface (api) defined query systems |
CN109739873A (en) * | 2018-12-27 | 2019-05-10 | 广州市玄武无线科技股份有限公司 | A kind of business datum querying method, device, equipment and readable storage medium storing program for executing |
CN111639078A (en) * | 2020-05-25 | 2020-09-08 | 北京百度网讯科技有限公司 | Data query method and device, electronic equipment and readable storage medium |
CN112463836A (en) * | 2020-12-15 | 2021-03-09 | 广州品唯软件有限公司 | Data query method and device based on Django framework, computer equipment and medium |
CN112835930A (en) * | 2021-03-03 | 2021-05-25 | 上海渠杰信息科技有限公司 | Database query method and device |
CN113704307A (en) * | 2021-08-31 | 2021-11-26 | 深圳市兆珑科技有限公司 | Data query method, device, server and computer readable storage medium |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116204136A (en) * | 2023-05-04 | 2023-06-02 | 山东浪潮科学研究院有限公司 | Data storage and query method, device, equipment and storage medium |
CN116204136B (en) * | 2023-05-04 | 2023-08-15 | 山东浪潮科学研究院有限公司 | Data storage and query method, device, equipment and storage medium |
CN116483483A (en) * | 2023-06-21 | 2023-07-25 | 中科方德软件有限公司 | Data query method and device and electronic equipment |
CN116483483B (en) * | 2023-06-21 | 2023-09-19 | 中科方德软件有限公司 | Data query method and device and electronic equipment |
CN116662376A (en) * | 2023-08-01 | 2023-08-29 | 腾讯科技(深圳)有限公司 | Data query method, device, electronic equipment and storage medium |
CN116662376B (en) * | 2023-08-01 | 2024-02-13 | 腾讯科技(深圳)有限公司 | Data query method, device, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN113704307A (en) | 2021-11-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2023029752A1 (en) | Data query method and apparatus, server, and computer-readable storage medium | |
US8417714B2 (en) | Techniques for fast and scalable XML generation and aggregation over binary XML | |
US9582467B2 (en) | Normalizing data for fast superscalar processing | |
US10963481B2 (en) | Custom object-in-memory format in data grid network appliance | |
MX2013014800A (en) | Recommending data enrichments. | |
WO2021159762A1 (en) | Data relationship extraction method and apparatus, electronic device, and storage medium | |
WO2019196239A1 (en) | Method for managing thread interfaces, and terminal device and computer-readable storage medium | |
WO2023124425A1 (en) | Data processing method and apparatus, electronic device, and storage medium | |
CN111142863A (en) | Page generation method and device | |
WO2023056946A1 (en) | Data caching method and apparatus, and electronic device | |
CN111104426A (en) | Data query method and system | |
JP2001016292A (en) | Message broker for providing issue/quotation service, and method for processing message in issue/quotation environment | |
US7882089B1 (en) | Caching database information | |
US20090049459A1 (en) | Dynamically converting symbolic links | |
WO2019127772A1 (en) | Data dictionary display method and device, terminal device and storage medium | |
CN113625998B (en) | Request processing method and device | |
US8234586B2 (en) | User interface framework and techniques | |
CN109544207A (en) | A kind of information processing method, storage medium and server | |
US9342581B2 (en) | System to disclose the internal structure of persistent database objects | |
US9201937B2 (en) | Rapid provisioning of information for business analytics | |
WO2013159342A1 (en) | Similarity score lookup and representation | |
CN107871020B (en) | Method for complementing data object attributes based on SolrCloud | |
WO2022048676A1 (en) | Api generation method and apparatus | |
US20230418878A1 (en) | Multi-model enrichment memory and catalog for better search recall with granular provenance and lineage | |
US20210357453A1 (en) | Query usage based organization for very large databases |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22862893 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |