| | |
| | | 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)表控制层 |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("cause") |
| | | @Api(tags = "案件区") |
| | | public class CauseController extends ApiController { |
| | | /** |
| | | * 服务对象 |
| | |
| | | @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()); |
| | | } |
| | | } |
| | | |