diff --git a/ZR.Admin.WebApi/Controllers/System/SysConfigController.cs b/ZR.Admin.WebApi/Controllers/System/SysConfigController.cs index b50c99a..ec7734a 100644 --- a/ZR.Admin.WebApi/Controllers/System/SysConfigController.cs +++ b/ZR.Admin.WebApi/Controllers/System/SysConfigController.cs @@ -150,7 +150,8 @@ namespace ZR.Admin.WebApi.Controllers { int[] idsArr = Tools.SpitIntArrary(ids); if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } - + int sysCount = _SysConfigService.Count(s => s.ConfigType == "Y" && idsArr.Contains(s.ConfigId)); + if (sysCount > 0) { return ToResponse(ApiResult.Error($"删除失败Id: 系统内置参数不能删除!")); } var response = _SysConfigService.Delete(idsArr); return SUCCESS(response); diff --git a/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs b/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs index f70cb3c..f2e199f 100644 --- a/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs +++ b/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs @@ -3,6 +3,7 @@ using Infrastructure.Enums; using Infrastructure.Model; using Mapster; using Microsoft.AspNetCore.Mvc; +using Org.BouncyCastle.Crypto; using System; using ZR.Admin.WebApi.Extensions; using ZR.Admin.WebApi.Filters; diff --git a/ZR.Admin.WebApi/Extensions/EntityExtension.cs b/ZR.Admin.WebApi/Extensions/EntityExtension.cs index 81bb60d..044deb7 100644 --- a/ZR.Admin.WebApi/Extensions/EntityExtension.cs +++ b/ZR.Admin.WebApi/Extensions/EntityExtension.cs @@ -27,6 +27,14 @@ namespace ZR.Admin.WebApi.Extensions { types.GetProperty("Create_by")?.SetValue(source, context.GetName(), null); } + if (types.GetProperty("Create_By") != null && context != null) + { + types.GetProperty("Create_By")?.SetValue(source, context.GetName(), null); + } + if (types.GetProperty("CreateBy") != null && context != null) + { + types.GetProperty("CreateBy")?.SetValue(source, context.GetName(), null); + } if (types.GetProperty("UserId") != null && context != null) { types.GetProperty("UserId")?.SetValue(source, context.GetUId(), null); diff --git a/ZR.Service/System/IService/ISysDictService.cs b/ZR.Service/System/IService/ISysDictService.cs index 331d5f7..a6b3232 100644 --- a/ZR.Service/System/IService/ISysDictService.cs +++ b/ZR.Service/System/IService/ISysDictService.cs @@ -8,7 +8,7 @@ namespace ZR.Service.System.IService /// /// /// - public interface ISysDictService + public interface ISysDictService: IBaseService { public List GetAll(); public PagedInfo SelectDictTypeList(SysDictType dictType, Model.PagerInfo pager); diff --git a/ZR.Service/System/SysDictService.cs b/ZR.Service/System/SysDictService.cs index f3ae943..53e7785 100644 --- a/ZR.Service/System/SysDictService.cs +++ b/ZR.Service/System/SysDictService.cs @@ -3,6 +3,7 @@ using Infrastructure.Attribute; using SqlSugar; using System; using System.Collections.Generic; +using System.Linq; using ZR.Model; using ZR.Model.System; using ZR.Service.System.IService; @@ -65,6 +66,8 @@ namespace ZR.Service.System /// public int DeleteDictTypeByIds(long[] dictIds) { + int sysCount = Count(s => s.Type == "Y" && dictIds.Contains(s.DictId)); + if (sysCount > 0) { throw new CustomException($"删除失败Id: 系统内置参数不能删除!"); } foreach (var dictId in dictIds) { SysDictType dictType = GetFirst(x => x.DictId == dictId);