<?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.ningdatech.pmapi.meeting.mapper.MeetingMapper">

    <select id="meetingCountSummary" resultType="com.ningdatech.pmapi.common.model.entity.CountGroupByDTO">
        select status groupKey, count(1) total
        from (SELECT (CASE
                          WHEN (status = 1 AND now() &lt; start_time) THEN 'TO_BE_HELD'
                          WHEN (status = 1 AND now() &gt;= start_time) THEN 'HELD'
                          WHEN status = 2 THEN 'COMPLETED'
                          ELSE 'CANCELED'
            END) status
              FROM meeting
              where create_by = #{createBy}) temp
        GROUP BY status
    </select>

</mapper>
