File was renamed from src/main/java/com/example/jz/controller/CaseController.java |
| | |
| | | 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.Case; |
| | | import com.example.jz.service.CaseService; |
| | | import com.example.jz.modle.entity.Cause; |
| | | import com.example.jz.service.CauseService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * (Case)表控制层 |
| | | * (Cause)表控制层 |
| | | * |
| | | * @author makejava |
| | | * @since 2022-07-11 16:35:56 |
| | | * @since 2022-07-11 16:55:40 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("case") |
| | | public class CaseController extends ApiController { |
| | | @RequestMapping("cause") |
| | | public class CauseController extends ApiController { |
| | | /** |
| | | * 服务对象 |
| | | */ |
| | | @Resource |
| | | private CaseService caseService; |
| | | private CauseService causeService; |
| | | |
| | | /** |
| | | * 分页查询所有数据 |
| | | * |
| | | * @param page 分页对象 |
| | | * @param case 查询实体 |
| | | * @param cause 查询实体 |
| | | * @return 所有数据 |
| | | */ |
| | | @GetMapping |
| | | public R selectAll(Page<Case> page, Case case) { |
| | | return success(this.caseService.page(page, new QueryWrapper<>(case))); |
| | | public R selectAll(Page<Cause> page, Cause cause) { |
| | | return success(this.causeService.page(page, new QueryWrapper<>(cause))); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("{id}") |
| | | public R selectOne(@PathVariable Serializable id) { |
| | | return success(this.caseService.getById(id)); |
| | | return success(this.causeService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 新增数据 |
| | | * |
| | | * @param case 实体对象 |
| | | * @param cause 实体对象 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping |
| | | public R insert(@RequestBody Case case) { |
| | | return success(this.caseService.save(case)); |
| | | public R insert(@RequestBody Cause cause) { |
| | | return success(this.causeService.save(cause)); |
| | | } |
| | | |
| | | /** |
| | | * 修改数据 |
| | | * |
| | | * @param case 实体对象 |
| | | * @param cause 实体对象 |
| | | * @return 修改结果 |
| | | */ |
| | | @PutMapping |
| | | public R update(@RequestBody Case case) { |
| | | return success(this.caseService.updateById(case)); |
| | | public R update(@RequestBody Cause cause) { |
| | | return success(this.causeService.updateById(cause)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @DeleteMapping |
| | | public R delete(@RequestParam("idList") List<Long> idList) { |
| | | return success(this.caseService.removeByIds(idList)); |
| | | return success(this.causeService.removeByIds(idList)); |
| | | } |
| | | } |
| | | |