id, statistics_name, dept_id, dept_name, start_date, end_date, file_name, file_url, is_all_visible, create_user_id, create_user_name, create_date, update_user_id, update_user_name, update_date, del_flg select temp.statistic_type, IF(s.uploadCount is null, 0, s.uploadCount) as uploadCount from ( SELECT 1 as statistic_type FROM dual union SELECT 2 as statistic_type FROM dual union SELECT 3 as statistic_type FROM dual union SELECT 4 as statistic_type FROM dual union SELECT 5 as statistic_type FROM dual union SELECT 6 as statistic_type FROM dual union SELECT 7 as statistic_type FROM dual ) temp left join ( SELECT statistic_type, COUNT(1) as uploadCount FROM T_Offe_Statistics where del_flg = 0 and create_user_name like concat('%', #{statistics.createUserName}, '%') and date_format(create_date, '%Y-%m') = #{statistics.uploadMonth} and date_format(create_date, '%Y') = #{statistics.uploadYear} group by statistic_type ) s on s.statistic_type = temp.statistic_type order by temp.statistic_type