!15 字典和参数

Merge pull request !15 from luning1214/net7.0
This commit is contained in:
字母搬运工 2022-12-24 10:48:53 +00:00 committed by Gitee
commit 8b8fc3975b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 14 additions and 1 deletions

View File

@ -150,7 +150,8 @@ namespace ZR.Admin.WebApi.Controllers
{ {
int[] idsArr = Tools.SpitIntArrary(ids); int[] idsArr = Tools.SpitIntArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } 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); var response = _SysConfigService.Delete(idsArr);
return SUCCESS(response); return SUCCESS(response);

View File

@ -3,6 +3,7 @@ using Infrastructure.Enums;
using Infrastructure.Model; using Infrastructure.Model;
using Mapster; using Mapster;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Org.BouncyCastle.Crypto;
using System; using System;
using ZR.Admin.WebApi.Extensions; using ZR.Admin.WebApi.Extensions;
using ZR.Admin.WebApi.Filters; using ZR.Admin.WebApi.Filters;

View File

@ -27,6 +27,14 @@ namespace ZR.Admin.WebApi.Extensions
{ {
types.GetProperty("Create_by")?.SetValue(source, context.GetName(), null); 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) if (types.GetProperty("UserId") != null && context != null)
{ {
types.GetProperty("UserId")?.SetValue(source, context.GetUId(), null); types.GetProperty("UserId")?.SetValue(source, context.GetUId(), null);

View File

@ -3,6 +3,7 @@ using Infrastructure.Attribute;
using SqlSugar; using SqlSugar;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using ZR.Model; using ZR.Model;
using ZR.Model.System; using ZR.Model.System;
using ZR.Service.System.IService; using ZR.Service.System.IService;
@ -65,6 +66,8 @@ namespace ZR.Service.System
/// <returns></returns> /// <returns></returns>
public int DeleteDictTypeByIds(long[] dictIds) 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) foreach (var dictId in dictIds)
{ {
SysDictType dictType = GetFirst(x => x.DictId == dictId); SysDictType dictType = GetFirst(x => x.DictId == dictId);