¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.dto.AddMaterialDto; |
| | | import com.yuanchu.limslaboratory.service.MaterialService; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-07-17 |
| | | */ |
| | | @Api(tags = "æ ååº-->1ãç©æ") |
| | | @RestController |
| | | @RequestMapping("/material") |
| | | public class MaterialController { |
| | | |
| | | @Autowired |
| | | private MaterialService materialService; |
| | | |
| | | @ApiOperation("æ·»å ç©æ") |
| | | @PostMapping("/add") |
| | | public Result<?> addMaterialInformation(@Validated @RequestBody AddMaterialDto addMaterialDto) { |
| | | Integer isMaterialSuccess = materialService.addMaterialInformation(addMaterialDto); |
| | | if (isMaterialSuccess == 1) { |
| | | return Result.success("æ·»å ç©æã"+ addMaterialDto.getMaterialName() +"ãæåï¼"); |
| | | } |
| | | return Result.fail("æ·»å ç©æã"+ addMaterialDto.getMaterialName() +"ã失败ï¼"); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®ç©æIDå é¤ç©æ") |
| | | @DeleteMapping("/delete") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "ç©æID", name = "materialId", dataTypeClass = Integer.class) |
| | | }) |
| | | public Result<?> deleteMaterialInformation(Integer materialId) { |
| | | Integer isDeleteMaterialSuccess = materialService.deleteMaterialInformation(materialId); |
| | | if (isDeleteMaterialSuccess == 1) { |
| | | return Result.success("å 餿åï¼"); |
| | | } |
| | | return Result.fail("å é¤å¤±è´¥ï¼"); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ååº-->ç©æ-->ä¾§è¾¹æ å级å±å¼", tags = "âââåç«¯è°æ´") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "åå·/åå·åç§°", name = "specificationName", dataTypeClass = String.class) |
| | | }) |
| | | @GetMapping("/list") |
| | | public Result<?> getFourLevelInformation(String specificationName) { |
| | | List<Map<String, Object>> fourLevelInformation = materialService.getFourLevelInformation(specificationName); |
| | | return Result.success(fourLevelInformation); |
| | | } |
| | | } |