6 天以前 0c23c1e9b9e06ffc570edac28ee45555b772b99c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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.SafetyTrainingMaterial;
import com.ruoyi.safety.service.SafetyTrainingMaterialService;
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/material")
public class SafetyTrainingMaterialController extends SafetyControllerSupport {
 
    @Autowired
    private SafetyTrainingMaterialService materialService;
 
    /**
     * 分页查询培训资料。
     */
    @Log(title = "安环管理-培训资料-分页查询", businessType = BusinessType.OTHER)
    @ApiOperation("分页查询培训资料")
    @GetMapping("/list")
    public AjaxResult list(Page<SafetyTrainingMaterial> page, SafetyTrainingMaterial query,
                           @RequestParam(value = "pageNum", required = false) Long pageNum,
                           @RequestParam(value = "pageSize", required = false) Long pageSize) {
        return AjaxResult.success(materialService.queryPage(buildPage(page, pageNum, pageSize), query));
    }
 
    /**
     * 上传培训资料元数据。
     */
    @Log(title = "安环管理-培训资料-上传", businessType = BusinessType.INSERT)
    @ApiOperation("上传培训资料")
    @PostMapping("/upload")
    public AjaxResult upload(@RequestBody SafetyTrainingMaterial material) {
        return toAjax(materialService.saveSafety(material));
    }
 
    /**
     * 修改培训资料。
     */
    @Log(title = "安环管理-培训资料-修改", businessType = BusinessType.UPDATE)
    @ApiOperation("修改培训资料")
    @PutMapping("/update")
    public AjaxResult update(@RequestBody SafetyTrainingMaterial material) {
        return toAjax(materialService.updateSafety(material));
    }
 
    /**
     * 删除培训资料。
     */
    @Log(title = "安环管理-培训资料-删除", businessType = BusinessType.DELETE)
    @ApiOperation("删除培训资料")
    @DeleteMapping("/delete/{id}")
    public AjaxResult delete(@PathVariable Long id) {
        return toAjax(materialService.deleteSafetyById(id));
    }
 
    /**
     * 查询培训资料详情。
     */
    @Log(title = "安环管理-培训资料-详情", businessType = BusinessType.OTHER)
    @ApiOperation("查询培训资料详情")
    @GetMapping("/detail/{id}")
    public AjaxResult detail(@PathVariable Long id) {
        return AjaxResult.success(materialService.getById(id));
    }
}