change:轨迹内容有多个轨迹标记
This commit is contained in:
parent
8942fddc55
commit
ba868dc168
@ -93,10 +93,10 @@ public class GetTrackContentDetailDto
|
||||
/// <summary>
|
||||
/// 轨迹标记id
|
||||
/// </summary>
|
||||
public int? TrackFlagId { get; set; }
|
||||
public string? TrackFlagId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹标记
|
||||
/// 轨迹标记ids
|
||||
/// </summary>
|
||||
public string TrackFlag { get; set; }
|
||||
public List<string>? TrackFlagIds { get; set; }
|
||||
}
|
||||
|
||||
@ -60,7 +60,6 @@ public class TrackContentService : ApplicationService
|
||||
|
||||
var dto = ObjectMapper.Map<GetTrackContentDetailVO, GetTrackContentDetailDto>(detailInfo);
|
||||
|
||||
if (dto.TrackFlagId == 0) dto.TrackFlagId = null;
|
||||
return new UnifyResultDto<GetTrackContentDetailDto>(GlobalConst.SuccessCode, "", dto);
|
||||
}
|
||||
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
using Microsoft.Extensions.Localization;
|
||||
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 SqlSugar;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
|
||||
namespace SJZY.Track.Application.Services.TrackFlags;
|
||||
@ -152,7 +153,8 @@ public class TrackFlagService : ApplicationService, ITransientDependency
|
||||
{
|
||||
#region 业务校验
|
||||
|
||||
var isExistContent = await _trackContentRepository.GetFirstAsync(a => a.TrackFlagId == input.Id);
|
||||
var isExistContent =
|
||||
await _trackContentRepository.GetFirstAsync(a => SqlFunc.SplitIn(a.TrackFlagId, input.Id.ToString()));
|
||||
if (isExistContent != null)
|
||||
{
|
||||
//throw new BusinessException(message: _stringLocalizer["IsExistTrackFlag"]);
|
||||
|
||||
@ -37,10 +37,10 @@ public class TrackContentEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
||||
public int SubSystemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹标记id
|
||||
/// 轨迹标记id,多个逗号分隔
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "TrackFlagId")]
|
||||
public int TrackFlagId { get; set; }
|
||||
public string TrackFlagId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属轨迹状态id
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackFlagAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackFlagAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹标记表
|
||||
@ -30,9 +30,9 @@ public class TrackFlagEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
||||
[SugarColumn(ColumnName = "SubSystemId")]
|
||||
public int SubSystemId { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 是否完结
|
||||
///// </summary>
|
||||
//[SugarColumn(ColumnName = "IsCompleted")]
|
||||
//public bool IsCompleted { get; set; }
|
||||
/// <summary>
|
||||
/// 是否广播
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "IsCompleted")]
|
||||
public bool IsToMq { get; set; }
|
||||
}
|
||||
|
||||
@ -47,4 +47,10 @@ public class TrackStatusEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "IsCompleted")]
|
||||
public bool IsCompleted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否广播
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "IsCompleted")]
|
||||
public bool IsToMq { get; set; }
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
namespace SJZY.Track.Domain.Dtos.TrackContents;
|
||||
namespace SJZY.Track.Domain.Dtos.TrackContents;
|
||||
|
||||
public class GetTrackContentDetailVO
|
||||
{
|
||||
@ -45,10 +45,10 @@ public class GetTrackContentDetailVO
|
||||
/// <summary>
|
||||
/// 轨迹标记id
|
||||
/// </summary>
|
||||
public int TrackFlagId { get; set; }
|
||||
public string? TrackFlagId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹标记
|
||||
/// 轨迹标记ids
|
||||
/// </summary>
|
||||
public string TrackFlag { get; set; }
|
||||
public List<int>? TrackFlagIds { get; set; }
|
||||
}
|
||||
|
||||
@ -10,10 +10,6 @@ namespace SJZY.Track.Repository.Repositories;
|
||||
|
||||
public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrackContentRepository, IScopedDependency
|
||||
{
|
||||
public TrackContentRepository()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取轨迹内容明细
|
||||
/// </summary>
|
||||
@ -23,10 +19,9 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
||||
{
|
||||
var detail = await Context.Queryable<TrackContentEntity>()
|
||||
.LeftJoin<TrackStatusEntity>((a, b) => a.TrackStatusId == b.Id && b.IsDeleted == false)
|
||||
.LeftJoin<TrackFlagEntity>((a, b, c) => a.TrackFlagId == c.Id && c.IsDeleted == false)
|
||||
.LeftJoin<VSystemEntity>((a, b, c, d) => a.SubSystemId == d.Id && d.IsDeleted == false)
|
||||
.Where((a, b, c, d) => a.Id == id)
|
||||
.Select((a, b, c, d) => new GetTrackContentDetailVO
|
||||
.LeftJoin<VSystemEntity>((a, b, d) => a.SubSystemId == d.Id && d.IsDeleted == false)
|
||||
.Where((a, b, d) => a.Id == id)
|
||||
.Select((a, b, d) => new GetTrackContentDetailVO
|
||||
{
|
||||
Id = a.Id,
|
||||
SubSystemId = a.SubSystemId,
|
||||
@ -37,8 +32,8 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
||||
Content = a.Content,
|
||||
EnContent = a.EnContent,
|
||||
TrackFlagId = a.TrackFlagId,
|
||||
TrackFlag = c.Name
|
||||
})
|
||||
.Mapper(x => { x.TrackFlagIds = x.TrackFlagId?.Split(',').Select(int.Parse).ToList(); })
|
||||
.FirstAsync();
|
||||
return detail;
|
||||
}
|
||||
@ -50,23 +45,21 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
||||
/// <returns></returns>
|
||||
public async Task<UnifyPageResultDto<GetTrackContentListVO>> GetPageTrackContent(GetPageTrackContentVO input)
|
||||
{
|
||||
UnifyPageResultDto<GetTrackContentListVO> pagedList = new UnifyPageResultDto<GetTrackContentListVO>();
|
||||
pagedList = await Context.Queryable<TrackContentEntity>()
|
||||
var pagedList = await Context.Queryable<TrackContentEntity>()
|
||||
.LeftJoin<TrackStatusEntity>((a, b) => a.TrackStatusId == b.Id && b.IsDeleted == false)
|
||||
.LeftJoin<TrackFlagEntity>((a, b, c) => a.TrackFlagId == c.Id && c.IsDeleted == false)
|
||||
.LeftJoin<VSystemEntity>((a, b, c, d) => a.SubSystemId == d.Id && d.IsDeleted == false)
|
||||
.LeftJoin<VUserEntity>((a, b, c, d, e) => a.CreateUserId == e.Id && e.IsDeleted == false)
|
||||
.LeftJoin<VUserEntity>((a, b, c, d, e, f) => a.UpdateUserId == f.Id && f.IsDeleted == false)
|
||||
.WhereIF(input.SubSystemId > 0, (a, b, c, d, e, f) => a.SubSystemId == input.SubSystemId)
|
||||
.LeftJoin<VSystemEntity>((a, b, d) => a.SubSystemId == d.Id && d.IsDeleted == false)
|
||||
.LeftJoin<VUserEntity>((a, b, d, e) => a.CreateUserId == e.Id && e.IsDeleted == false)
|
||||
.LeftJoin<VUserEntity>((a, b, d, e, f) => a.UpdateUserId == f.Id && f.IsDeleted == false)
|
||||
.WhereIF(input.SubSystemId > 0, (a, b, d, e, f) => a.SubSystemId == input.SubSystemId)
|
||||
.WhereIF(!input.Keywords.IsNullOrWhiteSpace(),
|
||||
(a, b, c, d, e, f) => a.Code.Contains(input.Keywords) || a.Content.Contains(input.Keywords)
|
||||
(a, b, d, e, f) => a.Code.Contains(input.Keywords) || a.Content.Contains(input.Keywords)
|
||||
|| a.EnContent.Contains(input.Keywords))
|
||||
.WhereIF(input.TrackStatusId > 0, (a, b, c, d, e, f) => a.TrackStatusId == input.TrackStatusId)
|
||||
.OrderByIF(input.SelectIds.IsNullOrEmpty(), (a, b, c, d, e, f) => a.CreateTime, OrderByType.Desc)
|
||||
.WhereIF(input.TrackStatusId > 0, (a, b, d, e, f) => a.TrackStatusId == input.TrackStatusId)
|
||||
.OrderByIF(input.SelectIds.IsNullOrEmpty(), (a, b, 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, b, 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
|
||||
.Select((a, b, d, e, f) => new GetTrackContentListVO
|
||||
{
|
||||
Id = a.Id,
|
||||
SubSystem = d.CnName,
|
||||
@ -78,7 +71,9 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
||||
.Return("干线")
|
||||
.ElseIF(b.Node == 4).Return("派送").ElseIF(b.Node == 5).Return("其他")
|
||||
.End(""),
|
||||
TrackFlag = c.Name,
|
||||
TrackFlag = SqlFunc.Subqueryable<TrackFlagEntity>()
|
||||
.Where(x => SqlFunc.SplitIn(a.TrackFlagId, x.Id.ToString()))
|
||||
.SelectStringJoin(x => x.Name, ","),
|
||||
CreateTime = a.CreateTime,
|
||||
CreateUser = e.Name,
|
||||
UpdateTime = a.UpdateTime,
|
||||
|
||||
@ -78,23 +78,23 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
|
||||
.LeftJoin<VEnumValueInfoEntity>((templateContent, trackContent, trackStatus, enumValue) =>
|
||||
enumValue.Property == EnumPropertyEnums.节点.GetDescription() && trackStatus.Node == enumValue.Enumkey &&
|
||||
!enumValue.IsDeleted)
|
||||
.LeftJoin<TrackFlagEntity>((templateContent, trackContent, trackStatus, enumValue, trackFlag) =>
|
||||
trackContent.TrackFlagId == trackFlag.Id && !trackFlag.IsDeleted)
|
||||
.LeftJoin<VUserEntity>((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser) =>
|
||||
.LeftJoin<VUserEntity>((templateContent, trackContent, trackStatus, enumValue, createUser) =>
|
||||
templateContent.CreateUserId == createUser.Id && !createUser.IsDeleted)
|
||||
.LeftJoin<VUserEntity>(
|
||||
(templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) =>
|
||||
(templateContent, trackContent, trackStatus, enumValue, createUser, updateUser) =>
|
||||
templateContent.UpdateUserId == updateUser.Id && !updateUser.IsDeleted)
|
||||
.Filter(null, true)
|
||||
.Where(templateContent => input.TrackTemplateIds.Contains(templateContent.TrackTemplateId) &&
|
||||
!templateContent.IsDeleted)
|
||||
.Select((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) =>
|
||||
.Select((templateContent, trackContent, trackStatus, enumValue, createUser, updateUser) =>
|
||||
new GetTrackTemplateContentPageOutputVO
|
||||
{
|
||||
Id = templateContent.Id,
|
||||
TrackStatus = trackStatus.Status,
|
||||
Node = enumValue.Disp,
|
||||
TrackFlag = trackFlag.Name,
|
||||
TrackFlag = SqlFunc.Subqueryable<TrackFlagEntity>()
|
||||
.Where(x => SqlFunc.Contains(trackContent.TrackFlagId, x.Id.ToString()))
|
||||
.SelectStringJoin(x => x.Name, ","),
|
||||
CreateTime = templateContent.CreateTime,
|
||||
CreateUser = createUser.Name,
|
||||
UpdateTime = templateContent.UpdateTime,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user