Page query method and device, equipment and storage medium
通过在页面查询请求时根据数据量进行跳转和计算限制,解决了现有技术中查询效率低的问题,实现了更高效的页面查询和改善的用户体验。
Patent Information
- Application Number
- CN202510498364.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2025-07-11
AI Technical Summary
The existing page query technology has low query efficiency when processing massive data, resulting in poor user experience. Especially in JOIN operations of large data tables, the COUNT(*) operation is expensive and has extremely low performance, which cannot meet the real-time query needs.
When querying the page, determine the amount of data corresponding to the page number of the requested query page. If it is less than the basic data volume of the page, the data calculation limit will be performed. During the jump process, the page navigation bar will be set to reduce unnecessary data calculations.
Improve query efficiency, save query time, improve user experience, and reduce server pressure and hardware maintenance costs.
Smart Images

Figure CN120296233A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of page query, and in particular to a page query method, device, equipment and storage medium. Background Art
[0002] In today's era of digital information explosion, page query plays a vital role in various information systems and is widely used in many fields such as e-commerce, search engines, and enterprise management systems. Through the page query function, users can quickly locate and obtain the information they need. However, existing page query technologies face many challenges in practical applications, especially when processing massive data. Query efficiency has become a key issue that needs to be solved urgently.
[0003] Traditional page queries are usually based on COUNT queries. In order to support COUNT queries, a large amount of database resources are needed to perform full data calculations, which consumes a long waiting time, resulting in low query efficiency and poor user experience. Summary of the invention
[0004] In view of this, the present application provides a page query method, device, equipment and storage medium, which are used to solve the problem that traditional page queries are usually based on COUNT queries. In order to support COUNT queries, a large amount of database resources are required to perform full data calculations, which will consume a long waiting time, resulting in low query efficiency and poor user experience.
[0005] To achieve the above objectives, the proposed solution is as follows:
[0006] In a first aspect, a page query method includes:
[0007] When the user initiates a page query request instruction on the current page, in response to the page query request instruction, determining the requested query page number;
[0008] Obtaining the data volume of the page corresponding to the requested query page number;
[0009] If the data volume of the page corresponding to the requested query page number is less than the preset page basic data volume, a page jump is performed based on the data volume of the corresponding page;
[0010] If the data volume of the page corresponding to the requested query page number is not less than the basic data volume of the page, data calculation restriction is performed and the page is jumped to the page corresponding to the requested query page number;
[0011] In the process of jumping to the page corresponding to the requested query page number, the page navigation bar of the page corresponding to the requested query page number is set.
[0012] Preferably, the page jump based on the data volume of the corresponding page includes:
[0013] If the data volume of the page corresponding to the requested query page number is a null value, starting from the requested query page number, query the page number of the nearest adjacent page with a non-null data volume as the last page number;
[0014] Jump to the page corresponding to the last page number;
[0015] If the data volume of the page corresponding to the requested query page number is not a null value, jump to the page corresponding to the requested query page number.
[0016] Preferably, during the process of jumping to the page corresponding to the requested query page number, setting the page navigation bar of the page corresponding to the requested query page number includes:
[0017] Obtain the pre-set number of pages shown before and after;
[0018] Add the requested query page number to the number of pages shown before and after to obtain the first predicted page number;
[0019] Determine whether there is a page corresponding to the first predicted page number;
[0020] If so, display the first predicted page number in the page navigation bar of the current page;
[0021] If not, determine the true last page number and display the true last page number in the page navigation bar of the current page.
[0022] Preferably, the determination of whether there is a page corresponding to the first predicted page number includes:
[0023] Compare the first predicted page number with the pre-set page number limit;
[0024] If the first predicted page number is not less than the pre-set page number limit, obtain the basic page data volume;
[0025] Calculate the predicted total data volume according to the first predicted page number and the basic page data volume;
[0026] Obtain the actual total data volume of the page set to which the current page belongs;
[0027] Compare the size of the actual total data volume and the predicted total data volume;
[0028] If the predicted total data volume is less than the actual total data volume, determine that there is no page corresponding to the first predicted page number;
[0029] If the predicted total amount of data is equal to the actual total amount of data, it is determined that there is a page corresponding to the first predicted page number.
[0030] Preferably, the process of setting the number of pages displayed before and after includes:
[0031] Obtain the user's historical page access records;
[0032] Extracting the total number of pages, the total number of page turns, the page turn frequency and the number of page queries corresponding to each page access of the user from the historical page access records;
[0033] For each page access in the history, the total number of pages accessed is divided by the total number of page turns to obtain a page turn reference amount;
[0034] respectively setting weights of the page turning reference amount, page turning frequency and page query times;
[0035] The page turning reference quantity, the page turning frequency and the page query number are weighted and calculated according to the weight to obtain reference configuration data;
[0036] The number of pages to be displayed before and after is set based on the reference configuration data.
[0037] Preferably, the data calculation restriction comprises:
[0038] Get the preset page limit number;
[0039] Constructing a page number restriction function based on the page number restriction number;
[0040] The page number restriction function is used to restrict data calculation in the process of jumping to the page corresponding to the requested query page number.
[0041] Preferably, the method further comprises:
[0042] In the process of responding to the page query request instruction, calling a pre-built paging count template class;
[0043] The paging count template class includes a data counting functional interface, a data query functional interface, and a page number restriction function constructed by the data counting functional interface and the data query functional interface.
[0044] In a second aspect, a page query device includes:
[0045] A response module, used for determining a requested query page number in response to a page query request instruction when a user initiates a page query request instruction on a current page;
[0046] A data volume acquisition module, used to acquire the data volume of the page corresponding to the requested query page number;
[0047] A first page jump module, configured to perform a page jump based on the data volume of the corresponding page if the data volume of the page corresponding to the requested query page number is less than a preset basic page data volume;
[0048] A second page jump module, configured to perform data calculation restriction and jump to the page corresponding to the requested query page number if the data volume of the page corresponding to the requested query page number is not less than the basic page data volume;
[0049] A page navigation setting module, configured to set the page navigation bar of the page corresponding to the requested query page number during the process of jumping to the page corresponding to the requested query page number.
[0050] In a third aspect, a page query device includes a memory and a processor;
[0051] The memory is configured to store a program;
[0052] The processor is configured to execute the program to implement each step of the page query method according to any one of the first aspects.
[0053] In a fourth aspect, a storage medium stores a computer program, and when the computer program is executed by a processor, each step of the page query method according to any one of the first aspects is implemented.
[0054] It can be seen from the above technical scheme that the present application determines the requested query page number in response to the page query request instruction when the user initiates a page query request instruction on the current page; obtains the data volume of the page corresponding to the requested query page number; if the data volume of the page corresponding to the requested query page number is less than the preset page basic data volume, performs a page jump based on the data volume of the corresponding page; if the data volume of the page corresponding to the requested query page number is not less than the page basic data volume, performs data calculation restriction and jumps to the page corresponding to the requested query page number; in the process of jumping to the page corresponding to the requested query page number, sets the page navigation bar of the page corresponding to the requested query page number. The present application responds when the user initiates a page query request instruction on the current page, determines the page number requested by the user, and in order to limit the amount of data calculation, first obtains the amount of data of the page corresponding to the requested query page number. Since the amount of data corresponding to each page number has a maximum limit, that is, the basic data amount of the page, the distribution of the requested query page number for the overall page number can be judged according to the amount of data of the page corresponding to the requested query page number, such as the front page number, the middle page number or the back page number, etc., so as to determine whether it is possible to jump to the page number the user wants to query, which includes two situations. One is that the amount of data of the page corresponding to the requested query page number is less than the basic data amount of the page, which means that the page is already the last page; the other is that the amount of data of the page corresponding to the requested query page number is not less than the basic data amount of the page, which means that the page may not be the last page. In order to reduce or limit the full amount of data calculation, when the data amount is not less than the basic data amount of the page, it is necessary to limit the data calculation and then jump, and it is also necessary to set the page navigation bar of the page corresponding to the requested query page number, thereby reducing unnecessary data calculation, improving efficiency, saving query time, and enhancing user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0056] Figure 1 An optional flow chart of a page query method provided in an embodiment of the present application;
[0057] Figure 2 A schematic diagram of a page display provided in an embodiment of the present application;
[0058] Figure 3 A schematic diagram of the structure of a page query device provided in an embodiment of the present application;
[0059] Figure 4 A schematic diagram of the structure of a page query device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0060] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0061] In today's era of digital information explosion, page query plays a vital role in various information systems and is widely used in many fields such as e-commerce, search engines, and enterprise management systems. Through the page query function, users can quickly locate and obtain the information they need. However, existing page query technologies face many challenges in practical applications, especially when processing massive data. Query efficiency has become a key issue that needs to be solved urgently.
[0062] For example, in business scenarios such as e-commerce and retail, page queries are becoming increasingly important, especially in the "prohibited combination lifting" business. The scenarios where the "prohibited combination lifting" business is applied are usually in the commodity management or order processing process. Certain commodities or documents may be prohibited from being combined or have their restrictions lifted due to specific rules or limitations. Therefore, business personnel need to query information such as the prohibited combination lifting status of commodities and the prohibited combination lifting situation of documents in real time according to various dimensions (such as commodity type, store area, promotional activities, etc.) for business monitoring, report analysis, and decision-making support. With the expansion of business scale and the rapid growth of data volume, especially the growth of the number of stores and commodities, the data volume generated by the "prohibited combination lifting" business also grows exponentially. These data are usually stored in large data tables, such as the result table for recording the final results, the reason table for recording the reasons, and the log table for operation logs. In actual applications, the data volume of these tables may reach billions or even tens of billions. Therefore, to support the real-time query requirements for these massive data, common solutions are to adopt big data processing technologies and tools. For example, Alibaba Cloud's ADB (AnalyticDB) database is widely used in processing such large-scale data analysis scenarios. ADB has excellent query performance and can handle complex queries and high-concurrency access. In this solution, when a user needs to view data related to the "prohibited combination lifting" business, the system will execute SQL query statements to retrieve data from large tables such as the result table, the reason table, and the log table, and perform paging processing. Among them, it is necessary to implement the execution of COUNT(*) queries to obtain the total number of data that meet the conditions for calculating the total number of pages, and then execute SQL queries with LIMIT and OFFSET to retrieve data with the specified page number and page size. For small data volumes or simple query scenarios, this solution can better meet the requirements. However, in scenarios with massive data such as the "prohibited combination lifting" business, especially when report queries need to perform JOIN operations on multiple large tables such as the result table, the reason table, and the log table, the cost of COUNT(*) operations will become extremely large, with extremely low performance, long response times, and unable to meet the real-time query requirements. Moreover, a large amount of database resources are invested, full-scale data calculations are performed, increasing the hardware maintenance cost, and the long response time results in low query efficiency and poor user experience.
[0063] Therefore, to solve the defects of the above-mentioned existing technologies, the embodiments of the present invention provide a page query method. The present invention can be used in many general or special computing device environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, multi-processor devices, distributed computing environments including any of the above devices or equipment, and so on.
[0064] The method can be applied to various computer terminals or intelligent terminals, and its execution subject can be a processor or server of the computer terminal or intelligent terminal. The method flow chart of the method is as follows: Figure 1 As shown, specifically including:
[0065] S1: When a user initiates a page query request instruction on a current page, a requested query page number is determined in response to the page query request instruction.
[0066] One applicable scenario of the present application is that a user initiates a page query request instruction on a page-turning website, file, etc. For example, the user enters the page number to which he wants to jump in the page query input box. Under normal circumstances, the page needs to jump to the page corresponding to the page number to meet the user's requirements.
[0067] Therefore, the page number that the user wants to jump to can be directly obtained from the page query request instruction, that is, the request query page number, and regardless of whether to jump to the page corresponding to the page number, the request query page number must be obtained first when responding, so as to capture the user's intention and provide precise coordinate location and other information for subsequent page queries.
[0068] S2: Obtain the data volume of the page corresponding to the requested query page number.
[0069] It should be noted that before jumping, it is necessary to first determine whether there is a corresponding page for the page number, because there may be a situation where there are 10 pages in total, and the page number corresponding to the page query request initiated by the user is 11, so there is no page corresponding to 11. Therefore, in order to avoid unnecessary empty pages or insufficient page loading, it is necessary to determine whether there is a page corresponding to the page number from the perspective of page data volume.
[0070] This application assumes that except for the last page, the amount of data in the pages corresponding to the previous pages is the same, which is the basic data amount of the page. The basic data amount of the page refers to the maximum amount of data that the page can carry. Therefore, you only need to determine the amount of data in the page corresponding to the requested query page number.
[0071] S3: If the data volume of the page corresponding to the requested query page number is less than the preset page basic data volume, a page jump is performed based on the data volume of the corresponding page.
[0072] If the data volume of the page corresponding to the requested query page number is less than the preset page basic data volume, it means that the requested query page number is the last page. According to the settings of this application, the following situations may exist:
[0073] If the amount of data on the page corresponding to the requested query page number is equal to the basic page data amount, then this page may be the last page, that is to say, this page just finishes displaying the data; of course, it is also possible that the data has not been fully displayed, but this page can at most display the basic page data amount.
[0074] If the amount of data on the page corresponding to the requested query page number is less than the basic page data amount and greater than null, it means that this page must be the last page. If the amount of data on the page corresponding to the requested query page number is null, it means that there is no such page number and thus no corresponding page.
[0075] Then it is necessary to perform page jumps according to the specific amount of data on the page corresponding to this page number. If the amount of data on the page corresponding to the requested query page number is less than the basic page data amount and greater than null, it can directly jump to the page corresponding to the requested query page number; if the amount of data on the page corresponding to the requested query page number is null, it is necessary to further determine which page to jump to.
[0076] This application compares the amount of data on the page corresponding to the requested query page number with the basic page data amount, and realizes different jump logics according to the comparison results, which can reduce invalid page requests, reduce the server pressure, and improve the adaptability to the scenario of dynamic data changes.
[0077] S4: If the amount of data on the page corresponding to the requested query page number is not less than the basic page data amount, perform data calculation restriction and jump to the page corresponding to the requested query page number.
[0078] If the amount of data on the page corresponding to the requested query page number is not less than the basic page data amount, it means that the page corresponding to this page number is not the last page. There may be many more pages or this page may already be a relatively later page number. Therefore, in order to limit a large amount of data calculation, it is necessary to perform data calculation restriction during the jump process to be able to jump to this page, so as to improve the query efficiency while meeting the user's expected page number positioning requirements.
[0079] S5: During the process of jumping to the page corresponding to the requested query page number, set the page navigation bar of the page corresponding to the requested query page number.
[0080] Since the page number display of the page navigation bar will change with the change of the page number, the page navigation bar also needs to be configured and set, so as to enhance the user interaction perception and reduce the page rendering time.
[0081] It can be seen from the above technical scheme that the present application determines the requested query page number in response to the page query request instruction when the user initiates a page query request instruction on the current page; obtains the data volume of the page corresponding to the requested query page number; if the data volume of the page corresponding to the requested query page number is less than the preset page basic data volume, performs a page jump based on the data volume of the corresponding page; if the data volume of the page corresponding to the requested query page number is not less than the page basic data volume, performs data calculation restriction and jumps to the page corresponding to the requested query page number; in the process of jumping to the page corresponding to the requested query page number, sets the page navigation bar of the page corresponding to the requested query page number. The present application responds when the user initiates a page query request instruction on the current page, determines the page number requested by the user, and in order to limit the amount of data calculation, first obtains the amount of data of the page corresponding to the requested query page number. Since the amount of data corresponding to each page number has a maximum limit, that is, the basic data amount of the page, the distribution of the requested query page number for the overall page number can be judged according to the amount of data of the page corresponding to the requested query page number, such as the front page number, the middle page number or the back page number, etc., so as to determine whether it is possible to jump to the page number the user wants to query, which includes two situations. One is that the amount of data of the page corresponding to the requested query page number is less than the basic data amount of the page, which means that the page is already the last page; the other is that the amount of data of the page corresponding to the requested query page number is not less than the basic data amount of the page, which means that the page may not be the last page. In order to reduce or limit the full amount of data calculation, when the data amount is not less than the basic data amount of the page, it is necessary to limit the data calculation and then jump, and it is also necessary to set the page navigation bar of the page corresponding to the requested query page number, thereby reducing unnecessary data calculation, improving efficiency, saving query time, and enhancing user experience.
[0082] In the method provided in the embodiment of the present invention, the process of performing page jump based on the data volume of the corresponding page is specifically described as follows:
[0083] If the data volume of the page corresponding to the requested query page number is null, starting from the requested query page number, query the nearest adjacent page number whose data volume is not null as the last page number;
[0084] Jump to the page corresponding to the last page number;
[0085] If the data volume of the page corresponding to the requested query page number is not a null value, jump to the page corresponding to the requested query page number.
[0086] Specifically, if the data volume of the page corresponding to the requested query page number is a null value, in order to enable the user to quickly see the data or information they want, the real last page is displayed to the user, that is, the last page number is determined. Starting from the requested query page number, the page number with a non-null data volume that is the closest adjacent can be queried as the last page number. It can be queried in the direction of decreasing page numbers and then redirected. This can optimize the user experience, prevent the query from being interrupted due to a blank page being queried, automatically provide the user with the nearest valid content, which is also the content that the user most likely needs, meet the accurate response to the user's request for a specific page number, and avoid rendering blank pages and querying invalid data, saving resources.
[0087] If the data volume of the page corresponding to the requested query page number is not a null value and is also less than the basic data volume of the page, then the requested query page number can be directly determined as the last page, and then directly redirected, reducing the response time and meeting the user's expectations.
[0088] The following details the process of setting the page navigation bar of the page corresponding to the requested query page number during the process of redirecting to the page corresponding to the requested query page number in this application.
[0089] Obtain the pre-set number of pages displayed before and after;
[0090] Add the requested query page number to the number of pages displayed before and after to obtain the first predicted page number;
[0091] Determine whether there is a page corresponding to the first predicted page number;
[0092] If so, display the first predicted page number in the page navigation bar of the current page;
[0093] If not, determine the real last page number and display the real last page number in the page navigation bar of the current page.
[0094] Specifically, the page navigation bar can help the user quickly locate the page number they want to reach. The number of pages displayed before and after refers to the number of pages displayed before and after the current page. As Figure 2 shown, the current page is page 6, and 3 pages are displayed before and after each, that is, the number of pages displayed before and after is 3. Therefore, the page navigation bar of the current page can display [3, 4, 5, 6, 7, 8, 9]. It can be understood that when the page number changes, the corresponding page navigation bar will also change accordingly to meet the user's needs. Therefore, during the process of redirecting to the page corresponding to the requested query page number, it is also necessary to set the page navigation bar of the page corresponding to the requested query page number to be redirected.
[0095] Setting the number of pages displayed before and after in advance is to limit the maximum calculation range and avoid traversing all page numbers without limit. Adding the requested query page number to the number of pages displayed before and after can predict the range of pages to be displayed. Continuing with the above example, if the requested query page number is page 8, then the page navigation bar for page 8 is [5, 6, 7, 8, 9, 10, 11], and it is ensured that the navigation bar is symmetrically displayed centered on the current page, which conforms to the user's mental model of flipping through pages forward and backward.
[0096] It should be noted that it is necessary to ensure that pages 9, 10, and 11 actually exist to display like this, so as to prevent illegal page numbers (such as negative numbers or exceeding the maximum number of pages) from appearing in the navigation bar, enhance robustness, and improve adaptability. To improve efficiency, it can first be judged whether page 11 exists, and then judge page 10, page 9, etc. in turn according to the situation. If the page corresponding to the first predicted page number does not exist, then it is determined whether page 10 exists. If page 10 exists, then the page navigation bar is [5, 6, 7, 8, 9, 10], but in this case, it cannot be symmetrically displayed centered on page 8.
[0097] Among them, the steps for judging whether there is a page corresponding to the first predicted page number are explained in detail as follows:
[0098] Compare the first predicted page number with the pre-set page number limit;
[0099] If the first predicted page number is not less than the pre-set page number limit, then obtain the basic page data volume;
[0100] Calculate the total predicted data according to the first predicted page number and the basic page data volume;
[0101] Obtain the actual total data volume of the page set to which the current page belongs;
[0102] Compare the size of the actual total data volume and the total predicted data volume;
[0103] If the total predicted data volume is less than the actual total data volume, then determine that there is no page corresponding to the first predicted page number;
[0104] If the total predicted data volume is equal to the actual total data volume, then determine that there is a page corresponding to the first predicted page number.
[0105] Specifically, this application is provided with a page number limit. For example, there are actually 1000 pages, but the page numbers are limited to 10 pages, that is, the user can only see these 10 pages. This can prevent the user from maliciously inputting extremely large page numbers and other abnormal calculations that may cause page system overload. Therefore, the first predicted page number can be compared with the page number limit. If the first predicted page number is not less than the pre-set page number limit, then it is necessary to predict the total data volume based on the first predicted page number and the basic data volume of the page, and then compare it with the actual total data volume to determine whether there is a page corresponding to the first predicted page number. This application avoids directly querying whether there is a page corresponding to the first predicted page number in this way, but instead reduces the calculation pressure through the calculation of the total data volume. Among them, the page set is the set formed by all pages corresponding to the page numbers.
[0106] Further, the process of setting the number of pages displayed before and after may include the following steps:
[0107] Obtain the historical page access records of the user;
[0108] Extract the total number of pages, the total number of page flips, the page flip frequency, and the number of page queries corresponding to each historical page access of the user from the historical page access records;
[0109] For each historical page access, divide the total number of pages of this access by the total number of page flips to obtain a page flip reference quantity;
[0110] Set the weights of the page flip reference quantity, the page flip frequency, and the number of page queries respectively;
[0111] Perform a weighted sum calculation on the page flip reference quantity, the page flip frequency, and the number of page queries according to the weights to obtain reference configuration data;
[0112] Set the number of pages displayed before and after based on the reference configuration data.
[0113] Specifically, in order to be more relevant to users and provide a better user experience, the paging characteristics of users are extracted to provide data support for subsequent analysis. Specifically, the historical page access records of users can be extracted, and for each page access, calculations are made on the total number of pages (i.e., the total number of page numbers in the page set), the total paging count (i.e., the total number of times the user clicks "next page / previous page" or directly clicks on a specific page number in the page navigation bar), the paging frequency (i.e., the number of paging operations per unit time, such as 5 times / minute), and the page query count (i.e., the number of times the user actively enters a page number to jump). Dividing the total number of pages for each page access by the total paging count can obtain a paging characteristic as a paging reference quantity. For example, when the total number of pages corresponding to a certain page access by the user is 8 pages and the total paging count is 4 times, the calculated paging reference quantity is 2. In this way, the characteristics of users can be identified through the quantification of paging efficiency. For example, the larger the paging reference quantity, the more page numbers the user jumps across each time. Then, the number of pages displayed before and after with a larger value can be given priority. The smaller the paging reference quantity, the number of pages displayed before and after with a smaller value can be given priority.
[0114] Then, taking the paging reference quantity, paging frequency, and page query count as three characteristics, a weighted sum calculation is performed, and the weights can be set personalized. For example, the characteristics of the user can be determined first. For users with the characteristic of "quick flipping", larger values are set for the weights of their paging reference quantity and paging frequency; for users with the characteristic of "large-span browsing", a larger value is set for the weight of their page query count. After the weighted sum calculation, the reference configuration data is obtained, which is a numerical value. The application pre-sets the number of pages displayed before and after corresponding to the reference range. In an example, the number of pages displayed before and after corresponding to the reference range is shown in Table 1 below:
[0115]
[0116] Furthermore, this method also includes:
[0117] During the process of responding to the page query request instruction, a pre-constructed paging count template class is called;
[0118] The paging count template class includes a data counting functional interface, a data query functional interface, and a page number limit function constructed by the data counting functional interface and the data query functional interface.
[0119] Specifically, the paging count template class RainbowPageCountTemplate includes a data counting functional interface, a data query functional interface, and a page number limit function constructed by the data counting functional interface and the data query functional interface. Among them, R and T are defined. R represents the type of a single piece of data in the query result list (Result Type). For example, if the query is for a product list, R might be the Product class; T extends PageBaseDto represents the type of the query condition object (Template Parameter Type), and it is restricted that T must be PageBaseDto or its subclass. The purpose of this restriction is to limit the type of the passed-in parameter, that is, if this condition is not met, an error will be reported during the program compilation phase, rather than waiting until the running phase. PageBaseDto is a basic paging DTO that contains paging-related parameters such as pageSize (paging size) and pageNum (current page number).
[0120] Data counting functional interface DataCountFunction <t>For obtaining the total amount of data, apply(Tobject, int queryCount) means accepting the query condition object object and the record quantity limit queryCount of the current query, and returning the total number of data. The queryCount parameter is used to limit the data range of the COUNT operation to prevent full amount data scanning and calculation; The data query functional interface DataQueryFunction<R, T> is used to execute data query, and apply(Tobject) means accepting the query condition object object and returning the query data list List <r>。
[0121] Next, construct a page number limit function based on the data counting functional interface and the data query functional interface:
[0122] DataCountFunction <t>dataCountFunction: An implementation class instance of the DataCountFunction interface, used to perform the calculation of the total data volume.
[0123] DataQueryFunction<R, T> dataQueryFunction: An implementation class instance of the DataQueryFunction interface, used to perform page queries.
[0124] int pageCount: The configured limit on the display of page numbers. For example, if set to 10, it means that by default, the first 10 page numbers are displayed at most.
[0125] The core calculation method used is getDataByPage. The getDataByPage method is the core method for obtaining the data volume. It accepts the paging size pageSize, the current page number pageNum, and the query condition object object as parameters and returns a Pager encapsulating the paged data. <r>Object, thereby achieving automatic redirection of empty data pages.
[0126] Optionally, in the process of limiting data calculation, a page number limit can be pre-set; based on the page number limit, a page number limit function is constructed, and the page number limit function can be used to limit data calculation in the process of jumping to the page corresponding to the requested query page number, thereby avoiding full COUNT, greatly reducing the response time of complex queries, and users do not need to wait for irrelevant total statistics.
[0127] and Figure 1 Corresponding to the method described above, the embodiment of the present invention also provides a page query device for querying Figure 1 In the specific implementation of the method, the page query device provided by the embodiment of the present invention can be used in a computer terminal or various mobile devices, combined with Figure 3 , introduce the page query device, such as Figure 3 As shown, the device may include:
[0128] A response module 10 is used to determine a requested query page number in response to a page query request instruction when a user initiates a page query request instruction on a current page;
[0129] A data volume acquisition module 20 is used to acquire the data volume of the page corresponding to the requested query page number;
[0130] A first page jump module 30, configured to perform page jump based on the data volume of the corresponding page if the data volume of the page corresponding to the requested query page number is less than a preset page basic data volume;
[0131] The second page jump module 40 is used to perform data calculation restriction and jump to the page corresponding to the requested query page number if the data volume of the page corresponding to the requested query page number is not less than the page basic data volume;
[0132] The page navigation setting module 50 is used to set the page navigation bar of the page corresponding to the requested query page number during the process of jumping to the page corresponding to the requested query page number.
[0133] As can be seen from the above technical solution, in this application, when a user initiates a page query request instruction on the current page, in response to the page query request instruction, the requested query page number is determined; the data volume of the page corresponding to the requested query page number is obtained; if the data volume of the page corresponding to the requested query page number is less than the preset basic page data volume, page jump is performed based on the data volume of the corresponding page; if the data volume of the page corresponding to the requested query page number is not less than the basic page data volume, data calculation is restricted, and the page corresponding to the requested query page number is jumped to; during the process of jumping to the page corresponding to the requested query page number, the page navigation bar of the page corresponding to the requested query page number is set. This application responds when the user initiates a page query request instruction on the current page to determine the page number requested by the user. To limit the data calculation amount, first, the data volume of the page corresponding to the requested query page number is obtained. Since the data volume of each page corresponding to the page number has a maximum limit, that is, the basic page data volume, the distribution of the page numbers as a whole can be judged according to the data volume of the page corresponding to the requested query page number, such as whether it is the front pages, the middle pages, or the back pages, etc., so as to determine whether the page number that the user wants to query can be jumped to. There are two cases. One is that the data volume of the page corresponding to the requested query page number is less than the basic page data volume, which means that this page is already the last page; the other is that the data volume of the page corresponding to the requested query page number is not less than the basic page data volume, which means that this page may not be the last page. Then, to reduce or limit the full-volume data calculation, when the data volume is not less than the basic page data volume, data calculation needs to be restricted, and then the jump is performed, and the page navigation bar of the page corresponding to the requested query page number also needs to be set, so as to reduce unnecessary data calculation, improve efficiency, save query time, and enhance the user experience.
[0134] Furthermore, an embodiment of this application provides a page query device. Optionally, Figure 4 The hardware structure block diagram of the page query device is shown. Referring to Figure 4 , the hardware structure of the page query device may include: at least one processor 01, at least one communication interface 02, at least one memory 03, and at least one communication bus 04.
[0135] In the embodiment of this application, the number of the processor 01, the communication interface 02, the memory 03, and the communication bus 04 is at least one, and the processor 01, the communication interface 02, and the memory 03 complete mutual communication through the communication bus 04.
[0136] The processor 01 can be a central processing unit (CPU), or a specific application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention, etc.
[0137] The memory 03 may include high-speed RAM memory and may also include non-volatile memory, such as at least one disk memory.
[0138] Among them, the memory stores a program, and the processor can call the program stored in the memory. The program is used to execute the following page query method, including:
[0139] When the user initiates a page query request instruction on the current page, in response to the page query request instruction, determine the requested query page number;
[0140] Obtain the data volume of the page corresponding to the requested query page number;
[0141] If the data volume of the page corresponding to the requested query page number is less than the preset page basic data volume, perform a page jump based on the data volume of the corresponding page;
[0142] If the data volume of the page corresponding to the requested query page number is not less than the page basic data volume, perform data calculation restriction and jump to the page corresponding to the requested query page number;
[0143] During the process of jumping to the page corresponding to the requested query page number, set the page navigation bar of the page corresponding to the requested query page number.
[0144] Optionally, the refined functions and extended functions of the program can refer to the description of the page query method in the method embodiments.
[0145] The embodiment of the present application also provides a storage medium. The storage medium can store a program suitable for the processor to execute. When the program runs, it controls the device where the storage medium is located to execute the following page query method, including:
[0146] When the user initiates a page query request instruction on the current page, in response to the page query request instruction, determine the requested query page number;
[0147] Obtain the data volume of the page corresponding to the requested query page number;
[0148] If the data volume of the page corresponding to the requested query page number is less than the preset page basic data volume, perform a page jump based on the data volume of the corresponding page;
[0149] If the data volume of the page corresponding to the requested query page number is not less than the basic data volume of the page, data calculation restrictions are imposed, and the process jumps to the page corresponding to the requested query page number;
[0150] During the process of jumping to the page corresponding to the requested query page number, the page navigation bar of the page corresponding to the requested query page number is set.
[0151] Specifically, the storage medium may be a computer-readable storage medium, and the computer-readable storage medium may be an electronic memory such as a flash memory, EEPROM (electrically erasable programmable read-only memory), EPROM, a hard disk, or a ROM.
[0152] Optionally, the refinement function and the extension function of the program may refer to the description of the page query method in the method embodiment.
[0153] In addition, in each of the embodiments of the present disclosure, the functional modules may be integrated together to form an independent part, or each module may exist alone, or two or more modules may be integrated to form an independent part. If the function is implemented in the form of a software functional module and sold or used as an independent product, it may be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present disclosure, in essence, or the part that contributes to the prior art or a part of the technical solution may be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a live broadcast device, or a network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present disclosure.
[0154] Finally, it should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variation thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or device including the element.
[0155] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments may be referred to each other.
[0156] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but rather to the broadest scope consistent with the principles and novel features disclosed herein.< / r> < / t> < / r> < / t>
Claims
1. A page query method, characterized in that, Including: When the user initiates a page query request instruction on the current page, in response to the page query request instruction, determine the requested query page number; Obtain the data volume of the page corresponding to the requested query page number; If the data volume of the page corresponding to the requested query page number is less than the preset basic page data volume, perform a page jump based on the data volume of the corresponding page; If the data volume of the page corresponding to the requested query page number is not less than the basic page data volume, perform data calculation restriction and jump to the page corresponding to the requested query page number; During the process of jumping to the page corresponding to the requested query page number, set the page navigation bar of the page corresponding to the requested query page number.
2. The method according to claim 1, characterized in that, The performing a page jump based on the data volume of the corresponding page includes: If the data volume of the page corresponding to the requested query page number is a null value, start from the requested query page number and query the page number with the nearest adjacent non-null data volume as the last page number; Jump to the page corresponding to the last page number; If the data volume of the page corresponding to the requested query page number is not a null value, jump to the page corresponding to the requested query page number.
3. The method according to claim 1, characterized in that, The setting the page navigation bar of the page corresponding to the requested query page number during the process of jumping to the page corresponding to the requested query page number includes: Obtain the pre-set number of pages shown before and after; Add the requested query page number to the number of pages shown before and after to obtain the first predicted page number; Determine whether there is a page corresponding to the first predicted page number; If so, display the first predicted page number in the page navigation bar of the current page; If not, determine the true last page number and display the true last page number in the page navigation bar of the current page.
4. The method according to claim 3, characterized in that, The determining whether there is a page corresponding to the first predicted page number includes: Compare the first predicted page number with the pre-set page number limit; If the first predicted page number is not less than the pre-set page number limit, obtain the basic page data volume; Calculate the predicted total data volume according to the first predicted page number and the basic page data volume; Obtain the actual total data volume of the page set to which the current page belongs; Compare the size of the actual total data volume and the predicted total data volume; If the predicted total data volume is less than the actual total data volume, determine that there is no page corresponding to the first predicted page number; If the predicted total data volume is equal to the actual total data volume, determine that there is a page corresponding to the first predicted page number.
5. The method according to claim 3, wherein The setting process of the number of pages shown before and after includes: Obtain the user's historical page access records; Extract the total number of pages, total paging count, paging frequency, and page query times corresponding to each historical page access of the user from the historical page access records; For each historical page access, divide the total number of pages of that time by the total paging count to obtain the paging reference amount; Respectively set the weights of the paging reference amount, paging frequency, and page query times; Perform a weighted sum calculation on the paging reference amount, paging frequency, and page query times according to the weights to obtain the reference configuration data; The number of pages to be displayed before and after is set based on the reference configuration data.
6. The method according to claim 1, wherein The data calculation restrictions include: Get the preset page limit number; Constructing a page number restriction function based on the page number restriction number; The page number restriction function is used to restrict data calculation in the process of jumping to the page corresponding to the requested query page number.
7. The method according to any one of claims 1 to 6, characterized in that, The method further comprises: In the process of responding to the page query request instruction, calling a pre-built paging count template class; The paging count template class includes a data counting functional interface, a data query functional interface, and a page number restriction function constructed by the data counting functional interface and the data query functional interface.
8. A page query device, characterized in that, include: A response module, used for determining a requested query page number in response to a page query request instruction when a user initiates a page query request instruction on a current page; A data volume acquisition module, used to acquire the data volume of the page corresponding to the requested query page number; A first page jump module, configured to perform page jump based on the data volume of the corresponding page if the data volume of the page corresponding to the requested query page number is less than a preset page basic data volume; A second page jump module, for performing data calculation restriction and jumping to the page corresponding to the requested query page number if the data volume of the page corresponding to the requested query page number is not less than the page basic data volume; The page navigation setting module is used to set the page navigation bar of the page corresponding to the requested query page number during the process of jumping to the page corresponding to the requested query page number.
9. A page query device, characterized in that, including memory and processor; The memory is used to store programs; The processor is used to execute the program to implement each step of the page query method as described in any one of claims 1-7.
10. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, each step of the page query method according to any one of claims 1 to 7 is implemented.