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); } }