| | |
| | | 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.utils.JackSonUtil; |
| | | import com.yuanchu.limslaboratory.utils.RedisUtil; |
| | | 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; |
| | |
| | | * @author 江苏鵷雏网络科技有限公司 |
| | | * @since 2023-07-17 |
| | | */ |
| | | @Api(tags = "标准库-->规格-->查看-->父->物料") |
| | | @Api(tags = "标准库-->1、物料") |
| | | @RestController |
| | | @RequestMapping("/material") |
| | | public class MaterialController { |
| | |
| | | @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 = materialService.addMaterialInformation(material); |
| | | @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查询所有物料") |
| | | @GetMapping("/list") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "规格ID", name = "specificationsId", dataTypeClass = String.class) |
| | | }) |
| | | public Result<?> getListMaterialInformation(String specificationsId) { |
| | | List<Map<String, Object>> listMaterialInformation = materialService.getListMaterialInformation(specificationsId); |
| | | return Result.success(listMaterialInformation); |
| | | } |
| | | |
| | | @ApiOperation("物料库-->根据规格ID查询物料详情") |
| | | @GetMapping("/list_id") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "物料ID", name = "materialId", dataTypeClass = String.class) |
| | | }) |
| | | public Result<?> getListIdMaterialInformation(String materialId) { |
| | | Material listIdMaterialInformation = materialService.ListIdMaterialInformation(materialId); |
| | | return Result.success(listIdMaterialInformation); |
| | | } |
| | | |
| | | @ApiOperation("物料库-->根据物料ID删除物料") |
| | | @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("物料库-->修改物料") |
| | | @PutMapping("/update") |
| | | public Result<?> updateMaterialInformation(@RequestBody Material material) { |
| | | Integer isUpdateMaterialSuccess = materialService.updateMaterialInformation(material); |
| | | if (isUpdateMaterialSuccess == 1) { |
| | | return Result.success("修改物料【"+ material.getName() +"】成功!"); |
| | | } |
| | | return Result.fail("修改物料【"+ material.getName() +"】失败!"); |
| | | @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()); |
| | | } |
| | | } |