|
@@ -171,7 +171,27 @@ public class ProductSortServiceImpl implements IProductSortService { |
|
@@ -171,7 +171,27 @@ public class ProductSortServiceImpl implements IProductSortService { |
171
|
List<JSONObject> jsonObjectList = new ArrayList<>();
|
171
|
List<JSONObject> jsonObjectList = new ArrayList<>();
|
172
|
JSONObject jsonObject;
|
172
|
JSONObject jsonObject;
|
173
|
for (ProductSort productSort : productSorts) {
|
173
|
for (ProductSort productSort : productSorts) {
|
174
|
- if (productSort.getParentId() == null || productSort.getParentId() == 0) {
|
174
|
+ if ((productSort.getParentId() == null || productSort.getParentId() == 0) && PRODUCT_SORT_LEVEL_1.equals(productSort.getLevel())) {
|
|
|
175
|
+ jsonObject = new JSONObject();
|
|
|
176
|
+ jsonObject.put("id", productSort.getId());
|
|
|
177
|
+ jsonObject.put("text", productSort.getSortName());
|
|
|
178
|
+ jsonObjectList.add(jsonObject);
|
|
|
179
|
+ }
|
|
|
180
|
+ }
|
|
|
181
|
+ if (CollectionUtils.isEmpty(jsonObjectList)) {
|
|
|
182
|
+ jsonObject = new JSONObject();
|
|
|
183
|
+ jsonObjectList.add(jsonObject);
|
|
|
184
|
+ }
|
|
|
185
|
+ return jsonObjectList;
|
|
|
186
|
+ }
|
|
|
187
|
+
|
|
|
188
|
+ @Override
|
|
|
189
|
+ public List<JSONObject> getLevel2SortIdAndName() {
|
|
|
190
|
+ List<ProductSort> productSorts = this.getAllProcutSort();
|
|
|
191
|
+ List<JSONObject> jsonObjectList = new ArrayList<>();
|
|
|
192
|
+ JSONObject jsonObject;
|
|
|
193
|
+ for (ProductSort productSort : productSorts) {
|
|
|
194
|
+ if ((productSort.getParentId() != null || productSort.getParentId() != 0) && PRODUCT_SORT_LEVEL_2.equals(productSort.getLevel())) {
|
175
|
jsonObject = new JSONObject();
|
195
|
jsonObject = new JSONObject();
|
176
|
jsonObject.put("id", productSort.getId());
|
196
|
jsonObject.put("id", productSort.getId());
|
177
|
jsonObject.put("text", productSort.getSortName());
|
197
|
jsonObject.put("text", productSort.getSortName());
|
|
@@ -180,8 +200,6 @@ public class ProductSortServiceImpl implements IProductSortService { |
|
@@ -180,8 +200,6 @@ public class ProductSortServiceImpl implements IProductSortService { |
180
|
}
|
200
|
}
|
181
|
if (CollectionUtils.isEmpty(jsonObjectList)) {
|
201
|
if (CollectionUtils.isEmpty(jsonObjectList)) {
|
182
|
jsonObject = new JSONObject();
|
202
|
jsonObject = new JSONObject();
|
183
|
- /*jsonObject.put("id", "");
|
|
|
184
|
- jsonObject.put("text", "");*/
|
|
|
185
|
jsonObjectList.add(jsonObject);
|
203
|
jsonObjectList.add(jsonObject);
|
186
|
}
|
204
|
}
|
187
|
return jsonObjectList;
|
205
|
return jsonObjectList;
|