From 5b04d19edea32888efa9ee4881395a21da348e3f Mon Sep 17 00:00:00 2001
From: 安瑾然 <107107765@qq.com>
Date: 星期四, 14 七月 2022 14:21:44 +0800
Subject: [PATCH] commit

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

diff --git a/src/main/java/com/example/jz/controller/ReportController.java b/src/main/java/com/example/jz/controller/ReportController.java
index 7e4bdf8..cfed973 100644
--- a/src/main/java/com/example/jz/controller/ReportController.java
+++ b/src/main/java/com/example/jz/controller/ReportController.java
@@ -1,27 +1,30 @@
 package com.example.jz.controller;
 
-
-
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.api.ApiController;
-import com.baomidou.mybatisplus.extension.api.R;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.jz.modle.R;
 import com.example.jz.modle.entity.Report;
 import com.example.jz.service.ReportService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.io.Serializable;
+import java.util.Date;
 import java.util.List;
 
 /**
  * 鎶ユ琛�(Report)琛ㄦ帶鍒跺眰
  *
- * @author makejava
+ * @author 瀹夌懢鐒�
  * @since 2022-07-13 11:52:58
  */
 @RestController
 @RequestMapping("report")
+@Api(value = "鎶ユ鎺ュ彛", tags = "鎶ユ鎺ュ彛")
 public class ReportController extends ApiController {
     /**
      * 鏈嶅姟瀵硅薄
@@ -32,13 +35,14 @@
     /**
      * 鍒嗛〉鏌ヨ鎵�鏈夋暟鎹�
      *
-     * @param page 鍒嗛〉瀵硅薄
+     * @param page   鍒嗛〉瀵硅薄
      * @param report 鏌ヨ瀹炰綋
      * @return 鎵�鏈夋暟鎹�
      */
     @GetMapping
-    public R selectAll(Page<Report> page, Report report) {
-        return success(this.reportService.page(page, new QueryWrapper<>(report)));
+    @ApiOperation(value = "鍒嗛〉鏌ヨ鎵�鏈夋暟鎹�")
+    public R<IPage<Report>> selectAll(Page<Report> page, Report report) {
+        return R.ok(reportService.page(page, new QueryWrapper<>(report)));
     }
 
     /**
@@ -48,41 +52,37 @@
      * @return 鍗曟潯鏁版嵁
      */
     @GetMapping("{id}")
-    public R selectOne(@PathVariable Serializable id) {
-        return success(this.reportService.getById(id));
+    @ApiOperation(value = "閫氳繃涓婚敭鏌ヨ鍗曟潯鏁版嵁")
+    public R<Report> selectOne(@PathVariable Serializable id) {
+        return R.ok(reportService.getById(id));
     }
 
     /**
-     * 鏂板鏁版嵁
+     * 鎶ユ
      *
      * @param report 瀹炰綋瀵硅薄
      * @return 鏂板缁撴灉
      */
     @PostMapping
-    public R insert(@RequestBody Report report) {
-        return success(this.reportService.save(report));
+    @ApiOperation(value = "鎶ユ")
+    public R<Boolean> insert(@RequestBody Report report) {
+        report.setCtime(new Date());
+        report.setStatus(0);
+        //TODO 鍔ㄦ�佽幏鍙栧綋鍓嶇殑鐢ㄦ埛id
+        report.setUserId(1);
+        return R.ok(reportService.save(report));
     }
 
     /**
-     * 淇敼鏁版嵁
+     * 瀹℃牳閫氳繃骞朵笖鍏宠仈妗堜欢id
      *
      * @param report 瀹炰綋瀵硅薄
      * @return 淇敼缁撴灉
      */
-    @PutMapping
-    public R update(@RequestBody Report report) {
-        return success(this.reportService.updateById(report));
-    }
-
-    /**
-     * 鍒犻櫎鏁版嵁
-     *
-     * @param idList 涓婚敭缁撳悎
-     * @return 鍒犻櫎缁撴灉
-     */
-    @DeleteMapping
-    public R delete(@RequestParam("idList") List<Long> idList) {
-        return success(this.reportService.removeByIds(idList));
+    @PostMapping("/audit")
+    @ApiOperation(value = "瀹℃牳閫氳繃")
+    public R<Boolean> audit(@RequestBody Report report) {
+        return R.ok(reportService.audit(report));
     }
 }
 

--
Gitblit v1.8.0