yaowanxin
9 天以前 b0c345d2a74f47e5c34617051bcd61becde11b96
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
package com.ruoyi.warehouse.controller;
 
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.warehouse.pojo.DocumentClassification;
import com.ruoyi.warehouse.service.DocumentClassificationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
@RestController
@Api(tags = "文档分类")
@RequestMapping("/warehouse/documentClassification")
public class DocumentClassificationController extends BaseController {
    @Autowired
    private DocumentClassificationService documentClassificationService;
    @GetMapping("/getList")
    @ApiOperation("文档分类-查询")
    @Log(title = "文档分类-查询", businessType = BusinessType.OTHER)
    public AjaxResult getList() {
        return AjaxResult.success(documentClassificationService.list());
    }
    @PostMapping("/add")
    @ApiOperation("文档分类-添加")
    @Log(title = "文档分类-添加", businessType = BusinessType.INSERT)
    public AjaxResult add(@RequestBody DocumentClassification documentClassification) {
        return AjaxResult.success(documentClassificationService.save(documentClassification));
    }
    @PostMapping("/update")
    @ApiOperation("文档分类-更新")
    @Log(title = "文档分类-更新", businessType = BusinessType.UPDATE)
    public AjaxResult update(@RequestBody DocumentClassification documentClassification) {
        return AjaxResult.success(documentClassificationService.updateById(documentClassification));
    }
    @DeleteMapping("/delete")
    @ApiOperation("文档分类删除")
    @Log(title = "文档分类删除", businessType = BusinessType.DELETE)
    public AjaxResult delete(@RequestBody List<Long> ids) {
        if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID");
        return AjaxResult.success(documentClassificationService.deleteByIds(ids));
    }
 
}