轨迹标记添加选中

This commit is contained in:
moyongzhen 2024-03-01 17:53:15 +08:00
parent e3a8a94e1e
commit d8065bb9d1
8 changed files with 56 additions and 11 deletions

View File

@ -11,6 +11,11 @@
/// 关键字
/// </summary>
public string? Keywords { get; set; }
/// <summary>
/// 选中的轨迹内容id
/// </summary>
public List<int>? SelectIds { get; set; }
}
public class GetTrackContentListDto

View File

@ -7,6 +7,9 @@
"TemplateExist": "The template code already exists under the currently selected subsystem",
"TrackContentExist": "The trace code or trace content or trace content in the current subsystem is repeated in English",
"TrackStatusExist": "The trajectory status code or trajectory status or trajectory status in English is repeated under the current subsystem",
"TrackFlagExist": "Duplicate code or flag in the current subsystem"
"TrackFlagExist": "Duplicate code or flag in the current subsystem",
"IsExistTrackPullConfig": "Track Pull The template has been bound. Delete the track pull before deleting the template",
"IsExistTrackStatus": "The trajectory content has been bound to the trajectory status. Delete the trajectory content before deleting the trajectory status",
"IsExistTrackFlag": "The track content has been bound to the track mark. Delete the track content before deleting the track mark"
}
}

View File

@ -7,6 +7,9 @@
"TemplateExist": "模板代码已存在于当前选择的子系统下",
"TrackContentExist": "当前子系统下轨迹代码或轨迹内容或轨迹内容英文重复",
"TrackStatusExist": "当前子系统下轨迹状态代码或轨迹状态或轨迹状态英文重复",
"TrackFlagExist": "当前子系统下代码或标记重复"
"TrackFlagExist": "当前子系统下代码或标记重复",
"IsExistTrackPullConfig": "轨迹拉取已绑定了该模版,请先删除轨迹拉取再删除该模版",
"IsExistTrackStatus": "轨迹内容已经绑定了该轨迹状态,请先删除轨迹内容后再删除该轨迹状态",
"IsExistTrackFlag": "轨迹内容已经绑定了该轨迹标记,请先删除轨迹内容后再删除该轨迹标记"
}
}

View File

