package com.liquidnet.service.sweet.mapper;

import com.liquidnet.service.sweet.dto.SweetAppletSubMsgOfTypeDto;
import com.liquidnet.service.sweet.entity.SweetAppletSubMsg;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 小程序订阅消息记录表 Mapper 接口
 * </p>
 *
 * @author jiangxiulong
 * @since 2021-11-22
 */
public interface SweetAppletSubMsgMapper extends BaseMapper<SweetAppletSubMsg> {

    @Select({
            "select target_id as targetId " +
                    "from sweet_applet_sub_msg " +
                    "where is_push = 1 " +
                    "and activity_type = #{type} " +
                    "group by target_id"
    })
    List<SweetAppletSubMsgOfTypeDto> selectListOfType(@Param("type") Integer type);
}
