mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-01-24 05:42:01 +08:00
Update demo
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SqlugarDemo
|
||||
{
|
||||
public class CustomerMainInfomation:ERPEntityParentBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户编号
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "CustomerNo")]
|
||||
public string CustomerNo { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 客户名称
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "CustomerCorpName")]
|
||||
public string CustomerName { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SqlugarDemo
|
||||
{
|
||||
public class CustomerTranslatorBindingRelationship:ERPEntitySubBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 译员ID
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "gysbh")]
|
||||
public string TranslatorID { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "zt")]
|
||||
public string Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 客户的主信息
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
[Navigate(NavigateType.OneToOne, nameof(CustomerTranslatorBindingRelationship.ParentID), nameof(CustomerMainInfomation.RecordID))]
|
||||
public CustomerMainInfomation CustomerInfo { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SqlugarDemo
|
||||
{
|
||||
public class DEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true)]
|
||||
public virtual long Id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SqlugarDemo
|
||||
{
|
||||
/// <summary>
|
||||
/// 关联ERP系统的数据库
|
||||
/// </summary>
|
||||
public abstract class ERPEntityBaseId
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "SerialID", IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
}
|
||||
public abstract class ERPEntityBase : ERPEntityBaseId
|
||||
{
|
||||
/// <summary>
|
||||
/// RecordID
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "RecordID")]
|
||||
public string RecordID { get; set; }
|
||||
}
|
||||
|
||||
public abstract class ERPEntityParentBase : ERPEntityBase
|
||||
{
|
||||
}
|
||||
|
||||
public abstract class ERPEntitySubBase: ERPEntityBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// ParentID
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "ParentID")]
|
||||
public string ParentID { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace TranslateTool
|
||||
{
|
||||
/// <summary>
|
||||
/// 处理 Lambda 参数不一致问题
|
||||
/// </summary>
|
||||
internal sealed class ParameterReplaceExpressionVisitor : ExpressionVisitor
|
||||
{
|
||||
/// <summary>
|
||||
/// 参数表达式映射集合
|
||||
/// </summary>
|
||||
private readonly Dictionary<ParameterExpression, ParameterExpression> parameterExpressionSetter;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="parameterExpressionSetter">参数表达式映射集合</param>
|
||||
public ParameterReplaceExpressionVisitor(Dictionary<ParameterExpression, ParameterExpression> parameterExpressionSetter)
|
||||
{
|
||||
this.parameterExpressionSetter = parameterExpressionSetter ?? new Dictionary<ParameterExpression, ParameterExpression>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 替换表达式参数
|
||||
/// </summary>
|
||||
/// <param name="parameterExpressionSetter">参数表达式映射集合</param>
|
||||
/// <param name="expression">表达式</param>
|
||||
/// <returns>新的表达式</returns>
|
||||
public static Expression ReplaceParameters(Dictionary<ParameterExpression, ParameterExpression> parameterExpressionSetter, Expression expression)
|
||||
{
|
||||
return new ParameterReplaceExpressionVisitor(parameterExpressionSetter).Visit(expression);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写基类参数访问器
|
||||
/// </summary>
|
||||
/// <param name="parameterExpression"></param>
|
||||
/// <returns></returns>
|
||||
protected override Expression VisitParameter(ParameterExpression parameterExpression)
|
||||
{
|
||||
if (parameterExpressionSetter.TryGetValue(parameterExpression, out var replacement))
|
||||
{
|
||||
parameterExpression = replacement;
|
||||
}
|
||||
|
||||
return base.VisitParameter(parameterExpression);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SqlugarDemo
|
||||
{
|
||||
[SugarTable("ProjectDetailInfomation")]
|
||||
public class ProjectDetailInfomation : DEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目信息主键, ProjectMainInfomation表
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "MainId")]
|
||||
public long MainId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目的主信息
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
[Navigate(NavigateType.OneToOne, nameof(MainId))]
|
||||
public ProjectMainInfomation ProjectMainInfo { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SqlugarDemo
|
||||
{
|
||||
/// <summary>
|
||||
/// 项目信息表
|
||||
///</summary>
|
||||
[SugarTable("ProjectMainInfomation")]
|
||||
public class ProjectMainInfomation : DEntityBase
|
||||
{
|
||||
//public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目调研状态
|
||||
/// </summary>
|
||||
public ProjectResearchStateDto ResearchState { get; set; } = ProjectResearchStateDto.RESEARCHING;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SqlugarDemo
|
||||
{
|
||||
public enum ProjectResearchStateDto : int
|
||||
{
|
||||
/// <summary>
|
||||
/// 正在调研
|
||||
/// </summary>
|
||||
[Description("调研中")]
|
||||
RESEARCHING = 0,
|
||||
/// <summary>
|
||||
/// 完成调研
|
||||
/// </summary>
|
||||
[Description("调研完成")]
|
||||
FINISH_RESEARCH = 1
|
||||
}
|
||||
|
||||
public enum RessearchReplyType
|
||||
{
|
||||
/// <summary>
|
||||
/// 接受
|
||||
/// </summary>
|
||||
[Description("接受")]
|
||||
Accept,
|
||||
|
||||
/// <summary>
|
||||
/// 拒绝
|
||||
/// </summary>
|
||||
[Description("拒绝")]
|
||||
Reject,
|
||||
|
||||
/// <summary>
|
||||
/// 未回复
|
||||
/// </summary>
|
||||
[Description("未回复")]
|
||||
NO_REPLY,
|
||||
|
||||
/// <summary>
|
||||
/// 已过期
|
||||
/// </summary>
|
||||
[Description("已过期")]
|
||||
EXPIRED,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SqlugarDemo
|
||||
{
|
||||
[SugarTable("ResearchRecorder")]
|
||||
public class ResearchRecorder : DEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//public string Name { get; set; }
|
||||
public long TranslaterId { get; set; }
|
||||
/// <summary>
|
||||
/// 关联ProjectDetailInfomation表,对应这个调研属于哪个项目哪个语言对下面
|
||||
/// 因为某一个译员如果会多个语言对,同一个项目是可以做不同的任务的
|
||||
/// </summary>
|
||||
public long ProjectDetailInfomationId { get; set; }
|
||||
|
||||
|
||||
#region 翻译员回复
|
||||
|
||||
/// <summary>
|
||||
/// 回复结果,如果为空表示未回复
|
||||
/// </summary>
|
||||
public RessearchReplyType ReplyReseult { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 该调研是针对哪一个项目详细信息的
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
[Navigate(NavigateType.OneToOne, nameof(ResearchRecorder.ProjectDetailInfomationId))]
|
||||
public ProjectDetailInfomation ProjectDetailInfo { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SqlugarDemo
|
||||
{
|
||||
public abstract class TranslatorMainInfomation : ERPEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 译员ID
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "SupplierNo", IsNullable = true)]
|
||||
public string TranslatorID { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class ERPTranslatorMainInfomation : TranslatorMainInfomation
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户绑定关系
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
[Navigate(NavigateType.OneToMany, nameof(CustomerTranslatorBindingRelationship.TranslatorID), nameof(ERPTranslatorMainInfomation.TranslatorID))]
|
||||
public List<CustomerTranslatorBindingRelationship> CustomerBindingRelationships { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user