<?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="vip.xiaonuo.modular.ai.personCapture.mapper.PersonCaptureMapper">

    <select id="listPast" resultType="vip.xiaonuo.modular.ai.personCapture.entity.vo.PersonCaptureHourVo">
        SELECT
            DATE_FORMAT(cap_time, "%Y-%m-%d %H:00:00") AS time,
            COUNT(*) as value
        FROM
            `person_capture`
        WHERE
            org_id = #{orgId} AND cap_time BETWEEN NOW() - INTERVAL 12 HOUR AND NOW()
            AND delete_flag = 'NOT_DELETE'
        GROUP BY
            DATE_FORMAT(cap_time, "%Y-%m-%d %H:00:00")
        ORDER BY
            cap_time ASC
    </select>
</mapper>