<?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.bcrjl.miwifi.mapper.DeviceDayTrafficMapper">
    <resultMap id="BaseResultMap" type="com.bcrjl.miwifi.model.domain.DeviceDayTraffic">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="date" jdbcType="VARCHAR" property="date"/>
        <result column="ip" jdbcType="VARCHAR" property="ip"/>
        <result column="mac" jdbcType="VARCHAR" property="mac"/>
        <result column="device_name" jdbcType="VARCHAR" property="deviceName"/>
        <result column="upload" jdbcType="VARCHAR" property="upload"/>
        <result column="download" jdbcType="VARCHAR" property="download"/>
        <result column="total" jdbcType="VARCHAR" property="total"/>
    </resultMap>

    <select id="pageList" resultMap="BaseResultMap">
        SELECT * FROM device_day_traffic
        <where>
            <if test="param2.date == null or param2.date == ''">
                and date = DATE('now', '-1 day')
            </if>
            <if test="param2.date != null and param2.date != ''">
                and date = #{param2.date}
            </if>
        </where>
        ORDER BY ID DESC
    </select>
</mapper>
