Sorting processing method and device, computer device and storage medium
By copying the list and sorting it according to its type, the problem of sorting errors in numeric lists in existing technologies is solved, and the functions of global and page-specific sorting and quick restoration of the original list are achieved.
Patent Information
- Application Number
- CN202311235439.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-22
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2043-09-22
AI Technical Summary
Existing list sorting components, such as ElementUI's el-table, will sort numeric list contents as string contents by default, resulting in incorrect sorting results. This fails to meet users' global sorting needs and makes it impossible to quickly restore the original list state.
By copying the list to be sorted, a copied list is obtained, and the sorting type and parameters are determined. The backend uses a dynamic structured query statement for global sorting, and the frontend uses data type matching rules for in-page sorting, ensuring that different data types use appropriate sorting rules.
It achieves both global and page-specific sorting, accurately and quickly meeting user needs, and does not require restoring the sorting state when viewing the original list, thus improving the efficiency and accuracy of sorting processing.
Smart Images

Figure CN117194532B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of big data processing, and in particular to a sorting processing method and device, computer equipment, a storage medium and a computer program product. BACKGROUND
[0002] At present, components for realizing list sorting, such as the el-table (table component) of ElementUI (a set of UI component library), can provide basic sorting functions, but when sorting the list content of a number type, the list content is defaulted as string content. For example, for the list content of a number type, the first number is sorted first, and the second number is sorted in the next round, and so on until the end. That is, the sorting method for string content is used to sort the number content, resulting in incorrect sorting results for the list content of a number type, which cannot correctly meet the user's sorting requirements.
[0003] In addition, the existing table component el-table usually sorts the list content in the current page by the front end, which cannot meet the user's global sorting requirements, and when the user needs to view the original list, the list with changed sorting needs to be restored to the default order, and then the original list is displayed to the user, which cannot quickly meet the user's requirements.
[0004] Therefore, the sorting processing method in the prior art cannot balance global sorting and in-page sorting, and cannot correctly and quickly meet the user's requirements. SUMMARY
[0005] Therefore, it is necessary to provide a sorting processing method, device, computer equipment, computer readable storage medium and computer program product that can balance global sorting and in-page sorting and can correctly and quickly meet the user's requirements.
[0006] In a first aspect, the present application provides a sorting processing method, comprising:
[0007] copying a to-be-sorted list to obtain a copied list, and determining a sorting type and a sorting parameter for the to-be-sorted list;
[0008] in a case where the sorting type represents global sorting, passing the sorting parameter to a back end, obtaining a sorting result returned by the back end, and the back end being configured to sort the copied list according to the sorting parameter by dynamically adjusting a structured query statement to obtain the sorting result;
[0009] In the case of sorting in the page-in-page-out sorting type characterization page, the data column in the copy list serving as the basis for sorting is determined based on the sorting parameter, the current page-in-data in the copy list is sorted based on the sorting rule matched with the data type corresponding to the data column, and a sorting result is obtained.
[0010] In a second aspect, the application further provides a sorting processing apparatus, comprising:
[0011] a list copying module, configured to copy a to-be-sorted list to obtain a copy list, and determine a sorting type and a sorting parameter of the to-be-sorted list;
[0012] a global sorting module, configured to, in the case of global sorting in the sorting type characterization, pass the sorting parameter to a back end, and acquire a sorting result returned by the back end, the back end being configured to sort the copy list according to the sorting parameter by dynamically adjusting a structured query language statement to obtain the sorting result;
[0013] a page-in sorting module, configured to, in the case of sorting in the page-in-page-out sorting type characterization, determine a data column in the copy list serving as the basis for sorting based on the sorting parameter, sort current page-in-data in the copy list based on a sorting rule matched with a data type corresponding to the data column, and obtain a sorting result.
[0014] In a third aspect, the application further provides a computer device, comprising a memory and a processor, the memory storing a computer program, and the processor implementing the steps of the above sorting processing method when executing the computer program.
[0015] In a fourth aspect, the application further provides a computer readable storage medium, storing a computer program, and the computer program implementing the steps of the above sorting processing method when executed by a processor.
[0016] In a fifth aspect, the application further provides a computer program product, comprising a computer program, and the computer program implementing the steps of the above sorting processing method when executed by a processor.
[0017] The sorting processing method, device, computer device, storage medium and computer program product copy the to-be-sorted list first to obtain a copied list, and determine a sorting type and a sorting parameter for the to-be-sorted list, so that subsequent sorting processing can be performed on the copied list according to the sorting type and the sorting parameter, without changing the order of data in the original to-be-sorted list. Therefore, when a user needs to view the original to-be-sorted list, the original to-be-sorted list can be quickly displayed to the user, thereby quickly meeting the user's query requirement. Specifically, in the case of global sorting represented by the sorting type, the sorting parameter is transmitted to the back end, the back end sorts the copied list according to the sorting parameter by dynamically adjusting a structured query language statement, obtains a sorting result, and returns the sorting result to the front end, thereby achieving global sorting. Further, in the case of page-in sorting represented by the sorting type, a data column serving as a sorting basis in the copied list is determined based on the sorting parameter, and the current page-in data in the copied list is sorted based on a sorting rule matched with the data type of the data column, thereby obtaining a sorting result, and thereby achieving page-in sorting. In page-in sorting, different sorting rules are used for different data types, and each data type can be correctly sorted. The entire process can take into account global sorting and page-in sorting, and can correctly and quickly meet the user's requirement. BRIEF DESCRIPTION OF DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the drawings needed to be used in the embodiments or the related art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.
[0019] Figure 1 An application environment diagram of the sorting processing method in an embodiment;
[0020] Figure 2 A flowchart of the sorting processing method in an embodiment;
[0021] Figure 3 A list diagram in a financial institution platform in an embodiment;
[0022] Figure 4 A flowchart of switching a front-end view in an embodiment;
[0023] Figure 5 A flowchart of determining a data column serving as a sorting basis in an embodiment;
[0024] Figure 6 A flowchart of sorting a data column of a string type in an embodiment;
[0025] Figure 7 a flowchart of a process for sorting data columns of a digital type in an embodiment;
[0026] Figure 8 a flowchart of a process for default sorting in a sort by category in an embodiment;
[0027] Figure 9 a flowchart of a process for sorting in another embodiment;
[0028] Figure 10 a block diagram of a sorting processing apparatus in an embodiment;
[0029] Figure 11 an internal structure diagram of a computer device in an embodiment. DETAILED DESCRIPTION
[0030] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not intended to limit the present application.
[0031] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of the relevant data need to comply with relevant regulations.
[0032] The sorting processing method provided by the embodiments of the present application can be applied to, for example, Figure 1The application environment shown. Among them, the terminal 102 communicates with the front end 104 through the network, and the front end 104 and the back end 106 can communicate through the interface protocol. The front end 104 can sort the to-be-sorted list imported by the user into the secondary encapsulated sorting component in response to the sorting instruction initiated by the user on the terminal 102. The data storage system can store the data required by the front end 104 for processing. The data storage system can be integrated on the front end 104, or placed on the cloud or other network servers. The front end 104 can copy the imported to-be-sorted list to obtain a copy list, and determine the sorting type and sorting parameters for the to-be-sorted list, so as to pass the sorting parameters to the back end 106 in the case that the sorting type represents global sorting, and obtain the sorting result returned by the back end 106, wherein the back end 106 is used to sort the copy list according to the sorting parameters by dynamically adjusting the structured query statement to obtain the sorting result. Further, in the case of classified sorting in the page sorting, the server 104 can determine the data column in the copy list as the basis for sorting based on the sorting parameters, and sort the current page data in the copy list based on the sorting rule matched with the data type corresponding to the data column to obtain the sorting result.
[0033] Among them, the terminal 102 can be but not limited to various personal computers, notebook computers, smart phones, tablet computers, Internet of Things devices, etc. The front end 104 and the back end 106 can be implemented by independent servers or server clusters composed of multiple servers, and the front end 104 and the back end 106 can be interconnected through an interface protocol, which can be the front end and the back end of a financial institution. Specifically, in the global sorting process, the front end 104 can pass the sorting parameters to the back end 106 in response to the sorting instruction initiated by the user through the terminal 102, and sort the data of the financial institution platform by the back end 106, and then the front end 104 can obtain and display the sorting result returned by the back end 106; in the page sorting process, the front end 104 can directly sort the data of the financial institution platform and display the sorting result to the user. The secondary encapsulated sorting component in the present application based on the existing el-table secondary encapsulation can implement the above sorting processing method, can be compatible with various sorting scenarios, and can meet the sorting needs of users in various scenarios.
[0034] In an exemplary embodiment, as Figure 2 shown, a sorting processing method is provided, and the method is applied to the front end 104 in Figure 1 for example, including the following steps 202 to 208. Among them:
[0035] Step 202, copying the to-be-sorted list to obtain a copy list, and determining the sorting type and sorting parameters for the to-be-sorted list.
[0036] The data in the list to be sorted can be data in a financial platform. The sorting type can include global sorting and in-page sorting. The in-page sorting can be classified into sorting by category, default sorting, and no sorting. The sorting by category can be sorting according to different sorting rules according to the data types of the data contents in the data columns used as the basis for sorting. The sorting parameter can include a field parameter and a sorting order. The field parameter is used to determine which column of data needs to be sorted. The sorting order includes ascending order, descending order, and default order.
[0037] Optionally, after the user logs in to the financial institution platform using the terminal and triggers a sorting instruction for the data in a certain list in the financial institution platform in the front-end page, the front end can copy the list to be sorted to obtain a copied list, and determine the sorting type and the sorting parameter for the list to be sorted.
[0038] For example, the front end can assign the value of the string representing the list to be sorted to the string representing the copied list, thereby copying the list to be sorted to obtain the original list to be sorted (original list) and the copied list.
[0039] For example, as shown in Figure 3 , a list diagram in a financial institution platform is provided. If the user clicks the upward arrow in the date, the front end can determine that the field parameter in the sorting parameter is date, and the sorting order in the sorting parameter is positive order. Further, if the user further selects global sorting, the front end can determine that the sorting type is global sorting. If the user further selects in-page sorting, the front end can determine that the sorting type is in-page sorting. As shown in Figure 3 , the sorting button has two arrows, one representing ascending order and the other representing descending order. However, when the ascending order button is clicked to sort, the ascending order button is clicked again to restore the default order. On the front-end page, the front end can prompt the user about the current sorting state by highlighting the button.
[0040] Step 204, in the case where the sorting type represents global sorting, the sorting parameter is transmitted to the back end to obtain the sorting result returned by the back end. The back end is used to sort the copied list according to the sorting parameter by dynamically adjusting the structured query statement to obtain the sorting result.
[0041] The structured query statement can be a SQL (structured query language) statement, which is a database query and programming language.
[0042] Optionally, in the case that the front end detects that the user selects the global sorting, the front end can send a parameter passing request to the back end through an interface protocol between the front end and the back end, pass the sorting parameter to the back end, and then obtain the sorting result returned by the back end.
[0043] Exemplarily, the cooperation mode between the front end and the back end can be as follows: in the case of global sorting, the back end performs paging on all data in the copy list, and returns one page of data to the front end at a time. The returned page of data can be the automatically returned first page of data, or the user-specified page of data.
[0044] In step 206, in the case of page-in sorting, the front end determines the data column in the copy list as the basis for sorting based on the sorting parameter, and then performs step 208 of sorting the data in the current page in the copy list based on the sorting rule matched with the data type corresponding to the data column, to obtain the sorting result.
[0045] The data type can include a string type and a number type, and different data types correspond to different sorting rules. When the data in the list to be sorted is large, the front end usually displays the data in the list to be sorted in pages. The data in the current page is the data in a certain page currently displayed by the front end. Page-in sorting is sorting only the data in the current page, without sorting the data in other pages not displayed.
[0046] Optionally, in the case of page-in sorting, the front end can determine the data column in the copy list as the basis for sorting based on the sorting parameter, so that the order of each row of data in the current page can be adjusted by subsequently sorting each row of data in the data column. Specifically, the front end can determine the sorting result of each row of data in the data column based on the sorting rule matched with the data type corresponding to the data column, so as to sort the data in the current page in the copy list, to obtain the sorting result. Further, after determining the sorting result, the front end can update the front-end view to display the sorting result to the user.
[0047] In the above sorting processing method, the list to be sorted is copied to obtain a copied list, and the sorting type and the sorting parameter for the list to be sorted are determined, so that subsequent sorting processing can be performed on the copied list according to the sorting type and the sorting parameter, without changing the order of data in the original list to be sorted, thereby quickly displaying the original list to be sorted to the user when the user needs to view the original list to be sorted, and thereby quickly meeting the user's query demand. Specifically, in the case of global sorting represented by the sorting type, the sorting parameter is transmitted to the backend, the backend sorts the copied list according to the sorting parameter by dynamically adjusting the structured query statement, obtains the sorting result, and returns the sorting result to the front end, thereby achieving global sorting. Further, in the case of page sorting represented by the sorting type, the data column in the copied list serving as the basis for sorting is determined based on the sorting parameter, and the current page data in the copied list is sorted based on the sorting rule matched with the data type corresponding to the data column, thereby obtaining the sorting result, and thereby achieving page sorting. In the page sorting, different sorting rules are used for different data types, and each data type can be correctly sorted. The entire process can take into account global sorting and page sorting, and can correctly and quickly meet the user's demand.
[0048] In one exemplary embodiment, as shown in Figure 4 After global sorting is completed, a flowchart for switching the front-end view is provided, including:
[0049] In step 402, in response to the page number switching instruction, the target page number indicated by the page number switching instruction is transmitted to the backend.
[0050] After global sorting is completed, the backend will automatically return the first page data in the sorted list to the front end, and the front end will display the sorting result of the first page in the sorted list.
[0051] Optionally, the front end can determine the target page number indicated by the page number switching instruction in response to the page number switching instruction input by the user on the front-end page, and then transmit the target page number indicated by the page number switching instruction to the backend through the interface protocol between the front end and the backend.
[0052] For example, after the backend completes the classification sorting in the page sorting, the backend will automatically transmit the first page data in the sorted list to the front end for display. The user can switch the page to be viewed according to the demand. Taking the page number switching instruction sent by the user as an example to switch to the Xth page, the front end can analyze the page number parameter "X" input by the user in the page number switching instruction, and then send a request to the backend through the interface protocol between the front end and the backend, and send the page number parameter "X" representing the target page number to the backend.
[0053] Exemplarily, the backend can also automatically return the data of the Nth page in the list obtained after sorting in response to a configuration instruction of the user, and N can be configured by the user. In the case where the user does not configure, the data of the first page in the list obtained after sorting is automatically returned by default after the global sorting is completed.
[0054] At step 404, the data in the target page returned by the backend is obtained.
[0055] Optionally, after the page number parameter is transmitted to the backend by the front end, the backend extracts the data in the target page from the list obtained after sorting based on the page number parameter, and the data in the target page extracted is transmitted back to the front end through the interface protocol between the front end and the backend, so that the front end can obtain the data in the target page returned by the backend.
[0056] Exemplarily, taking switching to the Xth page represented by the page number switching instruction sent by the user as an example, the sorting result of the Xth page in the list obtained after sorting is transmitted back to the front end by the backend through the interface protocol between the front end and the backend, and then displayed.
[0057] At step 406, the data in the target page is displayed.
[0058] Optionally, after the data in the target page returned by the backend is received, the front end can update the current front-end view to display the data in the target page to the user.
[0059] In this embodiment, when the user needs to view the sorting result of the data in other pages, the front end can transmit the page number parameter to the backend, the backend can transmit the sorting result in the corresponding page back to the front end, and then the front end can display the sorting result in the corresponding page to the user, thereby meeting the user's demand.
[0060] In another embodiment, after the in-page sorting is completed, the front end can also automatically respond to the page number switching instruction of the user to display the sorting data in the target page selected by the user in the front-end view. The in-page sorting includes but is not limited to: classification sorting (sorting of string type data column, sorting of numerical type data column, default sorting), native sorting (sorting using a traditional el-table component), and no sorting.
[0061] In an exemplary embodiment, as shown in Figure 5 A flowchart for determining a data column as a sorting basis is provided, which includes:
[0062] At step 502, a field parameter is extracted from the sorting parameter.
[0063] Optionally, the front end can extract the field parameter from the sorting parameter to determine the data column used as the sorting basis, i.e., determine the data column selected by the user.
[0064] In each data column, a field parameter is configured to represent the attribute of the content of each row in the data column. The field parameter in each column, such as Figure 3 “Date”, “Name”, “Address”, etc. in the table, is generally fixed in the first row of each column.
[0065] For example, the front end can extract the field parameter from the sorting instruction triggered by the user. For example, if the user clicks the upward arrow in the “Date” column in Figure 3 , the front end will automatically extract the field parameter “Date” from the sorting instruction. Figure 3
[0066] Step 504, based on the field parameter, determine the data column used as the sorting basis from the copy list.
[0067] In the copy list, the first row of each column has a field representing the field parameter. As the sorting basis: the front end will adjust the sorting result of each row in the current page in the copy page table according to the sorting result of each row in the data column used as the sorting basis.
[0068] Optionally, the front end can traverse the field in the first row of each column in the copy list to determine the data column matching the extracted field parameter, and then determine the data column used as the sorting basis.
[0069] For example, if the field parameter selected by the user is “Date”, the front end can traverse the fields in the first row of each column in the copy list, such as “Date”, “Name”, “Address”, etc. The column whose first row field matches the field parameter “Date” is determined as the data column used as the sorting basis. Wherein, matching means: the first row field of the data column used as the sorting basis is the same as the field parameter. Figure 3
[0070] For example, the front end can traverse the first row field of each column in the copy list based on the text similarity algorithm in the natural language processing algorithm (NLP), i.e., compare the similarity between the first row field of each column and the field parameter, to determine the data column used as the sorting basis. The text similarity algorithm includes but is not limited to: cosine similarity, Euclidean distance, edit distance, to accurately measure the similarity between two texts.
[0071] In this embodiment, the data column selected by the user as the basis for sorting can be determined in response to a sorting instruction triggered by the user, and then the data in the current page can be sorted by sorting each row of data in the data column, thereby correctly meeting the user's demand.
[0072] In one exemplary embodiment, as shown in Figure 6 a flowchart for sorting a data column of string type is provided. Based on the sorting rule matched with the data type corresponding to the data column, the data in the current page in the copy list is sorted to obtain a sorting result, including:
[0073] In step 602, in the case where the data type corresponding to the data column is of string type, a character encoding correspondence table is obtained; the character encoding correspondence table stores the sorting relationship between various characters.
[0074] The character encoding correspondence table can be an ASCII code table, which is a set of character encodings based on Latin letters. The sorting relationship between various characters in the character encoding correspondence table can be 0~9<A~Z<a~z.
[0075] Optionally, the front end can perform data type identification on the content of each row in the data column, thereby determining the data type corresponding to the data column. In the case where the data type corresponding to the data column is of string type, the front end can obtain a pre-configured character encoding correspondence table from the data storage system.
[0076] Exemplarily, the front end can perform data type identification on the content of each row in the data column through a regular expression. The regular expression can match with the content of each row based on a specific matching mechanism, thereby determining which data type the content of each row in the data column belongs to.
[0077] In step 604, based on the character encoding correspondence table and the data of each row of the data column in the current page, the data in the current page in the copy list is sorted according to the sorting order in the sorting parameter, and a sorting result is obtained.
[0078] Optionally, the front end can compare the ASCII code values of the data content between any two rows based on the character encoding correspondence table and the data of each row of the data column in the current page, and determine the sorting result of each row of data in the current page of the data column according to the ASCII code values of each row of data in the data column according to the sorting order in the sorting parameter, such as ascending or descending, thereby sorting the data in the current page in the copy list to obtain a sorting result.
[0079] Exemplarily, in the process of comparing the ASCII code values of the data contents between any two rows one by one, taking the string a in the A-th row and the string b in the B-th row as an example, the front end can determine the size relationship between the string a and the string b by comparing the ASCII code values of each character in the string a and the string b in turn, and then determine the sorting order between the A-th row and the B-th row.
[0080] Exemplarily, taking the data column of "user number" as an example, if the sorting order is ascending, and the ASCII code value of the data content in the A-th row > the ASCII code value of the data content in the B-th row > the ASCII code value of the data content in the C-th row, after the in-page data in the current page in the copy list is sorted, the row number of the data content in the A-th row > the row number of the data content in the B-th row > the row number of the data content in the C-th row in the in-page data in the current page.
[0081] In this embodiment, for the data column of the string type, the front end sorts based on the size of the ASCII code value of each row of data in the data column, so as to realize correct sorting of the data of the string type, and can correctly meet the sorting demand of the user.
[0082] In an example embodiment, as shown in Figure 7 a flowchart for sorting the data column of the number type is provided. Based on the sorting rule matched with the data type corresponding to the data column, the in-page data in the current page in the copy list is sorted to obtain a sorting result, including:
[0083] In step 702, in the case that the data type corresponding to the data column is the number type, the assignment mode for the default field in the data column is determined based on the sorting order in the sorting parameter.
[0084] The default field is a certain row of data in the data column that is abnormal, missing or empty.
[0085] Optionally, the front end can determine the data type corresponding to the data column by identifying the data content of each row in the data column. In the case that the data type corresponding to the data column is the number type, the front end will determine the assignment mode for the default field in the data column based on the sorting order in the sorting parameter, such as ascending or descending.
[0086] Exemplarily, if the sorting order is ascending, the front end can assign the default field in the data column as "Infinity", i.e. positive infinity, so that each row of data corresponding to the default field is at the end of the sorting result after ascending sorting, so as to be uniformly viewed by the user.
[0087] Exemplarily, if the sorting order is descending, the front end can assign a default field in the data column with a value of "-Infinity", i.e., negative infinity, so that each row of data corresponding to the default field is at the end of the sorting result after descending sorting, so as to be uniformly viewed by the user.
[0088] At step 704, the default field in the data column is assigned based on the assignment mode, to obtain an updated data column.
[0089] Optionally, the front end can assign the default field in the data column based on the assignment mode matched with the sorting order, to obtain an updated data column.
[0090] Exemplarily, if the sorting order is ascending, all the default fields in the updated data column are "Infinity"; if the sorting order is descending, all the default fields in the updated data column are "-Infinity".
[0091] At step 706, based on each row of data of the updated data column in the current page, the data in the current page in the copied list is sorted according to the sorting order, to obtain a sorting result.
[0092] Optionally, for each row of data of the updated data column in the current page, the front end can determine the sorting result of each row of data of the updated data column in the current page according to the sorting order based on the value of each row of data, so as to sort the data in the current page in the copied list, to obtain a sorting result.
[0093] Exemplarily, if the sorting order is ascending, the front end can ensure that the difference between the previous row of data and the next row of data in the adjacent two rows of data of the data column is less than or equal to 0 during the sorting process; if the sorting order is descending, the front end can ensure that the difference between the previous row of data and the next row of data in the adjacent two rows of data of the data column is greater than or equal to 0 during the sorting process. Regardless of ascending or descending, the default field is at the end of the sorting result.
[0094] In this embodiment, the default field can be assigned to make the default field at the end of the sorting result in ascending or descending sorting, which is beneficial for the user to uniformly view the data in the row of the missing field. In addition, in this embodiment, the difference between the adjacent two rows is used to realize accurate sorting of the data column of the number type, rather than directly sorting the data column of the number type based on the sorting rule of the string type as in the traditional el-table, which leads to incorrect sorting of the data column of the number type.
[0095] In one exemplary embodiment, as shown in Figure 8 a flowchart of default sorting in classification sorting is provided, comprising:
[0096] Step 802, in the case that the sorting type is the sorting in the page and the sorting order in the sorting parameter is the default order, the current page data in the original list is determined.
[0097] After the list to be sorted is copied, the original list and the copied list can be obtained.
[0098] Optionally, in the case that the sorting type is the sorting in the page and the sorting order in the sorting parameter is the default order, the front end can determine that the sorting type is the default sorting in the page sorting, and determine the current page data in the original list based on the page number of the list data currently displayed in the front end view.
[0099] For example, in the front end view, the sorting result of the Xth page after the sorting (the sorting order is ascending or descending) is currently displayed, if the user selects the default sorting, the front end can obtain the data in the Xth page from the original list, and take the data in the Xth page in the original list as the current page data in the original list.
[0100] Step 804, the current page data in the original list is displayed as the sorting result.
[0101] Optionally, even if the front end view displays the sorting result of a page in the list after sorting, the front end can quickly obtain the default data (the original data without changing the data order) of the page from the original list, and take the obtained default data of the page as the current page data in the original list, and then update the front end view to display the current page data in the original list as the sorting result.
[0102] In this embodiment, after the list data to be sorted is copied, the original list data to be sorted, i.e., the original list, is retained, so that when the user needs to view the original list to be sorted, even if the sorting has been performed, the sorted list after the change does not need to be restored to the original state, but the original list can be quickly obtained from the data storage system and displayed to the user, so that the user's query demand can be quickly met.
[0103] In another embodiment, if the data type is the native sorting in the page sorting, the front end imports the copied list into the traditional el-table component, obtains the sorting result returned by the el-table component, and updates the front end view. It should be noted that, Figure 7 The sorting method for the numerical list data in the above embodiment is an optimization of the native sorting in the el-table, which can realize the correct sorting of the numerical content, thereby solving the problem that the traditional el-table cannot correctly sort the numerical list data.
[0104] In one embodiment, asFigure 9 As shown, a flowchart of another sorting processing method is provided, mainly including the following steps:
[0105] The front end can first copy the to-be-sorted list to obtain a copied list, and determine the sorting type and sorting parameter for the to-be-sorted list, and then determine whether it is global sorting.
[0106] In the case that the sorting type represents global sorting, the front end can pass the sorting parameter to the back end, and the back end sorts based on the sorting parameter to obtain the sorting result returned by the back end, wherein the back end is used to sort the copied list by dynamically adjusting the structured query statement according to the sorting parameter to obtain the sorting result.
[0107] In the case that the sorting type represents page sorting, the front end can first determine which one of the classification sorting, native sorting, and no sorting the sorting type is.
[0108] If it is classification sorting, the front end further determines which one of the ascending order, descending order, and default order the sorting order is. If it is ascending order or descending order, the data type corresponding to the data column is determined to be which one of the numerical type and the string type by using a regular expression. If it is a numerical type, a default field is assigned a value, and the sorting result is obtained according to the numerical value in the ascending order or descending order, and the front-end view is updated. If it is a string type, the sorting result is obtained according to the string encoding table, and the front-end view is updated. If it is a default order, the default sorting is performed, the page data in the original list is obtained, the page data in the original list is used as the sorting result, and the front-end view is updated.
[0109] Further, if it is native sorting, the copied list is imported into a traditional el-table component, the sorting result returned by the el-table component is obtained, and the front-end view is updated. If it is not sorted, the flow is stopped.
[0110] It should be understood that although each step in the flowchart involved in each of the above embodiments is displayed in sequence according to the arrow, these steps are not necessarily executed in the order indicated by the arrow. Unless otherwise stated herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other orders. Moreover, at least part of the steps in the flowchart involved in each of the above embodiments can include multiple steps or stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or steps or stages in other steps.
[0111] Based on the same inventive concept, the embodiments of the present application further provide a sorting processing apparatus for implementing the sorting processing method as described above. The apparatus provides a solution to the problem similar to the solution as described in the above method, and thus the specific limitations in one or more sorting processing apparatus embodiments provided below can refer to the limitations of the sorting processing method as described above, and will not be described here again.
[0112] In one exemplary embodiment, as shown in Figure 10 a sorting processing apparatus is provided, comprising: a list copying module 1002, a global sorting module 1004, and an intra-page sorting module 1006, wherein:
[0113] The list copying module is configured to copy the to-be-sorted list to obtain a copied list, and determine a sorting type and a sorting parameter of the to-be-sorted list.
[0114] The global sorting module is configured to, in a case where the sorting type represents global sorting, pass the sorting parameter to a backend, and obtain a sorting result returned by the backend, wherein the backend is configured to sort the copied list according to the sorting parameter by dynamically adjusting a structured query language to obtain the sorting result.
[0115] The intra-page sorting module is configured to, in a case where the sorting type represents intra-page sorting, determine a data column in the copied list as a sorting basis based on the sorting parameter, and sort current intra-page data in the copied list based on a sorting rule matched with a data type corresponding to the data column to obtain a sorting result.
[0116] In the above sorting processing apparatus, the list to be sorted is copied to obtain a copied list, and the sorting type and the sorting parameter for the list to be sorted are determined, so that subsequent sorting processing can be performed on the copied list according to the sorting type and the sorting parameter, without changing the order of data in the original list to be sorted, thereby quickly displaying the original list to be sorted to the user when the user needs to view the original list to be sorted, and thereby quickly meeting the query requirement of the user. Specifically, in the case of global sorting represented by the sorting type, the sorting parameter is transmitted to the backend, the copied list is sorted by the backend according to the sorting parameter through dynamic adjustment of a structured query statement to obtain a sorting result, and the sorting result returned by the backend is obtained to realize global sorting. Further, in the case of page sorting represented by the sorting type, the data column in the copied list serving as a basis for sorting is determined based on the sorting parameter, and the current page data in the copied list is sorted based on a sorting rule matched with the data type corresponding to the data column to obtain a sorting result, thereby realizing page sorting. In the page sorting, different sorting rules are used for list contents of different data types, and each type of data can be correctly sorted. The entire process can take into account global sorting and page sorting, and can correctly and quickly meet the requirement of the user.
[0117] In one embodiment, the sorting result returned by the backend is the first page data in the list obtained after sorting. The sorting processing apparatus further includes a page number switching module configured to, in response to a page number switching instruction, transmit a target page number indicated by the page number switching instruction to the backend, obtain data in the target page number returned by the backend, and display the data in the target page number.
[0118] In one embodiment, each data column is configured with a field parameter representing the attribute of the data content in the data column. The page sorting module is further configured to extract the field parameter from the sorting parameter, and determine the data column serving as a basis for sorting from the copied list based on the field parameter.
[0119] In one embodiment, the page sorting module is further configured to, in the case that the data type corresponding to the data column is a string type, obtain a character encoding correspondence table, store the sorting relationship between various characters in the character encoding correspondence table, and sort the current page data in the copied list according to the sorting order in the sorting parameter based on the character encoding correspondence table and the data in each row in the current page of the data column to obtain a sorting result.
[0120] In one embodiment, the in-page sorting module is further configured to, in a case where the data type corresponding to the data column is a numerical type, determine an assignment manner for the default field in the data column based on the sorting order in the sorting parameter; assign the default field in the data column based on the assignment manner to obtain an updated data column; and sort the data in the current page in the copy list based on the updated data column in each row of data in the current page according to the sorting order to obtain a sorting result.
[0121] In one embodiment, after copying the list to be sorted, an original list and a copy list are obtained. The sorting processing apparatus further includes a default sorting module configured to, in a case where the sorting type represents in-page sorting and the sorting order in the sorting parameter is a default order, determine the data in the current page in the original list; and display the data in the current page in the original list as a sorting result.
[0122] The modules in the sorting processing apparatus can be implemented in whole or in part by software, hardware, or a combination thereof. The modules can be embedded in or independent of a processor in a computer device in hardware form, or stored in a memory in the computer device in software form, so as to be called and executed by the processor to perform the operations corresponding to the modules.
[0123] In one exemplary embodiment, a computer device is provided, which can be a terminal, and an internal structure diagram of the computer device can be as shown in Figure 11 The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected through a system bus, and the communication interface, the display unit, and the input device are connected to the system bus through the input / output interface. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is configured to exchange information between the processor and external devices. The communication interface of the computer device is configured to perform wired or wireless communication with external terminals, and the wireless communication can be achieved through WIFI, mobile cellular network, NFC (near field communication), or other technologies. The computer program is executed by the processor to implement a sorting processing method. The display unit of the computer device is configured to form a visually visible picture, which can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or can be a key, a trackball, or a touchpad arranged on the shell of the computer device, or can be an external keyboard, a touchpad, or a mouse, etc.
[0124] Those skilled in the art can understand, Figure 11 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0125] In an exemplary embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, and the processor implementing the steps in the above method embodiments when executing the computer program.
[0126] In an embodiment, a computer readable storage medium is provided, storing a computer program, and the computer program is executed by a processor to implement the steps in the above method embodiments.
[0127] In an embodiment, a computer program product is provided, including a computer program, and the computer program is executed by a processor to implement the steps in the above method embodiments.
[0128] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. The non-volatile memory can include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric memory (Ferroelectric Random Access Memory, FRAM), phase change memory (Phase Change Memory, PCM), graphene memory, etc. The volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, etc. As an illustration but not limitation, the RAM can be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.
[0129] Any combination of the technical features of the above embodiments can be made. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist contradictory, it should be considered as the scope of the present application.
[0130] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent of the present application. It should be noted that for those skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are within the scope of protection of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A method of sorting processing, characterized by, The method comprises: copying a to-be-sorted list to obtain a copied list, and determining a sorting type and a sorting parameter for the to-be-sorted list; in a case where the sorting type represents global sorting, passing the sorting parameter to a backend to obtain a sorting result returned by the backend, the backend being configured to page all data in the copied list, and sorting data in each page after paging according to the sorting parameter by dynamically adjusting a structured query language to obtain the sorting result; in a case where the sorting type represents page-in sorting, determining a data column in the copied list as a sorting basis based on the sorting parameter, and sorting data in a current page in the copied list based on a sorting rule matched with a data type corresponding to the data column to obtain the sorting result; the sorting of the data in the current page in the copied list based on the sorting rule matched with the data type corresponding to the data column to obtain the sorting result comprises: in a case where the data type corresponding to the data column is a numerical type, determining an assignment mode for a default field in the data column based on a sorting order in the sorting parameter, assigning the default field in the data column based on the assignment mode to obtain an updated data column, and sorting the data in the current page in the copied list according to the sorting order and a difference between adjacent two rows of data in the current page of the updated data column to obtain the sorting result.
2. The method of claim 1, wherein, the sorting result returned by the backend is a first page data in a list obtained after sorting; the method further comprises: in response to a page number switching instruction, passing a target page number indicated by the page number switching instruction to a backend; obtaining data in the target page number returned by the backend; displaying the data in the target page number.
3. The method of claim 1, wherein, each of the data columns is configured with a field parameter used to represent an attribute to which data content in the data column belongs; the determination of the data column in the copied list as the sorting basis based on the sorting parameter comprises: extracting a field parameter from the sorting parameter; and determining the data column in the copied list as the sorting basis based on the field parameter.
4. The method of claim 1, wherein, the sorting of the data in the current page in the copied list based on the sorting rule matched with the data type corresponding to the data column to obtain the sorting result comprises: in a case where the data type corresponding to the data column is a string type, obtaining a character encoding correspondence table; the character encoding correspondence table stores sorting relationships between various characters; based on the character encoding correspondence table and each row of data of the data column in the current page, sorting the data in the current page in the copied list according to a sorting order in the sorting parameter to obtain the sorting result.
5. The method of claim 1, wherein, after copying the to-be-sorted list, an original list and the copied list are obtained; the method further comprises: in a case where the sorting type represents page-in sorting and a sorting order in the sorting parameter is a default order, determining data in a current page in the original list; displaying the data in the current page in the original list as the sorting result.
6. A sorting processing device, characterized by comprising: the apparatus comprises: The list copying module is configured to copy a to-be-sorted list to obtain a copied list, and determine a sorting type and a sorting parameter of the to-be-sorted list; The global sorting module is configured to, in a case where the sorting type represents global sorting, pass the sorting parameter to a backend, and obtain a sorting result returned by the backend. The backend is configured to page all data in the copied list, sort data in each page after paging according to the sorting parameter by dynamically adjusting a structured query language, and obtain the sorting result. The in-page sorting module is configured to, in a case where the sorting type represents in-page sorting, determine a data column in the copied list as a sorting basis based on the sorting parameter, and sort data in a current page in the copied list according to a sorting rule matched with a data type corresponding to the data column to obtain a sorting result. The sorting rule matched with the data type corresponding to the data column includes, in a case where the data type corresponding to the data column is a numerical type, determining an assignment mode of a default field in the data column based on a sorting order in the sorting parameter, assigning the default field in the data column according to the assignment mode to obtain an updated data column, and sorting the data in the current page in the copied list according to the sorting order and a difference between adjacent two rows of data in the current page of the updated data column to obtain the sorting result.
7. The apparatus of claim 6, wherein, The sorting result returned by the backend is a first page of data in a list obtained after sorting. The apparatus further includes: The page number switching module is configured to, in response to a page number switching instruction, pass a target page number indicated by the page number switching instruction to the backend, obtain data in the target page number returned by the backend, and display the data in the target page number.
8. The apparatus of claim 6, wherein, Each of the data columns is configured with a field parameter representing an attribute of data content in the data column. The in-page sorting module is further configured to extract the field parameter from the sorting parameter, and determine the data column as the sorting basis based on the field parameter.
9. The apparatus of claim 6, wherein, The in-page sorting module is further configured to, in a case where the data type corresponding to the data column is a string type, obtain a character encoding correspondence table, store a sorting relationship between various characters in the character encoding correspondence table, and sort the data in the current page in the copied list according to the sorting order in the sorting parameter based on the character encoding correspondence table and each row of data in the current page of the data column to obtain the sorting result.
10. The apparatus of claim 6, wherein, After copying the to-be-sorted list, an original list and the copied list are obtained. The apparatus further includes: The default sorting module is configured to, in a case where the sorting type represents in-page sorting by category and a sorting order in the sorting parameter is a default order, determine data in a current page in the original list, and display the data in the current page in the original list as a sorting result. 11.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-10. The processor, when executing the computer program, implements the steps of the method in any one of claims 1 to 5.
12. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program, which when executed by a processor, implements the steps of the method of any one of claims 1 to 5.
13. A computer program product comprising a computer program, characterized in that, The computer program, which when executed by a processor, implements the steps of the method of any one of claims 1 to 5.
Citation Information
Patent Citations
Data sorting method and device, electronic medium and storage medium
CN112527847A
Sorting method, computing device and computer storage medium
CN116304398A