<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zioinfo.cms.dashboard.mapper.DashboardMapper">

  <select id="countContentByStatus" resultType="int">
    SELECT COUNT(*) FROM cms_content WHERE status = #{status}
  </select>

  <select id="countTotalContent" resultType="int">SELECT COUNT(*) FROM cms_content</select>
  <select id="countMedia" resultType="int">SELECT COUNT(*) FROM cms_media</select>
  <select id="countPendingUgc" resultType="int">SELECT COUNT(*) FROM cms_ugc WHERE moderation_status = 'PENDING'</select>
  <select id="countMembers" resultType="int">SELECT COUNT(*) FROM cms_member</select>

  <select id="contentByStatus" resultType="map">
    SELECT status, COUNT(*) AS count FROM cms_content GROUP BY status ORDER BY status
  </select>

</mapper>
