We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
数据库mysql 8.0 freesql版本:3.5.102
{ FilterInfo: { Logic: 'And', Filters: [{ Field: 'ProductionLineId', Operator: 'Equal', Value: 615775969181701}] }, Sorting: "Sort,CreationTime desc", PageSize: 100 } tosql生成的子查询表别名重复,导致查询结果不对
不传查询条件生成的表别名是对的 { FilterInfo: { Logic: 'And', Filters: [] }, Sorting: "Sort,CreationTime desc", PageSize: 100 }
var queryable = _repository.FreeSql.GetAggregateRootRepository<WorkOrder>().Select.OrderBy(search.Sorting).Count(out var total).Page(search.CurrentPage, search.PageSize); queryable.Include(t => t.Localtion).IncludeMany(b => b.WorkOrderProductionLineDetails, then => then.Include(s => s.ProductionLine)); var sql = queryable.Where(b => b.WorkOrderProductionLineDetails.AsSelect().WhereDynamicFilter(search.FilterInfo).Any()).ToSql(); [Serializable] [Table("TPRD_WorkOrder")] public class WorkOrder : BaseAuditedAggregateRoot<long> { /// <summary> /// /// </summary> public Guid? TenantId { get; set; } /// <summary> /// /// </summary> public Guid? OrgId { get; set; } [FreeSql.DataAnnotations.Navigate(nameof(OrgId))] public Org Org { get; set; } /// <summary> /// /// </summary> public string Code { get; set; } /// <summary> /// 计划完成日期 /// </summary> public DateTime PlanFinishDate { get; set; } /// <summary> /// 关闭状态 /// </summary> public sbyte CloseStatus { get; set; } /// <summary> /// /// </summary> public Guid? CloserId { get; set; } /// <summary> /// /// </summary> public DateTime? CloseDate { get; set; } /// <summary> /// 工单取消 /// </summary> public byte CancelStatus { get; set; } /// <summary> /// /// </summary> public Guid? CancellerId { get; set; } /// <summary> /// /// </summary> public DateTime? CancelDate { get; set; } /// <summary> /// 申请日期 /// </summary> public DateTime ApplyDate { get; set; } /// <summary> /// /// </summary> public Guid? Applicant { get; set; } /// <summary> /// /// </summary> public Guid? ApproverId { get; set; } /// <summary> /// /// </summary> public DateTime? ApproveDate { get; set; } /// <summary> /// 工单类型1正常2返工 /// </summary> public int TypeId { get; set; } /// <summary> /// 0:低 1:中 2:高 /// </summary> public int Priority { get; set; } /// <summary> /// 物料内码 /// </summary> public long MaterialId { get; set; } [FreeSql.DataAnnotations.Navigate(nameof(MaterialId))] public virtual MaterialInfo MaterialInfo { get; set; } /// <summary> /// 关联BOMid /// </summary> public long? BomId { get; set; } [FreeSql.DataAnnotations.Navigate(nameof(BomId))] public BOM Bom { get; set; } /// <summary> /// 工单创批状态 /// </summary> public byte LotCreateState { get; set; } = 0; /// <summary> /// 工单数量 /// </summary> public Decimal Qty { get; set; } /// <summary> /// 在制数量 /// </summary> public Decimal WipQty { get; set; } /// <summary> /// 报废数量 /// </summary> public Decimal ScrappedQty { get; set; } /// <summary> /// 完工数量 /// </summary> public Decimal FinishedQty { get; set; } /// <summary> /// 剩余数量 /// </summary> public Decimal LeftQty { get; set; } /// <summary> /// 重工数量 /// </summary> public Decimal ReworkQty { get; set; } /// <summary> /// 维修数量 /// </summary> public Decimal RepairQty { get; set; } /// <summary> /// 开始时间 /// </summary> public DateTime StartTime { get; set; } /// <summary> /// 结束时间 /// </summary> public DateTime? EndTime { get; set; } /// <summary> /// 税收类型(1保税/2完税)Taxation type /// </summary> public int? TaxType { get; set; } /// <summary> /// 车间 /// </summary> public long LocaltionId { get; set; } [FreeSql.DataAnnotations.Navigate(nameof(LocaltionId))] public virtual Localtion Localtion { get; set; } /// 工单线别 /// </summary> [FreeSql.DataAnnotations.Navigate(nameof(WorkOrderProductionLine.WorkOrderId))] public virtual List<WorkOrderProductionLine> WorkOrderProductionLineDetails { get; set; } } [Serializable] [System.ComponentModel.DataAnnotations.Schema.Table("TBAS_Localtion")] public class Localtion : BaseAuditedAggregateRoot<long> { /// <summary> /// /// </summary> public Guid? TenantId { get; set; } /// <summary> /// 父项Id /// </summary> public long? ParentId { get; set; } /// <summary> /// 编码 /// </summary> public string Code { get; set; } /// <summary> /// 名称 /// </summary> public string Name { get; set; } /// <summary> /// 0:工厂 /// 1:车间 /// 2:区域 /// </summary> public int Type { get; set; } /// <summary> /// 说明 /// </summary> public string Description { get; set; } /// <summary> /// 区域负责人 /// </summary> public Guid? ManagerId { get; set; } /// <summary> /// 排序 /// </summary> public int Sort { get; set; } /// <summary> /// 状态:1、新增、2、审核中3、已审核、4退回 /// </summary> public byte Status { get; set; } /// <summary> /// 禁用状态0有效1、禁用状态 /// </summary> public byte ForbidStatus { get; set; } /// <summary> /// 禁用人 /// </summary> public Guid? ForbidderId { get; set; } /// <summary> /// 禁用时间 /// </summary> public DateTime? ForbidDate { get; set; } /// <summary> /// 设置主键 /// </summary> /// <param name="key"></param> public void SetKey(long key) { Id = key; } } [Serializable] [Table("TPRD_WorkOrderProductionLine")] public class WorkOrderProductionLine : BaseAuditedAggregateRoot<long> { /// <summary> /// 工单Id /// </summary> public long WorkOrderId { get; set; } [FreeSql.DataAnnotations.Navigate(nameof(WorkOrderId))] public virtual WorkOrder WorkOrder { get; set; } /// <summary> /// 生产线Id /// </summary> public long ProductionLineId { get; set; } /// <summary> /// 禁用状态-->0:未禁用; 1:已禁用 /// </summary> public bool ForbidStatus { get; set; } /// <summary> /// /// </summary> public Guid? ForbidderId { get; set; } /// <summary> /// 禁用时间 /// </summary> public DateTime? ForbidDate { get; set; } /// <summary> /// 排序顺序 /// </summary> public int? Sort { get; set; } /// <summary> /// 设置主键 /// </summary> /// <param name="key"></param> public void SetKey(long key) { Id = key; } }
The text was updated successfully, but these errors were encountered:
b.WorkOrderProductionLineDetails.AsSelect().As("b").WhereDynamicFilter(search.FilterInfo).Any()
先这样处理
Sorry, something went wrong.
fsql.Select<WorkOrderProductionLineDetail>().Where(b => b.workid == a.id).WhereDynamicFilter(search.FilterInfo).Any()
No branches or pull requests
数据库mysql 8.0
freesql版本:3.5.102
{ FilterInfo: { Logic: 'And', Filters: [{ Field: 'ProductionLineId', Operator: 'Equal', Value: 615775969181701}] }, Sorting: "Sort,CreationTime desc", PageSize: 100 }
tosql生成的子查询表别名重复,导致查询结果不对
不传查询条件生成的表别名是对的
{ FilterInfo: { Logic: 'And', Filters: [] }, Sorting: "Sort,CreationTime desc", PageSize: 100 }
The text was updated successfully, but these errors were encountered: