package com.example.xiaoshiweixinback.controller; import com.example.xiaoshiweixinback.business.common.Constants; import com.example.xiaoshiweixinback.business.common.Response; import com.example.xiaoshiweixinback.business.common.base.Records; import com.example.xiaoshiweixinback.entity.product.ProductAddDTO; import com.example.xiaoshiweixinback.entity.product.ProductDTO; import com.example.xiaoshiweixinback.service.ProductService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.models.security.SecurityScheme; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @Slf4j @RequestMapping(Constants.XIAOSHI_WEIXINBACK + "/product") @RestController @RequiredArgsConstructor public class ProductController { private final ProductService productService; @Operation(summary = "查询爆款产品") @PostMapping("/queryHotProduct") public Response queryHotProduct(@RequestBody ProductDTO productDTO) { Records records = productService.queryHotProduct(productDTO); return Response.success(records); } @Operation(summary = "添加或更新产品") @PostMapping("/addOrUpdateProduct") public Response addOrUpdateProduct(@RequestBody ProductAddDTO productAddDTO) { Records records = new Records(); Integer id = productService.addOrUpdateProduct(productAddDTO); records.setData(id); return Response.success(records); } }