zss
2024-12-30 97bb7a8832281eafe0ef947ea095258d355e52f5
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
package com.yuanchu.mom.controller;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.mom.annotation.ValueAuth;
import com.yuanchu.mom.annotation.ValueClassify;
import com.yuanchu.mom.pojo.StandardTemplate;
import com.yuanchu.mom.service.StandardTemplateService;
import com.yuanchu.mom.utils.JackSonUtil;
import com.yuanchu.mom.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
 
import java.util.Map;
 
@RequestMapping("/StandardTemplate")
@RestController
@AllArgsConstructor
@Api(tags = "原始记录模板")
public class StandardTemplateController {
 
    private StandardTemplateService standardTemplateService;
    @ValueClassify("标准库")
    @ApiOperation(value = "获取原始记录模板列表")
    @PostMapping("/selectStandardTemplatePageList")
    public Result selectStandardTemplatePageList(@RequestBody Map<String, Object> data) throws Exception {
        Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class);
        StandardTemplate standardTemplate = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), StandardTemplate.class);
        return Result.success(standardTemplateService.selectStandardTemplatePageList(page, standardTemplate));
    }
    @ValueClassify("标准库")
    @ApiOperation(value = "添加原始记录模板")
    @PostMapping("/addStandardTemplate")
    public Result addStandardTemplate(@RequestBody StandardTemplate standardTemplate) {
        return Result.success(standardTemplateService.addStandardTemplate(standardTemplate));
    }
    @ValueClassify("标准库")
    @ApiOperation(value = "修改原始记录模板")
    @PostMapping("/upStandardTemplate")
    public Result<?> upStandardTemplate(@RequestBody StandardTemplate standardTemplate) {
        return Result.success(standardTemplateService.upStandardTemplate(standardTemplate));
    }
    @ValueClassify("标准库")
    @ApiOperation(value = "删除原始记录模板")
    @PostMapping("/delStandardTemplate")
    public Result<?> delStandardTemplate(Integer id) {
        return Result.success(standardTemplateService.delStandardTemplate(id));
    }
 
    @ApiOperation(value = "查询原始记录模板枚举")
    @GetMapping("/getStandardTemplate")
    @ValueAuth
    public Result<?> getStandardTemplate() {
        return Result.success(standardTemplateService.getStandardTemplate());
    }
 
    @ApiOperation(value = "通过模板id获取检验项模板内容")
    @PostMapping("/getStandTempThingById")
    @ValueAuth
    public Result<?> getStandTempThingById(Integer id) {
        return Result.success(standardTemplateService.getStandTempThingById(id));
    }
 
    @ValueAuth
    @ApiOperation(value = "编辑模板编制")
    @GetMapping("/getEditTemplatePreparation")
    public Result<?> getEditTemplatePreparation(@RequestParam("id") Integer id) {
        StandardTemplate byId = standardTemplateService.getById(id);
        return Result.success("OK", byId.getThing());
    }
}