package com.cool.store.controller.webb;

import com.alibaba.fastjson.JSONObject;
import com.cool.store.context.PartnerUserHolder;
import com.cool.store.dto.pre.fry.*;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.PreFryRecordsService;
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.*;

import javax.annotation.Resource;

/**
 * @Author suzhuhong
 * @Date 2025/6/23 20:36
 * @Version 1.0
 */
@Slf4j
@Api(tags = "预炸-预炸记录-PC")
@RestController
@RequestMapping("/pc/pre/record/")
public class PCPreFryRecordsController {


    @Resource
    PreFryRecordsService preFryRecordsService;


    @ApiOperation("预炸品管理记录")
    @PostMapping("/queryByQueryDTO")
    public ResponseResult<PageInfo<PreFryRecordsDTO>> queryByQueryDTO(@RequestBody @Validated PreFryRecordQueryDTO dto) {
        log.info("预炸品管理记录：{}", JSONObject.toJSONString(dto));
        return ResponseResult.success(preFryRecordsService.queryByQueryDTO(dto));
    }

    @ApiOperation("预炸记录详情列表")
    @GetMapping("/queryById")
    public ResponseResult<PreFryRecordsDetailDTO> queryById(@RequestParam(required = true, value = "id") Long id) {
        log.info("预炸记录详情：{}", JSONObject.toJSONString(id));
        return ResponseResult.success(preFryRecordsService.getById(id));
    }


}
