package com.seer.teach.mall.order.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.seer.teach.common.PageListBean;
import com.seer.teach.common.ResultBean;
import com.seer.teach.common.annotation.LogPrint;
import com.seer.teach.common.utils.PageConverterUtils;
import com.seer.teach.mall.convert.OrderLogConvert;
import com.seer.teach.mall.entity.OrderLogEntity;
import com.seer.teach.mall.request.OrderLogPageReq;
import com.seer.teach.mall.response.OrderLogResp;
import com.seer.teach.mall.service.IOrderLogService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
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;

/**
 * <p>
 * 订单日志 前端控制器
 * </p>
 *
 * @author Wang
 * @since 2025-07-10 15:31:18
 */
@Tag(name = "管理端 - 订单日志管理")
@AllArgsConstructor
@LogPrint
@RestController
@RequestMapping("/mall/order/logs")
public class AdminOrderLogController {

    private final IOrderLogService orderLogService;

    @PostMapping("/page")
    @SaCheckPermission("admin:order:log:page")
    public ResultBean<PageListBean<OrderLogResp>> page(@RequestBody OrderLogPageReq reqVO) {
        IPage<OrderLogEntity> pageList = orderLogService.pageList(reqVO);
        return ResultBean.success(PageConverterUtils.convertPageListBean(pageList, OrderLogConvert.INSTANCE::toRespList));
    }
}