When a zero-divisor graph is planar or complete r-partite graph