|
@@ -25,7 +25,8 @@ namespace OASystem.Infrastructure.Repositories.Resource
|
|
|
public async Task<Result> LocalGuideOperation(LocalGuideOperationDto dto)
|
|
|
{
|
|
|
var localGuideDat = _mapper.Map<Res_LocalGuideData>(dto);
|
|
|
- localGuideDat.LastUpdate = DateTime.Now;
|
|
|
+ localGuideDat.LastUpdateTime = DateTime.Now;
|
|
|
+ localGuideDat.LastUpdateUserId = dto.CreateUserId;
|
|
|
EncryptionProcessor.EncryptProperties(localGuideDat);
|
|
|
|
|
|
if (dto.Status == 1)//添加
|
|
@@ -62,27 +63,43 @@ namespace OASystem.Infrastructure.Repositories.Resource
|
|
|
{
|
|
|
Result result = new Result() { Code = -2, Msg = "未知错误" };
|
|
|
|
|
|
- var localGuideDatas = await _sqlSugar.Queryable<Res_LocalGuideData>().Where(x => x.IsDel == 0).ToListAsync();
|
|
|
-
|
|
|
string unitName = dto.UnitName, unitArea = dto.UnitArea, contact = dto.Contact, contactTel = dto.ContactTel;
|
|
|
-
|
|
|
int pageSize = dto.PageSize, pageIndex = dto.PageIndex;
|
|
|
|
|
|
+ var localGuideDataSearch = await _sqlSugar
|
|
|
+ .Queryable<Res_LocalGuideData>()
|
|
|
+ .Where(x => x.IsDel == 0)
|
|
|
+ .Select(x => new Res_LocalGuideData()
|
|
|
+ {
|
|
|
+ Id = x.Id,
|
|
|
+ UnitName = x.UnitName,
|
|
|
+ UnitArea = x.UnitArea,
|
|
|
+ Contact = x.Contact,
|
|
|
+ ContactTel = x.ContactTel
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
//处理要查询的字段解密
|
|
|
- foreach (var item in localGuideDatas)
|
|
|
+ foreach (var item in localGuideDataSearch)
|
|
|
{
|
|
|
- if (!string.IsNullOrEmpty(unitName)) AesEncryptionHelper.Decrypt(unitName);
|
|
|
- if (!string.IsNullOrEmpty(unitArea)) AesEncryptionHelper.Decrypt(unitName);
|
|
|
- if (!string.IsNullOrEmpty(contact)) AesEncryptionHelper.Decrypt(unitName);
|
|
|
- if (!string.IsNullOrEmpty(contactTel)) AesEncryptionHelper.Decrypt(unitName);
|
|
|
+ item.UnitName = AesEncryptionHelper.Decrypt(item.UnitName);
|
|
|
+ item.UnitArea = AesEncryptionHelper.Decrypt(item.UnitArea);
|
|
|
+ item.Contact = AesEncryptionHelper.Decrypt(item.Contact);
|
|
|
+ item.ContactTel = AesEncryptionHelper.Decrypt(item.ContactTel);
|
|
|
}
|
|
|
- localGuideDatas = localGuideDatas
|
|
|
- .WhereIF(!string.IsNullOrEmpty(unitName),x => x.UnitName.Contains(unitName))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(unitArea), x => x.UnitArea.Contains(unitArea))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(contact), x => x.Contact.Contains(contact))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(contactTel), x => x.ContactTel.Contains(contactTel))
|
|
|
+ var localGuideIds = localGuideDataSearch
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(unitName), x => !string.IsNullOrEmpty(x.UnitName) && x.UnitName.Contains(unitName))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(unitArea), x => !string.IsNullOrEmpty(x.UnitArea) && x.UnitArea.Contains(unitArea))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(contact), x => !string.IsNullOrEmpty(x.Contact) && x.Contact.Contains(contact))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(contactTel), x => !string.IsNullOrEmpty(x.ContactTel) && x.ContactTel.Contains(contactTel))
|
|
|
+ .Select(x => x.Id)
|
|
|
.ToList();
|
|
|
|
|
|
+ var localGuideDataInfos = await _sqlSugar
|
|
|
+ .Queryable<Res_LocalGuideData>()
|
|
|
+ .WhereIF(localGuideIds.Any(), x => localGuideIds.Contains(x.Id))
|
|
|
+ .ToListAsync();
|
|
|
+ var localGuideDatas = _mapper.Map<List<LocalGuideDataView>>(localGuideDataInfos);
|
|
|
if (dto.PortType == 1 || dto.PortType == 2)
|
|
|
{
|
|
|
if (localGuideDatas.Count == 0)
|