@Select({ "<script>", "SELECT COUNT(id) FROM do_exception_log", "WHERE `exception_level` = #{level} AND created_at >= #{startDate} AND #{endDate} >= created_at", "<when test=‘moduleId != null‘>", "AND `module_id` like \"%\" #{moduleId}" , "</when>", "</script>" }) Long getLevelCountByPeriod(@Param(value = "startDate") LocalDateTime startDate, @Param(value = "endDate") LocalDateTime endDate, @Param(value = "level") int levelCode, @Param(value="moduleId") String moduleId);