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/NewsColumnController.java |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/ycl-platform/src/main/java/com/ycl/controller/NewsColumnController.java b/ycl-platform/src/main/java/com/ycl/controller/NewsColumnController.java
index 63916a4..973c586 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/NewsColumnController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/NewsColumnController.java
@@ -6,8 +6,14 @@
 import com.baomidou.mybatisplus.extension.api.ApiController;
 import com.baomidou.mybatisplus.extension.api.R;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ycl.dto.ColumnDto;
+import com.ycl.entity.NewsChannelColumn;
 import com.ycl.entity.NewsColumn;
+import com.ycl.service.NewsChannelColumnService;
 import com.ycl.service.NewsColumnService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
@@ -22,12 +28,16 @@
  */
 @RestController
 @RequestMapping("newsColumn")
+@Api(tags = "鏍忕洰绠$悊")
 public class NewsColumnController extends ApiController {
     /**
      * 鏈嶅姟瀵硅薄
      */
     @Resource
     private NewsColumnService newsColumnService;
+
+    @Autowired
+    private NewsChannelColumnService newsChannelColumnService;
 
     /**
      * 鍒嗛〉鏌ヨ鎵�鏈夋暟鎹�
@@ -37,6 +47,7 @@
      * @return 鎵�鏈夋暟鎹�
      */
     @GetMapping
+    @ApiOperation(value = "鏌ヨ鎵�鏈夋暟鎹�")
     public R selectAll(Page<NewsColumn> page, NewsColumn newsColumn) {
         return success(this.newsColumnService.page(page, new QueryWrapper<>(newsColumn)));
     }
@@ -48,6 +59,7 @@
      * @return 鍗曟潯鏁版嵁
      */
     @GetMapping("{id}")
+    @ApiOperation(value = "鎸塱d鏌ヨ鏁版嵁")
     public R selectOne(@PathVariable Serializable id) {
         return success(this.newsColumnService.getById(id));
     }
@@ -55,12 +67,16 @@
     /**
      * 鏂板鏁版嵁
      *
-     * @param newsColumn 瀹炰綋瀵硅薄
+     * @param columnDto 瀹炰綋瀵硅薄
      * @return 鏂板缁撴灉
      */
     @PostMapping
-    public R insert(@RequestBody NewsColumn newsColumn) {
-        return success(this.newsColumnService.save(newsColumn));
+    @ApiOperation(value = "鏂板鏁版嵁")
+    public R insert(@RequestBody ColumnDto columnDto) {
+        List<String> columnId = columnDto.getChannelId();
+        this.newsColumnService.save(columnDto.getNewsColumn());
+        columnId.stream().forEach(item->newsChannelColumnService.save(NewsChannelColumn.builder().channelId(Integer.parseInt(item)).columnId(columnDto.getNewsColumn().getId()).build()));
+        return success(columnDto).setMsg("鎵ц鎴愬姛");
     }
 
     /**
@@ -70,6 +86,7 @@
      * @return 淇敼缁撴灉
      */
     @PutMapping
+    @ApiOperation(value = "淇敼鏁版嵁")
     public R update(@RequestBody NewsColumn newsColumn) {
         return success(this.newsColumnService.updateById(newsColumn));
     }
@@ -81,8 +98,10 @@
      * @return 鍒犻櫎缁撴灉
      */
     @DeleteMapping
+    @ApiOperation(value = "鍒犻櫎鏁版嵁")
     public R delete(@RequestParam("idList") List<Long> idList) {
         return success(this.newsColumnService.removeByIds(idList));
     }
+
 }
 

--
Gitblit v1.8.0