From b044d9fbf64ebf7e7beae0b7c49e5f39c6ac620c Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期一, 09 十二月 2024 15:30:59 +0800
Subject: [PATCH] 12.9

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 59 insertions(+), 0 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
index 783f4e0..913d2b3 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
@@ -2,6 +2,7 @@
 
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.security.service.TokenService;
@@ -109,6 +110,64 @@
     }
 
 
+    @ApiOperation(value = "添加", tags = {"后台-分享管理"})
+    @PostMapping("/manage/add")
+    public R<Void> manage(@RequestBody Share share){
+        Long userid = tokenService.getLoginUser().getUserid();
+        share.setAddType(1);
+            share.setAuditStatus(ShareAuditStatus.SUCCESS.getCode());
+            share.setObjectId(userid.toString());
+        share.setDelFlag(0);
+        shareService.save(share);
+        return R.ok();
+    }
+
+    @ApiOperation(value = "编辑", tags = {"后台-分享管理"})
+    @PostMapping("/manage/edit")
+    public R<Void> manageedit(@RequestBody Share share){
+
+        shareService.updateById(share);
+        return R.ok();
+    }
+
+    @ApiOperation(value = "删除", tags = {"后台-分享管理"})
+    @GetMapping("/manage/delete")
+    public R<Void> managedelete(@RequestParam Integer id){
+
+        shareService.removeById(id);
+        return R.ok();
+    }
+
+    @ApiOperation(value = "列表", tags = {"后台-分享管理"})
+    @GetMapping("/manage/list")
+    public R<Page<Share>> managelist(String name,Integer addType,@RequestParam Integer PageNum,Integer pageSize){
+        Page<Share> page = shareService.lambdaQuery().like(name != null, Share::getName, name).eq(addType != null, Share::getAddType, addType).page(Page.of(pageSize, pageSize));
+        return R.ok(page);
+    }
+
+    @ApiOperation(value = "设为小程序分享", tags = {"后台-分享管理"})
+    @GetMapping("/manage/set")
+    public R<Void> set(@RequestParam Integer id){
+        //将所有分享设为不是小程序分享
+        List<Share> list = shareService.lambdaQuery().list();
+        if (!list.isEmpty()){
+            for (Share share : list) {
+                share.setAppletShare(0);
+            }
+            shareService.updateBatchById(list);
+        }
+        //设置小程序分享
+        Share byId = shareService.getById(id);
+        byId.setAppletShare(1);
+        shareService.updateById(byId);
+        return R.ok();
+    }
+
+
+
+
+
+
 
 
 }

--
Gitblit v1.7.1