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/NewsPoliceController.java | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/ycl-platform/src/main/java/com/ycl/controller/NewsPoliceController.java b/ycl-platform/src/main/java/com/ycl/controller/NewsPoliceController.java
index f135613..815d910 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/NewsPoliceController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/NewsPoliceController.java
@@ -7,11 +7,17 @@
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ycl.entity.NewsPolice;
+import com.ycl.service.NewsAdminService;
import com.ycl.service.NewsPoliceService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.Serializable;
+import java.sql.SQLException;
import java.util.List;
/**
@@ -19,16 +25,20 @@
(NewsPolice)琛ㄦ帶鍒跺眰
*
* @author makejava
- * @since 2022-11-17 11:12:42
+ * @since 2022-11-17 11:38:27
*/
@RestController
@RequestMapping("newsPolice")
+@Api(tags = "璀﹀憳绠$悊")
public class NewsPoliceController extends ApiController {
/**
* 鏈嶅姟瀵硅薄
*/
@Resource
private NewsPoliceService newsPoliceService;
+
+ @Autowired
+ private NewsAdminService newsAdminService;
/**
* 鍒嗛〉鏌ヨ鎵�鏈夋暟鎹�
@@ -38,6 +48,7 @@
* @return 鎵�鏈夋暟鎹�
*/
@GetMapping
+ @ApiOperation(value = "鏌ヨ鎵�鏈夋暟鎹�")
public R selectAll(Page<NewsPolice> page, NewsPolice newsPolice) {
return success(this.newsPoliceService.page(page, new QueryWrapper<>(newsPolice)));
}
@@ -49,6 +60,7 @@
* @return 鍗曟潯鏁版嵁
*/
@GetMapping("{id}")
+ @ApiOperation(value = "鎸塱d鏌ヨ鏁版嵁")
public R selectOne(@PathVariable Serializable id) {
return success(this.newsPoliceService.getById(id));
}
@@ -59,9 +71,12 @@
* @param newsPolice 瀹炰綋瀵硅薄
* @return 鏂板缁撴灉
*/
+ @Transactional(rollbackFor = SQLException.class)
@PostMapping
+ @ApiOperation(value = "鏂板璀﹀憳骞舵敞鍐�")
public R insert(@RequestBody NewsPolice newsPolice) {
- return success(this.newsPoliceService.save(newsPolice));
+ this.newsPoliceService.save(newsPolice);
+ return success(newsAdminService.autoCreateAdmin(newsPolice));
}
/**
@@ -71,6 +86,7 @@
* @return 淇敼缁撴灉
*/
@PutMapping
+ @ApiOperation(value = "淇敼鏁版嵁")
public R update(@RequestBody NewsPolice newsPolice) {
return success(this.newsPoliceService.updateById(newsPolice));
}
@@ -82,6 +98,7 @@
* @return 鍒犻櫎缁撴灉
*/
@DeleteMapping
+ @ApiOperation(value = "鍒犻櫎鏁版嵁")
public R delete(@RequestParam("idList") List<Long> idList) {
return success(this.newsPoliceService.removeByIds(idList));
}
--
Gitblit v1.8.0