package com.cool.store.controller.webc;

import com.alibaba.fastjson.JSONObject;
import com.cool.store.dto.pre.fry.PreFriedProductsDetailDTO;
import com.cool.store.dto.pre.fry.PreFriedProductsQueryDTO;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.PreFriedProductsService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
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;

import javax.annotation.Resource;

/**
 * @Author suzhuhong
 * @Date 2025/6/21 13:38
 * @Version 1.0
 */
@Slf4j
@Api(tags = "预炸-小程序端")
@RestController
@RequestMapping("/mini/pre/fry/")
public class MiniPreFryController {

    @Resource
    PreFriedProductsService preFriedProductsService;


    @ApiOperation("查询预炸品列表")
    @PostMapping("/queryProducts")
    public ResponseResult<PageInfo<PreFriedProductsDetailDTO>> queryProducts(@RequestBody @Validated PreFriedProductsQueryDTO dto) {
        log.info("查询预炸品：{}", JSONObject.toJSONString(dto));
        return ResponseResult.success(preFriedProductsService.queryProducts(dto));
    }


}
