| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.Material; |
| | | import com.yuanchu.limslaboratory.annotation.AuthHandler; |
| | | import com.yuanchu.limslaboratory.enums.InterfaceType; |
| | | import com.yuanchu.limslaboratory.enums.MenuEnums; |
| | | 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.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> |
| | |
| | | @Autowired |
| | | private MaterialService materialService; |
| | | |
| | | @ApiOperation("添加物料") |
| | | @ApiOperation(value = "添加指标-->选择样品名称") |
| | | @GetMapping("/selectmater") |
| | | @AuthHandler |
| | | public Result selectmater() { |
| | | return Result.success(materialService.selectmater()); |
| | | } |
| | | |
| | | @ApiOperation("添加指标") |
| | | @PostMapping("/add") |
| | | public Result<?> addMaterialInformation(@RequestBody Material material) { |
| | | Integer isMaterialSuccess = null; |
| | | @AuthHandler |
| | | public Result<?> addMaterialInformation(@Validated @RequestBody AddMaterialDto addMaterialDto) { |
| | | Integer isMaterialSuccess = materialService.addMaterialInformation(addMaterialDto); |
| | | if (isMaterialSuccess == 1) { |
| | | return Result.success("添加物料【"+ material.getName() +"】成功!"); |
| | | return Result.success("添加物料【"+ addMaterialDto.getMaterialName() +"】成功!"); |
| | | } |
| | | return Result.fail("添加物料【"+ material.getName() +"】失败!"); |
| | | return Result.fail("添加物料【"+ addMaterialDto.getMaterialName() +"】失败!"); |
| | | } |
| | | |
| | | @ApiOperation("根据物料ID删除物料") |
| | | @DeleteMapping("/delete") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "物料ID", name = "materialId", dataTypeClass = String.class) |
| | | @ApiImplicitParam(value = "物料ID", name = "materialId", dataTypeClass = Integer.class) |
| | | }) |
| | | public Result<?> deleteMaterialInformation(String materialId) { |
| | | @AuthHandler |
| | | public Result<?> deleteMaterialInformation(Integer materialId) { |
| | | Integer isDeleteMaterialSuccess = materialService.deleteMaterialInformation(materialId); |
| | | if (isDeleteMaterialSuccess == 1) { |
| | | return Result.success("删除成功!"); |
| | | } |
| | | return Result.fail("删除失败!"); |
| | | } |
| | | |
| | | @ApiOperation(value = "标准库-->物料-->侧边栏四级展开") |
| | | @GetMapping("/list") |
| | | @AuthHandler |
| | | public Result<?> getFourLevelInformation() { |
| | | List<Map<String, Object>> fourLevelInformation = materialService.getFourLevelInformation(); |
| | | return Result.success(fourLevelInformation); |
| | | } |
| | | |
| | | @ApiOperation(value = "标准库-->下拉基础数据样品") |
| | | @GetMapping("/getSample") |
| | | @AuthHandler(type = InterfaceType.SELECT,menuId = MenuEnums.index,isAdd = true) |
| | | public Result<?> getSample() { |
| | | return Result.success(materialService.getSample()); |
| | | } |
| | | } |