change 结构调整
This commit is contained in:
parent
752f65b1e2
commit
37e225e456
@ -19,14 +19,15 @@ using Volo.Abp.Json;
|
||||
using Volo.Abp.Modularity;
|
||||
|
||||
[assembly: HostingStartup(typeof(HostingStartup))]
|
||||
|
||||
namespace SJZY.Track.Api
|
||||
{
|
||||
[DependsOn(
|
||||
typeof(AbpAutofacModule),
|
||||
typeof(SjzyAbpCodeModule),
|
||||
typeof(ApplicationModule),
|
||||
typeof(AbpAspNetCoreMvcModule),
|
||||
typeof(AbpAspNetCoreSerilogModule),
|
||||
typeof(ApplicationModule),
|
||||
typeof(SJZYTrackRepositoryModule)
|
||||
)]
|
||||
public class SJZYTrackApiModule : AbpModule
|
||||
@ -49,7 +50,9 @@ namespace SJZY.Track.Api
|
||||
//Json格式化全局处理
|
||||
context.Services.Configure<MvcNewtonsoftJsonOptions>(options =>
|
||||
{
|
||||
options.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver();//.DefaultContractResolver();
|
||||
options.SerializerSettings.ContractResolver =
|
||||
new Newtonsoft.Json.Serialization.
|
||||
CamelCasePropertyNamesContractResolver(); //.DefaultContractResolver();
|
||||
options.SerializerSettings.Converters.Add(new DateTimeJsonConverter("yyyy-MM-dd HH:mm:ss"));
|
||||
options.SerializerSettings.Converters.Add(new LongJsonConverter());
|
||||
});
|
||||
@ -59,7 +62,6 @@ namespace SJZY.Track.Api
|
||||
|
||||
|
||||
context.Services.AddRedis();
|
||||
|
||||
}
|
||||
|
||||
public override void OnApplicationInitialization(ApplicationInitializationContext context)
|
||||
@ -79,6 +81,7 @@ namespace SJZY.Track.Api
|
||||
app.UsePrometheus();
|
||||
|
||||
#region 启动提示
|
||||
|
||||
Console.WriteLine($@"
|
||||
+-------------------------------------------------------+
|
||||
| |
|
||||
@ -89,8 +92,8 @@ namespace SJZY.Track.Api
|
||||
| |
|
||||
+-------------------------------------------------------+
|
||||
");
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using AutoMapper;
|
||||
using SJZY.Track.Application.Dtos.Demo;
|
||||
using SJZY.Track.Domain.DemoAggregate;
|
||||
using SJZY.Track.Domain.DemoAggregate.Dtos;
|
||||
using SJZY.Track.Domain.Aggregates.DemoAggregate;
|
||||
using SJZY.Track.Domain.Dtos.Demo;
|
||||
|
||||
namespace SJZY.Track.Application.AutoMapper;
|
||||
|
||||
@ -12,7 +12,8 @@ internal class AutoMapperProfile : Profile
|
||||
CreateMap<UnifyPageResultDto<DemoEntity>, UnifyPageResultDto<GetDemoListByPageOutput>>(MemberList.None);
|
||||
|
||||
CreateMap<GetDemoListByPageInput, DemoValueObject>(MemberList.None).ReverseMap();
|
||||
CreateMap<UnifyPageResultDto<GetDemoListByPageInput>, UnifyPageResultDto<DemoValueObject>>(MemberList.None).ReverseMap();
|
||||
CreateMap<UnifyPageResultDto<GetDemoListByPageInput>, UnifyPageResultDto<DemoValueObject>>(MemberList.None)
|
||||
.ReverseMap();
|
||||
/*
|
||||
代码说明:
|
||||
MemberList.None的意思是,忽略源对象和目标对象的属性匹配检查,其他可选值:MemberList.Source(检查是否映射了所有源成员)、MemberList.Destination(检查是否映射了所有目标成员)
|
||||
@ -28,6 +29,5 @@ internal class AutoMapperProfile : Profile
|
||||
CreateMap<DemoEntity, DemoInput>(MemberList.None).ReverseMap();
|
||||
CreateMap<DemoEntity, GetDemoListByPageOutput>(MemberList.None);
|
||||
CreateMap<DemoEntity, DemoDetailSaveInput>(MemberList.None).ReverseMap();
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
using AutoMapper;
|
||||
using SJZY.Track.Application.Dtos.TrackTemplates;
|
||||
using SJZY.Track.Domain.TrackTemplateAggregate;
|
||||
using SJZY.Track.Domain.TrackTemplateAggregate.Dtos;
|
||||
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
|
||||
using SJZY.Track.Domain.Dtos.TrackTemplate;
|
||||
|
||||
namespace SJZY.Track.Application.AutoMapper;
|
||||
|
||||
namespace SJZY.Track.Application.AutoMapper
|
||||
{
|
||||
/// <summary>
|
||||
/// 轨迹模版自动映射
|
||||
/// </summary>
|
||||
@ -19,4 +19,3 @@ namespace SJZY.Track.Application.AutoMapper
|
||||
CreateMap<EditTrackTemplateContentInput, TrackTemplateContentEntity>(MemberList.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||
|
||||
namespace SJZY.Track.Application.Dtos.ProvideServices;
|
||||
|
||||
@ -22,7 +23,6 @@ public class CreateOrderInput
|
||||
public OrderDetails Details { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class OrderTemplateInfo
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@ -1,26 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||
|
||||
namespace SJZY.Track.Application.Dtos.ProvideServices;
|
||||
|
||||
public class LinkOrderInput
|
||||
{
|
||||
/// <summary>
|
||||
/// false解绑,true关联,必填
|
||||
/// </summary>
|
||||
public bool IsLink { get; set; }
|
||||
|
||||
public NoInfo NoInfo { get; set; }
|
||||
|
||||
public List<NoInfo> LinkedOrderInfos { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class NoInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 订单类型
|
||||
/// </summary>
|
||||
public int NoType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单号
|
||||
/// </summary>
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string OrderNo { get; set; }
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
using SJZY.Expand.ABP.Core.Common;
|
||||
using SJZY.Track.Application.Dtos.Demo;
|
||||
using SJZY.Track.Domain.DemoAggregate;
|
||||
using SJZY.Track.Domain.DemoAggregate.Dtos;
|
||||
using SJZY.Track.Domain.Aggregates.DemoAggregate;
|
||||
using SJZY.Track.Domain.Dtos.Demo;
|
||||
|
||||
namespace SJZY.Track.Application.Services.Demo;
|
||||
|
||||
namespace SJZY.Track.Application.Services.Demo
|
||||
{
|
||||
/// <summary>
|
||||
/// 接口请求完整样例
|
||||
/// </summary>
|
||||
@ -12,14 +12,18 @@ namespace SJZY.Track.Application.Services.Demo
|
||||
public class InterFaceDemoService : ApplicationService
|
||||
{
|
||||
#region 构造函数
|
||||
|
||||
private readonly IDemoRepository _demoRepository;
|
||||
|
||||
public InterFaceDemoService(IDemoRepository demoRepository)
|
||||
{
|
||||
_demoRepository = demoRepository;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 增删改
|
||||
|
||||
/// <summary>
|
||||
/// 增删改
|
||||
/// </summary>
|
||||
@ -37,7 +41,6 @@ namespace SJZY.Track.Application.Services.Demo
|
||||
}
|
||||
else if (input.Option == OptionType.修改 || input.Option == OptionType.删除)
|
||||
{
|
||||
|
||||
var demoInfo = await _demoRepository.GetById1(input.Id);
|
||||
if (demoInfo == null)
|
||||
{
|
||||
@ -60,12 +63,14 @@ namespace SJZY.Track.Application.Services.Demo
|
||||
await _demoRepository.UpdateAsync(entity);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 局部更新最佳实践
|
||||
|
||||
/// <summary>
|
||||
/// 局部更新最佳实践
|
||||
/// </summary>
|
||||
@ -87,9 +92,11 @@ namespace SJZY.Track.Application.Services.Demo
|
||||
|
||||
return new IdBaseDto() { Id = input.Id };
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 分页查询接口
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询
|
||||
/// </summary>
|
||||
@ -105,9 +112,11 @@ namespace SJZY.Track.Application.Services.Demo
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 入参转换
|
||||
|
||||
/// <summary>
|
||||
/// 入参转换
|
||||
/// </summary>
|
||||
@ -122,6 +131,7 @@ namespace SJZY.Track.Application.Services.Demo
|
||||
var res = ObjectMapper.Map<List<DemoEntity>, List<GetDemoListByPageOutput>>(list);
|
||||
return res;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 原生sql
|
||||
@ -141,6 +151,7 @@ namespace SJZY.Track.Application.Services.Demo
|
||||
#endregion
|
||||
|
||||
#region 自定义返回结果格式
|
||||
|
||||
/// <summary>
|
||||
/// 自定义返回结果格式
|
||||
/// </summary>
|
||||
@ -162,9 +173,11 @@ namespace SJZY.Track.Application.Services.Demo
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 约定类型下返回null
|
||||
|
||||
/// <summary>
|
||||
/// 约定类型下返回null
|
||||
/// </summary>
|
||||
@ -176,9 +189,11 @@ namespace SJZY.Track.Application.Services.Demo
|
||||
MyCustomerResultOutput res = null;
|
||||
return res;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region
|
||||
|
||||
/// <summary>
|
||||
/// 没有返回值
|
||||
/// </summary>
|
||||
@ -189,9 +204,11 @@ namespace SJZY.Track.Application.Services.Demo
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 主从关系实体存储
|
||||
|
||||
/// <summary>
|
||||
/// 主从关系实体存储
|
||||
/// </summary>
|
||||
@ -209,6 +226,7 @@ namespace SJZY.Track.Application.Services.Demo
|
||||
#endregion
|
||||
|
||||
#region 数据缓存
|
||||
|
||||
/// <summary>
|
||||
/// 数据缓存
|
||||
/// </summary>
|
||||
@ -220,6 +238,7 @@ namespace SJZY.Track.Application.Services.Demo
|
||||
var res = await _demoRepository.GetDataCache(input.Id);
|
||||
return res;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
//[HttpPost("InterFace/AAAA")]
|
||||
@ -230,4 +249,3 @@ namespace SJZY.Track.Application.Services.Demo
|
||||
// return result;
|
||||
//}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
using SJZY.Track.Application.Dtos.ProvideServices;
|
||||
using SJZY.Track.Domain;
|
||||
using SJZY.Track.Domain.OrderAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||
using SJZY.UserCenter.HttpApi.Services;
|
||||
|
||||
namespace SJZY.Track.Application.Services.ProvideServices;
|
||||
@ -13,10 +13,12 @@ namespace SJZY.Track.Application.Services.ProvideServices;
|
||||
public class OrderService : ApplicationService
|
||||
{
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
private readonly IBasicQuery<OrderLinkEntity> _orderLinkQuery;
|
||||
|
||||
public OrderService(IOrderRepository orderRepository)
|
||||
public OrderService(IOrderRepository orderRepository, IBasicQuery<OrderLinkEntity> orderLinkQuery)
|
||||
{
|
||||
_orderRepository = orderRepository;
|
||||
_orderLinkQuery = orderLinkQuery;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -69,13 +71,23 @@ public class OrderService: ApplicationService
|
||||
[HttpPost("Order/Link")]
|
||||
public async Task<bool> LinkOrderAsync(LinkOrderInput input)
|
||||
{
|
||||
// var distinctOrderNos = input.LinkedOrderInfos.Distinct().ToList();
|
||||
//
|
||||
//todo:去重
|
||||
var distinctOrderInfos = input.LinkedOrderInfos.Distinct().ToList();
|
||||
|
||||
if (await _orderRepository.IsAnyAsync(x => x.IsEqual(input.NoInfo)))
|
||||
{
|
||||
}
|
||||
|
||||
// var links = input.LinkedOrderInfos.Select(x => new OrderLinkEntity
|
||||
// {
|
||||
// LinkOrderId = x.,
|
||||
// OrderId = 0
|
||||
// })
|
||||
// OrderNo = x.OrderNo,
|
||||
// OrderType = x.NoType
|
||||
// }).ToList();
|
||||
//
|
||||
// foreach (var link in links)
|
||||
// {
|
||||
// if (await _orderLinkQuery.IsAnyAsync(x => x.))
|
||||
// }
|
||||
// _orderRepository.LinkOrderAsync();
|
||||
|
||||
return true;
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
using SJZY.Track.Application.Dtos.ProvideServices;
|
||||
using SJZY.Track.Domain;
|
||||
using SJZY.Track.Domain.OrderAggregate;
|
||||
using SJZY.Track.Domain.TrackTemplateAggregate;
|
||||
using SJZY.Track.Application.Dtos.ProvideServices;
|
||||
using SJZY.Track.Repository.TrackDetails;
|
||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
|
||||
|
||||
namespace SJZY.Track.Application.Services.ProvideServices;
|
||||
|
||||
|
||||
@ -1,16 +1,9 @@
|
||||
using SJZY.Track.Application.Dtos.TrackStatus;
|
||||
using SJZY.Track.Application.Dtos.TrackTemplates;
|
||||
using SJZY.Track.Domain.TrackStatusAggregate;
|
||||
using SJZY.Track.Domain.TrackTemplateAggregate;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
|
||||
namespace SJZY.Track.Application.Services.TrackStatus
|
||||
{
|
||||
namespace SJZY.Track.Application.Services.TrackStatus;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹状态
|
||||
/// </summary>
|
||||
@ -44,6 +37,7 @@ namespace SJZY.Track.Application.Services.TrackStatus
|
||||
}
|
||||
|
||||
#region 私有方法
|
||||
|
||||
private async Task<UnifyResultDto> AddAsync(EditTrackStatusInput input)
|
||||
{
|
||||
var entity = ObjectMapper.Map<EditTrackStatusInput, TrackStatusEntity>(input);
|
||||
@ -67,6 +61,6 @@ namespace SJZY.Track.Application.Services.TrackStatus
|
||||
|
||||
return new UnifyResultDto("200", "删除成功", isTrue);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
using Microsoft.Extensions.Localization;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using SJZY.Expand.ABP.Core.Localization;
|
||||
using SJZY.Track.Application.Dtos.TrackTemplates;
|
||||
using SJZY.Track.Application.Localization;
|
||||
using SJZY.Track.Domain.TrackTemplateAggregate;
|
||||
using SJZY.Track.Domain.TrackTemplateAggregate.Dtos;
|
||||
using System.Linq.Expressions;
|
||||
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
|
||||
using SJZY.Track.Domain.Dtos.TrackTemplate;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
|
||||
namespace SJZY.Track.Application.Services.TrackTemplates;
|
||||
@ -113,7 +113,8 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("GetContentPage")]
|
||||
public async Task<UnifyPageResultDto<GetTrackTemplateContentPageOutputVO>> GetContentPageAsync([FromBody] GetTrackTemplateContentPageInputVO input)
|
||||
public async Task<UnifyPageResultDto<GetTrackTemplateContentPageOutputVO>> GetContentPageAsync(
|
||||
[FromBody] GetTrackTemplateContentPageInputVO input)
|
||||
{
|
||||
return await _trackTemplateRepository.GetContentPageAsync(input);
|
||||
}
|
||||
@ -159,7 +160,8 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
||||
|
||||
case OptionTypeNoNull.修改:
|
||||
|
||||
var oldEntity = await _trackTemplateRepository.GetByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||
var oldEntity = await _trackTemplateRepository.GetByIdAsync(input.Id!.Value) ??
|
||||
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||
|
||||
ObjectMapper.Map(input, oldEntity);
|
||||
|
||||
@ -174,7 +176,8 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum, nameof(EditTrackTemplateContentInput.Options)]);
|
||||
throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
|
||||
nameof(EditTrackTemplateContentInput.Options)]);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
namespace SJZY.Track.Domain.DemoAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.DemoAggregate;
|
||||
|
||||
[SugarTable("t_demo_detail")]
|
||||
public class DemoDetailEntity
|
||||
public class DemoDetailEntity : IEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
@ -1,10 +1,10 @@
|
||||
namespace SJZY.Track.Domain.DemoAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.DemoAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// 测试表
|
||||
/// </summary>
|
||||
[SugarTable("t_demo")]
|
||||
public class DemoEntity : IFullAuditedBasicEntitys
|
||||
public class DemoEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
@ -33,5 +33,4 @@ public class DemoEntity : IFullAuditedBasicEntitys
|
||||
|
||||
[Navigate(NavigateType.OneToMany, nameof(DemoDetailEntity.DemoId))]
|
||||
public List<DemoDetailEntity> DemoDetailList { get; set; }
|
||||
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
using SJZY.Track.Domain.DemoAggregate.Dtos;
|
||||
using SJZY.Track.Domain.Dtos.Demo;
|
||||
|
||||
namespace SJZY.Track.Domain.DemoAggregate
|
||||
namespace SJZY.Track.Domain.Aggregates.DemoAggregate
|
||||
{
|
||||
public interface IDemoRepository
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
using SJZY.Track.Domain.OrderAggregate.Dtos;
|
||||
using SJZY.Track.Domain.Dtos.Order;
|
||||
|
||||
namespace SJZY.Track.Domain.OrderAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||
|
||||
public interface IOrderRepository : IBasicRepository<OrderEntity>
|
||||
{
|
||||
@ -1,12 +1,13 @@
|
||||
namespace SJZY.Track.Domain.OrderAggregate;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹订单主表
|
||||
/// </summary>
|
||||
[SugarTable("t_order")]
|
||||
public class OrderEntity : IFullAuditedBasicEntitys
|
||||
public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 自增主键
|
||||
/// </summary>
|
||||
@ -67,4 +68,25 @@ public class OrderEntity : IFullAuditedBasicEntitys
|
||||
[SugarColumn(ColumnName = "SubSystemId")]
|
||||
public int SubSystemId { get; set; }
|
||||
|
||||
|
||||
public bool IsEqual(NoInfo noInfo)
|
||||
{
|
||||
return OrderType == noInfo.NoType && OrderNo == noInfo.OrderNo;
|
||||
}
|
||||
}
|
||||
|
||||
public struct NoInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 订单类型,必填
|
||||
/// </summary>
|
||||
[Required]
|
||||
public int NoType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单号,必填
|
||||
/// </summary>
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string OrderNo { get; set; }
|
||||
}
|
||||
@ -1,13 +1,12 @@
|
||||
namespace SJZY.Track.Domain.OrderAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹订单关联表(1:N)
|
||||
/// </summary>
|
||||
[SugarTable("t_order_link")]
|
||||
public class OrderLinkEntity : ICreateBaicEntity,
|
||||
ISoftDeleteBasicEntity
|
||||
ISoftDeleteBasicEntity, IEntity
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 自增主键
|
||||
/// </summary>
|
||||
@ -1,12 +1,11 @@
|
||||
namespace SJZY.Track.Domain.OrderAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹订单模板表(1:N)
|
||||
/// </summary>
|
||||
[SugarTable("t_order_template")]
|
||||
public class OrderTemplateEntity : ICreateBaicEntity
|
||||
public class OrderTemplateEntity : ICreateBaicEntity, IEntity
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 自增主键
|
||||
/// </summary>
|
||||
@ -0,0 +1,5 @@
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||
|
||||
public interface ITrackContentRepository : IBasicRepository<TrackContentEntity>
|
||||
{
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
namespace SJZY.Track.Domain.TrackContentAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹内容
|
||||
/// </summary>
|
||||
[SugarTable("t_track_content")]
|
||||
public class TrackContentEntity : IFullAuditedBasicEntitys
|
||||
public class TrackContentEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
||||
{
|
||||
/// <summary>
|
||||
/// 自增主键
|
||||
@ -1,10 +1,10 @@
|
||||
namespace SJZY.Track.Domain.TrackContentAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹内容映射表
|
||||
/// </summary>
|
||||
[SugarTable("t_track_content_map")]
|
||||
public class TrackContentMapEntity : IFullAuditedBasicEntitys
|
||||
public class TrackContentMapEntity : IFullAuditedBasicEntitys, IEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 自增主键
|
||||
@ -1,7 +1,6 @@
|
||||
using SJZY.Track.Domain.TrackDetailsAggregate;
|
||||
using SJZY.Track.Repository.TrackDetails.Dtos;
|
||||
using SJZY.Track.Domain.Dtos.TrackDetails;
|
||||
|
||||
namespace SJZY.Track.Repository.TrackDetails;
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||
|
||||
public interface ITrackDetailsRepository
|
||||
{
|
||||
@ -1,9 +1,9 @@
|
||||
using Nest;
|
||||
using SJZY.Expand.ElasticSearch;
|
||||
|
||||
namespace SJZY.Track.Domain.TrackDetailsAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||
|
||||
[ElasticsearchType(Name = IndexName)]
|
||||
[ElasticsearchType(RelationName = IndexName)]
|
||||
public class TrackDetailsIndex : IdBaseIndex
|
||||
{
|
||||
public const string IndexName = "sjzy_track_details";
|
||||
@ -1,4 +1,4 @@
|
||||
namespace SJZY.Track.Domain.TrackFlagAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackFlagAggregate;
|
||||
|
||||
public interface ITrackFlagRepository : IBasicRepository<TrackFlagEntity>
|
||||
{
|
||||
@ -1,10 +1,10 @@
|
||||
namespace SJZY.Track.Domain.TrackFlagAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackFlagAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹标记表
|
||||
/// </summary>
|
||||
[SugarTable("t_track_flag")]
|
||||
public class TrackFlagEntity : IFullAuditedBasicEntitys
|
||||
public class TrackFlagEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
||||
{
|
||||
/// <summary>
|
||||
/// 自增主键
|
||||
@ -1,6 +1,5 @@
|
||||
namespace SJZY.Track.Domain.TrackPullAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||
|
||||
public interface ITrackPullConfigRepository : IBasicRepository<TrackPullConfigEntity>
|
||||
{
|
||||
|
||||
}
|
||||
@ -1,12 +1,11 @@
|
||||
namespace SJZY.Track.Domain.TrackPullAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹拉取配置表
|
||||
/// </summary>
|
||||
[SugarTable("t_track_pull_config")]
|
||||
public class TrackPullConfigEntity : IFullAuditedBasicEntitys
|
||||
public class TrackPullConfigEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 自增主键
|
||||
/// </summary>
|
||||
@ -42,5 +41,4 @@ public class TrackPullConfigEntity : IFullAuditedBasicEntitys
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "TrackTemplateId")]
|
||||
public int TrackTemplateId { get; set; }
|
||||
|
||||
}
|
||||
@ -1,12 +1,11 @@
|
||||
namespace SJZY.Track.Domain.TrackPullAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹拉取内容配置表
|
||||
/// </summary>
|
||||
[SugarTable("t_track_pull_content_config")]
|
||||
public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys
|
||||
public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys, IEntity
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 自增主键
|
||||
/// </summary>
|
||||
@ -66,5 +65,4 @@ public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "TrackTimeZone")]
|
||||
public string TrackTimeZone { get; set; }
|
||||
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
namespace SJZY.Track.Domain.TrackPullAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹拉取/推送参数配置
|
||||
/// </summary>
|
||||
[SugarTable("t_track_push_pull_params_config")]
|
||||
public class TrackPushPullParamsConfigEntity : IFullAuditedBasicEntitys
|
||||
public class TrackPushPullParamsConfigEntity : IFullAuditedBasicEntitys, IEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 自增主键
|
||||
@ -1,4 +1,4 @@
|
||||
namespace SJZY.Track.Domain.TrackPushAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||
|
||||
public interface ITrackPushConfigRepository : IBasicRepository<TrackPushConfigEntity>
|
||||
{
|
||||
@ -1,10 +1,10 @@
|
||||
namespace SJZY.Track.Domain.TrackPushAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹推送配置表
|
||||
/// </summary>
|
||||
[SugarTable("t_track_push_config")]
|
||||
public class TrackPushConfigEntity : IFullAuditedBasicEntitys
|
||||
public class TrackPushConfigEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
||||
{
|
||||
/// <summary>
|
||||
/// 自增主键
|
||||
@ -1,10 +1,10 @@
|
||||
namespace SJZY.Track.Domain.TrackPushAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹推送内容配置表
|
||||
/// </summary>
|
||||
[SugarTable("t_track_push_content_config")]
|
||||
public class TrackPushContentConfigEntity : IFullAuditedBasicEntitys
|
||||
public class TrackPushContentConfigEntity : IFullAuditedBasicEntitys, IEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 自增主键
|
||||
@ -1,6 +1,5 @@
|
||||
namespace SJZY.Track.Domain.TrackStatusAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
|
||||
|
||||
public interface ITrackStatusRepository : IBasicRepository<TrackStatusEntity>
|
||||
{
|
||||
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
namespace SJZY.Track.Domain.TrackStatusAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹状态表
|
||||
/// </summary>
|
||||
[SugarTable("t_track_status")]
|
||||
public class TrackStatusEntity : IFullAuditedBasicEntitys
|
||||
public class TrackStatusEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
||||
{
|
||||
/// <summary>
|
||||
/// 自增主键
|
||||
@ -1,6 +1,6 @@
|
||||
using SJZY.Track.Domain.TrackTemplateAggregate.Dtos;
|
||||
using SJZY.Track.Domain.Dtos.TrackTemplate;
|
||||
|
||||
namespace SJZY.Track.Domain.TrackTemplateAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
|
||||
|
||||
public interface ITrackTemplateRepository : IBasicRepository<TrackTemplateEntity>
|
||||
{
|
||||
@ -15,7 +15,8 @@ public interface ITrackTemplateRepository : IBasicRepository<TrackTemplateEntity
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task<UnifyPageResultDto<GetTrackTemplateContentPageOutputVO>> GetContentPageAsync(GetTrackTemplateContentPageInputVO input);
|
||||
Task<UnifyPageResultDto<GetTrackTemplateContentPageOutputVO>> GetContentPageAsync(
|
||||
GetTrackTemplateContentPageInputVO input);
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹模板内容详情
|
||||
@ -1,10 +1,10 @@
|
||||
namespace SJZY.Track.Domain.TrackTemplateAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹模板内容表(1:N)
|
||||
/// </summary>
|
||||
[SugarTable("t_track_template_content")]
|
||||
public class TrackTemplateContentEntity : IFullAuditedBasicEntitys
|
||||
public class TrackTemplateContentEntity : IFullAuditedBasicEntitys, IEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 自增主键
|
||||
@ -1,12 +1,11 @@
|
||||
namespace SJZY.Track.Domain.TrackTemplateAggregate;
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹模板表
|
||||
/// </summary>
|
||||
[SugarTable("t_track_template")]
|
||||
public class TrackTemplateEntity : IFullAuditedBasicEntitys
|
||||
public class TrackTemplateEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 自增主键
|
||||
/// </summary>
|
||||
@ -30,5 +29,4 @@ public class TrackTemplateEntity : IFullAuditedBasicEntitys
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "SubSystemId")]
|
||||
public int SubSystemId { get; set; }
|
||||
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
namespace SJZY.Track.Domain.DemoAggregate.Dtos
|
||||
{
|
||||
public class DemoValueObject
|
||||
{
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前页码
|
||||
/// </summary>
|
||||
public int PageIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 每页大小
|
||||
/// </summary>
|
||||
public int PageSize { get; set; }
|
||||
}
|
||||
}
|
||||
16
src/SJZY.Track.Domain/Dtos/Demo/DemoValueObject.cs
Normal file
16
src/SJZY.Track.Domain/Dtos/Demo/DemoValueObject.cs
Normal file
@ -0,0 +1,16 @@
|
||||
namespace SJZY.Track.Domain.Dtos.Demo;
|
||||
|
||||
public class DemoValueObject
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前页码
|
||||
/// </summary>
|
||||
public int PageIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 每页大小
|
||||
/// </summary>
|
||||
public int PageSize { get; set; }
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
namespace SJZY.Track.Domain.OrderAggregate.Dtos;
|
||||
namespace SJZY.Track.Domain.Dtos.Order;
|
||||
|
||||
public class OrderTemplateDto
|
||||
{
|
||||
@ -1,4 +1,4 @@
|
||||
namespace SJZY.Track.Repository.TrackDetails.Dtos;
|
||||
namespace SJZY.Track.Domain.Dtos.TrackDetails;
|
||||
|
||||
public class TrackDetailsQueryInput : PageInfoInput
|
||||
{
|
||||
@ -1,4 +1,4 @@
|
||||
namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos;
|
||||
namespace SJZY.Track.Domain.Dtos.TrackTemplate;
|
||||
|
||||
public class GetPageTrackTemplateVO : PageInfoInput
|
||||
{
|
||||
@ -0,0 +1,41 @@
|
||||
namespace SJZY.Track.Domain.Dtos.TrackTemplate;
|
||||
|
||||
public class GetTrackTemplateContentDetailOutputVO
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否可删
|
||||
/// </summary>
|
||||
public bool IsCanDelete { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否对外
|
||||
/// </summary>
|
||||
public bool IsExternal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹内容
|
||||
/// </summary>
|
||||
public string TrackContent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹内容id
|
||||
/// </summary>
|
||||
public int TrackContentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹状态
|
||||
/// </summary>
|
||||
public string TrackStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹状态id
|
||||
/// </summary>
|
||||
public int TrackStatusId { get; set; }
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos;
|
||||
namespace SJZY.Track.Domain.Dtos.TrackTemplate;
|
||||
|
||||
public class GetTrackTemplateContentPageInputVO : PageInfoInput
|
||||
{
|
||||
@ -1,4 +1,4 @@
|
||||
namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos;
|
||||
namespace SJZY.Track.Domain.Dtos.TrackTemplate;
|
||||
|
||||
public class GetTrackTemplateContentPageOutputVO
|
||||
{
|
||||
@ -1,4 +1,4 @@
|
||||
namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos;
|
||||
namespace SJZY.Track.Domain.Dtos.TrackTemplate;
|
||||
|
||||
/// <summary>
|
||||
/// 获取轨迹模版明细
|
||||
@ -0,0 +1,5 @@
|
||||
namespace SJZY.Track.Domain.Dtos.TrackTemplate;
|
||||
|
||||
public class TemplateContentDto
|
||||
{
|
||||
}
|
||||
@ -7,3 +7,4 @@ global using System;
|
||||
global using System.Collections.Generic;
|
||||
global using System.Linq.Expressions;
|
||||
global using System.Threading.Tasks;
|
||||
global using SJZY.Track.Domain.SeedWork;
|
||||
38
src/SJZY.Track.Domain/IBasicQuery.cs
Normal file
38
src/SJZY.Track.Domain/IBasicQuery.cs
Normal file
@ -0,0 +1,38 @@
|
||||
namespace SJZY.Track.Domain;
|
||||
|
||||
public interface IBasicQuery<T> where T : IEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// top 1
|
||||
/// </summary>
|
||||
/// <param name="whereExpression"></param>
|
||||
/// <returns></returns>
|
||||
Task<T> GetFirstAsync(Expression<Func<T, bool>> whereExpression);
|
||||
|
||||
Task<TResult> GetFirstAsync<TResult>(Expression<Func<T, bool>> whereExpression,
|
||||
Expression<Func<T, TResult>> resultExpression);
|
||||
|
||||
/// <summary>
|
||||
/// get list
|
||||
/// </summary>
|
||||
/// <param name="whereExpression"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<T>> GetListAsync(Expression<Func<T, bool>> whereExpression);
|
||||
|
||||
Task<List<TResult>> GetListAsync<TResult>(Expression<Func<T, bool>> whereExpression,
|
||||
Expression<Func<T, TResult>> resultExpression);
|
||||
|
||||
/// <summary>
|
||||
/// count
|
||||
/// </summary>
|
||||
/// <param name="exp"></param>
|
||||
/// <returns></returns>
|
||||
Task<int> CountAsync(Expression<Func<T, bool>> exp);
|
||||
|
||||
/// <summary>
|
||||
/// exists
|
||||
/// </summary>
|
||||
/// <param name="exp"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> IsAnyAsync(Expression<Func<T, bool>> exp);
|
||||
}
|
||||
@ -1,39 +1,7 @@
|
||||
namespace SJZY.Track.Domain;
|
||||
|
||||
public interface IBasicRepository<T>
|
||||
public interface IBasicRepository<T> : IBasicQuery<T> where T : IAggregateRoot
|
||||
{
|
||||
/// <summary>
|
||||
/// top 1
|
||||
/// </summary>
|
||||
/// <param name="whereExpression"></param>
|
||||
/// <returns></returns>
|
||||
Task<T> GetFirstAsync(Expression<Func<T, bool>> whereExpression);
|
||||
|
||||
Task<TResult> GetFirstAsync<TResult>(Expression<Func<T, bool>> whereExpression, Expression<Func<T, TResult>> resultExpression);
|
||||
|
||||
/// <summary>
|
||||
/// get list
|
||||
/// </summary>
|
||||
/// <param name="whereExpression"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<T>> GetListAsync(Expression<Func<T, bool>> whereExpression);
|
||||
|
||||
Task<List<TResult>> GetListAsync<TResult>(Expression<Func<T, bool>> whereExpression, Expression<Func<T, TResult>> resultExpression);
|
||||
|
||||
/// <summary>
|
||||
/// count
|
||||
/// </summary>
|
||||
/// <param name="exp"></param>
|
||||
/// <returns></returns>
|
||||
Task<int> CountAsync(Expression<Func<T, bool>> exp);
|
||||
|
||||
/// <summary>
|
||||
/// exists
|
||||
/// </summary>
|
||||
/// <param name="exp"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> IsAnyAsync(Expression<Func<T, bool>> exp);
|
||||
|
||||
/// <summary>
|
||||
/// update
|
||||
/// </summary>
|
||||
|
||||
@ -12,12 +12,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="TrackContentAggregate\Dtos\" />
|
||||
<Folder Include="TrackFlagAggregate\Dtos\" />
|
||||
<Folder Include="TrackPullAggregate\Dtos\" />
|
||||
<Folder Include="TrackPushAggregate\Dtos\" />
|
||||
<Folder Include="TrackStatusAggregate\Dtos\" />
|
||||
<Folder Include="TrackStatusAggregate\Dtos\" />
|
||||
<Folder Include="Aggregates\"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
5
src/SJZY.Track.Domain/SeedWork/IAggregateRoot.cs
Normal file
5
src/SJZY.Track.Domain/SeedWork/IAggregateRoot.cs
Normal file
@ -0,0 +1,5 @@
|
||||
namespace SJZY.Track.Domain.SeedWork;
|
||||
|
||||
public interface IAggregateRoot : IEntity
|
||||
{
|
||||
}
|
||||
5
src/SJZY.Track.Domain/SeedWork/IEntity.cs
Normal file
5
src/SJZY.Track.Domain/SeedWork/IEntity.cs
Normal file
@ -0,0 +1,5 @@
|
||||
namespace SJZY.Track.Domain.SeedWork;
|
||||
|
||||
public interface IEntity
|
||||
{
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
namespace SJZY.Track.Domain.TrackContentAggregate
|
||||
{
|
||||
public interface ITrackContentRepository : IBasicRepository<TrackContentEntity>
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos
|
||||
{
|
||||
public class GetTrackTemplateContentDetailOutputVO
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否可删
|
||||
/// </summary>
|
||||
public bool IsCanDelete { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否对外
|
||||
/// </summary>
|
||||
public bool IsExternal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹内容
|
||||
/// </summary>
|
||||
public string TrackContent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹内容id
|
||||
/// </summary>
|
||||
public int TrackContentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹状态
|
||||
/// </summary>
|
||||
public string TrackStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹状态id
|
||||
/// </summary>
|
||||
public int TrackStatusId { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos;
|
||||
|
||||
public class TemplateContentDto
|
||||
{
|
||||
|
||||
}
|
||||
25
src/SJZY.Track.Repository/BasicQuery.cs
Normal file
25
src/SJZY.Track.Repository/BasicQuery.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System.Linq.Expressions;
|
||||
using SJZY.Track.Domain;
|
||||
using SJZY.Track.Domain.SeedWork;
|
||||
|
||||
namespace SJZY.Track.Repository;
|
||||
|
||||
public class BasicQuery<T> : SimpleClient<T>, IBasicQuery<T> where T : class, IEntity, new()
|
||||
{
|
||||
public BasicQuery()
|
||||
{
|
||||
Context = SqlsugarScopeBasic.GetContextSafely("default");
|
||||
}
|
||||
|
||||
public async Task<TResult> GetFirstAsync<TResult>(Expression<Func<T, bool>> whereExpression,
|
||||
Expression<Func<T, TResult>> resultExpression)
|
||||
{
|
||||
return await Context.Queryable<T>().Where(whereExpression).Select(resultExpression).FirstAsync();
|
||||
}
|
||||
|
||||
public async Task<List<TResult>> GetListAsync<TResult>(Expression<Func<T, bool>> whereExpression,
|
||||
Expression<Func<T, TResult>> resultExpression)
|
||||
{
|
||||
return await Context.Queryable<T>().Where(whereExpression).Select(resultExpression).ToListAsync();
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
using SJZY.Track.Domain;
|
||||
using System.Linq.Expressions;
|
||||
using System.Linq.Expressions;
|
||||
using SJZY.Track.Domain;
|
||||
using SJZY.Track.Domain.SeedWork;
|
||||
using Volo.Abp;
|
||||
|
||||
namespace SJZY.Track.Repository;
|
||||
@ -8,25 +9,8 @@ namespace SJZY.Track.Repository;
|
||||
/// 仓储基类实现
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class BasicRepository<T> : SimpleClient<T>, IBasicRepository<T> where T : class, new()
|
||||
public class BasicRepository<T> : BasicQuery<T>, IBasicRepository<T> where T : class, IAggregateRoot, new()
|
||||
{
|
||||
public BasicRepository()
|
||||
{
|
||||
Context = SqlsugarScopeBasic.GetContextSafely("default");
|
||||
}
|
||||
|
||||
public async Task<TResult> GetFirstAsync<TResult>(Expression<Func<T, bool>> whereExpression,
|
||||
Expression<Func<T, TResult>> resultExpression)
|
||||
{
|
||||
return await Context.Queryable<T>().Where(whereExpression).Select(resultExpression).FirstAsync();
|
||||
}
|
||||
|
||||
public async Task<List<TResult>> GetListAsync<TResult>(Expression<Func<T, bool>> whereExpression,
|
||||
Expression<Func<T, TResult>> resultExpression)
|
||||
{
|
||||
return await Context.Queryable<T>().Where(whereExpression).Select(resultExpression).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<bool> UpdateAsync(T entity, Expression<Func<T, object>> ignoreColumns)
|
||||
{
|
||||
return await Context.Updateable(entity)
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
using SJZY.Track.Domain.DemoAggregate;
|
||||
using SJZY.Track.Domain.DemoAggregate.Dtos;
|
||||
using System.Transactions;
|
||||
using System.Transactions;
|
||||
using SJZY.Track.Domain.Aggregates.DemoAggregate;
|
||||
using SJZY.Track.Domain.Dtos.Demo;
|
||||
|
||||
namespace SJZY.Track.Repository;
|
||||
|
||||
namespace SJZY.Track.Repository
|
||||
{
|
||||
public class DemoRepository : BasicRepository<DemoEntity>, IDemoRepository, IScopedDependency
|
||||
{
|
||||
/*
|
||||
@ -53,6 +53,7 @@ namespace SJZY.Track.Repository
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 参数为实体
|
||||
@ -67,9 +68,11 @@ namespace SJZY.Track.Repository
|
||||
var list = await AsQueryable().ToListAsync();
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 执行原生sql语句
|
||||
|
||||
/// <summary>
|
||||
/// 执行原生sql语句
|
||||
/// </summary>
|
||||
@ -99,12 +102,11 @@ namespace SJZY.Track.Repository
|
||||
#endregion
|
||||
|
||||
#region 简单事务
|
||||
|
||||
public async Task Transaction()
|
||||
{
|
||||
|
||||
using (var ts = new TransactionScope())
|
||||
{
|
||||
|
||||
await base.InsertAsync(new DemoEntity { Name = "1111" });
|
||||
await base.InsertAsync(new DemoEntity { Name = "222" });
|
||||
await base.InsertAsync(new DemoEntity { Name = "3333" });
|
||||
@ -115,9 +117,11 @@ namespace SJZY.Track.Repository
|
||||
ts.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 夸方法事务
|
||||
|
||||
public async Task MultipleMethodTrans1()
|
||||
{
|
||||
await base.InsertAsync(new DemoEntity { Name = "---" });
|
||||
@ -126,13 +130,14 @@ namespace SJZY.Track.Repository
|
||||
|
||||
public async Task MultipleMethodTrans2()
|
||||
{
|
||||
|
||||
//throw new BusinessException(message: "手动抛出异常");
|
||||
await base.InsertAsync(new DemoEntity { Name = "xxx" });
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 事务嵌套
|
||||
|
||||
public async Task InternalTrans()
|
||||
{
|
||||
using (var ts = new TransactionScope())
|
||||
@ -145,9 +150,11 @@ namespace SJZY.Track.Repository
|
||||
ts.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 局部更新
|
||||
|
||||
public async Task UpdatePartColumns(DemoEntity entity)
|
||||
{
|
||||
Context.Updateable(entity).UpdateColumns(m => new { m.Description, m.Name }).ExecuteCommand();
|
||||
@ -156,9 +163,11 @@ namespace SJZY.Track.Repository
|
||||
Context.Updateable(entity).IgnoreColumns(m => new { m.CreateUserId, m.Age }).ExecuteCommand();
|
||||
// UPDATE `test` SET`IsDeleted`= 0,`Name`= 'string',`Description`= 'string',`EnabledMark`= 0,`DeleteUserId`= 0,`DeleteTime`= '2022/8/13 23:42:36',`CreateTime`= '2015/5/12 0:00:00',`UpdateUserId`= 0,`UpdateTime`= '2022/8/13 23:55:27' WHERE `id`= 5
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 导航属性
|
||||
|
||||
/// <summary>
|
||||
/// 导航属性
|
||||
/// </summary>
|
||||
@ -170,9 +179,11 @@ namespace SJZY.Track.Repository
|
||||
var res = await Context.InsertNav(entity).Include(m => m.DemoDetailList).ExecuteCommandAsync();
|
||||
return res;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 缓存
|
||||
|
||||
/// <summary>
|
||||
/// 获取数据包含缓存
|
||||
/// </summary>
|
||||
@ -192,7 +203,6 @@ namespace SJZY.Track.Repository
|
||||
|
||||
return demo;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
using SJZY.Track.Domain.OrderAggregate;
|
||||
using SJZY.Track.Domain.OrderAggregate.Dtos;
|
||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||
using SJZY.Track.Domain.Dtos.Order;
|
||||
|
||||
namespace SJZY.Track.Repository;
|
||||
|
||||
|
||||
@ -21,7 +21,8 @@ public class SJZYTrackRepositoryModule : AbpModule
|
||||
|
||||
context.Services.AddSqlsugar(options =>
|
||||
{
|
||||
options.AddRange(new List<SqlsugarOptions> {
|
||||
options.AddRange(new List<SqlsugarOptions>
|
||||
{
|
||||
new()
|
||||
{
|
||||
ConnectionString = configuration["ConnectionStrings:DefaultConnection"],
|
||||
@ -33,10 +34,6 @@ public class SJZYTrackRepositoryModule : AbpModule
|
||||
);
|
||||
}, DataBaseContext.OnExcutingAction, "SJZY.Track.Repository");
|
||||
|
||||
|
||||
context.Services.AddScoped(typeof(IBasicRepository<>), typeof(BasicRepository<>));
|
||||
|
||||
|
||||
context.Services.AddElasticSearch(options =>
|
||||
{
|
||||
options.NodeUrls = configuration.GetSection("ElasticSearch:NodeUrls").Get<List<string>>();
|
||||
@ -45,4 +42,10 @@ public class SJZYTrackRepositoryModule : AbpModule
|
||||
options.Base64PassPassword = configuration["ElasticSearch:Base64PassPassword"];
|
||||
});
|
||||
}
|
||||
|
||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||
{
|
||||
context.Services.AddTransient(typeof(IBasicQuery<>), typeof(BasicQuery<>));
|
||||
context.Services.AddTransient(typeof(IBasicRepository<>), typeof(BasicRepository<>));
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
using SJZY.Track.Domain.TrackContentAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||
|
||||
namespace SJZY.Track.Repository;
|
||||
|
||||
|
||||
@ -2,9 +2,8 @@ using Nest;
|
||||
using SJZY.Expand.ABP.Core.Logger;
|
||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||
using SJZY.Expand.ElasticSearch.Services;
|
||||
using SJZY.Track.Domain.TrackDetailsAggregate;
|
||||
using SJZY.Track.Repository.TrackDetails;
|
||||
using SJZY.Track.Repository.TrackDetails.Dtos;
|
||||
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||
using SJZY.Track.Domain.Dtos.TrackDetails;
|
||||
|
||||
namespace SJZY.Track.Repository;
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using SJZY.Track.Domain.TrackFlagAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackFlagAggregate;
|
||||
|
||||
namespace SJZY.Track.Repository;
|
||||
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
using SJZY.Track.Domain.TrackPullAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||
|
||||
namespace SJZY.Track.Repository;
|
||||
|
||||
public class TrackPullConfigRepository : BasicRepository<TrackPullConfigEntity>, ITrackPullConfigRepository, IScopedDependency
|
||||
public class TrackPullConfigRepository : BasicRepository<TrackPullConfigEntity>, ITrackPullConfigRepository,
|
||||
IScopedDependency
|
||||
{
|
||||
}
|
||||
@ -1,7 +1,8 @@
|
||||
using SJZY.Track.Domain.TrackPushAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||
|
||||
namespace SJZY.Track.Repository;
|
||||
|
||||
public class TrackPushConfigRepository : BasicRepository<TrackPushConfigEntity>, ITrackPushConfigRepository, IScopedDependency
|
||||
public class TrackPushConfigRepository : BasicRepository<TrackPushConfigEntity>, ITrackPushConfigRepository,
|
||||
IScopedDependency
|
||||
{
|
||||
}
|
||||
@ -1,12 +1,13 @@
|
||||
namespace SJZY.Track.Repository.TrackPushRecord.Entitys
|
||||
using SJZY.Track.Domain.SeedWork;
|
||||
|
||||
namespace SJZY.Track.Repository.TrackPushRecord.Entitys
|
||||
{
|
||||
/// <summary>
|
||||
/// 轨迹推送记录
|
||||
/// </summary>
|
||||
[SugarTable("t_track_push_record")]
|
||||
public class TrackPushRecordEntity
|
||||
public class TrackPushRecordEntity : IAggregateRoot
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 自增主键
|
||||
/// </summary>
|
||||
@ -54,6 +55,5 @@
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "TrackTotal")]
|
||||
public string TrackTotal { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,13 @@
|
||||
namespace SJZY.Track.Repository.TrackPushRecordDetails.Entitys
|
||||
using SJZY.Track.Domain.SeedWork;
|
||||
|
||||
namespace SJZY.Track.Repository.TrackPushRecordDetails.Entitys
|
||||
{
|
||||
/// <summary>
|
||||
/// 轨迹推送明细表
|
||||
/// </summary>
|
||||
[SugarTable("t_track_push_record_details")]
|
||||
public class TrackPushRecordDetailsEntity
|
||||
public class TrackPushRecordDetailsEntity : IAggregateRoot
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 自增主键
|
||||
/// </summary>
|
||||
@ -42,6 +43,5 @@
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "PushRecordId")]
|
||||
public int PushRecordId { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
using SJZY.Track.Domain.TrackStatusAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
|
||||
|
||||
namespace SJZY.Track.Repository;
|
||||
|
||||
@ -7,6 +7,4 @@ public class TrackStatusRepository : BasicRepository<TrackStatusEntity>, ITrackS
|
||||
public TrackStatusRepository()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,13 +1,12 @@
|
||||
using SJZY.Expand.ABP.Core.Common.Dto;
|
||||
using System.Linq.Expressions;
|
||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||
using SJZY.Track.Domain.TrackContentAggregate;
|
||||
using SJZY.Track.Domain.TrackFlagAggregate;
|
||||
using SJZY.Track.Domain.TrackStatusAggregate;
|
||||
using SJZY.Track.Domain.TrackTemplateAggregate;
|
||||
using SJZY.Track.Domain.TrackTemplateAggregate.Dtos;
|
||||
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackFlagAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
|
||||
using SJZY.Track.Domain.Dtos.TrackTemplate;
|
||||
using SJZY.Track.Domain.VEntities;
|
||||
using SJZY.Track.Repository.Enum;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace SJZY.Track.Repository;
|
||||
|
||||
@ -26,7 +25,8 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
|
||||
/// <returns></returns>
|
||||
public async Task<GetTrackTemplateDetailVO?> GetDetailAsync(int id)
|
||||
{
|
||||
var detail = await Context.Queryable<TrackTemplateEntity>().LeftJoin<VSystemEntity>((a, b) => a.SubSystemId == b.Id)
|
||||
var detail = await Context.Queryable<TrackTemplateEntity>()
|
||||
.LeftJoin<VSystemEntity>((a, b) => a.SubSystemId == b.Id)
|
||||
.Where((a, b) => a.Id == id)
|
||||
.Select((a, b) => new
|
||||
GetTrackTemplateDetailVO
|
||||
@ -49,9 +49,11 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
|
||||
public async Task<UnifyPageResultDto<GetTrackTemplateListVO>> GetPageTrackTemplate(GetPageTrackTemplateVO input)
|
||||
{
|
||||
UnifyPageResultDto<GetTrackTemplateListVO> pagedList = new UnifyPageResultDto<GetTrackTemplateListVO>();
|
||||
pagedList = await Context.Queryable<TrackTemplateEntity>().LeftJoin<VSystemEntity>((a, b) => a.SubSystemId == b.Id)
|
||||
pagedList = await Context.Queryable<TrackTemplateEntity>()
|
||||
.LeftJoin<VSystemEntity>((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))
|
||||
.WhereIF(!input.Keywords.IsNullOrWhiteSpace(),
|
||||
(a, b) => a.Name.Contains(input.Keywords) || a.Code.Contains(input.Keywords))
|
||||
.Select((a, b) => new GetTrackTemplateListVO
|
||||
{
|
||||
Id = a.Id,
|
||||
@ -75,7 +77,8 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
|
||||
}
|
||||
else
|
||||
{
|
||||
var item = await Context.Queryable<TrackTemplateEntity>().LeftJoin<VSystemEntity>((a, b) => a.SubSystemId == b.Id)
|
||||
var item = await Context.Queryable<TrackTemplateEntity>()
|
||||
.LeftJoin<VSystemEntity>((a, b) => a.SubSystemId == b.Id)
|
||||
.Where((a, b) => a.Id == input.TrackTemplateId)
|
||||
.Select((a, b) => new GetTrackTemplateListVO
|
||||
{
|
||||
@ -100,18 +103,29 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<UnifyPageResultDto<GetTrackTemplateContentPageOutputVO>> GetContentPageAsync(GetTrackTemplateContentPageInputVO input)
|
||||
public async Task<UnifyPageResultDto<GetTrackTemplateContentPageOutputVO>> GetContentPageAsync(
|
||||
GetTrackTemplateContentPageInputVO input)
|
||||
{
|
||||
return await Context.Queryable<TrackTemplateContentEntity>()
|
||||
.InnerJoin<TrackContentEntity>((templateContent, trackContent) => templateContent.TrackContentId == trackContent.Id && !trackContent.IsDeleted)
|
||||
.LeftJoin<TrackStatusEntity>((templateContent, trackContent, trackStatus) => trackContent.TrackStatusId == trackStatus.Id && !trackStatus.IsDeleted)
|
||||
.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) => templateContent.CreateUserId == createUser.Id && !createUser.IsDeleted)
|
||||
.LeftJoin<VUserEntity>((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) => templateContent.UpdateUserId == updateUser.Id && !updateUser.IsDeleted)
|
||||
.InnerJoin<TrackContentEntity>((templateContent, trackContent) =>
|
||||
templateContent.TrackContentId == trackContent.Id && !trackContent.IsDeleted)
|
||||
.LeftJoin<TrackStatusEntity>((templateContent, trackContent, trackStatus) =>
|
||||
trackContent.TrackStatusId == trackStatus.Id && !trackStatus.IsDeleted)
|
||||
.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) =>
|
||||
templateContent.CreateUserId == createUser.Id && !createUser.IsDeleted)
|
||||
.LeftJoin<VUserEntity>(
|
||||
(templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) =>
|
||||
templateContent.UpdateUserId == updateUser.Id && !updateUser.IsDeleted)
|
||||
.Filter(null, true)
|
||||
.Where(templateContent => templateContent.TrackTemplateId == input.TrackTemplateId && !templateContent.IsDeleted)
|
||||
.Select((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) => new GetTrackTemplateContentPageOutputVO
|
||||
.Where(templateContent =>
|
||||
templateContent.TrackTemplateId == input.TrackTemplateId && !templateContent.IsDeleted)
|
||||
.Select((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) =>
|
||||
new GetTrackTemplateContentPageOutputVO
|
||||
{
|
||||
Id = templateContent.Id,
|
||||
TrackStatus = trackStatus.Status,
|
||||
@ -129,8 +143,10 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
|
||||
public async Task<GetTrackTemplateContentDetailOutputVO> GetContentDetailAsync(int id)
|
||||
{
|
||||
return await Context.Queryable<TrackTemplateContentEntity>()
|
||||
.InnerJoin<TrackContentEntity>((templateContent, trackContent) => templateContent.TrackContentId == trackContent.Id && !trackContent.IsDeleted)
|
||||
.LeftJoin<TrackStatusEntity>((templateContent, trackContent, trackStatus) => trackContent.TrackStatusId == trackStatus.Id && !trackStatus.IsDeleted)
|
||||
.InnerJoin<TrackContentEntity>((templateContent, trackContent) =>
|
||||
templateContent.TrackContentId == trackContent.Id && !trackContent.IsDeleted)
|
||||
.LeftJoin<TrackStatusEntity>((templateContent, trackContent, trackStatus) =>
|
||||
trackContent.TrackStatusId == trackStatus.Id && !trackStatus.IsDeleted)
|
||||
.Filter(null, true)
|
||||
.Where(templateContent => templateContent.Id == id && !templateContent.IsDeleted)
|
||||
.Select((templateContent, trackContent, trackStatus) => new GetTrackTemplateContentDetailOutputVO
|
||||
|
||||
Loading…
Reference in New Issue
Block a user