| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package cn.seecoder.paas.web.controller.api;
- import cn.seecoder.paas.service.ApplicationService;
- import cn.seecoder.paas.service.model.vo.ApplicationVO;
- import cn.seecoder.paas.util.ServiceException;
- import cn.seecoder.paas.web.model.Response;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- @RestController
- @RequestMapping("/api/application")
- public class ApplicationController {
- private final ApplicationService applicationService;
- @Autowired
- public ApplicationController(ApplicationService applicationService) {
- this.applicationService = applicationService;
- }
- @PostMapping("")
- public Response create(@RequestBody ApplicationVO vo) throws ServiceException {
- return Response.buildSuccess(applicationService.createOrUpdate(vo));
- }
- @PutMapping("")
- public Response update(@RequestBody ApplicationVO vo) throws ServiceException {
- return Response.buildSuccess(applicationService.createOrUpdate(vo));
- }
- @GetMapping("")
- public Response getAll() {
- return Response.buildSuccess(applicationService.getAll());
- }
- @GetMapping("/{id}")
- public Response get(@PathVariable("id") Integer id) throws ServiceException {
- return Response.buildSuccess(applicationService.getDetailById(id));
- }
- @DeleteMapping("/{id}")
- public Response delete(@PathVariable("id") Integer id) {
- applicationService.delete(id);
- return Response.buildSuccess(null);
- }
- }
|