<?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.njcn.prepare.harmonic.mapper.mysql.newalgorithm.RStatEventDPOMapper">

    <select id="listAll" resultType="com.njcn.prepare.harmonic.pojo.po.RStatEventDVO">
        select org_no           "orgNo",
               data_date        "dataDate",
               event_type       "eventType",
               data_type        "dataType",
               sum(event_measurement)
                                "emSum",
               sum(event_count) "ecSum"
        from r_stat_event_d
        where date_format(data_date, '%y%m%d') = date_format(#{date}, '%y%m%d')
          and org_no = #{orgId}
        GROUP BY org_no, data_date, event_type, data_type
    </select>

</mapper>