XiaoRuby
2023-08-28 5f72ddd4ca8a10d5dcb4e1ab79463593317ffbe6
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
107
108
package com.yuanchu.mom.controller;
 
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.mom.pojo.dto.TechnologyTemplateDto;
import com.yuanchu.mom.service.DeviceService;
import com.yuanchu.mom.utils.JackSonUtil;
import com.yuanchu.mom.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.mom.service.TechnologyTemplateService;
 
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
 
/**
 * 工艺路线维护表(TechnologyTemplate)表控制层
 *
 * @author zss
 * @since 2023-08-18 16:59:14
 */
@Api(tags = "基础数据-->工艺路线维护表接口")
@RestController
@RequestMapping("/technologyTemplate")
public class TechnologyTemplateController {
 
    @Autowired
    private TechnologyTemplateService technologyTemplateService;
 
 
    @ApiOperation(value = "新增工艺路线维护-->选择设备组")
    @GetMapping("/chooseDevGroup")
    public Result chooseDevGroup() {
        return Result.success(technologyTemplateService.chooseDevGroup());
    }
 
    @ApiOperation(value = "新增工艺路线维护")
    @PostMapping("/addTechTemp")
    public Result addSale(@Validated @RequestBody TechnologyTemplateDto technologyTemplateDto) {
        technologyTemplateService.addSale(technologyTemplateDto);
        return Result.success("新增成功!");
    }
 
    @ApiOperation(value = "查询工艺路线列表")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "pageSize", value = "页数", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "countSize", value = "条数/页", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "type", value = "类型", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "name", value = "工艺", dataTypeClass = String.class),
            @ApiImplicitParam(name = "father", value = "工序", dataTypeClass = String.class)
    })
    @GetMapping("/selectAllTechTem")
    public Result selectAllTechTem(int pageSize, int countSize, Integer type, String name, String father) {
        IPage<Map<String, Object>> technologyTemplatePage = technologyTemplateService.selectAllTechTem(new Page<Object>(pageSize, countSize), type, name, father);
        Map<String, Object> map = new HashMap<>();
        map.put("total", technologyTemplatePage.getTotal());
        map.put("row", technologyTemplatePage.getRecords());
        return Result.success(map);
    }
 
    @ApiOperation(value = "根据id查询详情")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "工艺id", dataTypeClass = Integer.class,required = true)
    })
    @GetMapping("/selecTechById")
    public Result selecTechById(Integer id) {
        return Result.success(technologyTemplateService.getById(id));
    }
 
    @ApiOperation(value = "编辑")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "工艺id", dataTypeClass = Integer.class,required = true)
    })
    @PostMapping("/writeTechById")
    public Result writeTechById(Integer id,@RequestBody TechnologyTemplateDto technologyTemplateDto) {
        technologyTemplateService.writeTechById(id,technologyTemplateDto);
        return Result.success("修改成功!");
    }
 
    @ApiOperation(value = "删除")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "工艺id", dataTypeClass = Integer.class,required = true)
    })
    @PostMapping("/delTechById")
    public Result delTechById(Integer id) {
        technologyTemplateService.delTechById(id);
        return Result.success("删除成功!");
    }
 
    @ApiOperation(value = "批量删除")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "ids", value = "工艺id", dataTypeClass = String.class,required = true)
    })
    @PostMapping("/delAllTech")
    public Result delAllTech(String ids) {
        technologyTemplateService.delAllTech(ids);
        return Result.success("批量删除成功!");
    }
}