package co.yixiang.yshop.module.product.dal.mysql.teamworkinfo;

import java.util.*;

import co.yixiang.yshop.framework.common.pojo.PageResult;
import co.yixiang.yshop.framework.mybatis.core.query.LambdaQueryWrapperX;
import co.yixiang.yshop.framework.mybatis.core.mapper.BaseMapperX;
import co.yixiang.yshop.module.product.controller.app.teamworkinfo.vo.AppTeamworkProductDetailRespVO;
import co.yixiang.yshop.module.product.controller.app.teamworkinfo.vo.AppWaitTeamworkReqVO;
import co.yixiang.yshop.module.product.controller.app.teamworkinfo.vo.AppWaitTeamworkRespVO;
import co.yixiang.yshop.module.product.controller.app.teamworkinfo.vo.AppWaitTeamworkUserRespVO;
import co.yixiang.yshop.module.product.dal.dataobject.teamworkinfo.TeamworkInfoDO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import co.yixiang.yshop.module.product.controller.admin.teamworkinfo.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 拼团信息 Mapper
 *
 * @author moxiangrong
 */
@Mapper
public interface TeamworkInfoMapper extends BaseMapperX<TeamworkInfoDO> {

    default PageResult<TeamworkInfoDO> selectPage(TeamworkInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TeamworkInfoDO>()
                .eqIfPresent(TeamworkInfoDO::getState, reqVO.getState())
                .orderByDesc(TeamworkInfoDO::getId));
    }

    List<TeamworkInfoRespVO> getTeamworkInfoPage(Page page, @Param("pageReqVO") TeamworkInfoPageReqVO pageReqVO);

    List<TeamworkOrderInfoRespVO> getTeamworkOrderInfoPage(Page page, @Param("pageReqVO") TeamworkOrderInfoPageReqVO pageReqVO);

    List<Long> getNotTeamwork(@Param("campaignId") Long campaignId);

    void teamworkFail(@Param("campaignId") Long campaignId);

    List<AppWaitTeamworkRespVO> getWaitTeamworkList(@Param("vo") AppWaitTeamworkReqVO vo);

    List<AppWaitTeamworkUserRespVO> getWaitTeamworkHeadList(@Param("ids") List<Long> ids);

    List<AppWaitTeamworkUserRespVO> getWaitTeamworkUserList(@Param("id") Long id);

    AppTeamworkProductDetailRespVO getProductDetail(@Param("id") Long id);

    List<Long> joinJudge(@Param("uid") Long uid, @Param("teamworkId") Long teamworkId);

    List<String> randomAvatar(@Param("userIds") List userIds, @Param("number") Integer number);

    Long getMember(@Param("userId") Long userId, @Param("id") Long id);

}
