value
2023-08-29 53b5ea2b96d76b2072819f14a48f26c58cea0f84
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
77
78
79
80
81
82
83
84
85
86
87
88
package com.yuanchu.limslaboratory.controller;
 
import com.yuanchu.limslaboratory.annotation.AuthHandler;
import com.yuanchu.limslaboratory.service.ProductService;
import com.yuanchu.limslaboratory.utils.MyUtil;
import com.yuanchu.limslaboratory.vo.Result;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 江苏鵷雏网络科技有限公司
 * @since 2023-07-17
 */
@Api(tags = "标准库-->4、项目")
@RestController
@RequestMapping("/product")
public class ProductController {
 
    @Autowired
    private ProductService productService;
 
    @ApiOperation("查询该型号下的项目-->选择版本")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "specificationsId", value = "型号ID", dataTypeClass = Integer.class, required = true)
    })
    @GetMapping("/chooseVersion")
    @AuthHandler
    public Result<?> chooseVersion(Integer specificationsId) {
        return Result.success(productService.chooseVersion(specificationsId));
    }
 
    @ApiOperation("查询该型号下的项目")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "specificationsId", value = "型号ID", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "version", value = "版本(默认最新版本)", dataTypeClass = Integer.class,required = true )
    })
    @GetMapping("/page")
    @AuthHandler
    public Result<?> pageProductInformation(Integer specificationsId,Integer version) {
        return Result.success(productService.pageProductInformation(specificationsId,version));
    }
 
    @ApiOperation("填写标准值与内控值,鼠标移开保存")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "标准项目ID", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "required", value = "标准值", dataTypeClass = String.class, required = true),
            @ApiImplicitParam(name = "internal", value = "内控值", dataTypeClass = String.class, required = true)
 
    })
    @PostMapping("/write")
    @AuthHandler
    public Result<?> write(Integer id, String required, String internal) {
        Integer write = productService.write(id, required, internal);
        if (write >= 1){
            return Result.success("更新成功");
        }
        return Result.fail("更新失败");
    }
 
    @ApiOperation("项目Id列表删除")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "ids", value = "标准项目ID", dataTypeClass = String.class, required = true)
    })
    @DeleteMapping("/deleteList")
    @AuthHandler
    public Result<?> deleteList(String ids) {
        if(ids==null||ids.equals(""))return Result.fail();
        MyUtil.PrintLog(ids);
        productService.deleteList(ids);
        return Result.success("删除成功");
    }
 
    @ApiOperation("添加同一个型号的其他版本")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true)
    })
    @PostMapping("/addVersion")
    @AuthHandler
    public Result<?> addVersion(Integer specificationsId ) {
        Integer version = productService.addVersion(specificationsId);
        return Result.success("添加版本"+version+"成功");
    }
}