package com.yunzhi.marketing.sample.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yunzhi.marketing.sample.entity.TaNotice;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

/**
 * <p>
 * 开屏通知  Mapper 接口
 * </p>
 *
 * @author fxf
 * @since 2020-03-18
 */
@Mapper
@Component
public interface TaNoticeMapper extends BaseMapper<TaNotice> {

    /**
     * 条件查询开屏通知
     *
     * @param pg
     * @param title
     * @param targetType
     * @param targetName
     * @param status
     * @return
     */
    IPage<TaNotice> listNoticeByCondition(IPage<TaNotice> pg, @Param("title") String title,
                                          @Param("targetType") String targetType,
                                          @Param("targetName") String targetName,
                                          @Param("status") Integer status,
                                          @Param("type") String type);

    IPage<TaNotice> listNoticeByConditionForAdmin(IPage<TaNotice> pg,
                                                  @Param("type") String type);

    /**
     * 自动下架已过期的开屏通知
     *
     * @return
     */
    Integer updateStatusByInvalidTime();
}
