项目管理crud
This commit is contained in:
@ -1,47 +1,110 @@
|
||||
package com.fastbee.data.controller.project;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.fastbee.common.utils.poi.ExcelUtil;
|
||||
import com.fastbee.project.domain.Project;
|
||||
import com.fastbee.project.service.IProjectService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.fastbee.common.annotation.Log;
|
||||
import com.fastbee.common.core.controller.BaseController;
|
||||
import com.fastbee.common.core.domain.AjaxResult;
|
||||
import com.fastbee.common.core.page.TableDataInfo;
|
||||
import com.fastbee.project.domain.Project;
|
||||
import com.fastbee.project.service.ProjectService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 项目表 前端控制器
|
||||
* </p>
|
||||
* 项目Controller
|
||||
*
|
||||
* @author 蒾酒
|
||||
* @since 2024-09-24
|
||||
* @author kerwincui
|
||||
* @date 2024-09-26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/project")
|
||||
public class ProjectController extends BaseController {
|
||||
@Api(tags = "项目")
|
||||
public class ProjectController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ProjectService projectService;
|
||||
private IProjectService projectService;
|
||||
|
||||
/**
|
||||
* 查询项目列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:project:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo getPageList(){
|
||||
super.startPage();
|
||||
return super.getDataTable(projectService.list());
|
||||
}
|
||||
@GetMapping("/info/{id}")
|
||||
public AjaxResult getInfo(@PathVariable Long id){
|
||||
|
||||
return AjaxResult.success(projectService.getBaseMapper().selectById(id));
|
||||
}
|
||||
@PutMapping("/update")
|
||||
public AjaxResult update(@RequestBody Project project){
|
||||
projectService.updateById(project);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public AjaxResult delete(@PathVariable Long id){
|
||||
projectService.removeById(id);
|
||||
return AjaxResult.success();
|
||||
@ApiOperation("查询项目列表")
|
||||
public TableDataInfo list(Project project)
|
||||
{
|
||||
startPage();
|
||||
List<Project> list = projectService.selectProjectList(project);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出项目列表
|
||||
*/
|
||||
@ApiOperation("导出项目列表")
|
||||
@PreAuthorize("@ss.hasPermi('iot:project:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Project project)
|
||||
{
|
||||
List<Project> list = projectService.selectProjectList(project);
|
||||
ExcelUtil<Project> util = new ExcelUtil<Project>(Project.class);
|
||||
util.exportExcel(response, list, "项目数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:project:query')")
|
||||
@GetMapping(value = "/{projectId}")
|
||||
@ApiOperation("获取项目详细信息")
|
||||
public AjaxResult getInfo(@PathVariable("projectId") Long projectId)
|
||||
{
|
||||
return success(projectService.selectProjectByProjectId(projectId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增项目
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:project:add')")
|
||||
@PostMapping
|
||||
@ApiOperation("新增项目")
|
||||
public AjaxResult add(@RequestBody Project project)
|
||||
{
|
||||
return toAjax(projectService.insertProject(project));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:project:edit')")
|
||||
@PutMapping
|
||||
@ApiOperation("修改项目")
|
||||
public AjaxResult edit(@RequestBody Project project)
|
||||
{
|
||||
return toAjax(projectService.updateProject(project));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除项目
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:project:remove')")
|
||||
@DeleteMapping("/{projectIds}")
|
||||
@ApiOperation("删除项目")
|
||||
public AjaxResult remove(@PathVariable Long[] projectIds)
|
||||
{
|
||||
return toAjax(projectService.deleteProjectByProjectIds(projectIds));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user