<?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.ozs.mapper.BaseTerminalMapper">

    <select id="getMessageStatisticsTerminal" resultType="java.util.Map">
        select count(id) countAllTerminal,
               SUM(CASE status WHEN '1' THEN 1 ELSE 0 end) AS offlineTerminal,
               SUM(CASE status WHEN '2' THEN 1 ELSE 0 end) AS onlineTerminal
        from base_terminal
    </select>
</mapper>
