| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.dto.AddStandardDto; |
| | | import com.yuanchu.limslaboratory.service.StandardService; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private StandardService standardService; |
| | | |
| | | @ApiOperation("添加物料") |
| | | @PostMapping("/add") |
| | | public Result<?> addStandardInformation(@Validated @RequestBody AddStandardDto addStandardDto) { |
| | | Integer isMaterialSuccess = standardService.addStandardInformation(addStandardDto); |
| | | if (isMaterialSuccess == 1) { |
| | | return Result.success("添加物料【"+ addStandardDto.getStandardName() +"】成功!"); |
| | | } |
| | | return Result.fail("添加物料【"+ addStandardDto.getStandardName() +"】失败!"); |
| | | } |
| | | |
| | | @ApiOperation("根据ID删除数据") |
| | | @DeleteMapping("/delete") |
| | | public Result<?> deleteStandardsInformation(String standardsId) { |
| | | Integer isDeleteSuccess = standardService.deleteStandardsInformation(standardsId); |
| | | if (isDeleteSuccess == 1){ |
| | | public Result<?> deleteStandardsInformation(Integer standardsId) { |
| | | Integer isDeleteMaterialSuccess = standardService.deleteStandardInformation(standardsId); |
| | | if (isDeleteMaterialSuccess == 1) { |
| | | return Result.success("删除成功!"); |
| | | } |
| | | return Result.fail("删除失败!"); |