﻿DELIMITER $$

SET @saved_sql_mode = @@sql_mode
$$
SET @@sql_mode = 'NO_AUTO_VALUE_ON_ZERO'
$$
CREATE PROCEDURE `sp_get_dashboard_summary`()
  COMMENT '대시보드 요약 정보 조회 (총 자산, 사용자, 그룹, 미할당 자산 수)'
BEGIN
  SELECT
    (SELECT COUNT(*) FROM resource_info) AS total_assets,
    (SELECT COUNT(*) FROM user_info) AS total_users,
    (SELECT COUNT(*) FROM group_info) AS total_groups,
    (SELECT COUNT(*) FROM resource_info WHERE user_id IS NULL) AS unassigned_assets;
END
$$

DELIMITER ;