'integer', 'pid' => 'integer', 'belong_id' => 'integer', 'account_type' => 'integer', 'status' => 'integer', 'rank' => 'integer', 'del_flag' => 'integer']; public static function list(int $belong_id, int $account_type, string $dept_name) { $model = self::where('belong_id', $belong_id) ->where('account_type', $account_type); if ($dept_name != '') { $model = $model->where('dept_name', "like", "%$dept_name%"); } return $model->orderByDesc("rank") ->select(["dept_id", "pid", "dept_name", "rank", "status", "create_time"]) ->get()->toArray(); } public static function options(int $belong_id, int $account_type) { return self::where('belong_id', $belong_id) ->where('account_type', $account_type) ->where("status", 1) ->orderByDesc("rank") ->select(["dept_id", "pid", "dept_name"]) ->get()->toArray(); } public static function getTop(int $dept_id, array &$depts) { $info = self::select(["dept_name", "pid", "dept_id"])->find($dept_id); if (!empty($info)) { $depts[] = $info; if ($info['pid'] != 0) { self::getTop($info['pid'], $depts); } } } }