zss
6 天以前 51ec98113c6d49d0f7eec4e3c030e55e337e97db
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
package com.yuanchu.mom.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.mom.annotation.CustomClazzName;
import com.yuanchu.mom.annotation.ValueAuth;
import com.yuanchu.mom.annotation.ValueClassify;
import com.yuanchu.mom.common.GetLook;
import com.yuanchu.mom.pojo.SupplierManagement;
import com.yuanchu.mom.service.ProcurementSuppliesContentsService;
import com.yuanchu.mom.service.SupplierManagementService;
import com.yuanchu.mom.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
 
/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 
 * @since 2024-11-15 02:46:45
 */
@Api(tags = "供应商管理")
@RestController
@RequestMapping("/supplierManagement")
@AllArgsConstructor
//@CustomClazzName(name = "供应商管理", index = 10)
public class SupplierManagementController {
 
    @Autowired
    private SupplierManagementService supplierManagementService;
 
    @Autowired
    private ProcurementSuppliesContentsService procurementSuppliesContentsService;
 
    private GetLook getLook;
 
    @ValueAuth
    @ApiOperation("查询供方名录")
    @GetMapping("/selectSupplierManagementByParentId/{parentId}")
    public Result<List<SupplierManagement>> selectSupplierManagementByParentId(@PathVariable Integer parentId) throws Exception {
        return Result.success(supplierManagementService.selectSupplierManagementByParentId(parentId));
    }
 
 
    @ValueClassify(value = "供应商管理")
    @ApiOperation("分页查询合格供方名录")
    @GetMapping("/selectQualifiedSupplierManagementPage")
    public Result<IPage<SupplierManagement>> selectQualifiedSupplierManagement(SupplierManagement supplierManagement, Page page) throws Exception {
        return Result.success(supplierManagementService.selectQualifiedSupplierManagement(page, supplierManagement));
    }
 
    @ValueAuth
    @ApiOperation("根据ID查询供应商")
    @GetMapping("/selectQualifiedSupplierManagementById/{supplierManagementId}")
    public Result<List<SupplierManagement>> selectQualifiedSupplierManagementById(@PathVariable Integer supplierManagementId) throws Exception {
        return Result.success(supplierManagementService.selectQualifiedSupplierManagementById(supplierManagementId));
    }
 
    @ValueClassify(value = "供应商管理")
    @ApiOperation("新增供应商")
    @PostMapping("/addSupplierManagement")
    public Result addSupplierManagement(@RequestBody SupplierManagement supplierManagement) {
        Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("selectRoleLists");
        supplierManagement.setCreateUser(map1.get("userId"));
        return Result.success(supplierManagementService.save(supplierManagement));
    }
 
    @ValueClassify(value = "供应商管理")
    @ApiOperation("修改供应商")
    @PostMapping("/updateSupplierManagement")
    public Result updateSupplierManagement(@RequestBody SupplierManagement supplierManagement) {
        return Result.success(supplierManagementService.updateById(supplierManagement));
    }
 
    @ValueClassify(value = "供应商管理")
    @ApiOperation("删除供应商")
    @PostMapping("/delSupplierManagement/{id}")
    public Result delSupplierManagement(@PathVariable Integer id) {
        return Result.success(supplierManagementService.removeById(id));
    }
 
    @ValueClassify(value = "供应商管理")
    @ApiOperation("导出供应商")
    @PostMapping("/exportSupplierManagement/{parentId}")
    public void exportSupplierManagement(@PathVariable Integer parentId, HttpServletResponse response) throws Exception {
        supplierManagementService.exportSupplierManagement(parentId, response);
    }
 
    @ValueAuth
    @ApiOperation("查询全部供方名录")
    @GetMapping("/selectSupplierManagementAll")
    public Result<List<SupplierManagement>> selectSupplierManagementAll() throws Exception {
        return Result.success(supplierManagementService.selectSupplierManagementAll());
    }
 
}