From ecad870fe1896c8c3e48506d50bb5818974253bf Mon Sep 17 00:00:00 2001
From: fangyuan <527392886@qq.com>
Date: 星期一, 16 一月 2023 11:33:58 +0800
Subject: [PATCH] 机场公安前后端联调内容

---
 ycl-platform/src/main/java/com/ycl/controller/NewsInformationController.java |   50 +++++++++++++++++++++++++++++---------------------
 1 files changed, 29 insertions(+), 21 deletions(-)

diff --git a/ycl-platform/src/main/java/com/ycl/controller/NewsInformationController.java b/ycl-platform/src/main/java/com/ycl/controller/NewsInformationController.java
index bc16c12..48c451a 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/NewsInformationController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/NewsInformationController.java
@@ -68,8 +68,8 @@
      */
     @GetMapping("{id}")
     @ApiOperation(value = "鎸塱d鏌ヨ鏁版嵁")
-    public R selectOne(@PathVariable Serializable id) {
-        return success(this.newsInformationService.getById(id));
+    public R selectOne(@PathVariable Integer id) {
+        return success(this.newsInformationService.selectInformationById(id));
     }
 
     /**
@@ -114,25 +114,27 @@
     @ApiOperation(value = "淇敼鏁版嵁")
     @Transactional
     public R update(@RequestBody NewsInformation newsInformation) {
-        Integer informationId = newsInformation.getId();
-        if (newsInformation.getIsSign()==0){
-            newsInformationPoliceService.remove(new QueryWrapper<NewsInformationPolice>().eq("news_information_id",informationId));
-            List<String> departmentIds = newsInformation.getDepartmentId();
-            for (String departmentId:departmentIds){
-                QueryWrapper<NewsPolice> wrapper = new QueryWrapper();
-                wrapper.eq("news_department_id",departmentId);
-                List<NewsPolice> list = policeService.list(wrapper);
-                if (!list.isEmpty()){
-                    for (NewsPolice newsPolice:list){
-                        newsInformationPoliceService.save(NewsInformationPolice.builder().newsPoliceId(newsPolice.getId()).newsInformationId(informationId).isSign(0).build());
-                    }
-                }
-            }
-        }
-        newsColumnInformationService.remove(new QueryWrapper<NewsColumnInformation>().eq("information_id",informationId));
-        for (String columnId:newsInformation.getColumnId()){
-            newsColumnInformationService.save(NewsColumnInformation.builder().columnId(Integer.parseInt(columnId)).informationId(informationId).build());
-        }
+//        Integer informationId = newsInformation.getId();
+//        if (newsInformation.getIsSign()==0){
+//            newsInformationPoliceService.remove(new QueryWrapper<NewsInformationPolice>().eq("news_information_id",informationId));
+//            List<String> departmentIds = newsInformation.getDepartmentId();
+//            for (String departmentId:departmentIds){
+//                QueryWrapper<NewsPolice> wrapper = new QueryWrapper();
+//                wrapper.eq("news_department_id",departmentId);
+//                List<NewsPolice> list = policeService.list(wrapper);
+//                if (!list.isEmpty()){
+//                    for (NewsPolice newsPolice:list){
+//                        newsInformationPoliceService.save(NewsInformationPolice.builder().newsPoliceId(newsPolice.getId()).newsInformationId(informationId).isSign(0).build());
+//                    }
+//                }
+//            }
+//        }
+//        newsColumnInformationService.remove(new QueryWrapper<NewsColumnInformation>().eq("information_id",informationId));
+//        for (String columnId:newsInformation.getColumnId()){
+//            newsColumnInformationService.save(NewsColumnInformation.builder().columnId(Integer.parseInt(columnId)).informationId(informationId).build());
+//        }
+
+//        return success(this.newsInformationService.updateInformationById(newsInformation));
         return success(this.newsInformationService.updateInformationById(newsInformation));
     }
 
@@ -145,6 +147,12 @@
     @DeleteMapping
     @ApiOperation(value = "鍒犻櫎鏁版嵁")
     public R delete(@RequestParam("idList") List<Long> idList) {
+        if (idList==null||idList.size()==0){
+            return failed("璇烽�夋嫨涓�涓埞杞﹀啘鎴峰璞�");
+        }
+        for (long id:idList){
+            newsColumnInformationService.remove(new QueryWrapper<NewsColumnInformation>().eq("information_id",id));
+        }
         return success(this.newsInformationService.removeByIds(idList));
     }
 }

--
Gitblit v1.8.0