Просмотр исходного кода

营销类别排序逻辑优化

hu 1 год назад
Родитель
Сommit
19bb879468

+ 2 - 1
src/custom/restcontroller/sale/item/Item.java

@@ -87,7 +87,7 @@ public class Item extends Controller {
              */
             for (Row row1 : toprows) {
                 Rows rows1 = getSubItemclass(row1, allrows);
-                Collections.sort(rows1, new SortByNum());
+                //Collections.sort(rows1, new SortByNum());
                 row1.put("subdep", rows1);
             }
             row.put("ttemclass", toprows);
@@ -115,6 +115,7 @@ public class Item extends Controller {
      */
     private Rows getSubItemclass(Row root, Rows allItemclasss) {
         Rows childrenRows = allItemclasss.toRowsMap("parentid").get(root.getString("itemclassid"));
+        Collections.sort(childrenRows, new SortByNum());
         for (Row row : childrenRows) {
             row.put("subdep", getSubItemclass(row, allItemclasss));
         }

+ 1 - 1
src/custom/restcontroller/webmanage/sale/itemclass/SortByNum.java

@@ -23,7 +23,7 @@ public class SortByNum implements Comparator {
             s2int = Double.parseDouble(s2.getString("num"));
         }
         // System.out.println(s1int + "," + s2int);
-        if (s1int < s2int)
+        if (s1int > s2int)
             return 1;
         return -1;
     }

+ 3 - 2
src/custom/restcontroller/webmanage/sale/itemclass/itemclass.java

@@ -252,7 +252,7 @@ public class itemclass extends Controller {
 				 */
 				for (Row row1 : toprows) {
 					Rows rows1 = getSubItemclass(row1, allrows);
-					Collections.sort(rows1, new SortByNum());
+					//Collections.sort(rows1, new SortByNum());
 					row1.put("subdep", rows1);
 				}
 				row.put("ttemclass", toprows);
@@ -345,7 +345,7 @@ public class itemclass extends Controller {
 				 */
 				for (Row row1 : toprows) {
 					Rows rows1 = getSubItemclass(row1, allrows);
-					Collections.sort(rows1, new SortByNum());
+					//Collections.sort(rows1, new SortByNum());
 					row1.put("subdep", rows1);
 				}
 				row.put("ttemclass", toprows);
@@ -443,6 +443,7 @@ public class itemclass extends Controller {
 	 */
 	private Rows getSubItemclass(Row root, Rows allItemclasss) {
 		Rows childrenRows = allItemclasss.toRowsMap("parentid").get(root.getString("itemclassid"));
+		Collections.sort(childrenRows, new SortByNum());
 		for (Row row : childrenRows) {
 			row.put("subdep", getSubItemclass(row, allItemclasss));
 		}