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/controller/CauseController.java | 107 ++++++++++++++++++++++++++--------------------------- 1 files changed, 53 insertions(+), 54 deletions(-) diff --git a/src/main/java/com/example/jz/controller/CauseController.java b/src/main/java/com/example/jz/controller/CauseController.java index 29f16da..2609aba 100644 --- a/src/main/java/com/example/jz/controller/CauseController.java +++ b/src/main/java/com/example/jz/controller/CauseController.java @@ -1,25 +1,26 @@ 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)琛ㄦ帶鍒跺眰 + * 妗堜欢琛�(Cause)琛ㄦ帶鍒跺眰 * * @author makejava - * @since 2022-07-11 16:55:40 + * @since 2022-07-13 11:52:57 */ @RestController @RequestMapping("cause") +@Api(tags = "妗堜欢鍖�-妗堜欢褰曞叆") public class CauseController extends ApiController { /** * 鏈嶅姟瀵硅薄 @@ -27,59 +28,57 @@ @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) { + causeService.addCause(causeDto); + return R.ok(); } - /** - * 閫氳繃涓婚敭鏌ヨ鍗曟潯鏁版嵁 - * - * @param id 涓婚敭 - * @return 鍗曟潯鏁版嵁 - */ - @GetMapping("{id}") - public R selectOne(@PathVariable Serializable id) { - return success(this.causeService.getById(id)); + @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)); } - /** - * 鏂板鏁版嵁 - * - * @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)); + @ApiOperation(httpMethod = "GET", value = "璐熻矗浜烘煡璇�") + @GetMapping("/getManagerList") + @ApiResponse(message = "鎵ц鎴愬姛", code = 200) + public R getManagerList() { + return R.ok(causeService.getManagerList()); } - /** - * 鍒犻櫎鏁版嵁 - * - * @param idList 涓婚敭缁撳悎 - * @return 鍒犻櫎缁撴灉 - */ - @DeleteMapping - public R delete(@RequestParam("idList") List<Long> idList) { - return success(this.causeService.removeByIds(idList)); + @ApiOperation(httpMethod = "GET", value = "鑾峰彇鎶ユ浜哄憳") + @GetMapping("/getReporterList") + @ApiResponse(message = "鎵ц鎴愬姛", code = 200) + public R getReporterList(Integer causeId) { + return R.ok(causeService.getReporterList(causeId)); } + + @ApiOperation(httpMethod = "GET", value = "鑾峰彇妗堜欢缇ゅ叕鍛�") + @GetMapping("/getGroupAnnouncement") + @ApiResponse(message = "鎵ц鎴愬姛", code = 200) + public R getGroupAnnouncement(Integer groupId) { + return R.ok(causeService.getGroupAnnouncement(groupId)); + } + + @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 瀵煎叆 } + -- Gitblit v1.8.0