From f016363ca628b296d6edb65fc509fb89b22ee94f Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期四, 14 七月 2022 16:34:14 +0800
Subject: [PATCH] 案件区相关接口
---
src/main/java/com/example/jz/controller/CauseController.java | 82 +++++++++++++---------------------------
1 files changed, 27 insertions(+), 55 deletions(-)
diff --git a/src/main/java/com/example/jz/controller/CauseController.java b/src/main/java/com/example/jz/controller/CauseController.java
index c0ec5f2..43fe51b 100644
--- a/src/main/java/com/example/jz/controller/CauseController.java
+++ b/src/main/java/com/example/jz/controller/CauseController.java
@@ -1,18 +1,16 @@
package com.example.jz.controller;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.entity.Cause;
+import com.example.jz.modle.R;
+import com.example.jz.modle.dto.CauseDto;
import com.example.jz.service.CauseService;
+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;
-import java.io.Serializable;
-import java.util.List;
/**
* 妗堜欢琛�(Cause)琛ㄦ帶鍒跺眰
@@ -22,6 +20,7 @@
*/
@RestController
@RequestMapping("cause")
+@Api(tags = "妗堜欢鍖�")
public class CauseController extends ApiController {
/**
* 鏈嶅姟瀵硅薄
@@ -29,60 +28,33 @@
@Resource
private CauseService causeService;
- /**
- * 鍒嗛〉鏌ヨ鎵�鏈夋暟鎹�
- *
- * @param page 鍒嗛〉瀵硅薄
- * @param cause 鏌ヨ瀹炰綋
- * @return 鎵�鏈夋暟鎹�
- */
- @GetMapping
- public R selectAll(Page<Cause> page, Cause cause) {
- return success(this.causeService.page(page, new QueryWrapper<>(cause)));
+ @ApiOperation(httpMethod = "POST", value = "娣诲姞妗堜欢")
+ @PostMapping("/addCause")
+ @ApiResponse(message = "鎵ц鎴愬姛", code = 200)
+ public R addCause(@RequestBody CauseDto causeDto) {
+ return R.ok(causeService.addCause(causeDto));
}
- /**
- * 閫氳繃涓婚敭鏌ヨ鍗曟潯鏁版嵁
- *
- * @param id 涓婚敭
- * @return 鍗曟潯鏁版嵁
- */
- @GetMapping("{id}")
- public R selectOne(@PathVariable Serializable id) {
- return success(this.causeService.getById(id));
+ @ApiOperation(httpMethod = "POST", value = "淇敼妗堜欢")
+ @PostMapping("/updateCause")
+ @ApiResponse(message = "鎵ц鎴愬姛", code = 200)
+ public R updateCause(@RequestBody CauseDto causeDto,Integer id) {
+ return R.ok(causeService.updateCause(causeDto,id));
}
- /**
- * 鏂板鏁版嵁
- *
- * @param cause 瀹炰綋瀵硅薄
- * @return 鏂板缁撴灉
- */
- @PostMapping
- public R insert(@RequestBody Cause cause) {
- return success(this.causeService.save(cause));
+
+ @ApiOperation(httpMethod = "GET", value = "妗堜欢褰曞叆鍒楄〃")
+ @GetMapping("/getCauseList")
+ @ApiResponse(message = "鎵ц鎴愬姛", code = 200)
+ public R getCauseList(String cause, Integer status, Integer size, Integer current) {
+ return R.ok(causeService.getCauserListByCondition(cause, status, size, current));
}
- /**
- * 淇敼鏁版嵁
- *
- * @param cause 瀹炰綋瀵硅薄
- * @return 淇敼缁撴灉
- */
- @PutMapping
- public R update(@RequestBody Cause cause) {
- return success(this.causeService.updateById(cause));
- }
-
- /**
- * 鍒犻櫎鏁版嵁
- *
- * @param idList 涓婚敭缁撳悎
- * @return 鍒犻櫎缁撴灉
- */
- @DeleteMapping
- public R delete(@RequestParam("idList") List<Long> idList) {
- return success(this.causeService.removeByIds(idList));
+ @ApiOperation(httpMethod = "GET", value = "璐熻矗浜烘煡璇�")
+ @GetMapping("/getManagerList")
+ @ApiResponse(message = "鎵ц鎴愬姛", code = 200)
+ public R getManagerList() {
+ return R.ok(causeService.getManagerList());
}
}
--
Gitblit v1.8.0