A drag-and-drop sorting method for list elements in a multi-level grouped device management platform.
By employing a local sorting mechanism and a high-precision index calculation method, the problems of large sorting computation and high database I/O overhead in multi-level data structures are solved, enabling an efficient drag-and-drop sorting process and improving system response speed and processing performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- FUZHOU WECON ELECTRONICS TECH
- Filing Date
- 2025-12-23
- Publication Date
- 2026-05-26
AI Technical Summary
Existing drag-and-drop sorting technology suffers from problems such as high sorting computation, high database I/O overhead, and system response latency in multi-level data structures and large data volume scenarios.
By introducing a local sorting mechanism based on preorder and postorder sorting values, the sorting value calculation is completed by relying on only a limited number of adjacent sorting values. A preset precision threshold is set to pre-determine the separability of the sorting value. Under the condition of satisfying separability, a local sorting density sensing and multi-model sorting value generation mechanism is introduced to avoid the accumulation of invalid calculations.
It achieves consistency and efficiency in cross-group and intra-group sorting, significantly reduces database write operations and system load, and significantly improves the system's response speed and processing performance in massive data and high-concurrency environments.
Smart Images

Figure CN122086895A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer data processing technology, and mainly to a drag-and-drop sorting method for list elements based on multi-level grouping in a device management platform. Background Technology
[0002] With the widespread adoption of cloud computing, the Internet of Things (IoT), and big data technologies, the sortable data structures involved in systems are becoming increasingly complex. Especially in application scenarios such as device management, task scheduling, configuration orchestration, and permission tree structure management, data is often not just represented as a single linear list, but rather as a tree-like or nested structure with multi-level grouping or hierarchical relationships. For example, an enterprise device management platform may be divided into multiple groups based on region, business line, or device type, with each group containing hundreds or even tens of thousands of data records. Users need to adjust the group order by dragging and dropping, or move elements within and between groups, to achieve personalized display, scheduling, and priority management.
[0003] Traditional implementations typically rely on sorting algorithms for single-level consecutive integer sequences, assigning each element an integer field as a sorting weight (e.g., 0, 1, 2, 3...). When a user adjusts the element order, the sorting value of that element and all subsequent elements needs to be recalculated based on their insertion position. A significant problem arises: when an element in the middle of the list is moved to a new position, the system must update the sorting field of all elements after that position. In databases, this operation can trigger a large number of writes and lock contention when dealing with large datasets, leading to high database I / O load, response time delays, and decreased system throughput. Furthermore, in multi-level grouping scenarios, in addition to the element's own sorting field, there may also be linked updates to group-level sorting fields. Summary of the Invention
[0004] This invention discloses a drag-and-drop sorting method for list elements of devices or group nodes in a device management platform, belonging to the field of data processing and sorting optimization technology. This method mainly addresses the problems of high computational load, high database I / O overhead, and system response latency inherent in existing drag-and-drop sorting technologies in multi-level data structures and large data volume scenarios. According to a first aspect of this invention, a drag-and-drop sorting method for list elements of devices or group nodes in a device management platform is proposed, specifically including: Receive a drag-and-drop sorting request initiated by the client, parse the drag-and-drop sorting request, and obtain the object to be inserted (element), the target group (group), the previous sorting value (a), and the next sorting value (b). Check if the target group is empty: If the target group is empty, initialize the sort value of the object to be inserted to the preset base value. If the target group is not empty, proceed to the next processing step. Based on the existence of the preceding sort value a and the following sort value b, the insertion type of the object to be inserted is determined, including first insertion, first insertion, middle insertion and last insertion; Based on the preceding sort value a and the following sort value b, a precision check is performed to determine whether |ab| is less than a preset precision threshold. When |ab| is less than the precision threshold When |ab| is not less than the precision threshold, a full reordering process for objects within the target group is triggered. Calculate the sorting value; Based on the determined insertion type, a new sort value for the object to be inserted is generated using the corresponding sort value calculation model. ,in: For the first insertion, let = ; For the insertion at the beginning, let =b- ; For insertion in the middle, let =(a+b) / 2; For tail insertion, let =a+ ; in, The preset positive real number interval parameter; The new sort value The value is assigned to the object to be inserted, and its group is updated to the target group; the updated sort value and group information are written to the database to complete the drag-and-drop sorting process.
[0005] Furthermore, the step of parsing the drag-and-drop sorting request includes: Obtain the unique identifier of the object to be inserted, the target group identifier, the preceding sort value 'a' and the following sort value 'b' of the target insertion position, and determine whether the target insertion position is at the beginning, end, or middle position of the target group based on the null values of 'a' and 'b'. When both 'a' and 'b' are null, it is determined to be the first insertion position.
[0006] Furthermore, the full reordering process includes: reassigning a sorting value to each object according to its current display order within the target group, wherein the sorting value is calculated using the following formula: = +i , where i is the ordinal index of the object within the target group.
[0007] Furthermore, the sorting value is a high-precision real number used to uniquely determine the relative order of objects within the same group, and the smaller the sorting value, the earlier the object is in the group.
[0008] Furthermore, when the drag-and-drop sorting request is a cross-group drag-and-drop request, the group identifier of the object to be inserted is updated simultaneously while updating the sorting value of the object to be inserted.
[0009] Furthermore, the accuracy threshold With interval parameters To reduce the frequency of sorting value conflicts and full reordering by pre-configuring parameters based on business scale.
[0010] Furthermore, the accuracy detection further includes the following steps: Based on the preceding sort value a and the following sort value b, a local sorting interval is determined that contains only the adjacent objects before and after the insertion position, wherein the local sorting interval does not contain any other objects in the target group other than the preceding and following objects. Within the local sorting interval, calculate the numerical difference between the preceding sorting value 'a' and the following sorting value 'b', and then compare this numerical difference with a preset precision threshold. Compare the local sorting intervals to determine whether they possess the divisibility condition for generating unique sorting values. When the local sorting interval satisfies the separability condition, the current sorting operation is determined to be a local sorting operation, and the traversal sorting process for the target group is prohibited from being triggered. In the case of a local sorting operation, the new sorting value of the object to be inserted is calculated solely based on the preceding sorting value 'a' and the following sorting value 'b' using a preset mathematical model. The mathematical model does not depend on the total number of objects in the target group or the absolute position index of the objects in the target group; The new sort value Write the data to the data record corresponding to the object to be inserted, and keep the sort values of other objects in the target group unchanged to complete the local sorting operation.
[0011] According to a second aspect of the present invention, a computer program product is provided, on which one or more computer programs are stored, which, when executed by a computer processor, implement the method described above.
[0012] The above-described one or more technical solutions in the embodiments of this application have at least one of the following technical effects: This invention introduces a local sorting mechanism based on preceding and subsequent sorting values during drag-and-drop sorting. Without traversing all objects within the target group, it calculates sorting values using only a limited number of adjacent sorting values, thus maintaining the time complexity of the sorting process at a constant level. By setting a preset precision threshold to pre-determine the separability of sorting values, and further introducing a local sorting density-aware and multi-model sorting value generation mechanism when the separability condition is met, the sorting value calculation process maintains numerical distinguishability and sorting stability even in high-frequency drag-and-drop scenarios. When the local sorting space cannot meet the precision requirements, a controlled re-sorting process for a specific group can be triggered, avoiding the accumulation of invalid calculations. Through this hierarchical sorting mechanism and high-precision index calculation method, this invention achieves consistency and efficiency in cross-group and intra-group sorting, significantly reduces database write operations and system load, and significantly improves the system's response speed, processing performance and scalability in massive data and high-concurrency environments. Attached Figure Description
[0013] The accompanying drawings are included to provide a further understanding of the embodiments and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments and, together with the description, serve to explain the principles of the invention. Other embodiments and many anticipated advantages of the embodiments will be readily recognized as they become better understood through reference to the following detailed description. Elements in the drawings are not necessarily to scale. The same reference numerals refer to corresponding similar parts.
[0014] Figure 1 A flowchart illustrating a drag-and-drop sorting method for list elements based on multi-level grouping in a device management platform, according to an embodiment of the present invention, is shown.
[0015] Figure 2 A schematic diagram of the process for receiving a sorting request according to an embodiment of the present invention is shown.
[0016] Figure 3 A schematic diagram of the target position sorting value calculation and accuracy check process according to an embodiment of the present invention is shown.
[0017] Figure 4 A schematic diagram of a device grouping and dragging sorting scenario according to an embodiment of the present invention is shown.
[0018] Figure 5 This is a schematic diagram of the structure of a computer system suitable for implementing the electronic devices of the present application embodiments. Detailed Implementation
[0019] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.
[0020] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0021] Figure 1 A flowchart illustrating a drag-and-drop sorting method for list elements based on multi-level grouping in a device management platform, according to an embodiment of the present invention, is shown, specifically including: S1. Receive drag-and-drop sorting request, parse target element information, the order values of the elements before and after the target position, and the group into which the target element will be moved.
[0022] The receiving of drag-and-drop sorting requests is as follows: Figure 2 As shown, it specifically includes: S1.1 Receive the sorting operation request initiated by the client; S1.2 Parse the parameters contained in the request: the object to be inserted (element), the target group (group), the preceding sort value (a), and the following sort value (b); S1.3 Determine if the target group is empty: If the group is empty: neither a nor b is set with a sort value; If the group is not empty: proceed to the next step of the process; S1.4 Determine if the target location is within the boundary conditions: If it is at the boundary, further distinguish whether it is the head boundary or the tail boundary: Head boundary: a. Set the sort value of the first element; Tail boundary: b. Set the sort value of the tail element. If not at the boundary: directly obtain the sorting values (a, b) corresponding to the target element.
[0023] The present invention provides a high-precision real number for sorting values, which are used to uniquely determine the relative order of objects within the same group, and the smaller the sorting value, the earlier the object is in the group.
[0024] S2. Monitor accuracy and determine whether a full reordering is triggered.
[0025] like Figure 3 As shown, the calculation and accuracy check of the target location sorting value specifically includes: S2.1 Receives four core input parameters as sorting criteria: a: Preorder sort value, the preorder sort value of the element to be inserted (i.e., the sort value of the "previous element" in the list, a∈R); b: Post-order sort value, the post-order sort value of the element to be inserted (i.e., the sort value of the "next element" in the list, b∈R); element: An object reference to the element to be inserted; group: The group into which the target element will be moved.
[0026] S2.2 Determine the insertion position based on the existence of a and b, and the sorting value of the new element according to the existence of a and b. ( R), determine the insertion type: First insertion: a and b are both null (when inserting the first element into the list, the initial sort value is the pivot value). ∈R); First insertion: 'a' is not null, 'b' is null (elements are inserted at the beginning of the list, without a "previous element", this must be guaranteed). <b); Insertion between two existing elements: a and b are not null (the element is inserted between two existing elements, and a < b must be less than null). <b); Tail insertion: 'a' is null, 'b' is not null (the element is inserted at the end of the list, there is no "next element", so 'a < b' must be true). ).
[0027] S2.3, High-precision data processing; S2.3.1, Precision Overflow Detection Function: When |ab|< ( The minimum distinguishable precision can be set according to business needs; a higher precision is recommended to reduce the possibility of triggering reordering. When this occurs, it is considered a precision overflow (unable to generate unique and distinguishable values). ): ; S2.3.2, Exception Handling Decision Tree: Within the overflow threshold: proceed to the next step of calculating the sorting value. .
[0028] Beyond the overflow threshold: Perform a full rearrangement, redistributing the sort values of elements within the specific group where the precision overflow occurred according to their existing order, following the rules: = +i ; The base value is a custom value (which can be set to any real number), i is the sequential index of the element (i=0,1,2,...,n−1, where n is the total number of elements), and δ is a custom interval (which can be set to any positive real number, and can be set according to business needs; it is recommended to set a higher precision to reduce the possibility of triggering reordering). S2.3.3, Adopt a hierarchical decision-making mechanism; The above two steps first involve setting a precision threshold. Quickly determine the difference between the preceding and following sorted values to ascertain whether the current insertion position is still within a range of values that can be locally sorted. If the numerical difference satisfies the separability condition, the local sorting enhancement sub-step is then entered to further refine the sorting value generation process.
[0029] The preset precision threshold judgment is used as a pre-judgment condition for local sorting processing to avoid performing sorting value calculation in intervals where the values are indivisible. The local sorting enhancement sub-step is used to select different sorting values to generate the model based on the local sorting density state at the current insertion position, provided that the separability condition is met.
[0030] The local sorting enhancement sub-step specifically includes: Based on the preceding sort value a and the following sort value b, a local sorting interval is determined that contains only the adjacent objects before and after the insertion position, wherein the local sorting interval does not contain any other objects in the target group other than the preceding and following objects. Within the local sorting interval, calculate the numerical difference between the preceding sorting value 'a' and the following sorting value 'b', and then compare this numerical difference with a preset precision threshold. Compare the local sorting intervals to determine whether they possess the divisibility condition for generating unique sorting values. When the local sorting interval satisfies the separability condition, the current sorting operation is determined to be a local sorting operation, and the traversal sorting process for the target group is prohibited from being triggered. In the case of a local sorting operation, the new sorting value of the object to be inserted is calculated solely based on the preceding sorting value 'a' and the following sorting value 'b' using a preset mathematical model. The mathematical model does not depend on the total number of objects in the target group or the absolute position index of the objects in the target group; The new sort value Write the data to the data record corresponding to the object to be inserted, and keep the sort values of other objects in the target group unchanged to complete the local sorting operation.
[0031] S2.4 Concurrency consistency control; S2.4.1 Upon receiving a drag-and-drop sorting request, in addition to obtaining the preceding sorting value 'a' and the following sorting value 'b', the sorting version label associated with the preceding and following objects is also obtained. and The sorting version identifier is used to characterize the current valid state of the sorting value of the corresponding object; S2.4.2 Compare the sorted version identifiers and ,when and If they are equal, the current insertion position is determined to be in a consistent local sorting state, and the subsequent local sorting calculation process is allowed; when and If they are not equal, it is determined that the current insertion position is in a concurrent update state, and the local conflict handling process is initiated. S2.4.3. When the concurrent update state is determined, the objects within the target group are not traversed; instead, the latest previous order value is retrieved again. Post-order sorting value and its corresponding sorting version identifier, and based on the and Reconstruct the local sorting computation context; S2.4.4 After completing the local sort value calculation and generating the new sort value Then, a new sorting version identifier is assigned to the object to be inserted. The sorting version identifier and the sorting value update operation are written together into the corresponding data record.
[0032] S2.4.5 By comparing and updating the sorting version identifier, concurrent drag-and-drop sorting operations for the same target group only cause conflict detection within the local sorting interval, and do not introduce global locking or full traversal operations for the target group.
[0033] Concurrency consistency control prevents two drag-and-drop requests from simultaneously generating the same Snew based on the same a and b. It only compares a constant number of fields, does not introduce locks on the entire table, and does not traverse the entire table, making it highly secure in the case of big data processing.
[0034] S3. Dynamically calculate the new index value based on the sorting values of the preceding and following elements; Differentiated mathematical modeling methods are used to generate sorting values for new elements based on different insertion types. ; S3.1, Initial insertion of the calculation model into the list = ,in, is the initial sorting reference value, which can be set to any real number according to business requirements (it is recommended to take 0 for easy calculation of the interval when inserting at the head and tail later); S3.2. Head Insertion Calculation Model =b - , where is a positive real number interval parameter, which can be adjusted to any positive real number according to business requirements. Core constraint: > 0, ensuring that < b, adapting to scenarios where b is negative, a decimal, etc., and maintaining the monotonicity of sorting.
[0035] S3.3. Middle Insertion Calculation Model =(a + b) / 2, Mathematical proof: For any real numbers a and b, if a < b, then there must be a < < b, which naturally satisfies the monotonicity constraint of middle insertion and adapts to all real number scenarios, expressed as: ; S3.4. Tail Insertion Calculation Model =a + , where is a positive real number interval coefficient, which can be adjusted to any positive real number according to business requirements. Core constraint: > 0, ensuring that > a, adapting to scenarios where a is negative, a decimal, etc., and maintaining the monotonicity of sorting.
[0036] S4. Assign a new sorting value to the element; S4.1. Calculate the new sorting value After that, the system performs the following operations: Generate a database update instruction for the moved element (such as an SQL UPDATE statement), and update the sorting value field corresponding to the unique identifier (ID) of the element ( = , which is the sorting value of the target element). This operation only involves modifying a single record, and the database I / O overhead is extremely small.
[0037] S4.2. Update the group to which the element belongs to a new group, and perform the following operations: Generate a database update instruction for updating the group to which the element belongs (such as an SQL UPDATE statement), and update the group attribution field corresponding to the element ( = group, the group to which the element belongs).
[0038] The above model guarantees correctness based on the following theorem: 1. For any real numbers a < b, there must be a < <b; For any real number a and positive real number , it is necessary that a + > a, b - < b, ensuring that the sorting values are strictly monotonous in all scenarios.
[0039] 2. The generated based on the above formula has no duplicates with the original element sequence values (in the rearrangement scenario, uniqueness is further ensured through equidistant distribution).
[0040] Based on a specific embodiment of the present invention, take the equipment management platform of Company A as an example. The company has multiple devices and needs to perform multi-level grouping management according to "region sub-region". The initial grouping structure is shown in the following figure. Each device and grouping has an initial high-precision sorting value assigned based on the method of the present invention (for example, the initial reference value = 0, the interval = 1, the threshold = 0.001).
[0041] As Figure 4 shown, under the root grouping, there is a first-level grouping, the East China Region grouping. Under the East China Region grouping, there are four second-level groupings, namely Fujian Province, Zhejiang Province, Jiangsu Province, and Anhui Province. Each grouping has its own grouped devices. This is a clear three-level grouping model of "region province device". Each node defines its own identity, location, and order through three attributes: id, group, and sort.
[0042] The figure shows the hierarchical device list data structure managed by the present invention. Each node (whether it is a grouping or a specific device) contains at least the following three core attributes, which are the cornerstones for implementing efficient drag-and-drop sorting: 1. id (unique identifier): The unique identity ID of each node (grouping or device) in the system, usually the primary key, used to accurately locate and operate a specific node. For example, when dragging, through the id, it is known which device or grouping the user is moving.
[0043] 2. group (id of the parent grouping): Indicates which parent grouping this node directly belongs to. Its value is the id of the parent grouping, determining which grouping the device or grouping belongs to. For example, in the above figure, the East China Region grouping is the parent grouping of the Fujian Province grouping, so the group value of the Fujian Province grouping is the id value of the East China Region grouping. If the group value of a grouping or device is 0, it means it is a root-level grouping (such as "East China Region" in the above figure).
[0044] 3. `sort` (sort value): A high-precision real number (such as a floating-point number) used to determine the order of all sibling nodes under the same parent group. The smaller the `sort` value, the earlier the node appears in the list. The new position can be determined with a single mathematical calculation, avoiding large-scale data updates.
[0045] like Figure 4 As shown, an action of dragging and dropping devices across groups (Zhejiang Province group) is implemented. (Fujian Province group).
[0046] 1. Operational Intent: The user wants to remove device G from the Zhejiang Province group and insert it between device A and device B in the Fujian Province group.
[0047] 2. System parsing of drag-and-drop requests: When the user releases the mouse, the system will parse the following key parameters: element (the dragged element): device G (its id=10 is known).
[0048] a(sort value of the element preceding the target position): the sort value of device A, i.e. 0.000.
[0049] b (sort value of the element following the target position): The sort value of device B, i.e., 1.000.
[0050] group(target group ID): The ID of the Zhejiang Province group, which is 2.
[0051] 3. Algorithm Application: (1) Situation judgment: This is a typical "intermediate insertion" (both a and b are not null); (2) Accuracy check: Use the formula |a−b|< ; |ab|=1.000, which is much greater than the system's preset minimum precision (such as 0.001), so it is considered normal and no full re-sorting is required; (3) Calculate the new sort value: .
[0052] 4. Perform the update: The database update command (such as an SQL UPDATE statement) for this moved element needs to be updated to the target group ID because the drag operation is a cross-group drag. Only one request is needed to modify two fields of the record for device G: the attributes of device G (id=10, group=9, sort=0.000) are changed to (id=10, group=2, sort=0.500).
[0053] Update the group field to 2 (belonging to Zhejiang Province group) and the sort field to 0.500.
[0054] After the update, device G is correctly displayed between device A and device B in the Zhejiang Province group. The entire process requires only a single record update; the sort values of device A, device B, and other elements within the group do not need to be changed. Compared to the traditional integer sequence method, which requires batch updates of all subsequent elements, this method greatly improves efficiency and reduces database load.
[0055] In summary, this invention discloses a drag-and-drop sorting method for large data list elements that supports multi-level grouping, belonging to the field of data processing and sorting optimization technology. This method mainly addresses the problems of high computational load, high database I / O overhead, and system response latency inherent in existing drag-and-drop sorting techniques in multi-level data structures and large data volume scenarios.
[0056] The core of this invention lies in the following: When a drag-and-drop request is received, the system first identifies the level (group level or within a group) to which the dragged target belongs, and determines the sorting values of the adjacent elements or groups. Then, a new high-precision sorting index value is calculated for the dragged object using a specific dynamic sorting algorithm. Regardless of whether the object is moved within a group, across groups, or the group itself adjusts its order, the system only needs to update the sorting index value of the single object to complete the reordering, without needing to update other elements or groups in batches. This keeps the time complexity of the entire sorting process at O(1) in most cases, and only when a full reordering is triggered does the time complexity become O(n), where n is the number of elements in the affected group.
[0057] Through this hierarchical sorting mechanism and high-precision index calculation method, this invention achieves consistency and efficiency in cross-group and intra-group sorting, significantly reduces database write operations and system load, and significantly improves the system's response speed, processing performance and scalability in massive data and high-concurrency environments.
[0058] The following is for reference. Figure 5 It shows a schematic diagram of the structure of a computer system 500 suitable for implementing electronic devices according to embodiments of the present application. Figure 5 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0059] like Figure 5As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 502 or programs loaded from storage section 508 into random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of the system 500. The CPU 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0060] The following components are connected to I / O interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a liquid crystal display (LCD) and speakers, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card and a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to I / O interface 505 as needed. A removable medium 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 510 as needed so that computer programs read from it can be installed into storage section 508 as needed.
[0061] Specifically, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by central processing unit (CPU) 501, it performs the functions defined in the methods of this application. It should be noted that the computer-readable storage medium of this application can be a computer-readable signal medium or a computer-readable storage medium or any combination thereof. The computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can also be any computer-readable storage medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. Program code contained on a computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0062] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages—such as Java, Smalltalk, and C++—as well as conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0063] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0064] The modules described in the embodiments of this application can be implemented in software or in hardware.
[0065] On the other hand, this application also provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The aforementioned computer-readable storage medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to: receive a drag-and-drop sorting request initiated by a client; parse the drag-and-drop sorting request; obtain the object to be inserted (element), the target group (group), the preceding sorting value (a), and the following sorting value (b); determine whether the target group is empty; and when the target group is empty, initialize the sorting value of the object to be inserted to a preset baseline value. Based on the existence of the preceding sort value 'a' and the following sort value 'b', the insertion type of the object to be inserted is determined; based on the preceding sort value 'a' and the following sort value 'b', a precision check is performed; according to the determined insertion type, a new sort value for the object to be inserted is generated using the corresponding sort value calculation model. ; the new sorting value The value is assigned to the object to be inserted, and its group is updated to the target group; the updated sort value and group information are written to the database to complete the drag-and-drop sorting process.
[0066] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described inventive concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.
Claims
1. A method for dragging and sorting list elements of devices or group nodes in a device management platform, characterized in that, include: Receive a drag-and-drop sorting request initiated by the client, parse the drag-and-drop sorting request, and obtain the object to be inserted (element), the target group (group), the previous sorting value (a), and the next sorting value (b). Check if the target group is empty: If the target group is empty, initialize the sort value of the object to be inserted to the preset base value. ; If the target group is not empty, proceed to the next processing step; Based on the existence of the preceding sort value a and the following sort value b, the insertion type of the object to be inserted is determined, including first insertion, first insertion, middle insertion and last insertion; Based on the preceding sort value a and the following sort value b, a precision check is performed to determine whether |ab| is less than a preset precision threshold. When |ab| is less than the precision threshold When |ab| is not less than the precision threshold, a full reordering process for objects within the target group is triggered. Calculate the sorting value; Based on the determined insertion type, a new sort value for the object to be inserted is generated using the corresponding sort value calculation model. ,in: For the first insertion, let = ; For the insertion at the beginning, let =b- ; For insertion in the middle, let =(a+b) / 2; For tail insertion, let =a+ ; in, The preset positive real number interval parameter; The new sort value The value is assigned to the object to be inserted, and its group is updated to the target group; the updated sort value and group information are written to the database to complete the drag-and-drop sorting process.
2. The list element drag-and-drop sorting method according to claim 1, characterized in that, The steps for parsing the drag-and-drop sorting request include: Obtain the unique identifier of the object to be inserted, the target group identifier, the preceding sort value 'a' and the following sort value 'b' of the target insertion position, and determine whether the target insertion position is at the beginning, end, or middle position of the target group based on the null values of 'a' and 'b'. When both 'a' and 'b' are null, it is determined to be the first insertion position.
3. The list element drag-and-drop sorting method according to claim 1, characterized in that, The full reordering process includes: reassigning a sorting value to each object according to its current display order within the target group, wherein the sorting value is calculated using the following formula: = +i , where i is the ordinal index of the object within the target group.
4. The list element drag-and-drop sorting method according to claim 1, characterized in that, The sorting value is a high-precision real number used to uniquely determine the relative order of objects within the same group, and the smaller the sorting value, the earlier the object is in the group.
5. The list element drag-and-drop sorting method according to claim 1, characterized in that, When the drag-and-drop sorting request is a cross-group drag-and-drop request, the group identifier of the object to be inserted is updated simultaneously while updating the sorting value of the object to be inserted.
6. The list element drag-and-drop sorting method according to claim 1, characterized in that, The precision threshold With interval parameters To reduce the frequency of sorting value conflicts and full reordering by pre-configuring parameters based on business scale.
7. The list element drag-and-drop sorting method according to claim 1, characterized in that, The accuracy detection further includes the following steps: Based on the preceding sort value a and the following sort value b, a local sorting interval is determined that contains only the adjacent objects before and after the insertion position, wherein the local sorting interval does not contain any other objects in the target group other than the preceding and following objects. Within the local sorting interval, calculate the numerical difference between the preceding sorting value 'a' and the following sorting value 'b', and then compare this numerical difference with a preset precision threshold. Compare the local sorting intervals to determine whether they possess the divisibility condition for generating unique sorting values. When the local sorting interval satisfies the separability condition, the current sorting operation is determined to be a local sorting operation, and the traversal sorting process for the target group is prohibited from being triggered. In the case of a local sorting operation, the new sorting value of the object to be inserted is calculated solely based on the preceding sorting value 'a' and the following sorting value 'b' using a preset mathematical model. The mathematical model does not depend on the total number of objects in the target group or the absolute position index of the objects in the target group; The new sort value Write the data to the data record corresponding to the object to be inserted, and keep the sort values of other objects in the target group unchanged to complete the local sorting operation.
8. A computer program product, characterized in that, It stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1-7.
9. A computing system, characterized in that, It includes a processor and a memory, the processor being configured to perform the method as described in any one of claims 1-7.