From 1de3b3fe57cd58e76c90fb33d4cdedc67c246a58 Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期五, 15 七月 2022 11:50:47 +0800
Subject: [PATCH] 案件区报案人员相关接口

---
 src/main/java/com/example/jz/service/ReportService.java          |    2 ++
 src/main/java/com/example/jz/controller/ReportController.java    |   28 ++++++++++++++++++++++++++++
 src/main/java/com/example/jz/controller/CauseController.java     |    3 ++-
 src/main/java/com/example/jz/modle/vo/ReportListVo.java          |   15 +++++++++++++++
 src/main/java/com/example/jz/service/impl/ReportServiceImpl.java |    6 ++++++
 5 files changed, 53 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/example/jz/controller/CauseController.java b/src/main/java/com/example/jz/controller/CauseController.java
index 67f349e..2609aba 100644
--- a/src/main/java/com/example/jz/controller/CauseController.java
+++ b/src/main/java/com/example/jz/controller/CauseController.java
@@ -72,12 +72,13 @@
         return R.ok(causeService.getGroupAnnouncement(groupId));
     }
 
-    @ApiOperation(httpMethod = "Delete", value = "妗堜欢鍒犻櫎")
+    @ApiOperation(httpMethod = "DELETE", value = "妗堜欢鍒犻櫎")
     @DeleteMapping("/deleteCause")
     @ApiResponse(message = "鎵ц鎴愬姛", code = 200)
     public R deleteCause(@RequestParam(value = "id") Integer id) {
         causeService.deleteCause(id);
         return R.ok();
     }
+    // TODO: 2022/7/15 瀵煎叆
 }
 
diff --git a/src/main/java/com/example/jz/controller/ReportController.java b/src/main/java/com/example/jz/controller/ReportController.java
index cfed973..a0c9c82 100644
--- a/src/main/java/com/example/jz/controller/ReportController.java
+++ b/src/main/java/com/example/jz/controller/ReportController.java
@@ -4,11 +4,15 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.api.ApiController;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.jz.enums.BusinessHttpStatus;
+import com.example.jz.exception.BusinessException;
 import com.example.jz.modle.R;
 import com.example.jz.modle.entity.Report;
+import com.example.jz.modle.vo.ReportListVo;
 import com.example.jz.service.ReportService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
@@ -84,5 +88,29 @@
     public R<Boolean> audit(@RequestBody Report report) {
         return R.ok(reportService.audit(report));
     }
+
+    @ApiOperation(httpMethod = "PUT", value = "鎶ユ浜虹紪杈�")
+    @PutMapping("/updateReport")
+    @ApiResponse(message = "鎵ц鎴愬姛", code = 200)
+    public R updateReport(@RequestBody Report report) {
+        reportService.updateById(report);
+        return R.ok();
+    }
+
+    @ApiOperation(httpMethod = "DELETE", value = "鎶ユ浜轰汉鍛橀��缇�")
+    @DeleteMapping("/leaveGroup")
+    @ApiResponse(message = "鎵ц鎴愬姛", code = 200)
+    public R leaveGroup( @RequestParam(value = "id") Integer id,@RequestParam(value = "groupId") Integer groupId) {
+       reportService.leaveGroup(id,groupId);
+        return R.ok();
+    }
+
+    @ApiOperation(httpMethod = "DELETE", value = "鍒犻櫎鎶ユ浜�")
+    @DeleteMapping("/deleteReporter")
+    @ApiResponse(message = "鎵ц鎴愬姛", code = 200)
+    public R deleteReporter( @RequestParam(value = "id") Integer id) {
+        reportService.removeById(id);
+        return R.ok();
+    }
 }
 
diff --git a/src/main/java/com/example/jz/modle/vo/ReportListVo.java b/src/main/java/com/example/jz/modle/vo/ReportListVo.java
new file mode 100644
index 0000000..f008f83
--- /dev/null
+++ b/src/main/java/com/example/jz/modle/vo/ReportListVo.java
@@ -0,0 +1,15 @@
+package com.example.jz.modle.vo;
+
+import com.example.jz.modle.entity.Report;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+@Data
+@ApiModel(description = "鎶ユ浜哄憳棣栭〉",value = "ReportListVo")
+public class ReportListVo extends Report {
+    //鏄惁杩涚兢
+    private Integer isIntoGroup;
+
+    //缇d
+    private Integer groupId;
+}
diff --git a/src/main/java/com/example/jz/service/ReportService.java b/src/main/java/com/example/jz/service/ReportService.java
index 90e6203..89fa38b 100644
--- a/src/main/java/com/example/jz/service/ReportService.java
+++ b/src/main/java/com/example/jz/service/ReportService.java
@@ -12,5 +12,7 @@
 public interface ReportService extends IService<Report> {
 
     Boolean audit(Report report);
+
+    void leaveGroup(Integer id, Integer groupId);
 }
 
diff --git a/src/main/java/com/example/jz/service/impl/ReportServiceImpl.java b/src/main/java/com/example/jz/service/impl/ReportServiceImpl.java
index 71860a6..c56e2c2 100644
--- a/src/main/java/com/example/jz/service/impl/ReportServiceImpl.java
+++ b/src/main/java/com/example/jz/service/impl/ReportServiceImpl.java
@@ -1,6 +1,7 @@
 package com.example.jz.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.example.jz.dao.CauseDao;
 import com.example.jz.dao.GroupDao;
@@ -51,5 +52,10 @@
         groupUserDao.insert(groupUser);
         return true;
     }
+
+    @Override
+    public void leaveGroup(Integer id, Integer groupId) {
+        groupUserDao.delete(new QueryWrapper<GroupUser>().eq("user_id",id).eq("group_id",groupId));
+    }
 }
 

--
Gitblit v1.8.0