<?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.xy.mapper.DeviceDataMapper">
    <select id="dayChart" resultType="com.xy.dto.DeviceDataDto$DayChartVo">
        SELECT date_value as time, sum(sales_count) num, sum(sales_money) total_money
        FROM device_data
        WHERE type = #{type}
          and merc_id = #{mercId}
          and date_value BETWEEN #{beginDateInt} and #{endDateInt}
        GROUP BY date_value
    </select>


    <select id="deviceFaultInfoCount" resultType="com.xy.dto.DeviceFaultInfoDto$CountByDeviceVO">
            SELECT
            event_code eventCode,
            sum( state = '0'  ) todoNum,
            sum( state = '1'   ) doneNum
        FROM
            device_fault_info
        GROUP BY
            event_code


    </select>


</mapper>
