公共库sort

optimize
wet 2 years ago
parent 67e282da05
commit ab8a92db6e

@ -822,7 +822,7 @@ namespace Myshipping.Application
[HttpGet("/BookingOrder/GetFile")] [HttpGet("/BookingOrder/GetFile")]
public async Task<List<BookingFile>> GetFile(long Id) public async Task<List<BookingFile>> GetFile(long Id)
{ {
var list = await _bookingfile.AsQueryable().Where(u => u.BookingId == Id).ToListAsync(); var list = await _bookingfile.AsQueryable().Filter(null, true).Where(u => u.BookingId == Id).ToListAsync();
return list; return list;
} }
@ -834,7 +834,7 @@ namespace Myshipping.Application
public async Task<List<BookingStatusLogDto>> GetBookingStatusLog(long Id) public async Task<List<BookingStatusLogDto>> GetBookingStatusLog(long Id)
{ {
var statuslog = await _repStatuslog.AsQueryable().Where(x => x.BookingId == Id).ToListAsync(); var statuslog = await _repStatuslog.AsQueryable().Filter(null, true).Where(x => x.BookingId == Id).ToListAsync();
var dto = statuslog.Adapt<List<BookingStatusLogDto>>(); var dto = statuslog.Adapt<List<BookingStatusLogDto>>();
foreach (var item in dto) foreach (var item in dto)
{ {
@ -852,7 +852,7 @@ namespace Myshipping.Application
public async Task<List<BookingStatus>> GetBookingStatus(long Id) public async Task<List<BookingStatus>> GetBookingStatus(long Id)
{ {
var dto = await _repBookingStatus.AsQueryable().Where(x => x.BookingId == Id).ToListAsync(); var dto = await _repBookingStatus.AsQueryable().Filter(null, true).Where(x => x.BookingId == Id).ToListAsync();
return dto; return dto;
} }

@ -219,7 +219,6 @@ namespace Myshipping.Application
throw Oops.Bah("请传入正确参数"); throw Oops.Bah("请传入正确参数");
} }
var excelwork = new HSSFWorkbook(); var excelwork = new HSSFWorkbook();
var sheet = excelwork.CreateSheet("订舱台账"); var sheet = excelwork.CreateSheet("订舱台账");
sheet.ForceFormulaRecalculation = true; sheet.ForceFormulaRecalculation = true;
@ -230,21 +229,23 @@ namespace Myshipping.Application
for (int _row = 0; _row < entity.Max(x => x.Row); _row++) for (int _row = 0; _row < entity.Max(x => x.Row); _row++)
{ {
if (entity.Where(x => x.Row == (_row + 1)).Count() > 0) if (entity.Where(x => x.Row == (_row + 1)).Count() > 0)
{ {
///创建行 ///创建行
var row = NpoiExcelExportHelper._.CreateRow(sheet, _row, 25); var row = NpoiExcelExportHelper._.CreateRow(sheet, _row, 25);
for (int _cellNum = 0; _cellNum < entity.Max(x => x.Column); _cellNum++) for (int _cellNum = 0; _cellNum < entity.Max(x => x.Column); _cellNum++)
{ {
if (entity.Where(x=>x.Row==_row+1&&x.Column==_cellNum+1).Count()>0) { if (entity.Where(x => x.Row == _row + 1 && x.Column == _cellNum + 1).Count() > 0)
{
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(order)) foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(order))
{ {
var name = entity.Where(x => x.Row == _row + 1 && x.Column == _cellNum + 1).Select(x => x.Field).FirstOrDefault(); var name = entity.Where(x => x.Row == _row + 1 && x.Column == _cellNum + 1).Select(x => x.Field).FirstOrDefault();
var _name = descriptor.Name.ToLower(); var _name = descriptor.Name.ToLower();
if (name == _name) { if (name == _name)
var value = descriptor.GetValue(order).ToString(); {
var cell=NpoiExcelExportHelper._.CreateCells(row, cellStyle, _cellNum+1, value); var value = descriptor.GetValue(order).ToString();
var cell = NpoiExcelExportHelper._.CreateCells(row, cellStyle, _cellNum + 1, value);
} }
} }
} }
@ -259,16 +260,10 @@ namespace Myshipping.Application
} }
var fileName = string.Format("订舱{0}.xls", DateTime.Now.Ticks); var fileName = string.Format("订舱{0}.xls", DateTime.Now.Ticks);
_logger.LogInformation("导出excel:" + Path.Combine(fileFullPath, fileName)); _logger.LogInformation("导出excel:" + Path.Combine(fileFullPath, fileName));
var filestream = new FileStream(Path.Combine(fileFullPath ,fileName), FileMode.OpenOrCreate, FileAccess.ReadWrite); var filestream = new FileStream(Path.Combine(fileFullPath, fileName), FileMode.OpenOrCreate, FileAccess.ReadWrite);
excelwork.Write(filestream); excelwork.Write(filestream);
var result = new FileStreamResult(new FileStream(Path.Combine(fileFullPath, fileName), FileMode.Open), "application/octet-stream") { FileDownloadName = fileName }; //var result = new FileStreamResult(new FileStream(Path.Combine(fileFullPath, fileName), FileMode.Open), "application/octet-stream") { FileDownloadName = fileName };
return result; return fileName;
} }
} }
} }

