2025-01-09 16:09:40 +08:00
|
|
|
|
using Infrastructure;
|
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2025-04-10 16:08:18 +08:00
|
|
|
|
using OpenAuth.App.BaseApp.Base;
|
2025-01-09 16:09:40 +08:00
|
|
|
|
using OpenAuth.App.ServiceApp.DataMaintenance;
|
2025-04-10 16:08:18 +08:00
|
|
|
|
using OpenAuth.App.ServiceApp.DataMaintenance.Request;
|
2025-01-09 16:09:40 +08:00
|
|
|
|
using OpenAuth.Repository.Domain.DataMaintenance;
|
|
|
|
|
|
using OpenAuth.WebApi.Model.CustomAttribute;
|
2025-04-10 16:08:18 +08:00
|
|
|
|
using System.Data;
|
2025-01-09 16:09:40 +08:00
|
|
|
|
|
|
|
|
|
|
namespace OpenAuth.WebApi.Controllers.ServiceControllers.DataMaintenance
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 应用管理
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Route("api/[controller]/[action]")]
|
|
|
|
|
|
[ApiController]
|
|
|
|
|
|
public class ApplicationDataController : ControllerBase
|
|
|
|
|
|
{
|
|
|
|
|
|
readonly ApplicationManagementApp _app;
|
|
|
|
|
|
|
|
|
|
|
|
public ApplicationDataController(ApplicationManagementApp app)
|
|
|
|
|
|
{
|
|
|
|
|
|
_app = app;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询应用列表
|
|
|
|
|
|
/// </summary>
|
2025-04-10 16:08:18 +08:00
|
|
|
|
/// <param name="name">目录或服务名称</param>
|
|
|
|
|
|
/// <param name="isCatalogue">是否只查询目录</param>
|
2025-01-09 16:09:40 +08:00
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet]
|
2025-04-10 16:08:18 +08:00
|
|
|
|
public async Task<Response<List<ApplicationData>>> GetApplicationList(string name, int isCatalogue)
|
2025-01-09 16:09:40 +08:00
|
|
|
|
{
|
2025-04-10 16:08:18 +08:00
|
|
|
|
return await _app.GetApplicationList(name, isCatalogue);
|
2025-01-09 16:09:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 添加应用
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
public async Task<Response<bool>> AddApplication(ApplicationData app)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await _app.Add(app);
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 编辑应用
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
public async Task<Response<bool>> UpdateApplication(ApplicationData app)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await _app.Update(app);
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 删除应用
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
public async Task<Response<bool>> DeleteApplication(long id)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await _app.Delete(id);
|
|
|
|
|
|
}
|
2025-04-10 16:08:18 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取数据库表名及注释
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="req"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
public async Task<Response<DataTable>> GetGeomTableList(PageReq req)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await _app.GetGeomTableList(req);
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="tableDataReq"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
public async Task<Response<PageInfo<List<object>>>> GetDataList(TableDataReq tableDataReq)
|
|
|
|
|
|
{
|
|
|
|
|
|
var result = new Response<PageInfo<List<object>>>();
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
result = await _app.GetDataList(tableDataReq);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
result.Code = 500;
|
|
|
|
|
|
result.Message = ex.Message;
|
|
|
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
2025-01-09 16:09:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|