Przeglądaj źródła

秒杀代码生成

guomengjiao 1 miesiąc temu
rodzic
commit
eeb33ccb75

+ 10 - 0
ruoyi-api/src/main/java/com/ruoyi/api/controller/merchant/ApiMerchantCategoryController.java

@@ -45,4 +45,14 @@ public class ApiMerchantCategoryController extends AbstractApiController {
         return R.ok(iMerchantCategoryService.queryList(bo));
     }
 
+    /**
+     * 加载顶级分类树
+     */
+    @FilePathSplicing(type = FilePathSplicingType.RESPONSE)
+    @ApiOperation("加载顶级分类树")
+    @GetMapping("/tree")
+    public R<List<MerchantCategoryVo>> loadTree(){
+        return R.ok(iMerchantCategoryService.loadTree(false));
+    }
+
 }

+ 2 - 1
ruoyi-shop/src/main/java/com/ruoyi/shop/merchant/service/impl/MerchantCategoryServiceImpl.java

@@ -85,7 +85,8 @@ public class MerchantCategoryServiceImpl implements IMerchantCategoryService {
         lqw.like(StringUtils.isNotBlank(bo.getCategoryName()), MerchantCategory::getCategoryName, bo.getCategoryName());
         lqw.eq(bo.getParentId() != null, MerchantCategory::getParentId, bo.getParentId());
         lqw.eq(bo.getShelvedStatus() != null, MerchantCategory::getShelvedStatus, bo.getShelvedStatus());
-        lqw.orderByAsc(MerchantCategory::getSortOrder);
+        lqw.orderByDesc(MerchantCategory::getSortOrder)
+            .orderByDesc(MerchantCategory::getCreateTime);
         return lqw;
     }