@ -7674,6 +7674,11 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeCarrierDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeCountryDto.GID"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeCountryDto.GID">
<summary> <summary>
主键 主键
@ -7714,6 +7719,11 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeCountryDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeCtnDto.GID"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeCtnDto.GID">
<summary> <summary>
主键 主键
@ -7754,6 +7764,11 @@
大小箱分类small-小箱 big-大箱) 大小箱分类small-小箱 big-大箱)
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeCtnDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeForwarderDto.Code"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeForwarderDto.Code">
<summary> <summary>
代码 代码
@ -7774,6 +7789,11 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeForwarderDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeFrtDto.Code"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeFrtDto.Code">
<summary> <summary>
代码 代码
@ -7799,6 +7819,11 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeFrtDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeIssueTypeDto.Code"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeIssueTypeDto.Code">
<summary> <summary>
代码 代码
@ -7864,6 +7889,11 @@
描述 描述
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeLaneDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodePackageDto.Code"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.CodePackageDto.Code">
<summary> <summary>
代码 代码
@ -7889,6 +7919,11 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodePackageDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodePortDto.Code"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.CodePortDto.Code">
<summary> <summary>
代码 代码
@ -7939,6 +7974,11 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodePortDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodePortLoadDto.Code"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.CodePortLoadDto.Code">
<summary> <summary>
代码 代码
@ -7969,6 +8009,11 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodePortLoadDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeServiceDto.Code"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeServiceDto.Code">
<summary> <summary>
代码 代码
@ -7994,6 +8039,11 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeServiceDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeVesselDto.Name"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeVesselDto.Name">
<summary> <summary>
名称 名称
@ -8014,6 +8064,11 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeVesselDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeYardDto.Code"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeYardDto.Code">
<summary> <summary>
代码 代码
@ -8034,6 +8089,11 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeYardDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingCarrierDto.GID"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingCarrierDto.GID">
<summary> <summary>
业务id 业务id
@ -8064,6 +8124,11 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingCarrierDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingCtnDto.GID"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingCtnDto.GID">
<summary> <summary>
业务id 业务id
@ -8099,6 +8164,11 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingCtnDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingFrtDto.GID"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingFrtDto.GID">
<summary> <summary>
业务id 业务id
@ -8134,6 +8204,11 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingFrtDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingServiceDto.GID"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingServiceDto.GID">
<summary> <summary>
业务id 业务id
@ -8169,6 +8244,11 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingServiceDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingPortDto.GID"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingPortDto.GID">
<summary> <summary>
业务id 业务id
@ -8204,6 +8284,11 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingPortDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingPortLoadDto.GID"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingPortLoadDto.GID">
<summary> <summary>
业务id 业务id
@ -8239,6 +8324,11 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingPortLoadDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingPackageDto.GID"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingPackageDto.GID">
<summary> <summary>
业务id 业务id
@ -8274,6 +8364,11 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingPackageDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingVesselDto.Name"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingVesselDto.Name">
<summary> <summary>
名称 名称
@ -8294,6 +8389,11 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingVesselDto.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingYardDto.GID"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingYardDto.GID">
<summary> <summary>
业务id 业务id
@ -8324,6 +8424,11 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.MappingYardDto.Sort">
<summary>
排序
</summary>
</member>
<member name="T:Myshipping.Core.Service.CommonDB.Dto.RelaPortCarrierLaneDto"> <member name="T:Myshipping.Core.Service.CommonDB.Dto.RelaPortCarrierLaneDto">
<summary> <summary>
航线与港口的的关系表 航线与港口的的关系表

@ -1607,13 +1607,13 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_CTN)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_CTN))
{ {
var list = await _codeCtnRep.AsQueryable().OrderBy(x => x.Name).ToListAsync(); var list = await _codeCtnRep.AsQueryable().OrderBy(x => x.Sort).ToListAsync();
await _sysCacheService.SetAllCodeCtn(list); await _sysCacheService.SetAllCodeCtn(list);
} }
} }
else else
{ {
var list = await _codeCtnRep.AsQueryable().OrderBy(x => x.Name).ToListAsync(); var list = await _codeCtnRep.AsQueryable().OrderBy(x => x.Sort).ToListAsync();
await _sysCacheService.SetAllCodeCtn(list); await _sysCacheService.SetAllCodeCtn(list);
} }

@ -39,8 +39,10 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

@ -46,5 +46,9 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

@ -48,6 +48,9 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// </summary> /// </summary>
public string CtnCategory { get; set; } public string CtnCategory { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

@ -30,7 +30,10 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

@ -34,7 +34,10 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

@ -39,5 +39,9 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// 描述 /// 描述
/// </summary> /// </summary>
public string Description { get; set; } public string Description { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

@ -34,7 +34,10 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

@ -59,7 +59,10 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }

@ -39,5 +39,9 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

@ -34,6 +34,9 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

@ -29,8 +29,11 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

@ -28,6 +28,9 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

@ -37,6 +37,9 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

@ -41,6 +41,9 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

@ -41,5 +41,9 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

@ -41,5 +41,9 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

@ -41,5 +41,9 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

@ -42,5 +42,9 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

@ -41,5 +41,9 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

@ -28,6 +28,10 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

@ -36,6 +36,10 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }

Loading…
Cancel
Save