From 9b3dbdc74b2a508249b1d1e489db8a2134a3a7de Mon Sep 17 00:00:00 2001
From: 安瑾然 <107107765@qq.com>
Date: 星期一, 18 七月 2022 15:36:31 +0800
Subject: [PATCH] 权限模块

---
 src/main/java/com/example/jz/controller/CauseController.java |   54 +++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/example/jz/controller/CauseController.java b/src/main/java/com/example/jz/controller/CauseController.java
index 2609aba..fbe2d62 100644
--- a/src/main/java/com/example/jz/controller/CauseController.java
+++ b/src/main/java/com/example/jz/controller/CauseController.java
@@ -1,16 +1,23 @@
 package com.example.jz.controller;
 
 
+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.modle.R;
+import com.example.jz.modle.dto.AddReportDto;
 import com.example.jz.modle.dto.CauseDto;
+import com.example.jz.modle.dto.ReportParamDto;
+import com.example.jz.modle.entity.Report;
+import com.example.jz.modle.vo.ReportListVo;
 import com.example.jz.service.CauseService;
+import com.example.jz.service.ReportService;
+import com.example.jz.service.UserService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiResponse;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-
-import javax.annotation.Resource;
 
 /**
  * 妗堜欢琛�(Cause)琛ㄦ帶鍒跺眰
@@ -20,13 +27,24 @@
  */
 @RestController
 @RequestMapping("cause")
-@Api(tags = "妗堜欢鍖�-妗堜欢褰曞叆")
+@Api(tags = "妗堜欢鍖�")
 public class CauseController extends ApiController {
     /**
      * 鏈嶅姟瀵硅薄
      */
-    @Resource
     private CauseService causeService;
+    private ReportService reportService;
+
+    @Autowired
+    public void setReportService(ReportService reportService) {
+        this.reportService = reportService;
+    }
+
+    @Autowired
+    public void setCauseService(CauseService causeService) {
+        this.causeService = causeService;
+    }
+
 
     @ApiOperation(httpMethod = "POST", value = "娣诲姞妗堜欢")
     @PostMapping("/addCause")
@@ -39,8 +57,8 @@
     @ApiOperation(httpMethod = "PUT", value = "淇敼妗堜欢")
     @PutMapping("/updateCause")
     @ApiResponse(message = "鎵ц鎴愬姛", code = 200)
-    public R updateCause(@RequestBody CauseDto causeDto,Integer id) {
-        return R.ok(causeService.updateCause(causeDto,id));
+    public R updateCause(@RequestBody CauseDto causeDto, Integer id) {
+        return R.ok(causeService.updateCause(causeDto, id));
     }
 
 
@@ -79,6 +97,28 @@
         causeService.deleteCause(id);
         return R.ok();
     }
-    // TODO: 2022/7/15 瀵煎叆
+
+    @ApiOperation(httpMethod = "GET", value = "鏍规嵁缇ょ粍id鏌ヨ妗堜欢鍒嗛〉")
+    @GetMapping("/getAllReportList")
+    @ApiResponse(message = "鎵ц鎴愬姛", code = 200)
+    public R<IPage<ReportListVo>> get(Page<ReportListVo> page, ReportParamDto reportParamDto, Integer groupId) {
+        return R.ok(reportService.getPageByGroupId(page, reportParamDto, groupId));
+    }
+
+    @ApiOperation(httpMethod = "POST", value = "娣诲姞浜哄憳")
+    @PostMapping("/addReporter")
+    @ApiResponse(message = "鎵ц鎴愬姛", code = 200)
+    public R<Boolean> get(AddReportDto addReportDto) {
+        if (addReportDto.getReporterName() == null || addReportDto.getReporterName().equals("")) {
+            return R.failed("鎶ユ浜哄憳涓嶈兘涓虹┖");
+        }
+        if (addReportDto.getMobile() == null || addReportDto.getMobile().equals("")) {
+            return R.failed("鎶ユ浜哄憳鐢佃瘽涓嶈兘涓虹┖");
+        }
+        if (addReportDto.getIdcard() == null || addReportDto.getIdcard().equals("")) {
+            return R.failed("鎶ユ浜哄憳韬唤璇佷笉鑳戒负绌�");
+        }
+        return R.ok(causeService.addReportPeople(addReportDto));
+    }
 }
 

--
Gitblit v1.8.0