| | |
| | | package com.dji.sample.manage.controller; |
| | | |
| | | import com.dji.sample.common.model.CustomClaim; |
| | | import com.dji.sample.common.model.PaginationData; |
| | | import com.dji.sample.common.model.ResponseResult; |
| | | import com.dji.sample.manage.model.dto.UserListDTO; |
| | | import com.dji.sample.manage.model.dto.WorkspaceDTO; |
| | | import com.dji.sample.manage.service.IWorkspaceService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Optional; |
| | |
| | | |
| | | return workspaceOpt.isEmpty() ? ResponseResult.error() : ResponseResult.success(workspaceOpt.get()); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | public ResponseResult findCurrentWorkspace(@RequestParam(defaultValue = "1") Long page, |
| | | @RequestParam(value = "page_size", defaultValue = "50") Long pageSize) { |
| | | PaginationData<WorkspaceDTO> paginationData = workspaceService.selectWorkspace(page, pageSize); |
| | | return ResponseResult.success(paginationData); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | public ResponseResult add(@RequestBody WorkspaceDTO dto) { |
| | | return workspaceService.createWorkspace(dto)?ResponseResult.success():ResponseResult.error(); |
| | | } |
| | | |
| | | @PostMapping("/delete") |
| | | public ResponseResult delete(@RequestParam(value = "id") Integer id) { |
| | | return workspaceService.deleteWorkspaceById(id)?ResponseResult.success():ResponseResult.error(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | public ResponseResult update(@RequestBody WorkspaceDTO dto) { |
| | | return workspaceService.updateWorkspaceById(dto)?ResponseResult.success():ResponseResult.error(); |
| | | } |
| | | |
| | | } |