package org.dromara.zhishu.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.zhishu.domain.ShopGoodsPublishedLog;
import org.dromara.zhishu.domain.StockChangeLog;
import org.dromara.zhishu.service.ShopGoodsPublishedLogService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 记录已发布书籍
 *
 * @author yxy
 * @date 2025-04-11
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/zhishu/shopGoodsPublishedLog")
public class ShopGoodsPublishedLogController {

    private final ShopGoodsPublishedLogService shopGoodsPublishedLogService;

    /**
     * 通过平台商品id和相关Id查询商品发布记录
     */
    @GetMapping("/queryPublishedLogByOrderSn")
    @SaIgnore
    public R<ShopGoodsPublishedLog> queryPublishedLogByOrderSn(@NotNull(message = "平台订单编码不能为空") String platformId,
                                                               @NotNull(message = "日志类型不能为空") String aboutId,
                                                               @NotNull(message = "平台类型不能为空") Integer platformType,
                                                               @NotNull(message = "日志类型不能为空") Integer logType,
                                                               @NotNull(message = "操作类型不能为空") Integer operationType
    ) {
        ShopGoodsPublishedLog log = shopGoodsPublishedLogService.queryPublishedLogByOrderSn(platformId, aboutId, platformType, logType, operationType);
        return R.ok(log);
    }

}
