package jnpf.certificate.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fantaibao.permission.annotation.DataScope;
import com.fantaibao.permission.enums.FilterWhereTypeEnum;
import jnpf.model.certificate.req.app.CertificateAppEmployeeRiskQueryReq;
import jnpf.model.certificate.req.app.CertificateAppRiskChartReq;
import jnpf.model.certificate.req.app.CertificateAppStoreRiskQueryReq;
import jnpf.model.certificate.vo.app.CertificateAppEmployeeRiskVO;
import jnpf.model.certificate.vo.app.CertificateAppStatusCountVO;
import jnpf.model.certificate.vo.app.CertificateAppStoreRiskItemVO;
import jnpf.model.certificate.vo.app.CertificateAppStoreRiskVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;

public interface CertificateAppRiskMapper {

    @DataScope(tableField = "F_SubjectId",tableAlias = "ci")
    List<CertificateAppStatusCountVO> queryHealthRiskStatusCount(@Param("req") CertificateAppRiskChartReq req);
    @DataScope(tableFieldOrg = "F_SubjectId",tableAlias = "ci",type = FilterWhereTypeEnum.ORGANIZATION_FILTER)
    List<CertificateAppStatusCountVO> queryStoreRiskStatusCount(@Param("req") CertificateAppRiskChartReq req);

    @DataScope(tableField = "F_SubjectId",tableAlias = "ci")
    Page<CertificateAppEmployeeRiskVO> queryEmployeeRiskPageByUserIds(@Param("page") Page<CertificateAppEmployeeRiskVO> page,
                                                                      @Param("userIds") Collection<String> userIds);
    @DataScope(tableFieldOrg = "F_SubjectId",tableAlias = "ci",type = FilterWhereTypeEnum.ORGANIZATION_FILTER)
    Page<CertificateAppStoreRiskVO> queryStoreRiskPage(@Param("page") Page<CertificateAppStoreRiskVO> page,
                                                       @Param("req") CertificateAppStoreRiskQueryReq req);

    List<CertificateAppStoreRiskItemVO> queryStoreRiskDetailList(@Param("subjectIds") Collection<String> subjectIds);

    @DataScope(tableField = "F_SubjectId",tableAlias = "ci")
    Long queryEmployeeRiskTotalCount(@Param("userIds") Collection<String> userIds);

    @DataScope(tableFieldOrg = "F_SubjectId",tableAlias = "ci",type = FilterWhereTypeEnum.ORGANIZATION_FILTER)
    Long queryOrganizationRiskTotalCount(@Param("orgIds") Collection<String> orgIds);
}
