From 69ee7c605579c009ee3c087fa265619ba55155f6 Mon Sep 17 00:00:00 2001
From: fangyuan <527392886@qq.com>
Date: 星期五, 18 十一月 2022 10:57:33 +0800
Subject: [PATCH] 资讯相关接口,栏目相关接口

---
 ycl-platform/src/main/java/com/ycl/controller/NewsInformationPoliceController.java |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/ycl-platform/src/main/java/com/ycl/controller/NewsInformationPoliceController.java b/ycl-platform/src/main/java/com/ycl/controller/NewsInformationPoliceController.java
index ca6d89f..48cf832 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/NewsInformationPoliceController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/NewsInformationPoliceController.java
@@ -64,15 +64,22 @@
     }
 
     /**
-     * 淇敼鏁版嵁
+     * 淇敼淇℃伅鎴栫鏀剁姸鎬�
      *
      * @param newsInformationPolice 瀹炰綋瀵硅薄
      * @return 淇敼缁撴灉
      */
     @PutMapping
-    public R update(@RequestBody NewsInformationPolice newsInformationPolice) {
+    public R updateSignStatus(@RequestBody NewsInformationPolice newsInformationPolice) {
+        if (newsInformationPolice.getId()==null){
+            QueryWrapper<NewsInformationPolice> wrapper = new QueryWrapper<>();
+            NewsInformationPolice one = newsInformationPoliceService.getOne(wrapper.eq("news_information_id", newsInformationPolice.getNewsInformationId()).eq("news_police_id", newsInformationPolice.getNewsPoliceId()));
+            one.setIsSign(1);
+            return success(this.newsInformationPoliceService.updateById(one));
+        }
         return success(this.newsInformationPoliceService.updateById(newsInformationPolice));
     }
+
 
     /**
      * 鍒犻櫎鏁版嵁
@@ -84,5 +91,19 @@
     public R delete(@RequestParam("idList") List<Long> idList) {
         return success(this.newsInformationPoliceService.removeByIds(idList));
     }
+
+    /**
+     * 閫氳繃璧勮id鏌ヨ鎬绘暟鍜屽凡闃呬汉鏁�
+     *
+     * @param id 涓婚敭
+     * @return 鍗曟潯鏁版嵁
+     */
+    @GetMapping("information/{id}")
+    public R selectListByInformationId(@PathVariable Serializable id) {
+        int sum = this.newsInformationPoliceService.count(new QueryWrapper<NewsInformationPolice>().eq("news_information_id", id));
+        int sign = this.newsInformationPoliceService.count(new QueryWrapper<NewsInformationPolice>().eq("news_information_id", id).eq("is_sign",1));
+        return success(sign+"/"+sum);
+    }
+
 }
 

--
Gitblit v1.8.0