package com.liquidnet.service.adam.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.liquidnet.service.adam.dto.AdamCaomeiBadgeClaimCountDto;
import com.liquidnet.service.adam.entity.AdamCaomeiBadge;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface AdamCaomeiBadgeMapper extends BaseMapper<AdamCaomeiBadge> {
    @Select({
            "<script>",
            "select badge_id as badgeId, count(1) as claimedCount",
            "from adam_caomei_user_badge",
            "where badge_id in",
            "<foreach collection='badgeIds' item='badgeId' open='(' separator=',' close=')'>",
            "#{badgeId}",
            "</foreach>",
            "group by badge_id",
            "</script>"
    })
    List<AdamCaomeiBadgeClaimCountDto> selectClaimedCountByBadgeIds(@Param("badgeIds") List<String> badgeIds);
}
