| | |
| | | import com.yuanchu.limslaboratory.utils.JackSonUtil; |
| | | import com.yuanchu.limslaboratory.utils.RedisUtil; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import com.yuanchu.limslaboratory.vo.UpdateSpecificationsInformation; |
| | | import com.yuanchu.limslaboratory.pojo.dto.UpdateSpeStateSpecificationsDto; |
| | | import com.yuanchu.limslaboratory.pojo.dto.UpdateSpecificationsInformationDto; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | * @author 江苏鵷雏网络科技有限公司 |
| | | * @since 2023-07-11 |
| | | */ |
| | | @Api(tags = "标准库-->型号-->产品规格") |
| | | @Api(tags = "标准库-->3、型号-->产品规格") |
| | | @RestController |
| | | @RequestMapping("/specifications") |
| | | public class SpecificationsController { |
| | |
| | | @Autowired |
| | | private SpecificationsService specificationsService; |
| | | |
| | | @ApiOperation("标准库-->产品规格") |
| | | @ApiOperation("添加产品规格") |
| | | @PostMapping("/add") |
| | | public Result<?> addSpecificationsInformation(@RequestHeader("X-Token") String token,@RequestBody Specifications specifications) throws Exception { |
| | | Object object = RedisUtil.get(token); |
| | |
| | | return Result.fail("添加【"+ specifications.getName() +"】失败!"); |
| | | } |
| | | |
| | | @ApiOperation("标准库-->根据型号查询产品规格") |
| | | @ApiOperation("根据型号查询产品规格") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "pageNo", value = "起始页", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "pageSize", value = "每一页数量", dataTypeClass = Integer.class, required = true), |
| | |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @ApiOperation("标准库-->产品规格-->编辑") |
| | | @ApiOperation("编辑产品规格") |
| | | @PutMapping("/update") |
| | | public Result<?> updateSpecificationsInformation(@RequestHeader("X-Token") String token, @RequestBody UpdateSpecificationsInformation updateSpecificationsInformation) throws Exception { |
| | | public Result<?> updateSpecificationsInformation(@RequestHeader("X-Token") String token, @RequestBody UpdateSpecificationsInformationDto updateSpecificationsInformationDto) throws Exception { |
| | | Object object = RedisUtil.get(token); |
| | | if (ObjectUtils.isEmpty(object)){ |
| | | return Result.fail("对不起,请携带Token!"); |
| | | } |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); |
| | | updateSpecificationsInformation.setUserId((Integer) unmarshal.get("id")); |
| | | Specifications specifications = JackSonUtil.unmarshal(JackSonUtil.marshal(updateSpecificationsInformation), Specifications.class); |
| | | updateSpecificationsInformationDto.setUserId((Integer) unmarshal.get("id")); |
| | | Specifications specifications = JackSonUtil.unmarshal(JackSonUtil.marshal(updateSpecificationsInformationDto), Specifications.class); |
| | | Integer isStandardsSuccess = specificationsService.updateSpecificationsInformation(specifications); |
| | | if (isStandardsSuccess == 1) { |
| | | return Result.success("更新【"+ specifications.getName() +"】成功!"); |
| | |
| | | return Result.fail("更新【"+ specifications.getName() +"】失败!"); |
| | | } |
| | | |
| | | @ApiOperation("标准库-->产品规格-->删除") |
| | | @ApiOperation("删除产品规格") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "specificationsId", value = "规格Id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | |
| | | } |
| | | return Result.fail("删除失败!"); |
| | | } |
| | | |
| | | @ApiOperation("更新规格状态") |
| | | @PutMapping("/update_spe_state") |
| | | public Result<?> updateSpeStateSpecifications(@RequestBody UpdateSpeStateSpecificationsDto updateSpeStateSpecificationsDto) { |
| | | Integer isStandardsSuccess = specificationsService.updateSpeStateSpecifications(updateSpeStateSpecificationsDto); |
| | | if (isStandardsSuccess == 1) { |
| | | return Result.success("操作成功!"); |
| | | } |
| | | return Result.fail("操作失败!"); |
| | | } |
| | | } |