¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | 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.vo.Result; |
| | | import io.swagger.annotations.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | | * å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-07-17 |
| | | */ |
| | | @Api(tags = "æ ååº-->4ã项ç®") |
| | | @RestController |
| | | @RequestMapping("/product") |
| | | public class ProductController { |
| | | |
| | | @Autowired |
| | | private ProductService productService; |
| | | |
| | | @ApiOperation("1ãå页æ¥è¯¢é¡¹ç®") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "pageNo", value = "èµ·å§é¡µ", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯ä¸é¡µæ°é", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "specificationsId", value = "è§æ ¼åå·ID", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(value = "åææç¼ç /åææåç§°", name = "productCodeOrName", dataTypeClass = String.class) |
| | | }) |
| | | @GetMapping("/page") |
| | | public Result<?> pageProductInformation(Integer pageNo, Integer pageSize, Integer specificationsId, String productCodeOrName) { |
| | | IPage<Map<String, Object>> maps = productService.pageProductInformation(productCodeOrName, specificationsId, 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); |
| | | } |
| | | } |