package com.ruoyi.safety.controller;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.safety.pojo.SafetyTrainingPlan;
|
import com.ruoyi.safety.service.SafetyTrainingPlanService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
/**
|
* 安环管理-培训计划接口。
|
*/
|
@RestController
|
@Api(tags = "安环管理-培训计划")
|
@RequestMapping("/safety/training/plan")
|
public class SafetyTrainingPlanController extends SafetyControllerSupport {
|
|
@Autowired
|
private SafetyTrainingPlanService planService;
|
|
/**
|
* 分页查询培训计划。
|
*/
|
@Log(title = "安环管理-培训计划-分页查询", businessType = BusinessType.OTHER)
|
@ApiOperation("分页查询培训计划")
|
@GetMapping("/list")
|
public AjaxResult list(Page<SafetyTrainingPlan> page, SafetyTrainingPlan query,
|
@RequestParam(value = "pageNum", required = false) Long pageNum,
|
@RequestParam(value = "pageSize", required = false) Long pageSize) {
|
return AjaxResult.success(planService.queryPage(buildPage(page, pageNum, pageSize), query));
|
}
|
|
/**
|
* 新增培训计划。
|
*/
|
@Log(title = "安环管理-培训计划-新增", businessType = BusinessType.INSERT)
|
@ApiOperation("新增培训计划")
|
@PostMapping("/add")
|
public AjaxResult add(@RequestBody SafetyTrainingPlan plan) {
|
return toAjax(planService.saveSafety(plan));
|
}
|
|
/**
|
* 修改培训计划。
|
*/
|
@Log(title = "安环管理-培训计划-修改", businessType = BusinessType.UPDATE)
|
@ApiOperation("修改培训计划")
|
@PutMapping("/update")
|
public AjaxResult update(@RequestBody SafetyTrainingPlan plan) {
|
return toAjax(planService.updateSafety(plan));
|
}
|
|
/**
|
* 删除培训计划。
|
*/
|
@Log(title = "安环管理-培训计划-删除", businessType = BusinessType.DELETE)
|
@ApiOperation("删除培训计划")
|
@DeleteMapping("/delete/{id}")
|
public AjaxResult delete(@PathVariable Long id) {
|
return toAjax(planService.deleteSafetyById(id));
|
}
|
|
/**
|
* 查询培训计划详情。
|
*/
|
@Log(title = "安环管理-培训计划-详情", businessType = BusinessType.OTHER)
|
@ApiOperation("查询培训计划详情")
|
@GetMapping("/detail/{id}")
|
public AjaxResult detail(@PathVariable Long id) {
|
return AjaxResult.success(planService.getById(id));
|
}
|
}
|