private function getDeptSql($deptid) { $da = $this->conn; $da_im = $this->conn_im; $dept = new Dept($da, $da_im); $deptids = $dept->getAllChild($deptid); if (empty($deptid)) { $deptid = '1=1'; } else { $deptid = 's.dept_id in ('; $isFirst = true; foreach ($deptids as $key => $value) { if ($isFirst) { $isFirst = false; } else { $deptid .= ','; } $deptid .= '"'; $deptid .= $value['deptid']; $deptid .= '"'; } $deptid .= ')'; } return $deptid; }