<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.chushang.inspection.project.mapper.PollingTaskMapper">

    <select id="countByProjectIds" resultType="com.chushang.inspection.project.vo.CountVO">
        SELECT COUNT(*) AS total, pt.project_id AS projectId
        FROM ta_polling_task pt
        where pt.del_state = 0
        <if test="projectIds != null and projectIds.size() != 0">
        AND pt.project_id IN
            <foreach collection="projectIds" open="(" close=")" item="projectId" separator=",">
                #{projectId}
            </foreach>
        </if>
        GROUP BY pt.project_id
    </select>
</mapper>