Add front project draft APIs
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
package com.ruoyi.web.controller.front;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.generator.domain.front.dto.DatabaseDesignResponse;
|
||||
import com.ruoyi.generator.domain.front.dto.FrontProjectCreateRequest;
|
||||
import com.ruoyi.generator.domain.front.dto.FrontProjectUpdateRequest;
|
||||
import com.ruoyi.generator.service.front.IFrontProjectService;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/front/project")
|
||||
public class FrontProjectController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IFrontProjectService frontProjectService;
|
||||
|
||||
@PostMapping("/create")
|
||||
public AjaxResult create(@RequestBody FrontProjectCreateRequest request)
|
||||
{
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
return AjaxResult.success(frontProjectService.createProject(userId, request));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list()
|
||||
{
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
return AjaxResult.success(frontProjectService.listProjects(userId));
|
||||
}
|
||||
|
||||
@GetMapping("/{projectId}")
|
||||
public AjaxResult get(@PathVariable Long projectId)
|
||||
{
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
return AjaxResult.success(frontProjectService.getProject(userId, projectId));
|
||||
}
|
||||
|
||||
@PutMapping("/{projectId}")
|
||||
public AjaxResult update(@PathVariable Long projectId, @RequestBody FrontProjectUpdateRequest request)
|
||||
{
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
return toAjax(frontProjectService.updateProject(userId, projectId, request));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{projectId}")
|
||||
public AjaxResult delete(@PathVariable Long projectId)
|
||||
{
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
return toAjax(frontProjectService.deleteProject(userId, projectId));
|
||||
}
|
||||
|
||||
@GetMapping("/{projectId}/database")
|
||||
public AjaxResult database(@PathVariable Long projectId)
|
||||
{
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
return AjaxResult.success(frontProjectService.getDatabase(userId, projectId));
|
||||
}
|
||||
|
||||
@PutMapping("/{projectId}/database")
|
||||
public AjaxResult saveDatabase(@PathVariable Long projectId, @RequestBody DatabaseDesignResponse request)
|
||||
{
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
return AjaxResult.success(frontProjectService.saveDatabase(userId, projectId, request));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user