package org.jeecg.modules.demo.linkerrorstatistics.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.demo.linkerrorstatistics.entity.LinkErrorStatistics;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: 错链信息统计
 * @Author: jeecg-boot
 * @Date:   2023-04-13
 * @Version: V1.0
 */
@Mapper
public interface LinkErrorStatisticsMapper extends BaseMapper<LinkErrorStatistics> {

    @Select("select id,create_by createBy,create_time createTime,update_by updateBy,update_time updateTime,main_site_id mainSiteId,main_site_name mainSiteName,main_site_url mainSiteUrl,count(error_url) errorLinkNumber from link_chain_error_detection GROUP BY main_site_url")
    List<LinkErrorStatistics> listCount();

    @Select("select id,create_by createBy,create_time createTime,update_by updateBy,update_time updateTime,main_site_id mainSiteId,main_site_name mainSiteName,main_site_url mainSiteUrl,count(error_url) errorLinkNumber from link_chain_error_detection where main_site_url = #{mainUrl} GROUP BY main_site_url limit 1")
    LinkErrorStatistics listCountByMainUrl(@Param("mainUrl")  String mainUrl);
}
