新增过滤重复

optimize
wet 2 years ago
parent 6d070833ad
commit cd44ff1c80

@ -450,7 +450,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
{ {
var list = await _sysCacheService.GetAllMappingYard(); var list = await _sysCacheService.GetAllMappingYard();
var count = list.Where(x => x.Code == dto.Code&&x.Module==dto.Module && x.GID != dto.GID).Count(); var count = list.Where(x => x.Code == dto.Code&&x.Module==dto.Module &&x.MapCode==dto.MapCode && x.GID != dto.GID).Count();
if (count > 0) if (count > 0)
{ {
throw Oops.Bah(ErrorCode.D1006); throw Oops.Bah(ErrorCode.D1006);
@ -562,7 +562,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
public async Task AddOrUpdatePortload([FromBody] MappingPortLoadDto dto) public async Task AddOrUpdatePortload([FromBody] MappingPortLoadDto dto)
{ {
var list = await _sysCacheService.GetAllMappingPortLoad(); var list = await _sysCacheService.GetAllMappingPortLoad();
var count = list.Where(x => x.Code == dto.Code&&x.Module==dto.Module && x.GID != dto.GID).Count(); var count = list.Where(x => x.Code == dto.Code&&x.Module==dto.Module&&x.CarrierCode==dto.CarrierCode && x.GID != dto.GID).Count();
if (count > 0) if (count > 0)
{ {
throw Oops.Bah(ErrorCode.D1006); throw Oops.Bah(ErrorCode.D1006);
@ -676,7 +676,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
public async Task AddOrUpdatePort([FromBody] MappingPortDto dto) public async Task AddOrUpdatePort([FromBody] MappingPortDto dto)
{ {
var list = await _sysCacheService.GetAllMappingPort(); var list = await _sysCacheService.GetAllMappingPort();
var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.GID != dto.GID).Count(); var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module&&x.CarrierCode==dto.CarrierCode && x.GID != dto.GID).Count();
if (count > 0) if (count > 0)
{ {
throw Oops.Bah(ErrorCode.D1006); throw Oops.Bah(ErrorCode.D1006);
@ -779,7 +779,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
public async Task AddOrUpdateMappingPackage([FromBody] MappingPackageDto dto) public async Task AddOrUpdateMappingPackage([FromBody] MappingPackageDto dto)
{ {
var list = await _sysCacheService.GetAllMappingPackage(); var list = await _sysCacheService.GetAllMappingPackage();
var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module &&x.CarrierCode==dto.CarrierCode && x.GID != dto.GID).Count(); var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module &&x.MapCode==dto.MapCode && x.GID != dto.GID).Count();
if (count > 0) if (count > 0)
{ {
throw Oops.Bah(ErrorCode.D1006); throw Oops.Bah(ErrorCode.D1006);
@ -887,7 +887,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
public async Task AddOrUpdateMappingService([FromBody] MappingServiceDto dto) public async Task AddOrUpdateMappingService([FromBody] MappingServiceDto dto)
{ {
var list = await _sysCacheService.GetAllMappingService(); var list = await _sysCacheService.GetAllMappingService();
var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.GID != dto.GID).Count(); var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module&&x.MapCode==dto.MapCode && x.GID != dto.GID).Count();
if (count > 0) if (count > 0)
{ {
throw Oops.Bah(ErrorCode.D1006); throw Oops.Bah(ErrorCode.D1006);
@ -1115,7 +1115,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
public async Task AddOrUpdateMappingFrt([FromBody] MappingFrtDto dto) public async Task AddOrUpdateMappingFrt([FromBody] MappingFrtDto dto)
{ {
var list = await _sysCacheService.GetAllMappingFrt(); var list = await _sysCacheService.GetAllMappingFrt();
var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module&&x.GID!=dto.GID).Count(); var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module&&x.MapCode==dto.MapCode &&x.GID!=dto.GID).Count();
if (count > 0) if (count > 0)
{ {
throw Oops.Bah(ErrorCode.D1006); throw Oops.Bah(ErrorCode.D1006);

Loading…
Cancel
Save