Infrastructure/OpenAuth.App/CreateTable/BasicTableService.cs

58 lines
1.2 KiB
C#
Raw Normal View History

2025-05-15 13:50:30 +08:00
using Infrastructure;
2024-11-13 09:19:06 +08:00
using Infrastructure.Extensions;
using Microsoft.AspNetCore.Mvc;
2025-05-13 15:18:14 +08:00
using OpenAuth.Auth.Interface;
2024-11-13 09:19:06 +08:00
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;
}
2025-05-15 13:50:30 +08:00
2024-11-13 09:19:06 +08:00
[HttpPost]
public string CreateView([FromBody] CreateViewReq req) {
int count = client.Ado.ExecuteCommand(req.sql);
return "创建成功";
}
2025-05-15 13:50:30 +08:00
2024-11-13 09:19:06 +08:00
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; }
}
}
}