<?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.ytpm.dao.AgentStaticsMapper">

    <select id="getUserNum" resultType="java.lang.Integer">
        SELECT
            count( user_id )
        FROM
            yt_app_user
        WHERE
            DATE_FORMAT(registry_time,#{format} ) = DATE_FORMAT(NOW(),#{format})
    </select>
    <select id="getBannedNum" resultType="java.lang.Integer">
        SELECT
            count( user_id )
        FROM
            yt_platform_banned
        WHERE
            DATE_FORMAT(banned_time,#{format} ) = DATE_FORMAT(NOW(),#{format})
    </select>
    <select id="getWithdrawNum" resultType="java.lang.Integer">
        SELECT
            count( user_id )
        FROM
            yt_app_withdraw_record
        WHERE
            DATE_FORMAT(withdraw_time,#{format} ) = DATE_FORMAT(NOW(),#{format})
    </select>
    <select id="getWithdrawCount" resultType="java.lang.Integer">
        SELECT
            count( * )
        FROM
            yt_app_withdraw_record
        WHERE
            DATE_FORMAT(withdraw_time,#{format} ) = DATE_FORMAT(NOW(),#{format})
    </select>
    <select id="getWithdrawSum" resultType="java.math.BigDecimal">
        SELECT
            sum( withdraw_amount )
        FROM
            yt_app_withdraw_record
        WHERE
            withdraw_status = 1
            AND DATE_FORMAT(withdraw_time,#{format} ) = DATE_FORMAT(NOW(),#{format})
    </select>
    <select id="getVideoWatchCount" resultType="java.lang.Integer">
        select
            count(*)
        from yt_app_video_watch_record
        where
            DATE_FORMAT(watch_time,#{format} ) = DATE_FORMAT(NOW(),#{format})
    </select>
</mapper>