Infrastructure/OpenAuth.App/CreateTable/BasicTableService.cs

58 lines
1.2 KiB
C#

using Infrastructure;
using Infrastructure.Extensions;
using Microsoft.AspNetCore.Mvc;
using OpenAuth.Auth.Interface;
using OpenAuth.Repository.Domain;
using SqlSugar;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Nodes;
using System.Threading.Tasks;
namespace OpenAuth.App
{
public class BasicTableService
{
ISqlSugarClient client;
IAuth auth;
public BasicTableService(ISqlSugarClient client,IAuth auth)
{
this.client = client;
this.auth = auth;
}
[HttpPost]
public string CreateView([FromBody] CreateViewReq req) {
int count = client.Ado.ExecuteCommand(req.sql);
return "创建成功";
}
public bool CheckTableExist(string tableName)
{
string sql = "SELECT COUNT(*) FROM information_schema.tables WHERE table_name = '" + tableName + "';";
int count = client.Ado.GetInt(sql);
if (count > 0)
{
return true;
}
else { return false; }
}
}
}