From 393c6a8e5474f88589f7eb1f517aefa93ce98deb Mon Sep 17 00:00:00 2001
From: moyongzhen <2534173414@qq.com>
Date: Tue, 27 Feb 2024 20:26:54 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A8=A1=E7=89=88?=
=?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=B7=BB=E5=8A=A0=E6=A8=A1=E7=89=88id?=
=?UTF-8?q?=E6=9F=A5=E8=AF=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../GetPageTrackTemplateInput.cs | 5 ++
.../SJZY.Track.Domain.csproj | 1 +
.../Dtos/GetPageTrackTemplateVO.cs | 10 +++
.../TrackTemplateRepository.cs | 61 +++++++++++++++----
4 files changed, 65 insertions(+), 12 deletions(-)
diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs
index 1c98499d..357784df 100644
--- a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs
+++ b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs
@@ -14,5 +14,10 @@
/// 关键字
///
public string Keywords { get; set; }
+
+ ///
+ /// 轨迹模版id,轨迹映射的查询使用
+ ///
+ public int TrackTemplateId { get; set; }
}
}
diff --git a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj
index 43e82900..69cf9fb3 100644
--- a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj
+++ b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj
@@ -17,6 +17,7 @@
+
diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs
index 326a7d0c..c0c26bfe 100644
--- a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs
+++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs
@@ -11,4 +11,14 @@ public class GetPageTrackTemplateVO : PageInfoInput
/// 关键字
///
public string Keywords { get; set; }
+
+ /////
+ ///// 是否置顶
+ /////
+ //public bool IsTop { get; set; }=false;
+
+ ///
+ /// 轨迹模版id
+ ///
+ public int TrackTemplateId { get; set; }
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs
index 19308200..71f0ade8 100644
--- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs
+++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs
@@ -1,4 +1,5 @@
-using SJZY.Expand.ABP.Core.PublicMethords;
+using SJZY.Expand.ABP.Core.Common.Dto;
+using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.Track.Domain.TrackContentAggregate;
using SJZY.Track.Domain.TrackFlagAggregate;
using SJZY.Track.Domain.TrackStatusAggregate;
@@ -45,18 +46,54 @@ public class TrackTemplateRepository : BasicRepository, ITr
///
public async Task> GetPageTrackTemplate(GetPageTrackTemplateVO input)
{
- var pagedList = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId == b.Id)
- .WhereIF(input.SubSystemId > 0, (a, b) => a.SubSystemId == input.SubSystemId)
- .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (a, b) => a.Name.Contains(input.Keywords) || a.Code.Contains(input.Keywords))
- .Select((a, b) => new GetTrackTemplateListVO
+ UnifyPageResultDto pagedList = new UnifyPageResultDto();
+ pagedList = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId == b.Id)
+ .WhereIF(input.SubSystemId > 0, (a, b) => a.SubSystemId == input.SubSystemId)
+ .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (a, b) => a.Name.Contains(input.Keywords) || a.Code.Contains(input.Keywords))
+ .Select((a, b) => new GetTrackTemplateListVO
+ {
+ Id = a.Id,
+ Code = a.Code,
+ CreateTime = a.CreateTime,
+ Name = a.Name,
+ SubSystem = b.CnName
+ })
+ .ToPagedListAsync(input.PageIndex, input.PageSize);
+ //如果轨迹模版id传值了,就置顶在第一条
+ if (input.TrackTemplateId>0&& (!pagedList.List.IsNullOrEmpty()))
+ {
+ if (input.PageIndex==1)
{
- Id = a.Id,
- Code = a.Code,
- CreateTime = a.CreateTime,
- Name = a.Name,
- SubSystem = b.CnName
- })
- .ToPagedListAsync(input.PageIndex, input.PageSize);
+ bool existCurrent = pagedList.List.Any(x => x.Id==input.TrackTemplateId);
+ if (existCurrent)
+ {
+ var item = pagedList.List.FirstOrDefault(x => x.Id==input.TrackTemplateId);
+ pagedList.List.Remove(item);
+ pagedList.List.Insert(0, item);
+ }
+ else
+ {
+ var item = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId == b.Id)
+ .Where((a, b) => a.Id==input.TrackTemplateId)
+ .Select((a, b) => new GetTrackTemplateListVO
+ {
+ Id = a.Id,
+ Code = a.Code,
+ CreateTime = a.CreateTime,
+ Name = a.Name,
+ SubSystem = b.CnName
+ })
+ .FirstAsync();
+ if (item!=null)
+ {
+ var removeItem = pagedList.List.LastOrDefault();
+ pagedList.List.Remove(removeItem);
+ pagedList.List.Insert(0, item);
+ }
+ }
+ }
+ }
+
return pagedList;
}
From 31951cd0b14a22f542c8ffbe2c11966d5ecf7498 Mon Sep 17 00:00:00 2001
From: moyongzhen <2534173414@qq.com>
Date: Tue, 27 Feb 2024 20:52:04 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E7=8A=B6=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Services/TrackStatus/TrackStatusService.cs | 13 +++++++++++++
.../Services/TrackTemplates/TrackTemplateService.cs | 2 +-
.../TrackStatusAggregate/ITrackStatusRepository.cs | 1 +
src/SJZY.Track.Repository/TrackStatusRepository.cs | 5 +++++
4 files changed, 20 insertions(+), 1 deletion(-)
create mode 100644 src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs
diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs
new file mode 100644
index 00000000..938837c7
--- /dev/null
+++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SJZY.Track.Application.Services.TrackStatus
+{
+ public class TrackStatusService
+ {
+
+ }
+}
diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs
index d0920499..0dfe71fa 100644
--- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs
+++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs
@@ -12,7 +12,7 @@ namespace SJZY.Track.Application.Services.TrackTemplates;
///
[ApiExplorerSettings(GroupName = "轨迹模版")]
[Route("/Track/Template")]
-public class TrackTemplateService : ApplicationService, ITrackTemplateService, IScopedDependency
+public class TrackTemplateService : ApplicationService, ITransientDependency
{
private readonly IStringLocalizer _stringLocalizer;
private readonly ITrackTemplateRepository _trackTemplateRepository;
diff --git a/src/SJZY.Track.Domain/TrackStatusAggregate/ITrackStatusRepository.cs b/src/SJZY.Track.Domain/TrackStatusAggregate/ITrackStatusRepository.cs
index bdb5a17d..34cb832b 100644
--- a/src/SJZY.Track.Domain/TrackStatusAggregate/ITrackStatusRepository.cs
+++ b/src/SJZY.Track.Domain/TrackStatusAggregate/ITrackStatusRepository.cs
@@ -2,4 +2,5 @@
public interface ITrackStatusRepository : IBasicRepository
{
+
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Repository/TrackStatusRepository.cs b/src/SJZY.Track.Repository/TrackStatusRepository.cs
index 6ac8f9cc..bb13b376 100644
--- a/src/SJZY.Track.Repository/TrackStatusRepository.cs
+++ b/src/SJZY.Track.Repository/TrackStatusRepository.cs
@@ -4,4 +4,9 @@ namespace SJZY.Track.Repository;
public class TrackStatusRepository : BasicRepository, ITrackStatusRepository, IScopedDependency
{
+ public TrackStatusRepository()
+ {
+ }
+
+
}
\ No newline at end of file