lyh
3 天以前 2ab86210fb27787cb1be8976286b9b827f90997f
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
package com.lxzn.nc.controller;
 
import com.lxzn.api.nc.PartsInfoControllerApi;
import com.lxzn.framework.domain.nc.PartsInfo;
import com.lxzn.framework.model.response.CommonCode;
import com.lxzn.framework.model.response.ResponseResult;
import com.lxzn.nc.service.IPartsInfoService;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
@RestController
@RequestMapping("/nc/parts")
public class PartsInfoController implements PartsInfoControllerApi {
 
    @Autowired
    private IPartsInfoService partsInfoService;
 
    @Override
    @PostMapping("/add")
    public ResponseResult addPartsInfo(@RequestBody PartsInfo partsInfo) {
        boolean b = partsInfoService.addPartsInfo(partsInfo);
        if(b) {
            return new ResponseResult(CommonCode.SUCCESS);
        }
        return new ResponseResult(CommonCode.FAIL);
    }
 
    @Override
    @PutMapping("/edit/{id}")
    public ResponseResult editPartsInfo(@PathVariable("id") String id, @RequestBody PartsInfo partsInfo) {
        boolean b = partsInfoService.editPartsInfo(id, partsInfo);
        if(b) {
            return new ResponseResult(CommonCode.SUCCESS);
        }
        return new ResponseResult(CommonCode.FAIL);
    }
 
    @Override
    @DeleteMapping("/delete")
    public ResponseResult deletePartsInfo(@RequestParam("id") String id) {
        boolean b = partsInfoService.deletePartsInfo(id);
        if(b) {
            return new ResponseResult(CommonCode.SUCCESS);
        }
        return new ResponseResult(CommonCode.FAIL);
    }
}