| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.Product; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.service.ProductService; |
| | | import com.yuanchu.limslaboratory.utils.JackSonUtil; |
| | | import com.yuanchu.limslaboratory.utils.RedisUtil; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import io.swagger.annotations.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Autowired |
| | | private ProductService productService; |
| | | |
| | | @ApiOperation("删除测试标准模块数据") |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation("1、分页查询项目") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "测试标准ID", name = "productId", dataTypeClass = String.class) |
| | | @ApiImplicitParam(name = "pageNo", value = "起始页", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "pageSize", value = "每一页数量", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(value = "原材料编码/原材料名称", name = "productCodeOrName", dataTypeClass = String.class) |
| | | }) |
| | | public Result<?> deleteProductInformation(Integer productId) { |
| | | Integer isDeleteProduct = productService.deleteProductInformation(productId); |
| | | if (isDeleteProduct == 1) { |
| | | return Result.success("删除成功!"); |
| | | } |
| | | return Result.fail("删除失败!"); |
| | | @GetMapping("/page") |
| | | public Result<?> pageProductInformation(Integer pageNo, Integer pageSize,String productCodeOrName) { |
| | | IPage<Map<String, Object>> maps = productService.pageProductInformation(productCodeOrName, new Page<Objects>(pageNo, pageSize)); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("row", maps.getRecords()); |
| | | map.put("total", maps.getTotal()); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @ApiOperation("2、根据父类查子类") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "父类名称", name = "fatherName", dataTypeClass = String.class) |
| | | }) |
| | | @GetMapping("/father") |
| | | public Result<?> pageFatherNameProductInformation(String fatherName) { |
| | | List<Map<String, Object>> maps = productService.pageFatherNameProductInformation(fatherName); |
| | | return Result.success(maps); |
| | | } |
| | | } |