From 1442f149019ee0590389abd7a88a79c4d9b59034 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期二, 27 五月 2025 18:23:34 +0800
Subject: [PATCH] bug修改

---
 ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/RecoveryClassifyController.java |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/RecoveryClassifyController.java b/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/RecoveryClassifyController.java
index 1ee45c9..2d3d346 100644
--- a/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/RecoveryClassifyController.java
+++ b/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/RecoveryClassifyController.java
@@ -5,7 +5,9 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.admin.entity.RecoveryClassify;
 import com.ruoyi.admin.service.RecoveryClassifyService;
+import com.ruoyi.admin.service.SiteService;
 import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.security.annotation.RequiresPermissions;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -33,12 +35,14 @@
     @Resource
     private RecoveryClassifyService recoveryClassifyService;
 
+
     /**
      * 回收分类分页列表
      *
      * @param pageNum  页码
      * @param pageSize 每页显示条数
      */
+    @RequiresPermissions("serve_recycling_classification")
     @ApiOperation(value = "回收分类分页查询列表", tags = {"后台-回收管理-回收分类管理"})
     @GetMapping(value = "/page")
     @ApiImplicitParams({
@@ -49,8 +53,21 @@
                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
         return R.ok(recoveryClassifyService.lambdaQuery().eq(RecoveryClassify::getIsDelete, 0)
                 .orderByDesc(RecoveryClassify::getSupClassify)
+                .orderByAsc(RecoveryClassify::getSort)
                 .orderByDesc(RecoveryClassify::getCreateTime)
                 .page(Page.of(pageNum, pageSize)));
+    }
+
+
+    @ApiOperation(value = "分类下拉框", tags = {"后台-下拉框"})
+    @GetMapping(value = "/select")
+
+    public R<List<RecoveryClassify>> select(String className) {
+        return R.ok(recoveryClassifyService.lambdaQuery().eq(RecoveryClassify::getIsDelete, 0)
+                .orderByDesc(RecoveryClassify::getSupClassify).like(className!=null&&className!="", RecoveryClassify::getSubClassify,className)
+                .orderByAsc(RecoveryClassify::getSort)
+                .orderByDesc(RecoveryClassify::getCreateTime)
+                .list());
     }
 
     /**
@@ -58,6 +75,7 @@
      *
      * @param id 回收分类id
      */
+    @RequiresPermissions("classification_detail")
     @ApiOperation(value = "回收分类详情", tags = {"后台-回收管理-回收分类管理"})
     @GetMapping(value = "/detail")
     @ApiImplicitParams({
@@ -68,10 +86,31 @@
     }
 
     /**
+     * 是否首页推荐
+     */
+    @RequiresPermissions("classification_recommend")
+    @ApiOperation(value = "是否首页推荐", tags = {"后台-回收管理-回收分类管理"})
+    @GetMapping(value = "/recommend")
+    @ApiImplicitParams({
+            @ApiImplicitParam(value = "分类id", name = "id", dataType = "Integer", required = true),
+            @ApiImplicitParam(value = "是否推荐 0未推荐;1已推荐", name = "recommend", dataType = "Integer", required = true)
+    })
+    public R<String> recommend(@RequestParam Integer id, @RequestParam Integer recommend) {
+        Integer[] arr = {0, 1};
+        boolean contains = Arrays.stream(arr).collect(Collectors.toList()).contains(recommend);
+        if (!contains) {
+            return R.fail("推荐状态异常!");
+        }
+        return recoveryClassifyService.lambdaUpdate().set(RecoveryClassify::getIsRecommend, recommend)
+                .eq(RecoveryClassify::getId, id).update() ? R.ok() : R.fail();
+    }
+
+    /**
      * 新增回收分类
      *
      * @param recoveryClassify 回收分类信息
      */
+    @RequiresPermissions("classification_save")
     @ApiOperation(value = "新增回收分类", tags = {"后台-回收管理-回收分类管理"})
     @PostMapping(value = "/save")
     public R<String> save(@RequestBody RecoveryClassify recoveryClassify) {
@@ -83,6 +122,7 @@
      *
      * @param recoveryClassify 回收分类信息
      */
+    @RequiresPermissions("classification_update")
     @ApiOperation(value = "修改回收分类", tags = {"后台-回收管理-回收分类管理"})
     @PostMapping(value = "/update")
     public R<String> update(@RequestBody RecoveryClassify recoveryClassify) {
@@ -94,6 +134,7 @@
      *
      * @param ids 回收分类多条id拼接
      */
+    @RequiresPermissions("classification_delete")
     @ApiOperation(value = "批量删除回收分类", tags = {"后台-回收管理-回收分类管理"})
     @GetMapping(value = "/batchDelete")
     @ApiImplicitParams({

--
Gitblit v1.7.1