guoyujie
2 天以前 c4b9a339caff12e95f61c3d5dc950aafcc8c566c
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
package com.example.erp.controller.sd;
 
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.example.erp.common.Result;
import com.example.erp.entity.sd.Product;
import com.example.erp.service.sd.ProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
import java.util.Map;
 
@RestController
@Api(value="产品controller",tags={"产品操作接口"})
@RequestMapping("/product")
public class ProductController {
    final
    ProductService productService;
 
    public ProductController(ProductService productService) {
        this.productService = productService;
    }
 
    @ApiOperation("产品查询接口")
    @SaCheckPermission("selectProduct.search")
    @PostMapping  ("/{pageNum}/{pageSize}/{glassType}")
    public Result defaultDateProduct(@PathVariable Integer pageNum,
                                     @PathVariable Integer pageSize,
                                     @PathVariable List<String> glassType,
                                     @RequestBody Product product){
        return Result.seccess(productService.defaultDateProduct(pageNum,pageSize,glassType,product));
    }
    @ApiOperation("其他系统获取产品查询接口")
    @PostMapping("/otherSysGetProduct")
    public Result otherSysGetProduct(){
        return Result.seccess(productService.otherSysGetProduct());
    }
 
    @ApiOperation("产品保存接口")
    @SaCheckPermission("createProduct.add")
    @PostMapping("/saveProduct")
    public Result saveProduct(@RequestBody Map<String,Object> product){
        return Result.seccess(productService.saveProduct(product));
    }
    @ApiOperation("其他系统产品保存接口")
    @PostMapping("/otherSysSaveProduct")
    public Result otherSysSaveProduct(@RequestBody Map<String,Object> product){
        return Result.seccess(productService.saveProduct(product));
    }
 
    @ApiOperation("产品查重接口")
    @SaCheckPermission("createProduct.add")
    @PostMapping("/selectProduct/{productName}")
    public Result selectProduct(@PathVariable String productName,@RequestBody Map<String,Object> product){
        return Result.seccess(productService.selectProduct(productName,product));
    }
 
    @ApiOperation("产品删除接口")
    @SaCheckPermission("selectProduct.delete")
    @PostMapping("/deleteProductById/{id}")
    public Result deleteProductById(@PathVariable Integer id){
        return Result.seccess(productService.deleteProductById(id));
    }
 
    @ApiOperation("产品审核状态修改接口")
    @SaCheckPermission("createProduct.review")
    @PostMapping("/updateProductStateById/{id}/{state}")
    public Result updateProductStateById(@PathVariable Integer id,@PathVariable Integer state){
        return Result.seccess(productService.updateProductStateById(id,state));
    }
    @ApiOperation("根据产品id查询产品接口")
    @SaCheckPermission("selectProduct.edit")
    @PostMapping("/selectProductById/{id}")
    public Result selectProductById(@PathVariable Integer id){
        return Result.seccess(productService.selectProductById(id));
    }
}