diff --git a/admin-client/src/locale/langs/zhCN/menu-lang.ts b/admin-client/src/locale/langs/zhCN/menu-lang.ts index 1333334..c3e9524 100644 --- a/admin-client/src/locale/langs/zhCN/menu-lang.ts +++ b/admin-client/src/locale/langs/zhCN/menu-lang.ts @@ -1,9 +1,9 @@ export default { "menu.0": "工作台", "menu.28": "Vxe-Table", - "menu.44": "大数据表格", + // "menu.44": "大数据表格", "menu.22": "接口文档", - "menu.1": "更多示例", + // "menu.1": "更多示例", "menu.2": "查看更多组件", "menu.5": "基础图表", "menu.13": "会员管理", diff --git a/admin-client/src/services/Apps/T_Character_Labels/TCharacterLabelService.ts b/admin-client/src/services/Apps/T_Character_Labels/TCharacterLabelService.ts new file mode 100644 index 0000000..14b1b17 --- /dev/null +++ b/admin-client/src/services/Apps/T_Character_Labels/TCharacterLabelService.ts @@ -0,0 +1,74 @@ +import Http from "@/core/utils/Http"; + +/** + * T_Character_Label服务 + */ +export default class T_Character_LabelService { + + static urlPrefix = "/api/v1/admin/T_Character_Label"; + + /** + * 获取数据列表 + * @param current + * @param pageSize + * @param search + * @param searchSort + * @returns + */ + static findList(current: number, pageSize: number, search: any = {}, searchSort: any[] = []) { + return Http.post(`${this.urlPrefix}/findList`, { + page: current, + size: pageSize, + search, + searchSort + }) + } + + /** + * 删除集合数据 + * + * @param ids + * @returns + */ + static deleteList(ids: string[]) { + return Http.post(`${this.urlPrefix}/deleteList`, ids) + } + + /** + * 查询表单 + * + * @param id + * @returns + */ + static findForm(id?: string | undefined) { + return Http.get(`${this.urlPrefix}/findForm${(id ? '/' + id : '')}`) + } + + /** + * 保存表单数据 + * + * @param id + * @param formData + * @returns + */ + static saveForm(id: string | undefined, formData: any) { + return Http.post(`${this.urlPrefix}/${id ? 'update' : 'create'}`, formData) + } + + /** + * 导出 excel + * + * @param search + * @param searchSort + * @returns + */ + static exportExcel(search: any = {}, searchSort: any[] = []) { + return Http.download(`${this.urlPrefix}/exportExcel`, { + page: -1, + size: -1, + search, + searchSort + }); + } + +} \ No newline at end of file diff --git a/admin-client/src/services/Apps/T_Characters/T_CharacterService.ts b/admin-client/src/services/Apps/T_Characters/T_CharacterService.ts new file mode 100644 index 0000000..e569fb6 --- /dev/null +++ b/admin-client/src/services/Apps/T_Characters/T_CharacterService.ts @@ -0,0 +1,74 @@ +import Http from "@/core/utils/Http"; + +/** + * T_Character服务 + */ +export default class T_CharacterService { + + static urlPrefix = "/api/v1/admin/T_Character"; + + /** + * 获取数据列表 + * @param current + * @param pageSize + * @param search + * @param searchSort + * @returns + */ + static findList(current: number, pageSize: number, search: any = {}, searchSort: any[] = []) { + return Http.post(`${this.urlPrefix}/findList`, { + page: current, + size: pageSize, + search, + searchSort + }) + } + + /** + * 删除集合数据 + * + * @param ids + * @returns + */ + static deleteList(ids: string[]) { + return Http.post(`${this.urlPrefix}/deleteList`, ids) + } + + /** + * 查询表单 + * + * @param id + * @returns + */ + static findForm(id?: string | undefined) { + return Http.get(`${this.urlPrefix}/findForm${(id ? '/' + id : '')}`) + } + + /** + * 保存表单数据 + * + * @param id + * @param formData + * @returns + */ + static saveForm(id: string | undefined, formData: any) { + return Http.post(`${this.urlPrefix}/${id ? 'update' : 'create'}`, formData) + } + + /** + * 导出 excel + * + * @param search + * @param searchSort + * @returns + */ + static exportExcel(search: any = {}, searchSort: any[] = []) { + return Http.download(`${this.urlPrefix}/exportExcel`, { + page: -1, + size: -1, + search, + searchSort + }); + } + +} \ No newline at end of file diff --git a/admin-client/src/services/Apps/T_Image_Configs/TImageConfigService.ts b/admin-client/src/services/Apps/T_Image_Configs/TImageConfigService.ts new file mode 100644 index 0000000..a1cfd5a --- /dev/null +++ b/admin-client/src/services/Apps/T_Image_Configs/TImageConfigService.ts @@ -0,0 +1,74 @@ +import Http from "@/core/utils/Http"; + +/** + * TImageConfig服务 + */ +export default class TImageConfigService { + + static urlPrefix = "/api/v1/admin/TImageConfig"; + + /** + * 获取数据列表 + * @param current + * @param pageSize + * @param search + * @param searchSort + * @returns + */ + static findList(current: number, pageSize: number, search: any = {}, searchSort: any[] = []) { + return Http.post(`${this.urlPrefix}/findList`, { + page: current, + size: pageSize, + search, + searchSort + }) + } + + /** + * 删除集合数据 + * + * @param ids + * @returns + */ + static deleteList(ids: string[]) { + return Http.post(`${this.urlPrefix}/deleteList`, ids) + } + + /** + * 查询表单 + * + * @param id + * @returns + */ + static findForm(id?: string | undefined) { + return Http.get(`${this.urlPrefix}/findForm${(id ? '/' + id : '')}`) + } + + /** + * 保存表单数据 + * + * @param id + * @param formData + * @returns + */ + static saveForm(id: string | undefined, formData: any) { + return Http.post(`${this.urlPrefix}/${id ? 'update' : 'create'}`, formData) + } + + /** + * 导出 excel + * + * @param search + * @param searchSort + * @returns + */ + static exportExcel(search: any = {}, searchSort: any[] = []) { + return Http.download(`${this.urlPrefix}/exportExcel`, { + page: -1, + size: -1, + search, + searchSort + }); + } + +} \ No newline at end of file diff --git a/admin-client/src/views/Apps/T_Character_Labels/Index.vue b/admin-client/src/views/Apps/T_Character_Labels/Index.vue new file mode 100644 index 0000000..813f912 --- /dev/null +++ b/admin-client/src/views/Apps/T_Character_Labels/Index.vue @@ -0,0 +1,219 @@ + + + \ No newline at end of file diff --git a/admin-client/src/views/Apps/T_Character_Labels/Info.vue b/admin-client/src/views/Apps/T_Character_Labels/Info.vue new file mode 100644 index 0000000..4a07878 --- /dev/null +++ b/admin-client/src/views/Apps/T_Character_Labels/Info.vue @@ -0,0 +1,90 @@ + + + \ No newline at end of file diff --git a/admin-client/src/views/Apps/T_Characters/Index.vue b/admin-client/src/views/Apps/T_Characters/Index.vue new file mode 100644 index 0000000..48e10ad --- /dev/null +++ b/admin-client/src/views/Apps/T_Characters/Index.vue @@ -0,0 +1,325 @@ + + + \ No newline at end of file diff --git a/admin-client/src/views/Apps/T_Characters/Info.vue b/admin-client/src/views/Apps/T_Characters/Info.vue new file mode 100644 index 0000000..7ddda81 --- /dev/null +++ b/admin-client/src/views/Apps/T_Characters/Info.vue @@ -0,0 +1,137 @@ + + + \ No newline at end of file diff --git a/admin-client/src/views/Apps/T_Image_Configs/Index.vue b/admin-client/src/views/Apps/T_Image_Configs/Index.vue new file mode 100644 index 0000000..91fd651 --- /dev/null +++ b/admin-client/src/views/Apps/T_Image_Configs/Index.vue @@ -0,0 +1,226 @@ + + + \ No newline at end of file diff --git a/admin-client/src/views/Apps/T_Image_Configs/Info.vue b/admin-client/src/views/Apps/T_Image_Configs/Info.vue new file mode 100644 index 0000000..c42de11 --- /dev/null +++ b/admin-client/src/views/Apps/T_Image_Configs/Info.vue @@ -0,0 +1,97 @@ + + + \ No newline at end of file diff --git a/admin-client/vite.config.ts b/admin-client/vite.config.ts index 43f4844..643207f 100644 --- a/admin-client/vite.config.ts +++ b/admin-client/vite.config.ts @@ -20,6 +20,7 @@ export default defineConfig({ base: process.env.NODE_ENV == "production" ? "/client/" : "/", server: { port: 5501, + host: true, proxy: { "/api/v1": { target: "http://localhost:5500/", diff --git a/admin-server/MiaoYu.Api.Admin/ApplicationServices/Apps/MiaoYuChat/TCharacterLabelService.cs b/admin-server/MiaoYu.Api.Admin/ApplicationServices/Apps/MiaoYuChat/TCharacterLabelService.cs new file mode 100644 index 0000000..cbbb853 --- /dev/null +++ b/admin-server/MiaoYu.Api.Admin/ApplicationServices/Apps/MiaoYuChat/TCharacterLabelService.cs @@ -0,0 +1,111 @@ +using MiaoYu.Repository.ChatAI.Admin.Entities.Apps; +namespace MiaoYu.Api.Admin.ApplicationServices.Apps; + +/// +/// 角色标签表 服务 T_Character_LabelService +/// +public class T_Character_LabelService : ApplicationService> +{ + public T_Character_LabelService(IRepository defaultRepository) + : base(defaultRepository) + { + + } + + /// + /// 获取列表数据 + /// + /// + /// + public async Task FindListAsync(PagingSearchInput pagingSearchInput) + { + var query = this._defaultRepository.Select + .WhereIf(!string.IsNullOrWhiteSpace(pagingSearchInput.Search?.LabelName), w => w.LabelName.Contains(pagingSearchInput.Search.LabelName ?? "")) + .OrderByDescending(w => w.Id) + .Select(w => new + { + w.Id, + w.TenantId, + w.LabelName, + w.CreateTime, + w.UpdateTime, + // w.LastModificationTime, + // w.CreationTime + }) + ; + + var result = await _defaultRepository.AsPagingViewAsync(query, pagingSearchInput); + // result + // .FormatValue(query, w => w.CreationTime, (oldValue) => oldValue.ToString("yyyy-MM-dd")) + // .FormatValue(query, w => w.LastModificationTime, (oldValue) => oldValue?.ToString("yyyy-MM-dd")) + // ; + // 设置列 + //result.GetColumn(query, w => w.OperatorName).SetColumn("操作人"); + //result.GetColumn(query, w => w.OperatorName!).SetColumn(w => w.Name!); + + return result; + } + + /// + /// 根据id数组删除 + /// + /// ids + /// + public async Task DeleteListAsync(List ids) + { + await this._defaultRepository.DeleteByIdsAsync(ids); + } + + /// + /// 查询表单数据 + /// + /// id + /// + public async Task> FindFormAsync(int id) + { + var res = new Dictionary(); + var form = await this._defaultRepository.FindByIdAsync(id); + form = form.NullSafe(); + if (form.CreateTime == null || form.CreateTime == DateTime.MinValue) + { + form.CreateTime = DateTime.Now; + } + if (form.UpdateTime == null || form.UpdateTime == DateTime.MinValue) + { + form.UpdateTime = DateTime.Now; + } + res[nameof(id)] = id; + res[nameof(form)] = form; + return res; + } + + /// + /// 保存数据 + /// + /// form + /// + public Task SaveFormAsync(T_Character_Label form) + { + form.UpdateTime = DateTime.Now; + if (form.CreateTime == null) + { + form.CreateTime = DateTime.Now; + } + return this._defaultRepository.InsertOrUpdateAsync(form); + } + + /// + /// 导出Excel + /// + /// + /// + public async Task ExportExcelAsync(PagingSearchInput pagingSearchInput) + { + pagingSearchInput.Page = -1; + var tableViewModel = await this.FindListAsync(pagingSearchInput); + return ExcelUtil.ExportExcelByPagingView(tableViewModel, null, "Id"); + } + + + +} \ No newline at end of file diff --git a/admin-server/MiaoYu.Api.Admin/ApplicationServices/Apps/MiaoYuChat/TImageConfigService.cs b/admin-server/MiaoYu.Api.Admin/ApplicationServices/Apps/MiaoYuChat/TImageConfigService.cs new file mode 100644 index 0000000..9691364 --- /dev/null +++ b/admin-server/MiaoYu.Api.Admin/ApplicationServices/Apps/MiaoYuChat/TImageConfigService.cs @@ -0,0 +1,126 @@ +using IdGen; + +using MiaoYu.Repository.ChatAI.Admin.Entities; +namespace MiaoYu.Api.Admin.ApplicationServices.Apps; + +/// +/// 图片表 服务 TImageConfigService +/// +public class TImageConfigService : ApplicationService> +{ + public TImageConfigService(IRepository defaultRepository) + : base(defaultRepository) + { + + } + + /// + /// 获取列表数据 + /// + /// + /// + public async Task FindListAsync(PagingSearchInput pagingSearchInput) + { + var query = this._defaultRepository.Select + .WhereIf(!string.IsNullOrWhiteSpace(pagingSearchInput.Search?.Name), w => w.Name.Contains(pagingSearchInput.Search.Name ?? "")) + .OrderByDescending(w => w.Id) + .Select(w => new + { + w.Id, + w.ImageId, + w.Name, + w.Url, + w.OssPath, + w.Bucket, + w.Region, + w.UpdateAt, + w.TenantId, + //w.LastModificationTime, + //w.CreationTime + }) + ; + + var result = await _defaultRepository.AsPagingViewAsync(query, pagingSearchInput); + + // 覆盖值 + //result + // .FormatValue(query, w => w.CreationTime, (oldValue) => oldValue.ToString("yyyy-MM-dd")) + // .FormatValue(query, w => w.LastModificationTime, (oldValue) => oldValue?.ToString("yyyy-MM-dd")) + // ; + + // 设置列 + //result.GetColumn(query, w => w.OperatorName).SetColumn("操作人"); + //result.GetColumn(query, w => w.OperatorName!).SetColumn(w => w.Name!); + + return result; + } + + /// + /// 根据id数组删除 + /// + /// ids + /// + public async Task DeleteListAsync(List ids) + { + await this._defaultRepository.DeleteByIdsAsync(ids); + } + + /// + /// 查询表单数据 + /// + /// id + /// + public async Task> FindFormAsync(int id) + { + var res = new Dictionary(); + var form = await this._defaultRepository.FindByIdAsync(id); + form = form.NullSafe(); + + res[nameof(id)] = id; + res[nameof(form)] = form; + return res; + } + + /// + /// 保存数据 + /// + /// form + /// + public async Task SaveFormAsync(T_Image_Config form) + { + form.UpdateAt = DateTime.Now; + form.CreateAt = DateTime.Now; + var isUpdate = false; + if (form.Id != 0) + { + var _tempform = this._defaultRepository.FindById(form.Id); + if (_tempform != null) + { + form.CreateAt = _tempform.CreateAt; + isUpdate = true; + } + } + var x = await this._defaultRepository.InsertOrUpdateAsync(form); + if (x.ImageId == 0 && !isUpdate) + { + x.ImageId = x.Id; + } + await this._defaultRepository.InsertOrUpdateAsync(x); + return x; + } + + /// + /// 导出Excel + /// + /// + /// + public async Task ExportExcelAsync(PagingSearchInput pagingSearchInput) + { + pagingSearchInput.Page = -1; + var tableViewModel = await this.FindListAsync(pagingSearchInput); + return ExcelUtil.ExportExcelByPagingView(tableViewModel, null, "Id"); + } + + + +} \ No newline at end of file diff --git a/admin-server/MiaoYu.Api.Admin/ApplicationServices/Apps/MiaoYuChat/T_CharacterService.cs b/admin-server/MiaoYu.Api.Admin/ApplicationServices/Apps/MiaoYuChat/T_CharacterService.cs new file mode 100644 index 0000000..a651342 --- /dev/null +++ b/admin-server/MiaoYu.Api.Admin/ApplicationServices/Apps/MiaoYuChat/T_CharacterService.cs @@ -0,0 +1,115 @@ +using MiaoYu.Repository.ChatAI.Admin.Entities.Apps; +namespace MiaoYu.Api.Admin.ApplicationServices.Apps; + +/// +/// 人物表 服务 T_CharacterService +/// +public class T_CharacterService : ApplicationService> +{ + public T_CharacterService(IRepository defaultRepository) + : base(defaultRepository) + { + + } + + /// + /// 获取列表数据 + /// + /// + /// + public async Task FindListAsync(PagingSearchInput pagingSearchInput) + { + var query = this._defaultRepository.Select + .WhereIf(!string.IsNullOrWhiteSpace(pagingSearchInput.Search?.Name), w => w.Name.Contains(pagingSearchInput.Search.Name ?? "")) + .OrderByDescending(w => w.Id) + .Select(w => new + { + w.Id, + w.Name, + w.Biography, + w.TenantId, + w.Prologue, + w.ModelConfigId, + w.Visibility, + w.CreateTime, + w.UpdateTime, + w.Gender, + w.System, + w.BgImg, + w.IconImg, + // w.LastModificationTime, + // w.CreationTime + }) + ; + + var result = await _defaultRepository.AsPagingViewAsync(query, pagingSearchInput); + // result + // .FormatValue(query, w => w.CreationTime, (oldValue) => oldValue.ToString("yyyy-MM-dd")) + // .FormatValue(query, w => w.LastModificationTime, (oldValue) => oldValue?.ToString("yyyy-MM-dd")) + // ; + // 设置列 + //result.GetColumn(query, w => w.System).Width + //result.GetColumn(query, w => w.OperatorName!).SetColumn(w => w.Name!); + + return result; + } + + /// + /// 根据id数组删除 + /// + /// ids + /// + public async Task DeleteListAsync(List ids) + { + await this._defaultRepository.DeleteByIdsAsync(ids); + } + + /// + /// 查询表单数据 + /// + /// id + /// + public async Task> FindFormAsync(int id) + { + var res = new Dictionary(); + var form = await this._defaultRepository.FindByIdAsync(id); + form = form.NullSafe(); + if (form.CreateTime == null || form.CreateTime == DateTime.MinValue) + { + form.CreateTime = DateTime.Now; + } + if (form.UpdateTime == null || form.UpdateTime == DateTime.MinValue) + { + form.UpdateTime = DateTime.Now; + } + res[nameof(id)] = id; + res[nameof(form)] = form; + return res; + } + + /// + /// 保存数据 + /// + /// form + /// + public Task SaveFormAsync(T_Character form) + { + form.UpdateTime = DateTime.Now; + return this._defaultRepository.InsertOrUpdateAsync(form); + } + + /// + /// 导出Excel + /// + /// + /// + public async Task ExportExcelAsync(PagingSearchInput pagingSearchInput) + { + pagingSearchInput.Page = -1; + var tableViewModel = await this.FindListAsync(pagingSearchInput); + return ExcelUtil.ExportExcelByPagingView(tableViewModel, null, "Id"); + } + + + +} \ No newline at end of file diff --git a/admin-server/MiaoYu.Api.Admin/ApplicationServices/DevelopmentTools/LowCode/Impl/CodeGenerationService.cs b/admin-server/MiaoYu.Api.Admin/ApplicationServices/DevelopmentTools/LowCode/Impl/CodeGenerationService.cs index 79c7670..fbefd9e 100644 --- a/admin-server/MiaoYu.Api.Admin/ApplicationServices/DevelopmentTools/LowCode/Impl/CodeGenerationService.cs +++ b/admin-server/MiaoYu.Api.Admin/ApplicationServices/DevelopmentTools/LowCode/Impl/CodeGenerationService.cs @@ -7,6 +7,7 @@ public class CodeGenerationService : ICodeGenerationService { private readonly string _webRootPath; private readonly string templateRootPath = "/wwwroot/code_generation/template/"; + private readonly string templateRootPath_v4 = "/wwwroot/code_generation/templatev4/"; private readonly string codesRootPath = "/code_generation/codes"; private readonly string zipRootPath = "/code_generation/zip"; @@ -92,11 +93,19 @@ public class CodeGenerationService : ICodeGenerationService /// public LowCodeTable FillPathByLowCodeTable(LowCodeTable lowCodeTable) { + var rootPath = App.WebApplication.Environment.ContentRootPath.Replace("\\" + App.WebApplication.Environment.ApplicationName, ""); - + if (string.IsNullOrWhiteSpace(lowCodeTable.ModelPath)) { - lowCodeTable.ModelPath = rootPath + $"\\{typeof(AdminRepositoryStartup).Namespace}\\Entities\\Apps"; + if (lowCodeTable.DataBase == "MiaoYuChat") + { + lowCodeTable.ModelPath = rootPath + $"\\{typeof(ChatAdminRepositoryStartup).Namespace}\\Entities\\Apps"; + } + else + { + lowCodeTable.ModelPath = rootPath + $"\\{typeof(AdminRepositoryStartup).Namespace}\\Entities\\Apps"; + } } if (string.IsNullOrWhiteSpace(lowCodeTable.ServicePath)) @@ -152,8 +161,12 @@ public class CodeGenerationService : ICodeGenerationService public async Task GenModelAsync(GenFormDto genFormDto) { var context = GetGenContextDto(genFormDto); - - return ClearSymbol(await _razorViewRender.RenderAsync(templateRootPath + templateModel, context)); + var _templateRootPath = templateRootPath; + if (context.DataBase == "MiaoYuChat") + { + _templateRootPath = templateRootPath_v4; + } + return ClearSymbol(await _razorViewRender.RenderAsync(_templateRootPath + templateModel, context)); } /// @@ -164,8 +177,12 @@ public class CodeGenerationService : ICodeGenerationService public async Task GenServiceAsync(GenFormDto genFormDto) { var context = GetGenContextDto(genFormDto); - - return ClearSymbol(await _razorViewRender.RenderAsync(templateRootPath + templateService, context)); + var _templateRootPath = templateRootPath; + if (context.DataBase == "MiaoYuChat") + { + _templateRootPath = templateRootPath_v4; + } + return ClearSymbol(await _razorViewRender.RenderAsync(_templateRootPath + templateService, context)); } /// @@ -176,8 +193,12 @@ public class CodeGenerationService : ICodeGenerationService public async Task GenControllerAsync(GenFormDto genFormDto) { var context = GetGenContextDto(genFormDto); - - return ClearSymbol(await _razorViewRender.RenderAsync(templateRootPath + templateController, context)); + var _templateRootPath = templateRootPath; + if (context.DataBase == "MiaoYuChat") + { + _templateRootPath = templateRootPath_v4; + } + return ClearSymbol(await _razorViewRender.RenderAsync(_templateRootPath + templateController, context)); } /// @@ -188,8 +209,12 @@ public class CodeGenerationService : ICodeGenerationService public async Task GenServiceJsAsync(GenFormDto genFormDto) { var context = GetGenContextDto(genFormDto); - - return ClearSymbol(await _razorViewRender.RenderAsync(templateRootPath + templateServiceJs, context)); + var _templateRootPath = templateRootPath; + if (context.DataBase == "MiaoYuChat") + { + _templateRootPath = templateRootPath_v4; + } + return ClearSymbol(await _razorViewRender.RenderAsync(_templateRootPath + templateServiceJs, context)); } /// @@ -200,8 +225,12 @@ public class CodeGenerationService : ICodeGenerationService public async Task GenIndexAsync(GenFormDto genFormDto) { var context = GetGenContextDto(genFormDto); - - return ClearSymbol(await _razorViewRender.RenderAsync(templateRootPath + templateIndex, context)); + var _templateRootPath = templateRootPath; + if (context.DataBase == "MiaoYuChat") + { + _templateRootPath = templateRootPath_v4; + } + return ClearSymbol(await _razorViewRender.RenderAsync(_templateRootPath + templateIndex, context)); } /// @@ -212,8 +241,12 @@ public class CodeGenerationService : ICodeGenerationService public async Task GenInfoAsync(GenFormDto genFormDto) { var context = GetGenContextDto(genFormDto); - - return ClearSymbol(await _razorViewRender.RenderAsync(templateRootPath + templateInfo, context)); + var _templateRootPath = templateRootPath; + if (context.DataBase == "MiaoYuChat") + { + _templateRootPath = templateRootPath_v4; + } + return ClearSymbol(await _razorViewRender.RenderAsync(_templateRootPath + templateInfo, context)); } @@ -488,6 +521,10 @@ public class CodeGenerationService : ICodeGenerationService private string FindCodeFileClassName(GenFormDto genFormDto) { var tableName = genFormDto.TableName.ToLineConvertHump(); + if (genFormDto.TableName.Contains("T_")) + { + tableName = genFormDto.TableName; + } return genFormDto.Type switch { "MiaoYu.Models" => $"{tableName}.cs", @@ -520,13 +557,37 @@ public class CodeGenerationService : ICodeGenerationService switch (type) { case FileTypeEnum.Model: - path = tableInfo.ModelPath + $"/{humpTableName}s"; + if (tableInfo.DataBase == "MiaoYuChat") + { + path = tableInfo.ModelPath + $"/"; + } + else + { + path = tableInfo.ModelPath + $"/{humpTableName}s"; + } + break; case FileTypeEnum.Service: - path = tableInfo.ServicePath + $"/{humpTableName}s"; + if (tableInfo.DataBase == "MiaoYuChat") + { + path = tableInfo.ServicePath + $"/MiaoYuChat"; + } + else + { + path = tableInfo.ServicePath + $"/{humpTableName}s"; + } + break; case FileTypeEnum.Controller: - path = tableInfo.ControllerPath + $"/{humpTableName}s"; + if (tableInfo.DataBase == "MiaoYuChat") + { + path = tableInfo.ControllerPath + $"/MiaoYuChat"; + } + else + { + path = tableInfo.ControllerPath + $"/{humpTableName}s"; + } + break; case FileTypeEnum.ClientIndex: path = tableInfo.ClientIndexPath + $"/{tableName}s"; diff --git a/admin-server/MiaoYu.Api.Admin/ApplicationServices/DevelopmentTools/LowCode/Impl/LowCodeTableService.cs b/admin-server/MiaoYu.Api.Admin/ApplicationServices/DevelopmentTools/LowCode/Impl/LowCodeTableService.cs index 490e684..d4be9e2 100644 --- a/admin-server/MiaoYu.Api.Admin/ApplicationServices/DevelopmentTools/LowCode/Impl/LowCodeTableService.cs +++ b/admin-server/MiaoYu.Api.Admin/ApplicationServices/DevelopmentTools/LowCode/Impl/LowCodeTableService.cs @@ -1,4 +1,5 @@ -using MiaoYu.Repository.ChatAI.Admin.Entities; +using MiaoYu.Repository.Admin.Entities.LowCode; +using MiaoYu.Repository.ChatAI.Admin.Entities; namespace MiaoYu.Api.Admin.ApplicationServices.DevelopmentTools.LowCode.Impl; @@ -116,6 +117,7 @@ public class LowCodeTableService : ApplicationService> item.Schema = item.Schema.Replace(".MiaoYuChat", ""); lowCodeTable.Schema = item.Schema; lowCodeTable.DataBase = "MiaoYuChat"; + lowCodeTable.EntityName = item.Name; } insertList.Add(lowCodeTable); } @@ -127,6 +129,7 @@ public class LowCodeTableService : ApplicationService> item.Schema = item.Schema.Replace(".MiaoYuChat", ""); table.Schema = item.Schema; table.DataBase = "MiaoYuChat"; + table.EntityName = item.Name; } updateList.Add(table); diff --git a/admin-server/MiaoYu.Api.Admin/Controllers/Apps/MiaoYuChat/TCharacterLabelController.cs b/admin-server/MiaoYu.Api.Admin/Controllers/Apps/MiaoYuChat/TCharacterLabelController.cs new file mode 100644 index 0000000..36dad08 --- /dev/null +++ b/admin-server/MiaoYu.Api.Admin/Controllers/Apps/MiaoYuChat/TCharacterLabelController.cs @@ -0,0 +1,100 @@ +using MiaoYu.Api.Admin.ApplicationServices.Apps; +using MiaoYu.Repository.ChatAI.Admin.Entities.Apps; +namespace MiaoYu.Api.Admin.Controllers.Apps; + +/// +/// 角色标签表 控制器 +/// +[ControllerDescriptor(MenuId = "请设置菜单Id 系统菜单表中查找,如果不设置不受权限保护!", DisplayName = "角色标签表")] +public class T_Character_LabelController : AdminControllerBase +{ + public T_Character_LabelController(T_Character_LabelService defaultService) + : base(defaultService) + { + + } + + /// + /// 获取列表 + /// + /// + /// + [ActionDescriptor(PermissionFunctionConsts.Function_Display, DisplayName = "查看数据")] + [HttpPost] + public Task FindListAsync([FromBody] PagingSearchInput pagingSearchInput) + { + return this._defaultService.FindListAsync(pagingSearchInput); + } + + /// + /// 根据id数组删除 + /// + /// ids + /// + [ActionDescriptor(PermissionFunctionConsts.Function_Delete, DisplayName = "删除数据")] + [HttpPost] + public async Task DeleteListAsync([FromBody] List ids) + { + await this._defaultService.DeleteListAsync(ids); + return true; + } + + /// + /// 查询表单数据 + /// + /// id + /// + [ActionDescriptor(DisplayName = "查看表单")] + [HttpGet("{id?}")] + public Task> FindFormAsync([FromRoute] int id) + { + return this._defaultService.FindFormAsync(id); + } + + /// + /// 添加 + /// + /// + /// + [RequestLimitFilter(Duration = 1, LimitCount = 1)] + [ActionDescriptor(PermissionFunctionConsts.Function_Insert, DisplayName = "创建表单")] + [HttpPost] + [ApiCheckModel] + public Task CreateAsync([FromBody] T_Character_Label form) + { + return this._defaultService.SaveFormAsync(form); + } + + /// + /// 编辑 + /// + /// + /// + [RequestLimitFilter(Duration = 1, LimitCount = 1)] + [ActionDescriptor(PermissionFunctionConsts.Function_Update, DisplayName = "编辑表单")] + [HttpPost] + [ApiCheckModel] + public Task UpdateAsync([FromBody] T_Character_Label form) + { + return this._defaultService.SaveFormAsync(form); + } + + /// + /// 导出Excel + /// + /// + /// + [ActionDescriptor(PermissionFunctionConsts.Function_Export, DisplayName = "导出数据")] + [ApiResourceCacheFilter(10)] + [HttpPost] + public async Task ExportExcelAsync([FromBody] PagingSearchInput pagingSearchInput) + { + var data = await this._defaultService.ExportExcelAsync(pagingSearchInput); + var name = $"{PermissionUtil.GetControllerDisplayName(this.GetType())}列表数据 {DateTime.Now.ToString("yyyy-MM-dd")}.xls"; + base.HttpContext.DownLoadFile(data, Tools.GetFileContentType[".xls"].ToStr(), name); + } + + + + +} \ No newline at end of file diff --git a/admin-server/MiaoYu.Api.Admin/Controllers/Apps/MiaoYuChat/TImageConfigController.cs b/admin-server/MiaoYu.Api.Admin/Controllers/Apps/MiaoYuChat/TImageConfigController.cs new file mode 100644 index 0000000..bc09d90 --- /dev/null +++ b/admin-server/MiaoYu.Api.Admin/Controllers/Apps/MiaoYuChat/TImageConfigController.cs @@ -0,0 +1,100 @@ +using MiaoYu.Api.Admin.ApplicationServices.Apps; +using MiaoYu.Repository.ChatAI.Admin.Entities; +namespace MiaoYu.Api.Admin.Controllers.Apps; + +/// +/// 图片表 控制器 +/// +[ControllerDescriptor(MenuId = "44", DisplayName = "图片表")] +public class TImageConfigController : AdminControllerBase +{ + public TImageConfigController(TImageConfigService defaultService) + : base(defaultService) + { + + } + + /// + /// 获取列表 + /// + /// + /// + [ActionDescriptor(PermissionFunctionConsts.Function_Display, DisplayName = "查看数据")] + [HttpPost] + public Task FindListAsync([FromBody] PagingSearchInput pagingSearchInput) + { + return this._defaultService.FindListAsync(pagingSearchInput); + } + + /// + /// 根据id数组删除 + /// + /// ids + /// + [ActionDescriptor(PermissionFunctionConsts.Function_Delete, DisplayName = "删除数据")] + [HttpPost] + public async Task DeleteListAsync([FromBody] List ids) + { + await this._defaultService.DeleteListAsync(ids); + return true; + } + + /// + /// 查询表单数据 + /// + /// id + /// + [ActionDescriptor(DisplayName = "查看表单")] + [HttpGet("{id?}")] + public Task> FindFormAsync([FromRoute] int id) + { + return this._defaultService.FindFormAsync(id); + } + + /// + /// 添加 + /// + /// + /// + [RequestLimitFilter(Duration = 1, LimitCount = 1)] + [ActionDescriptor(PermissionFunctionConsts.Function_Insert, DisplayName = "创建表单")] + [HttpPost] + [ApiCheckModel] + public Task CreateAsync([FromBody] T_Image_Config form) + { + return this._defaultService.SaveFormAsync(form); + } + + /// + /// 编辑 + /// + /// + /// + [RequestLimitFilter(Duration = 1, LimitCount = 1)] + [ActionDescriptor(PermissionFunctionConsts.Function_Update, DisplayName = "编辑表单")] + [HttpPost] + [ApiCheckModel] + public Task UpdateAsync([FromBody] T_Image_Config form) + { + return this._defaultService.SaveFormAsync(form); + } + + /// + /// 导出Excel + /// + /// + /// + [ActionDescriptor(PermissionFunctionConsts.Function_Export, DisplayName = "导出数据")] + [ApiResourceCacheFilter(10)] + [HttpPost] + public async Task ExportExcelAsync([FromBody] PagingSearchInput pagingSearchInput) + { + var data = await this._defaultService.ExportExcelAsync(pagingSearchInput); + var name = $"{PermissionUtil.GetControllerDisplayName(this.GetType())}列表数据 {DateTime.Now.ToString("yyyy-MM-dd")}.xls"; + base.HttpContext.DownLoadFile(data, Tools.GetFileContentType[".xls"].ToStr(), name); + } + + + + +} \ No newline at end of file diff --git a/admin-server/MiaoYu.Api.Admin/Controllers/Apps/MiaoYuChat/T_CharacterController.cs b/admin-server/MiaoYu.Api.Admin/Controllers/Apps/MiaoYuChat/T_CharacterController.cs new file mode 100644 index 0000000..7e57d58 --- /dev/null +++ b/admin-server/MiaoYu.Api.Admin/Controllers/Apps/MiaoYuChat/T_CharacterController.cs @@ -0,0 +1,100 @@ +using MiaoYu.Api.Admin.ApplicationServices.Apps; +using MiaoYu.Repository.ChatAI.Admin.Entities.Apps; +namespace MiaoYu.Api.Admin.Controllers.Apps; + +/// +/// 人物表 控制器 +/// +[ControllerDescriptor(MenuId = "请设置菜单Id 系统菜单表中查找,如果不设置不受权限保护!", DisplayName = "人物表")] +public class T_CharacterController : AdminControllerBase +{ + public T_CharacterController(T_CharacterService defaultService) + : base(defaultService) + { + + } + + /// + /// 获取列表 + /// + /// + /// + [ActionDescriptor(PermissionFunctionConsts.Function_Display, DisplayName = "查看数据")] + [HttpPost] + public Task FindListAsync([FromBody] PagingSearchInput pagingSearchInput) + { + return this._defaultService.FindListAsync(pagingSearchInput); + } + + /// + /// 根据id数组删除 + /// + /// ids + /// + [ActionDescriptor(PermissionFunctionConsts.Function_Delete, DisplayName = "删除数据")] + [HttpPost] + public async Task DeleteListAsync([FromBody] List ids) + { + await this._defaultService.DeleteListAsync(ids); + return true; + } + + /// + /// 查询表单数据 + /// + /// id + /// + [ActionDescriptor(DisplayName = "查看表单")] + [HttpGet("{id?}")] + public Task> FindFormAsync([FromRoute] int id) + { + return this._defaultService.FindFormAsync(id); + } + + /// + /// 添加 + /// + /// + /// + [RequestLimitFilter(Duration = 1, LimitCount = 1)] + [ActionDescriptor(PermissionFunctionConsts.Function_Insert, DisplayName = "创建表单")] + [HttpPost] + [ApiCheckModel] + public Task CreateAsync([FromBody] T_Character form) + { + return this._defaultService.SaveFormAsync(form); + } + + /// + /// 编辑 + /// + /// + /// + [RequestLimitFilter(Duration = 1, LimitCount = 1)] + [ActionDescriptor(PermissionFunctionConsts.Function_Update, DisplayName = "编辑表单")] + [HttpPost] + [ApiCheckModel] + public Task UpdateAsync([FromBody] T_Character form) + { + return this._defaultService.SaveFormAsync(form); + } + + /// + /// 导出Excel + /// + /// + /// + [ActionDescriptor(PermissionFunctionConsts.Function_Export, DisplayName = "导出数据")] + [ApiResourceCacheFilter(10)] + [HttpPost] + public async Task ExportExcelAsync([FromBody] PagingSearchInput pagingSearchInput) + { + var data = await this._defaultService.ExportExcelAsync(pagingSearchInput); + var name = $"{PermissionUtil.GetControllerDisplayName(this.GetType())}列表数据 {DateTime.Now.ToString("yyyy-MM-dd")}.xls"; + base.HttpContext.DownLoadFile(data, Tools.GetFileContentType[".xls"].ToStr(), name); + } + + + + +} \ No newline at end of file diff --git a/admin-server/MiaoYu.Api.Admin/MiaoYu.Api.Admin.xml b/admin-server/MiaoYu.Api.Admin/MiaoYu.Api.Admin.xml index 385e1a8..cb00d37 100644 --- a/admin-server/MiaoYu.Api.Admin/MiaoYu.Api.Admin.xml +++ b/admin-server/MiaoYu.Api.Admin/MiaoYu.Api.Admin.xml @@ -129,6 +129,126 @@ + + + 角色标签表 服务 T_Character_LabelService + + + + + 获取列表数据 + + + + + + + 根据id数组删除 + + ids + + + + + 查询表单数据 + + id + + + + + 保存数据 + + form + + + + + 导出Excel + + + + + + + 图片表 服务 TImageConfigService + + + + + 获取列表数据 + + + + + + + 根据id数组删除 + + ids + + + + + 查询表单数据 + + id + + + + + 保存数据 + + form + + + + + 导出Excel + + + + + + + 人物表 服务 T_CharacterService + + + + + 获取列表数据 + + + + + + + 根据id数组删除 + + ids + + + + + 查询表单数据 + + id + + + + + 保存数据 + + form + + + + + 导出Excel + + + + 会员服务 @@ -1305,6 +1425,147 @@ 默认服务 + + + 角色标签表 控制器 + + + + + 获取列表 + + + + + + + 根据id数组删除 + + ids + + + + + 查询表单数据 + + id + + + + + 添加 + + + + + + + 编辑 + + + + + + + 导出Excel + + + + + + + 图片表 控制器 + + + + + 获取列表 + + + + + + + 根据id数组删除 + + ids + + + + + 查询表单数据 + + id + + + + + 添加 + + + + + + + 编辑 + + + + + + + 导出Excel + + + + + + + 人物表 控制器 + + + + + 获取列表 + + + + + + + 根据id数组删除 + + ids + + + + + 查询表单数据 + + id + + + + + 添加 + + + + + + + 编辑 + + + + + + + 导出Excel + + + + 会员控制器 @@ -2297,6 +2558,19 @@ 版本 + + + 获取类型 根据 appTableInfo + + + + + + + 获取 id 组件所对应的类型 + + + 获取类型 根据 appTableInfo diff --git a/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/template/tempController.cshtml b/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/template/tempController.cshtml index 7483942..13ec2f9 100644 --- a/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/template/tempController.cshtml +++ b/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/template/tempController.cshtml @@ -6,7 +6,7 @@
 
 using @(Model.Namespace).Api.Admin.ApplicationServices.Apps;
-using @(Model.Namespace).@(Model.DataBase == "MiaoYuChat" ? "Repository.ChatAI.Admin.Entities.Apps;" : "Repository.EntityFramework.Admin.Entities.Apps;");
+using @(Model.Namespace).@(Model.DataBase == "MiaoYuChat" ? "Repository.ChatAI.Admin.Entities.Apps;" : "Repository.EntityFramework.Admin.Entities.Apps;")
 namespace @(Model.Namespace).Api.Admin.Controllers.Apps;
 
 /// 
diff --git a/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/template/tempService.cshtml b/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/template/tempService.cshtml
index bd3aea1..5702b74 100644
--- a/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/template/tempService.cshtml
+++ b/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/template/tempService.cshtml
@@ -54,11 +54,19 @@ public class @(className)Service : ApplicationService<@("IRepository")<@(classNa
     public async Task<@("PagingView")> FindListAsync(PagingSearchInput<@(className)> pagingSearchInput)
     {
         var query = this._defaultRepository.Select
-                @if (!string.IsNullOrWhiteSpace(searchKeyWord))
-                {
-                    
.WhereIf(!string.IsNullOrWhiteSpace(pagingSearchInput.Search?.@(searchKeyWord)), w => w.@(searchKeyWord).Contains(pagingSearchInput.Search.@(searchKeyWord) ?? ""))
- } - .OrderByDescending(w => w.CreationTime) + @if (!string.IsNullOrWhiteSpace(searchKeyWord)) + { +
.WhereIf(!string.IsNullOrWhiteSpace(pagingSearchInput.Search?.@(searchKeyWord)), w => w.@(searchKeyWord).Contains(pagingSearchInput.Search.@(searchKeyWord) ?? ""))
+ } + @if (!string.IsNullOrWhiteSpace(searchKeyWord)) + { +
 .OrderByDescending(w => w.Id)
+ } + @if (!string.IsNullOrWhiteSpace(searchKeyWord)) + { +
 .OrderByDescending(w => w.CreationTime)
+ } + .Select(w => new { w.Id, @@ -69,13 +77,14 @@ public class @(className)Service : ApplicationService<@("IRepository")<@(classNa ; var result = await _defaultRepository.AsPagingViewAsync(query, pagingSearchInput); - - // 覆盖值 - result - .FormatValue(query, w => w.CreationTime, (oldValue) => oldValue.ToString("yyyy-MM-dd")) - .FormatValue(query, w => w.LastModificationTime, (oldValue) => oldValue?.ToString("yyyy-MM-dd")) - ; - + @if (Model.DataBase != "MiaoYuChat") + { + // 覆盖值 +
  result
+                .FormatValue(query, w => w.CreationTime, (oldValue) => oldValue.ToString("yyyy-MM-dd"))
+                .FormatValue(query, w => w.LastModificationTime, (oldValue) => oldValue?.ToString("yyyy-MM-dd"))
+                    ;
+ } // 设置列 //result.GetColumn(query, w => w.OperatorName).SetColumn("操作人"); //result.GetColumn(query, w => w.OperatorName!).SetColumn<@("SysUser")>(w => w.Name!); diff --git a/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/templatev4/tempClientIndex.cshtml b/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/templatev4/tempClientIndex.cshtml new file mode 100644 index 0000000..2eec82f --- /dev/null +++ b/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/templatev4/tempClientIndex.cshtml @@ -0,0 +1,259 @@ +@model GenDbTableDto +@{ + var className = Model.EntityName; + var tableName = Model.TableName; + var ignores = new string[] { + "Id", + "CreationTime", + "CreatorUserId", + "LastModificationTime", + "LastModifierUserId" , + "DeletionTime", + "DeleterUserId", + "IsDeleted" + }; + + var tableInfos = Model.TableInfos + .Where(w => !ignores.Contains(w.ColumnName)) + .OrderBy(w => w.Position) + .ToList() + ; + + var searchKeyWords = new[] { "Title", "Name", "Phone", "Address", "Email" }; + var searchKeyWord = string.Empty; + + foreach (var item in searchKeyWords) + { + if (tableInfos.Any(w => w.ColumnName == item)) + { + searchKeyWord = item; + break; + } + } + if (string.IsNullOrWhiteSpace(searchKeyWord)) + { + searchKeyWord = "请设置检索框"; + } +} + +
+
+
+
+
\ No newline at end of file diff --git a/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/templatev4/tempClientInfo.cshtml b/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/templatev4/tempClientInfo.cshtml new file mode 100644 index 0000000..f85ad27 --- /dev/null +++ b/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/templatev4/tempClientInfo.cshtml @@ -0,0 +1,113 @@ +@model GenDbTableDto +@{ + var className = Model.EntityName; + var tableName = Model.TableName; + var ignores = new string[] { + "Id", + "CreationTime", + "CreatorUserId", + "LastModificationTime", + "LastModifierUserId" , + "DeletionTime", + "DeleterUserId", + "IsDeleted" + }; + + var tableInfos = Model.TableInfos + .Where(w => !ignores.Contains(w.ColumnName)) + .OrderBy(w => w.Position) + .ToList() + ; +} + +
+
+
+
+
\ No newline at end of file diff --git a/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/templatev4/tempClientService.cshtml b/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/templatev4/tempClientService.cshtml new file mode 100644 index 0000000..d062660 --- /dev/null +++ b/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/templatev4/tempClientService.cshtml @@ -0,0 +1,81 @@ +@model GenDbTableDto +@{ + var className = Model.EntityName; + var classNameRemark = Model.DisplayName; +} +
+import Http from "@@/core/utils/Http";
+
+/**
+ * @(className)服务
+ */
+export default class @(className)Service {
+
+    static urlPrefix = "/api/v1/admin/@className";
+
+    /**
+     * 获取数据列表
+     * @@param current 
+     * @@param pageSize 
+     * @@param search 
+     * @@param searchSort 
+     * @@returns 
+     */
+    static findList(current: number, pageSize: number, search: any = {}, searchSort: any[] = []) {
+        return Http.post(`${this.urlPrefix}/findList`, {
+            page: current,
+            size: pageSize,
+            search,
+            searchSort
+        })
+    }
+
+    /**
+     * 删除集合数据
+     * 
+     * @@param ids 
+     * @@returns 
+     */
+    static deleteList(ids: string[]) {
+        return Http.post(`${this.urlPrefix}/deleteList`, ids)
+    }
+
+    /**
+     * 查询表单
+     * 
+     * @@param id 
+     * @@returns 
+     */
+    static findForm(id?: string | undefined) {
+        return Http.get(`${this.urlPrefix}/findForm${(id ? '/' + id : '')}`)
+    }
+
+    /**
+     * 保存表单数据
+     * 
+     * @@param id 
+     * @@param formData 
+     * @@returns 
+     */
+    static saveForm(id: string | undefined, formData: any) {
+        return Http.post(`${this.urlPrefix}/${id ? 'update' : 'create'}`, formData)
+    }
+
+    /**
+     * 导出 excel
+     * 
+     * @@param search 
+     * @@param searchSort 
+     * @@returns 
+     */
+    static exportExcel(search: any = {}, searchSort: any[] = []) {
+        return Http.download(`${this.urlPrefix}/exportExcel`, {
+            page: -1,
+            size: -1,
+            search,
+            searchSort
+        });
+    }
+
+}
+
\ No newline at end of file diff --git a/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/templatev4/tempController.cshtml b/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/templatev4/tempController.cshtml new file mode 100644 index 0000000..c2f7eeb --- /dev/null +++ b/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/templatev4/tempController.cshtml @@ -0,0 +1,109 @@ +@model GenDbTableDto +@{ + var className = Model.EntityName; + var classNameRemark = Model.DisplayName; +} +
+
+using @(Model.Namespace).Api.Admin.ApplicationServices.Apps;
+using @(Model.Namespace).Repository.ChatAI.Admin.Entities.Apps;
+namespace @(Model.Namespace).Api.Admin.Controllers.Apps;
+
+/// 
+/// @(classNameRemark) 控制器
+/// 
+[ControllerDescriptor(MenuId = "请设置菜单Id 系统菜单表中查找,如果不设置不受权限保护!", DisplayName = "@(classNameRemark)")]
+public class @(className)Controller : AdminControllerBase<@($"{className}Service")>
+{
+    public @(className)Controller(@(className)Service defaultService) 
+        : base(defaultService)
+    {
+
+    }
+        
+    /// 
+    /// 获取列表
+    /// 
+    /// 
+    /// 
+    [ActionDescriptor(PermissionFunctionConsts.Function_Display, DisplayName = "查看数据")]
+    [HttpPost]
+    public Task<@("PagingView")> FindListAsync([FromBody] PagingSearchInput<@(className)> pagingSearchInput)
+    {
+        return this._defaultService.FindListAsync(pagingSearchInput);
+    }
+
+    /// 
+    /// 根据id数组删除
+    /// 
+    /// ids
+    /// 
+    [ActionDescriptor(PermissionFunctionConsts.Function_Delete, DisplayName = "删除数据")]
+    [HttpPost]
+    public async Task<@("bool")> DeleteListAsync([FromBody] List<@("int")> ids)
+    {
+        await this._defaultService.DeleteListAsync(ids);
+        return true;
+    }
+
+    /// 
+    /// 查询表单数据
+    /// 
+    /// id
+    /// 
+    [ActionDescriptor(DisplayName = "查看表单")]
+    [HttpGet("{id?}")]
+    public Task<@Html.Raw("Dictionary")> FindFormAsync([FromRoute] int id)
+    {
+        return this._defaultService.FindFormAsync(id);
+    }
+
+    /// 
+    /// 添加
+    /// 
+    /// 
+    /// 
+    [RequestLimitFilter(Duration = 1, LimitCount = 1)]
+    [ActionDescriptor(PermissionFunctionConsts.Function_Insert, DisplayName = "创建表单")]
+    [HttpPost]
+    [ApiCheckModel]
+    public Task CreateAsync([FromBody] @(className) form)
+    {
+        return this._defaultService.SaveFormAsync(form);
+    }
+
+    /// 
+    /// 编辑
+    /// 
+    /// 
+    /// 
+    [RequestLimitFilter(Duration = 1, LimitCount = 1)]
+    [ActionDescriptor(PermissionFunctionConsts.Function_Update, DisplayName = "编辑表单")]
+    [HttpPost]
+    [ApiCheckModel]
+    public Task UpdateAsync([FromBody] @(className) form)
+    {
+        return this._defaultService.SaveFormAsync(form);
+    }
+
+    /// 
+    /// 导出Excel
+    /// 
+    /// 
+    /// 
+    [ActionDescriptor(PermissionFunctionConsts.Function_Export, DisplayName = "导出数据")]
+    [ApiResourceCacheFilter(10)]
+    [HttpPost]
+    public async Task ExportExcelAsync([FromBody] PagingSearchInput<@(className)> pagingSearchInput)
+    {
+        var data = await this._defaultService.ExportExcelAsync(pagingSearchInput);
+        var name = $"{PermissionUtil.GetControllerDisplayName(this.GetType())}列表数据 {DateTime.Now.ToString("yyyy-MM-dd")}.xls";
+        base.HttpContext.DownLoadFile(data, Tools.GetFileContentType[".xls"].ToStr(), name);
+    }
+
+
+
+
+}
+
+
\ No newline at end of file diff --git a/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/templatev4/tempModel.cshtml b/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/templatev4/tempModel.cshtml new file mode 100644 index 0000000..78f4c0d --- /dev/null +++ b/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/templatev4/tempModel.cshtml @@ -0,0 +1,116 @@ +@model GenDbTableDto +@{ + var className = Model.EntityName; + var classNameRemark = Model.DisplayName; + + var ignores = new string[] { + "Id", + "CreationTime", + "CreatorUserId", + "LastModificationTime", + "LastModifierUserId" , + "DeletionTime", + "DeleterUserId", + "IsDeleted", + "TenantId", + }; + + var tableInfos = Model.TableInfos + .Where(w => !ignores.Contains(w.ColumnName)) + .OrderBy(w => w.Position) + .ToList() + ; +} + +@functions +{ + //获取类型 根据 appTableInfo + string GetType(DbColumnInfo appTableInfo) + { + switch (appTableInfo.DbTypeText) + { + case "uniqueidentifier": + return appTableInfo.IsPrimary ? "Guid" : "Guid?"; + case "bit": + case "int": + return appTableInfo.IsPrimary ? "int" : "int?"; + case "datetime": + return appTableInfo.IsNullable ? "DateTime?" : "DateTime"; + case "float": + case "money": + return appTableInfo.IsNullable ? "double?" : "double"; + case "decimal": + return appTableInfo.IsNullable ? "decimal?" : "decimal"; + default: + return appTableInfo.IsNullable ? appTableInfo.CsType.Name + "?" : appTableInfo.CsType.Name; + } + } + + /// + /// 获取类型 根据 appTableInfo + /// + /// + /// + string GetTypeNew(LowCodeTableInfo appTableInfo) + { + if (appTableInfo.CsType.ToLower() == "string") + { + return "string?"; + } + + return appTableInfo.IsNullable ? $"{appTableInfo.CsType}?" : appTableInfo.CsType; + } + + /// + /// 获取 id 组件所对应的类型 + /// + /// + string GetIdType() + { + var lowCodeTableInfo = Model.TableInfos.Where(w => w.ColumnName == "Id")?.FirstOrDefault(); + + if (Model.DataBase == "MiaoYuChat") + { + return "DefaultEntityV4"; + } + if (lowCodeTableInfo == null) return "DefaultEntity"; + + if (lowCodeTableInfo.CsType.ToLower().Contains("string")) + return "DefaultEntityStringKey"; + + if (lowCodeTableInfo.CsType.ToLower().Contains("int")) + return "DefaultEntityIdentityIntKey"; + + if (lowCodeTableInfo.CsType.ToLower().Contains("guid")) + return "DefaultEntity"; + + return "DefaultEntity<" + lowCodeTableInfo.CsType + ">"; + } + + +} + +
+ 
+namespace @(Model.Namespace).Repository.ChatAI.Admin.Entities.Apps;
+
+/// 
+/// @(string.IsNullOrWhiteSpace(classNameRemark) ? className : classNameRemark)
+/// 
+[EntityDescription(FieldIgnored = true)]
+public class @className : @(GetIdType())
+{
+
+    @foreach (var item in tableInfos)
+    {
+    
+    /// 
+    ///  @(string.IsNullOrWhiteSpace(item.DisplayName) ? item.ColumnName : item.DisplayName) => 备注: @(string.IsNullOrWhiteSpace(item.Describe) ? item.ColumnName : item.Describe)
+    /// 
+    public @(GetTypeNew(item)) @item.ColumnName { get; set; }
+    
+ } + +} + +
\ No newline at end of file diff --git a/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/templatev4/tempService.cshtml b/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/templatev4/tempService.cshtml new file mode 100644 index 0000000..c8beab9 --- /dev/null +++ b/admin-server/MiaoYu.Api.Admin/wwwroot/code_generation/templatev4/tempService.cshtml @@ -0,0 +1,142 @@ +@model GenDbTableDto +@{ + var className = Model.EntityName; + var classNameRemark = Model.DisplayName; + + var ignores = new string[] + { + "Id", + "CreationTime", + "CreatorUserId", + "LastModificationTime", + "LastModifierUserId", + "DeletionTime", + "DeleterUserId", + "IsDeleted" + }; + + var tableInfos = Model.TableInfos + .Where(w => !ignores.Contains(w.ColumnName)) + .OrderBy(w => w.Position) + .ToList() + ; + var searchKeyWords = new[] { "Title", "Name", "Phone", "Address", "Email" }; + var searchKeyWord = string.Empty; + foreach (var item in searchKeyWords) + { + if (tableInfos.Any(w => w.ColumnName.Contains(item))) + { + searchKeyWord = item; + break; + } + } +} +
+using @(Model.Namespace).Repository.ChatAI.Admin.Entities.Apps;
+namespace @(Model.Namespace).Api.Admin.ApplicationServices.Apps;
+
+/// 
+/// @(classNameRemark) 服务 @(className)Service
+/// 
+public class @(className)Service : ApplicationService<@("IRepository")<@(className)>>
+{
+    public @(className)Service(IRepository<@(className)> defaultRepository)
+        : base(defaultRepository)
+    {
+
+    }
+
+    /// 
+    /// 获取列表数据
+    /// 
+    /// 
+    /// 
+    public async Task<@("PagingView")> FindListAsync(PagingSearchInput<@(className)> pagingSearchInput)
+    {
+        var query = this._defaultRepository.Select
+            @if (!string.IsNullOrWhiteSpace(searchKeyWord))
+            {
+                
.WhereIf(!string.IsNullOrWhiteSpace(pagingSearchInput.Search?.@(searchKeyWord)), w => w.@(searchKeyWord).Contains(pagingSearchInput.Search.@(searchKeyWord) ?? ""))
+ } + .OrderByDescending(w => w.Id) + .Select(w => new + { + w.Id, + @(string.Join(',', tableInfos.Select(w => "w." + w.ColumnName)))@(",") + // w.LastModificationTime, + // w.CreationTime + }) + ; + + var result = await _defaultRepository.AsPagingViewAsync(query, pagingSearchInput); + // result + // .FormatValue(query, w => w.CreationTime, (oldValue) => oldValue.ToString("yyyy-MM-dd")) + // .FormatValue(query, w => w.LastModificationTime, (oldValue) => oldValue?.ToString("yyyy-MM-dd")) + // ; + // 设置列 + //result.GetColumn(query, w => w.OperatorName).SetColumn("操作人"); + //result.GetColumn(query, w => w.OperatorName!).SetColumn<@("SysUser")>(w => w.Name!); + + return result; + } + + /// + /// 根据id数组删除 + /// + /// ids + /// + public async Task DeleteListAsync(List<@("int")> ids) + { + await this._defaultRepository.DeleteByIdsAsync(ids); + } + + /// + /// 查询表单数据 + /// + /// id + /// + public async Task<@("Dictionary")<@("string,object")>> FindFormAsync(int id) + { + var res = new Dictionary<@("string, object")>(); + var form = await this._defaultRepository.FindByIdAsync(id); + form = form.NullSafe(); + //if (form.CreateTime == null || form.CreateTime == DateTime.MinValue) + //{ + // form.CreateTime = DateTime.Now; + //} + //if (form.UpdateTime == null || form.UpdateTime == DateTime.MinValue) + //{ + // form.UpdateTime = DateTime.Now; + //} + res[nameof(id)] = id; + res[nameof(form)] = form; + return res; + } + + /// + /// 保存数据 + /// + /// form + /// + public Task SaveFormAsync(@className form) + { + return this._defaultRepository.InsertOrUpdateAsync(form); + } + + /// + /// 导出Excel + /// + /// + /// + public async Task<@("byte[]")> ExportExcelAsync(PagingSearchInput<@(className)> pagingSearchInput) + { + pagingSearchInput.Page = -1; + var tableViewModel = await this.FindListAsync(pagingSearchInput); + return ExcelUtil.ExportExcelByPagingView(tableViewModel, null, "Id"); + } + + + +} + +
\ No newline at end of file diff --git a/admin-server/MiaoYu.Repository.ChatAI.Admin/Entities/Apps/TCharacterLabel.cs b/admin-server/MiaoYu.Repository.ChatAI.Admin/Entities/Apps/TCharacterLabel.cs new file mode 100644 index 0000000..96e9cfa --- /dev/null +++ b/admin-server/MiaoYu.Repository.ChatAI.Admin/Entities/Apps/TCharacterLabel.cs @@ -0,0 +1,29 @@ +namespace MiaoYu.Repository.ChatAI.Admin.Entities.Apps; + +/// +/// 角色标签表 +/// +[EntityDescription(FieldIgnored = true)] +public class T_Character_Label : DefaultEntityV4 +{ + + + /// + /// 标签名称 => 备注: 标签名称 + /// + public string? LabelName { get; set; } + + + /// + /// 创建时间 => 备注: 创建时间 + /// + public DateTime? CreateTime { get; set; } + + + /// + /// 更新时间 => 备注: 更新时间 + /// + public DateTime? UpdateTime { get; set; } + + +} \ No newline at end of file diff --git a/admin-server/MiaoYu.Repository.ChatAI.Admin/Entities/Apps/T_Character.cs b/admin-server/MiaoYu.Repository.ChatAI.Admin/Entities/Apps/T_Character.cs new file mode 100644 index 0000000..202439d --- /dev/null +++ b/admin-server/MiaoYu.Repository.ChatAI.Admin/Entities/Apps/T_Character.cs @@ -0,0 +1,77 @@ +namespace MiaoYu.Repository.ChatAI.Admin.Entities.Apps; + +/// +/// 人物表 +/// +[EntityDescription(FieldIgnored = true)] +public class T_Character : DefaultEntityV4 +{ + + + /// + /// 人物名字 => 备注: 人物名字 + /// + public string? Name { get; set; } + + + /// + /// 人物简介 => 备注: 人物简介 + /// + public string? Biography { get; set; } + + + /// + /// 开场白 => 备注: 开场白 + /// + public string? Prologue { get; set; } + + + /// + /// 模型Id => 备注: 模型Id + /// + public Int32 ModelConfigId { get; set; } + + + /// + /// 公开/私密 0公开 1私密 => 备注: 公开/私密 0公开 1私密 + /// + public Boolean Visibility { get; set; } + + + /// + /// 创建时间 => 备注: 创建时间 + /// + public DateTime? CreateTime { get; set; } + + + /// + /// 更新时间 => 备注: 更新时间 + /// + public DateTime? UpdateTime { get; set; } + + + /// + /// 性别0男1女2其他 => 备注: 性别0男1女2其他 + /// + public Int32 Gender { get; set; } + + + /// + /// 人物初始设定 => 备注: 人物初始设定 + /// + public string? System { get; set; } + + + /// + /// 背景图片 => 备注: 背景图片 + /// + public Int32? BgImg { get; set; } + + + /// + /// 角色头像(是id) => 备注: 角色头像(是id) + /// + public Int32? IconImg { get; set; } + + +} \ No newline at end of file diff --git a/admin-server/MiaoYu.Repository.ChatAI.Admin/Entities/Apps/T_Image_Config.cs b/admin-server/MiaoYu.Repository.ChatAI.Admin/Entities/Apps/T_Image_Config.cs new file mode 100644 index 0000000..d84007e --- /dev/null +++ b/admin-server/MiaoYu.Repository.ChatAI.Admin/Entities/Apps/T_Image_Config.cs @@ -0,0 +1,28 @@ +namespace MiaoYu.Repository.ChatAI.Admin.Entities.Apps; + +/// +/// 图片表 +/// +public class T_Image_Config : DefaultEntityV4 +{ + + + /// + /// 图片Id => 备注: 图片Id + /// + public Int32 ImageId { get; set; } + + + /// + /// 图片名称 => 备注: 图片名称 + /// + public string? Name { get; set; } + + + /// + /// 图片地址 => 备注: 图片地址 + /// + public string? Url { get; set; } + + +} \ No newline at end of file diff --git a/admin-server/MiaoYu.Repository.ChatAI.Admin/Entities/T_Image_Config.cs b/admin-server/MiaoYu.Repository.ChatAI.Admin/Entities/T_Image_Config.cs index bc9a83a..4baf464 100644 --- a/admin-server/MiaoYu.Repository.ChatAI.Admin/Entities/T_Image_Config.cs +++ b/admin-server/MiaoYu.Repository.ChatAI.Admin/Entities/T_Image_Config.cs @@ -35,6 +35,31 @@ namespace MiaoYu.Repository.ChatAI.Admin.Entities public string Url { get; set; } + /// + /// 创建时间 + /// + public DateTime CreateAt { get; set; } + + /// + /// 修改时间 + /// + public DateTime UpdateAt { get; set; } + + /// + /// oss存放路径 + /// + public string? OssPath { get; set; } + + /// + /// 存储桶 + /// + public string? Bucket { get; set; } + + /// + /// 地域 + /// + public string? Region { get; set; } + } } diff --git a/admin-server/MiaoYu.Repository.ChatAI.Admin/MiaoYu.Repository.ChatAI.Admin.csproj b/admin-server/MiaoYu.Repository.ChatAI.Admin/MiaoYu.Repository.ChatAI.Admin.csproj index 6a424b5..b4dcbbe 100644 --- a/admin-server/MiaoYu.Repository.ChatAI.Admin/MiaoYu.Repository.ChatAI.Admin.csproj +++ b/admin-server/MiaoYu.Repository.ChatAI.Admin/MiaoYu.Repository.ChatAI.Admin.csproj @@ -8,6 +8,10 @@ $(MSBuildProjectName).xml + + + + @@ -20,7 +24,7 @@ - + diff --git a/admin-server/MiaoYu.Repository.ChatAI.Admin/MiaoYu.Repository.ChatAI.Admin.xml b/admin-server/MiaoYu.Repository.ChatAI.Admin/MiaoYu.Repository.ChatAI.Admin.xml index 6da15e1..833e66f 100644 --- a/admin-server/MiaoYu.Repository.ChatAI.Admin/MiaoYu.Repository.ChatAI.Admin.xml +++ b/admin-server/MiaoYu.Repository.ChatAI.Admin/MiaoYu.Repository.ChatAI.Admin.xml @@ -37,6 +37,86 @@
+ + + 角色标签表 + + + + + 标签名称 => 备注: 标签名称 + + + + + 创建时间 => 备注: 创建时间 + + + + + 更新时间 => 备注: 更新时间 + + + + + 人物表 + + + + + 人物名字 => 备注: 人物名字 + + + + + 人物简介 => 备注: 人物简介 + + + + + 开场白 => 备注: 开场白 + + + + + 模型Id => 备注: 模型Id + + + + + 公开/私密 0公开 1私密 => 备注: 公开/私密 0公开 1私密 + + + + + 创建时间 => 备注: 创建时间 + + + + + 更新时间 => 备注: 更新时间 + + + + + 性别0男1女2其他 => 备注: 性别0男1女2其他 + + + + + 人物初始设定 => 备注: 人物初始设定 + + + + + 背景图片 => 备注: 背景图片 + + + + + 角色头像(是id) => 备注: 角色头像(是id) + + 图片表 @@ -57,5 +137,30 @@ 图片url + + + 创建时间 + + + + + 修改时间 + + + + + oss存放路径 + + + + + 存储桶 + + + + + 地域 + + diff --git a/admin-server/MiaoYu.Repository.ChatAI.Admin/Migrations/ChatAdminDbContextModelSnapshot.cs b/admin-server/MiaoYu.Repository.ChatAI.Admin/Migrations/ChatAdminDbContextModelSnapshot.cs index 6a8ff2d..0aa309c 100644 --- a/admin-server/MiaoYu.Repository.ChatAI.Admin/Migrations/ChatAdminDbContextModelSnapshot.cs +++ b/admin-server/MiaoYu.Repository.ChatAI.Admin/Migrations/ChatAdminDbContextModelSnapshot.cs @@ -21,19 +21,39 @@ namespace MiaoYu.Repository.ChatAI.Admin.Migrations entity.ToTable(tb => tb.HasComment("图片表")); + entity.Property(e => e.Bucket) + .HasMaxLength(100) + .HasComment("存储桶"); + entity.Property(e => e.CreateAt) + .HasComment("创建时间") + .HasColumnType("datetime"); entity.Property(e => e.ImageId).HasComment("图片Id"); entity.Property(e => e.Name) .HasMaxLength(50) .HasComment("图片名称"); + entity.Property(e => e.OssPath) + .HasMaxLength(200) + .HasComment("oss存放路径"); + entity.Property(e => e.Region) + .HasMaxLength(100) + .HasComment("地域"); entity.Property(e => e.TenantId).HasComment("租户"); + entity.Property(e => e.UpdateAt) + .HasComment("修改时间") + .HasColumnType("datetime"); entity.Property(e => e.Url) .HasMaxLength(500) .HasComment("图片地址"); - + //添加全局筛选器 + //if (this.TenantInfo != null) + //{ + // entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId); + //} }); - + + #pragma warning restore 612, 618 } } diff --git a/admin-server/MiaoYu.Repository.ChatAI.Admin/Usings.cs b/admin-server/MiaoYu.Repository.ChatAI.Admin/Usings.cs index 043d34e..ac20147 100644 --- a/admin-server/MiaoYu.Repository.ChatAI.Admin/Usings.cs +++ b/admin-server/MiaoYu.Repository.ChatAI.Admin/Usings.cs @@ -23,4 +23,5 @@ global using System.ComponentModel.DataAnnotations; global using System.ComponentModel.DataAnnotations.Schema; global using System.Reflection; global using MiaoYu.Core.Logs; -global using System.Text; \ No newline at end of file +global using System.Text; +global using MiaoYu.Core.EntityFramework.Models; \ No newline at end of file diff --git a/admin-server/MiaoYu.Shared.Admin/Extensions/RepositoryBaseExtensions.cs b/admin-server/MiaoYu.Shared.Admin/Extensions/RepositoryBaseExtensions.cs index 7e7d863..fbb8961 100644 --- a/admin-server/MiaoYu.Shared.Admin/Extensions/RepositoryBaseExtensions.cs +++ b/admin-server/MiaoYu.Shared.Admin/Extensions/RepositoryBaseExtensions.cs @@ -82,7 +82,11 @@ public static class RepositoryBaseExtensions // 设置列显示名称 pagingView.SetColumnDisplayName(); - + var tenal = pagingView.Columns.Where(it => it.DataIndex == "tenantId").FirstOrDefault(); + if (tenal != null) + { + tenal.Show = false; + } return pagingView; } diff --git a/admin-server/MiaoYu.Shared.Admin/MiaoYu.Shared.Admin.xml b/admin-server/MiaoYu.Shared.Admin/MiaoYu.Shared.Admin.xml index 0523be7..5de6932 100644 --- a/admin-server/MiaoYu.Shared.Admin/MiaoYu.Shared.Admin.xml +++ b/admin-server/MiaoYu.Shared.Admin/MiaoYu.Shared.Admin.xml @@ -470,6 +470,11 @@ 字段名称
+ + + 字段名称 + + 标题名称 diff --git a/admin-server/MiaoYu.Shared.Admin/Models/PagingViews/PagingView.cs b/admin-server/MiaoYu.Shared.Admin/Models/PagingViews/PagingView.cs index 209c552..739bd9f 100644 --- a/admin-server/MiaoYu.Shared.Admin/Models/PagingViews/PagingView.cs +++ b/admin-server/MiaoYu.Shared.Admin/Models/PagingViews/PagingView.cs @@ -194,6 +194,12 @@ public class PagingView .Where(w => w.EntityName.ToLower() == MainTableEntityType.Name.ToLower()) .FirstOrDefault(); + if (table == null) + { + table = genDbTableDtos? + .Where(w => w.TableName.ToLower() == MainTableEntityType.Name.ToLower()) + .FirstOrDefault(); + } if (table == null) return this; foreach (var column in Columns) diff --git a/admin-server/MiaoYu.Shared.Admin/Models/PagingViews/TableColumnView.cs b/admin-server/MiaoYu.Shared.Admin/Models/PagingViews/TableColumnView.cs index e8f28e8..2a9cc82 100644 --- a/admin-server/MiaoYu.Shared.Admin/Models/PagingViews/TableColumnView.cs +++ b/admin-server/MiaoYu.Shared.Admin/Models/PagingViews/TableColumnView.cs @@ -11,6 +11,7 @@ public class TableColumnView public TableColumnView(string fieldName, string title) { + DataIndex = fieldName; FieldName = fieldName; Title = title; Show = !fieldName.StartsWith("_"); @@ -18,6 +19,7 @@ public class TableColumnView public TableColumnView(string fieldName, string title, int width) { + DataIndex = fieldName; FieldName = fieldName; Title = title; Show = !fieldName.StartsWith("_"); @@ -26,6 +28,7 @@ public class TableColumnView public TableColumnView(string fieldName, string title, bool show, int width) { + DataIndex = fieldName; FieldName = fieldName; Title = title; Show = show; @@ -35,9 +38,14 @@ public class TableColumnView /// /// 字段名称 /// - [JsonProperty("dataIndex")] public string FieldName { get; set; } + /// + /// 字段名称 + /// + [JsonProperty("dataIndex")] + public string DataIndex { get; set; } + /// /// 标题名称 ///