XiaoRuby
2023-08-22 dce5044043c3af93b84dae2804f2d54f779e7c1e
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package com.yuanchu.limslaboratory.controller;
 
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.limslaboratory.pojo.dto.AddMaterialDto;
import com.yuanchu.limslaboratory.pojo.dto.ProductModelDto;
import com.yuanchu.limslaboratory.utils.MyUtil;
import com.yuanchu.limslaboratory.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.yuanchu.limslaboratory.service.ProductModelService;
 
import java.util.HashMap;
import java.util.Map;
 
 
/**
 * 基础项目模版表(ProductModel)表控制层
 *
 * @author zss
 * @since 2023-08-19 11:00:39
 */
@Api(tags = "基础数据-->标准维护")
@RestController
@RequestMapping("/productModel")
public class ProductModelController {
 
    @Autowired
    private ProductModelService productModelService;
 
    @ApiOperation(value = "选择样品名称")
    @GetMapping("/selectmater")
    public Result selectmater() {
        return Result.success(productModelService.selectmater());
    }
 
    @ApiOperation(value = "添加标准-->选择项目分组")
    @GetMapping("/selectfather")
    public Result selectfather() {
        return Result.success(productModelService.selectfather());
    }
 
    @ApiOperation("添加标准")
    @PostMapping("/addproductModel")
    public Result<?> addproductModel(@Validated @RequestBody ProductModelDto productModelDto) {
        productModelService.addproductModel(productModelDto);
        return Result.success("添加标准项目【" + productModelDto.getName() + "】成功!");
    }
 
    @ApiOperation(value = "查询标准模版列表")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "name", value = "项目名称", dataTypeClass = String.class),
            @ApiImplicitParam(name = "father", value = "项目分组", dataTypeClass = String.class),
            @ApiImplicitParam(name = "material", value = "样品名称", dataTypeClass = String.class, required = true)
    })
    @GetMapping("/selectproductModel")
    public Result selectproductModel(String name, String father, String material) {
        return Result.success(productModelService.selectproductModel(name, father, material));
    }
 
    @ApiOperation(value = "根据id查询")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "标准模版id", dataTypeClass = Integer.class, required = true)
    })
    @GetMapping("/selectproductModelById")
    public Result selectproductModelById(Integer id) {
        return Result.success(productModelService.selectproductModelById(id));
    }
 
    @ApiOperation("编辑")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "标准模版id", dataTypeClass = Integer.class, required = true)
    })
    @PostMapping("/writeproductModel")
    public Result<?> writeproductModel(Integer id, @Validated @RequestBody ProductModelDto productModelDto) {
        productModelService.writeproductModel(id,productModelDto);
        return Result.success("修改标准项目【" + productModelDto.getName() + "】成功!");
    }
 
    @ApiOperation("删除")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "标准模版id", dataTypeClass = Integer.class, required = true)
    })
    @PostMapping("/delproductModel")
    public Result<?> delproductModel(Integer id) {
        productModelService.delproductModel(id);
        return Result.success("删除标准项目成功!");
    }
 
    @ApiOperation("批量删除")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "ids", value = "标准模版id", dataTypeClass = String.class, required = true)
    })
    @PostMapping("/delAllproductModel")
    public Result<?> delAllproductModel(String ids) {
        productModelService.delAllproductModel(ids);
        return Result.success("批量删除标准项目成功!");
    }
 
}