@ -1,6 +1,7 @@
using Microsoft.Extensions.Localization;
using SJZY.Track.Application.Contract.Dtos.TrackFlags;
using SJZY.Track.Application.Localization;
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
using SJZY.Track.Domain.Aggregates.TrackFlagAggregate;
using SJZY.Track.Domain.Dtos.TrackFlags;
using Volo.Abp.DependencyInjection;
@ -16,14 +17,17 @@ namespace SJZY.Track.Application.Services.TrackFlags
{
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
private readonly ITrackFlagRepository _trackFlagRepository;
private readonly ITrackContentRepository _trackContentRepository;
public TrackFlagService(
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
ITrackFlagRepository trackFlagRepository
ITrackFlagRepository trackFlagRepository,
ITrackContentRepository trackContentRepository
)
{
this._stringLocalizer = stringLocalizer;
this._trackFlagRepository = trackFlagRepository;
this._trackContentRepository=trackContentRepository;
}
/// <summary>
@ -121,6 +125,13 @@ namespace SJZY.Track.Application.Services.TrackFlags
private async Task<UnifyResultDto> DeleteAsync(EditTrackFlagInput input)
{
#region 业务校验
var isExistContent = await _trackContentRepository.GetFirstAsync(a => a.TrackFlagId==input.Id);
if (isExistContent!=null)
{
throw new BusinessException(message: _stringLocalizer["IsExistTrackFlag"]);
}
#endregion
var isTrue = await _trackFlagRepository.SoftDeleteAsync(x => x.Id == input.Id);
return new UnifyResultDto("200", "删除成功", isTrue);

View File

@ -1,6 +1,7 @@
using Microsoft.Extensions.Localization;
using SJZY.Track.Application.Contract.Dtos.TrackStatus;
using SJZY.Track.Application.Localization;
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
using SJZY.Track.Domain.Dtos.TrackStatus;
using Volo.Abp.DependencyInjection;
@ -16,14 +17,17 @@ public class TrackStatusService : ApplicationService, ITransientDependency
{
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
private readonly ITrackStatusRepository _trackStatusRepository;
private readonly ITrackContentRepository _trackContentRepository;
public TrackStatusService(
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
ITrackStatusRepository trackStatusRepository
ITrackStatusRepository trackStatusRepository,
ITrackContentRepository trackContentRepository
)
{
this._stringLocalizer = stringLocalizer;
this._trackStatusRepository = trackStatusRepository;
this._trackContentRepository=trackContentRepository;
}
/// <summary>
@ -122,6 +126,13 @@ public class TrackStatusService : ApplicationService, ITransientDependency
private async Task<UnifyResultDto> DeleteAsync(EditTrackStatusInput input)
{
#region 业务校验
var isExistStatus = await _trackContentRepository.GetFirstAsync(a => a.TrackStatusId==input.Id);
if (isExistStatus!=null)
{
throw new BusinessException(message: _stringLocalizer["IsExistTrackStatus"]);
}
#endregion
var isTrue = await _trackStatusRepository.SoftDeleteAsync(x => x.Id == input.Id);
return new UnifyResultDto("200", "删除成功", isTrue);

View File

@ -3,6 +3,7 @@ using Microsoft.Extensions.Localization;
using SJZY.Expand.ABP.Core.Localization;
using SJZY.Track.Application.Contract.Dtos.TrackTemplates;
using SJZY.Track.Application.Localization;
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
using SJZY.Track.Domain.Dtos.TrackTemplate;
using Volo.Abp.DependencyInjection;
@ -18,14 +19,18 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
{
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
private readonly ITrackTemplateRepository _trackTemplateRepository;
private readonly ITrackPullConfigRepository _trackPullConfigRepository;
/// <inheritdoc/>
public TrackTemplateService(
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
ITrackTemplateRepository trackTemplateRepository)
ITrackTemplateRepository trackTemplateRepository,
ITrackPullConfigRepository trackPullConfigRepository
)
{
_stringLocalizer = stringLocalizer;
_trackTemplateRepository = trackTemplateRepository;
_trackPullConfigRepository=trackPullConfigRepository;
}
/// <summary>
@ -105,14 +110,12 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
private async Task<UnifyResultDto> UpdateAsync(EditTrackTemplateInput input)
{
#region 业务校验
var isExist = await _trackTemplateRepository.GetFirstAsync(a =>
a.Id != input.Id && a.SubSystemId == input.SubSystemId && a.Code == input.Code);
if (isExist != null)
{
throw new BusinessException(message: _stringLocalizer["TemplateExist"]);
}
#endregion
var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.Id == input.Id);
@ -125,9 +128,12 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
private async Task<UnifyResultDto> DeleteAsync(EditTrackTemplateInput input)
{
#region 业务校验
//到时候,得判断这个模版有没有在轨迹映射里面被使用过,如果被使用就抛出提示
//查询看看在轨迹拉取里面有没有被占用
var isExisistTrackPullConfig = await _trackPullConfigRepository.GetFirstAsync(a => a.TrackTemplateId==input.Id);
if (isExisistTrackPullConfig!=null)
{
throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]);
}
#endregion
var isTrue = await _trackTemplateRepository.SoftDeleteAsync(x => x.Id == input.Id);

View File

@ -17,6 +17,11 @@ namespace SJZY.Track.Domain.Dtos.TrackContents
/// 关键字
/// </summary>
public string? Keywords { get; set; }
/// <summary>
/// 选中的轨迹内容id
/// </summary>
public List<int>? SelectIds { get; set; }
}
public class GetTrackContentListVO

View File

@ -62,7 +62,8 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
(a, b, c, d, e, f) => a.Code.Contains(input.Keywords) || a.Content.Contains(input.Keywords)
|| a.EnContent.Contains(input.Keywords)
)
.OrderByDescending((a, b, c, d, e, f) => a.CreateTime)
.OrderByIF(input.SelectIds.IsNullOrEmpty(), (a, b, c, d, e, f) => a.CreateTime, OrderByType.Desc)
.OrderByIF(!input.SelectIds.IsNullOrEmpty(), (a, b, c, d, e, f) => SqlFunc.IIF(input.SelectIds.Contains(a.Id), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc)
.Select((a, b, c, d, e, f) => new GetTrackContentListVO
{
Id = a.Id,