Ejemplo n.º 1
0
        public async Task <IActionResult> GetSqlTree([FromBody] Req <SqlSearchDto> request)
        {
            request.Data.AdminId = request.OperatorId;
            try {
                if (string.IsNullOrEmpty(request.Data.SearchType))
                {
                    var connDtos = await _sqlOnlineApplication.GetConnList(request.Data);

                    return(LayuiSuccess(GetSqlTree(connDtos, request.Data), request.PasswordString));
                }
                else if (request.Data.SearchType == "GetDatabaseNames")
                {
                    var databaseEntities = await _sqlOnlineApplication.GetDatabaseNames(request.Data);

                    return(LayuiSuccess(GetSqlTree(databaseEntities, request.Data), request.PasswordString));
                }
                else if (request.Data.SearchType == "GetTableNames")
                {
                    var tableEntities = await _sqlOnlineApplication.GetTableNames(request.Data);

                    return(LayuiSuccess(GetSqlTree(tableEntities, request.Data), request.PasswordString));
                }
                else if (request.Data.SearchType == "GetViewNames")
                {
                    var viewEntities = await _sqlOnlineApplication.GetViewNames(request.Data);

                    return(LayuiSuccess(GetSqlTree(viewEntities, request.Data), request.PasswordString));
                }
                else if (request.Data.SearchType == "GetProcedureNames")
                {
                    var procedureEntities = await _sqlOnlineApplication.GetProcedureNames(request.Data);

                    return(LayuiSuccess(GetSqlTree(procedureEntities, request.Data), request.PasswordString));
                }
                else if (request.Data.SearchType == "GetFunctionNames")
                {
                    var functionEntities = await _sqlOnlineApplication.GetFunctionNames(request.Data);

                    return(LayuiSuccess(GetSqlTree(functionEntities, request.Data), request.PasswordString));
                }
            } catch (Exception ex) {
                LogUtil.Error(ex);
            }
            return(LayuiError("系统出了个小差!"));
        }