/*
 * Copyright (c) 2018-2999 广州亚米信息科技有限公司 All rights reserved.
 *
 * https://www.gz-yami.com/
 *
 */

package com.yami.shop.groupbuy.comment.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yami.shop.groupbuy.comment.api.dto.ApiGroupUserDto;
import com.yami.shop.groupbuy.comment.model.GroupOrder;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author LGH
 * @date 2019-08-27 17:55:57
 */
public interface GroupOrderMapper extends BaseMapper<GroupOrder> {

    /**
     * 获取参团的用户列表
     *
     * @param groupTeamId 拼团单ID
     * @return ApiGroupUserDto列表
     */
    List<ApiGroupUserDto> listApiGroupUserDto(@Param("groupTeamId") Long groupTeamId);

    /**
     * 获取活动已经成团的用户数量
     */
    Long getHadGroupNumberCount(@Param("groupActivityId") Long groupActivityId, @Param("groupProdId") Long groupProdId);

    List<GroupOrder> listByGroupProdId(@Param("groupProdId") Long groupProdId, @Param("userId") String userId);

    Integer getUserHadOrderCountByGroupProdId(@Param("userId") String userId, @Param("groupProdId") Long groupProdId);

    int getUserUnGroupOrderCount(@Param("userId") String userId, @Param("groupProdId") Long groupProdId);

    int cancelGroupOrder(@Param("orderNumber") String orderNumber,@Param("status") int status);

}
