Browse Source

可配置开关

master
mahao 2 years ago
parent
commit
58b7cf6c3b
  1. 1
      host/WmsWebApi.HttpApi.Host/appsettings.json
  2. 8
      src/WmsWebApi.Application/OtherZll/OtherZllService.cs
  3. 15
      src/WmsWebApi.Domain/Options/OtherZllConfigOptions.cs

1
host/WmsWebApi.HttpApi.Host/appsettings.json

@ -28,6 +28,7 @@
},
"CustomConfig": {
"OtherZllConfig": {
"IsEnableErnamFilter": true,
"ErnamFilters": [ "1023", "1024" ]
}
}

8
src/WmsWebApi.Application/OtherZll/OtherZllService.cs

@ -102,11 +102,11 @@ public class OtherZllService : ApplicationService, IOtherZllService
if (_dtoList != null && _dtoList.Count() > 0)
{
//根据配置文件过滤ERNAM
List<string> ernamFilters = _otherZllConfigOptions.ErnamFilters;
if (ernamFilters != null && ernamFilters.Count > 0)
if (_otherZllConfigOptions.IsEnableErnamFilter == true)
{
_dtoList = _dtoList.FindAll(e => !ernamFilters.Contains(e.ERNAM));
//根据配置文件过滤ERNAM
List<string> ernamFilters = _otherZllConfigOptions.ErnamFilters;
_dtoList = _dtoList.FindAll(e => ernamFilters.Contains(e.ERNAM));
}
}

15
src/WmsWebApi.Domain/Options/OtherZllConfigOptions.cs

@ -8,8 +8,21 @@ namespace WmsWebApi.Options
public class OtherZllConfigOptions
{
/// <summary>
/// 创建对象的人员名称过滤
/// 是否启用
/// </summary>
public bool IsEnableErnamFilter { get; set; }
/// <summary>
/// 创建对象的人员名称保留
/// 前置条件 IsEnableErnamFilter == True
/// []都不保留
/// ["1023","1024"]保留1023、1024
/// </summary>
public List<string> ErnamFilters { get; set; }
public OtherZllConfigOptions()
{
ErnamFilters = new List<string>();
}
}
}

Loading…
Cancel
Save