This commit is contained in:
he
2022-04-27 17:33:45 +08:00
parent 35a9fe2878
commit 29fe343519
8 changed files with 116 additions and 4 deletions
@@ -6,6 +6,9 @@
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
using IRaCIS.Core.Infra.EFCore.Dto;
using System.ComponentModel.DataAnnotations;
namespace IRaCIS.Core.Application.ViewModel
{
/// <summary> FrontAuditConfigView 列表视图模型 </summary>
@@ -30,6 +33,14 @@ namespace IRaCIS.Core.Application.ViewModel
}
public class BatchAddFrontAudit
{
[NotDefault]
public Guid ParentId { get; set; }
public List<TableList> Columns { get; set; }
}
public class GetChildrenItem
{
@@ -27,6 +27,54 @@ namespace IRaCIS.Core.Application.Service
_frontAuditConfigRepository = frontAuditConfigRepository;
}
/// <summary>
/// 获取数据库所有表
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<List<TableList>> GetDatabaseTables()
{
return await _frontAuditConfigRepository._dbContext.GetTableList().ToListAsync();
}
/// <summary>
/// 获取表列名
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<List<TableList>> GetTableColumn(string tableName)
{
return await _frontAuditConfigRepository._dbContext.GetTableColumn(tableName).ToListAsync();
}
/// <summary>
/// 批量添加字段
/// </summary>
/// <param name="data">数据集</param>
/// <returns></returns>
public async Task BatchAddFrontAudit(BatchAddFrontAudit data)
{
var maxsort = await _frontAuditConfigRepository.Where(x => x.ParentId == data.ParentId).MaxAsync(x => x.Sort);
List<FrontAuditConfig> fronts=new List<FrontAuditConfig>();
foreach (var item in data.Columns)
{
maxsort++;
fronts.Add(new FrontAuditConfig()
{
Sort = maxsort,
Code = item.Name,
ValueCN = item.Remake,
IsEnable = true,
ParentId = data.ParentId
});
}
await _frontAuditConfigRepository.AddRangeAsync(fronts);
}
/// <summary>
/// 翻译稽查数据
/// </summary>