package co.yixiang.yshop.module.product.controller.admin.teamworkinfo;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;

import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;

import co.yixiang.yshop.framework.common.pojo.PageResult;
import co.yixiang.yshop.framework.common.pojo.CommonResult;

import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;

import co.yixiang.yshop.framework.excel.core.util.ExcelUtils;

import co.yixiang.yshop.framework.operatelog.core.annotations.OperateLog;

import static co.yixiang.yshop.framework.operatelog.core.enums.OperateTypeEnum.*;

import co.yixiang.yshop.module.product.controller.admin.teamworkinfo.vo.*;
import co.yixiang.yshop.module.product.dal.dataobject.teamworkinfo.TeamworkInfoDO;
import co.yixiang.yshop.module.product.convert.teamworkinfo.TeamworkInfoConvert;
import co.yixiang.yshop.module.product.service.teamworkinfo.TeamworkInfoService;

@Tag(name = "管理后台 - 拼团信息")
@RestController
@RequestMapping("/product/teamwork-info")
@Validated
public class TeamworkInfoController {

    @Resource
    private TeamworkInfoService teamworkInfoService;

    @GetMapping("/page")
    @Operation(summary = "获得拼团信息分页")
    @PreAuthorize("@ss.hasPermission('product:teamwork-info:query')")
    public CommonResult<PageResult<TeamworkInfoRespVO>> getTeamworkInfoPage(@Valid TeamworkInfoPageReqVO pageVO) {
        return success(teamworkInfoService.getTeamworkInfoPage(pageVO));
    }

    @GetMapping("/order-page")
    @Operation(summary = "获得拼团订单信息分页")
    @PreAuthorize("@ss.hasPermission('product:teamwork-info:order-page')")
    public CommonResult<PageResult<TeamworkOrderInfoRespVO>> getTeamworkInfoPage(@Valid TeamworkOrderInfoPageReqVO pageVO) {
        return success(teamworkInfoService.getTeamworkOrderInfoPage(pageVO));
    }

}
