yangys
2024-10-30 25db770e621f1259b8d5b7fd514207f7481c2d0f
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
package com.qianwen.smartman.modules.cps.controller;
 
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.util.List;
import com.qianwen.core.scanner.modular.annotation.DeleteResource;
import com.qianwen.core.scanner.modular.annotation.GetResource;
import com.qianwen.core.scanner.modular.annotation.PostResource;
import com.qianwen.core.scanner.modular.annotation.PutResource;
import com.qianwen.core.scanner.modular.stereotype.ApiResource;
import com.qianwen.core.secure.annotation.PreAuth;
import com.qianwen.core.tool.api.R;
import com.qianwen.core.tool.utils.Func;
import com.qianwen.smartman.modules.cps.entity.CheckItem;
import com.qianwen.smartman.modules.cps.service.ICheckItemService;
import com.qianwen.smartman.modules.cps.vo.CheckItemSubmitVO;
import com.qianwen.smartman.modules.cps.vo.CheckItemUpdateVO;
import com.qianwen.smartman.modules.cps.vo.CheckItemVO;
import com.qianwen.smartman.modules.cps.vo.IdsVO;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
@ApiResource({"smis/check-item"})
@Api(value = "点检项", tags = {"点检项"})
@RestController
public class CheckItemController {
    private final ICheckItemService checkItemService;
 
    public CheckItemController(final ICheckItemService checkItemService) {
        this.checkItemService = checkItemService;
    }
 
    @ApiOperationSupport(order = 1)
    @PostResource
    @ApiOperation("新增点检项")
    @PreAuth
    public R<List<CheckItem>> createCheckItem(@RequestBody CheckItemSubmitVO vo) {
        return R.data(this.checkItemService.createCheckItem(vo));
    }
 
    @ApiOperationSupport(order = 2)
    @GetResource({"/list"})
    @ApiOperation("查询点检项")
    public R<List<CheckItemVO>> listCheckItem(@RequestParam("projectId") @ApiParam("点检项目id") String projectId) {
        return R.data(this.checkItemService.listCheckItem(projectId));
    }
 
    @ApiOperationSupport(order = 3)
    @PutResource
    @ApiOperation("修改点检项")
    @PreAuth
    public R<Boolean> updateCheckItem(@RequestBody CheckItemUpdateVO vo) {
        return R.data(Boolean.valueOf(this.checkItemService.updateCheckItem(vo)));
    }
 
    @ApiOperationSupport(order = 4)
    @ApiOperation("删除点检项")
    @PreAuth
    @DeleteResource
    public R<Boolean> removeCheckItem(@RequestBody IdsVO vo) {
        return R.data(Boolean.valueOf(this.checkItemService.removeByIds(Func.toLongList(vo.getIds()))));
    }
}