package org.jeecg.modules.demo.pagecontentcapture.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.externalinternalsite.entity.ExternalInternalSite;
import org.jeecg.modules.demo.pagecontentcapture.entity.PageContentCapture;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: 页面内容抓取
 * @Author: jeecg-boot
 * @Date:   2023-04-17
 * @Version: V1.0
 */
@Mapper
public interface PageContentCaptureMapper extends BaseMapper<PageContentCapture> {
    @Select("select id,create_by createBy,create_time createTime,update_by updateBy,update_time updateTime,main_url mainUrl,sensitive_count sensitiveCount,count(1) heavyCount from page_content_capture where sensitive_count > 0 or sensitive_list is not null group by main_url")
    List<PageContentCapture> listCount();

    @Select("select id,create_by createBy,create_time createTime,update_by updateBy,update_time updateTime,main_url mainUrl,sensitive_count sensitiveCount,count(1) heavyCount from page_content_capture where (sensitive_count > 0 or sensitive_list is not null) and main_url = #{mainUrl} limit 1")
    PageContentCapture listCountByMainUrl(@Param("mainUrl") String mainUrl);

    @Select("select * from page_content_capture where main_url = #{mainSiteUrl} and sensitive_list != '' and sensitive_list is not null limit #{index},#{pageSize}")
    List<PageContentCapture> listPage(
            @Param("index")   Integer i,
            @Param("pageSize")   Integer pageSize,
            @Param("mainSiteUrl")   String mainSiteUrl
    );

}
