From b27ccd121ce173af9734dcbe57b4d3b308fbddb8 Mon Sep 17 00:00:00 2001 From: zpc Date: Fri, 8 Aug 2025 17:28:12 +0800 Subject: [PATCH] 333 --- .../Controllers/CommonController.cs | 59 ------------------- 1 file changed, 59 deletions(-) diff --git a/ZR.Admin.WebApi/Controllers/CommonController.cs b/ZR.Admin.WebApi/Controllers/CommonController.cs index cd3a304..ede239c 100644 --- a/ZR.Admin.WebApi/Controllers/CommonController.cs +++ b/ZR.Admin.WebApi/Controllers/CommonController.cs @@ -202,64 +202,5 @@ namespace ZR.Admin.WebApi.Controllers return DownFile(fullPath, fileName); } - /// - /// 初始化种子数据 - /// - /// 是否清空数据 - /// - [HttpGet] - [AllowAnonymous] - [ActionPermissionFilter(Permission = "common")] - [Log(BusinessType = BusinessType.INSERT, Title = "初始化数据")] - public IActionResult InitSeedData(bool clean = false) - { - if (!WebHostEnvironment.IsDevelopment()) - { - return ToResponse(ResultCode.CUSTOM_ERROR, "导入数据失败,请在开发模式下初始化"); - } - var path = Path.Combine(WebHostEnvironment.WebRootPath, "data.xlsx"); - SeedDataService seedDataService = new(); - var result = seedDataService.InitSeedData(path, clean); - Console.ForegroundColor = ConsoleColor.Red; - foreach (var item in result) - { - Console.WriteLine(item); - } - Console.ForegroundColor = ConsoleColor.White; - return SUCCESS(new - { - result - }); - } - - /// - /// - /// - /// - [HttpGet] - [AllowAnonymous] - [ActionPermissionFilter(Permission = "common")] - [Log(BusinessType = BusinessType.INSERT, Title = "初始化数据")] - public IActionResult UpdateSeedData() - { - if (!WebHostEnvironment.IsDevelopment()) - { - return ToResponse(ResultCode.CUSTOM_ERROR, "导入数据失败,请在开发模式下初始化"); - } - var path = Path.Combine(WebHostEnvironment.WebRootPath, "data.xlsx"); - SeedDataService seedDataService = new(); - - var sysNotice = MiniExcel.Query(path, sheetName: "notice").ToList(); - var result = seedDataService.InitNoticeData(sysNotice); - - var sysMenu = MiniExcel.Query(path, sheetName: "menu").Where(f => f.MenuId >= 1104).ToList(); - var result5 = seedDataService.InitMenuData(sysMenu); - - return SUCCESS(new - { - result, - result5 - }); - } } }