This commit is contained in:
owenchen committed 2026-09-01 15:26:40 +08:00
1 parent d2c2b3cf59
commit 4359903d9c
33 files changed
+2708 -246

No files matched your search

@@ -14,51 +14,55 @@ namespace CloudBuilder.Master.Entity
{
}
[Column("created_datetime")]
public DateTime CreatedDatetime { get; set; }
[Column("created_by")]
public string CreatedBy { get; set; }
[Column("updated_datetime")]
public DateTime UpdatedDatetime { get; set; }
[Column("updated_by")]
public string UpdatedBy { get; set; }
[Column("tree_id")]
public string TreeId { get; set; }
[Column("person_id")]
public string PersonId { get; set; }
[Column("spouse_id")]
public string SpouseId { get; set; }
[Column("children_id")]
public string ChildrenId { get; set; }
[Column("created_by")]
public string CreatedBy { get; set; }
[Column("created_datetime")]
public DateTime CreatedDatetime { get; set; }
[Column("orderby")]
public int Orderby { get; set; }
[Column("person_id")]
public string PersonId { get; set; }
[Column("relation_type")]
public string? RelationType { get; set; }
[Column("remark")]
public string? Remark { get; set; }
[Column("spouse_id")]
public string? SpouseId { get; set; }
[Column("tree_id")]
public string TreeId { get; set; }
[Column("updated_by")]
public string UpdatedBy { get; set; }
[Column("updated_datetime")]
public DateTime UpdatedDatetime { get; set; }
public const string CREATED_DATETIME = "CreatedDatetime";
public const string CREATED_BY = "CreatedBy";
public const string UPDATED_DATETIME = "UpdatedDatetime";
public const string UPDATED_BY = "UpdatedBy";
public const string TREE_ID = "TreeId";
public const string PERSON_ID = "PersonId";
public const string SPOUSE_ID = "SpouseId";
public const string CHILDREN_ID = "ChildrenId";
public const string CREATED_BY = "CreatedBy";
public const string CREATED_DATETIME = "CreatedDatetime";
public const string ORDERBY = "Orderby";
public const string PERSON_ID = "PersonId";
public const string RELATION_TYPE = "RelationType";
public const string REMARK = "Remark";
public const string SPOUSE_ID = "SpouseId";
public const string TREE_ID = "TreeId";
public const string UPDATED_BY = "UpdatedBy";
public const string UPDATED_DATETIME = "UpdatedDatetime";
public const string DB_NAME_FAMILY_TREE_CHILDREN_MAP = "family_tree_children_map";
public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,tree_id,person_id,spouse_id,children_id,relation_type,remark";
public const string DB_NAME_FIELDS="children_id,created_by,created_datetime,orderby,person_id,relation_type,remark,spouse_id,tree_id,updated_by,updated_datetime";
public const string DB_CREATED_DATETIME = "created_datetime";
public const string DB_CREATED_BY = "created_by";
public const string DB_UPDATED_DATETIME = "updated_datetime";
public const string DB_UPDATED_BY = "updated_by";
public const string DB_TREE_ID = "tree_id";
public const string DB_PERSON_ID = "person_id";
public const string DB_SPOUSE_ID = "spouse_id";
public const string DB_CHILDREN_ID = "children_id";
public const string DB_CREATED_BY = "created_by";
public const string DB_CREATED_DATETIME = "created_datetime";
public const string DB_ORDERBY = "orderby";
public const string DB_PERSON_ID = "person_id";
public const string DB_RELATION_TYPE = "relation_type";
public const string DB_REMARK = "remark";
public const string DB_SPOUSE_ID = "spouse_id";
public const string DB_TREE_ID = "tree_id";
public const string DB_UPDATED_BY = "updated_by";
public const string DB_UPDATED_DATETIME = "updated_datetime";
private string ProviderName { get; set; }
@@ -79,23 +83,24 @@ namespace CloudBuilder.Master.Entity
throw new NullReferenceException("Source entity is null.");
}
this.CreatedDatetime = source.CreatedDatetime;
this.CreatedBy = source.CreatedBy;
this.UpdatedDatetime = source.UpdatedDatetime;
this.UpdatedBy = source.UpdatedBy;
this.TreeId = source.TreeId;
this.PersonId = source.PersonId;
this.SpouseId = source.SpouseId;
this.ChildrenId = source.ChildrenId;
this.CreatedBy = source.CreatedBy;
this.CreatedDatetime = source.CreatedDatetime;
this.Orderby = source.Orderby;
this.PersonId = source.PersonId;
this.RelationType = source.RelationType;
this.Remark = source.Remark;
this.SpouseId = source.SpouseId;
this.TreeId = source.TreeId;
this.UpdatedBy = source.UpdatedBy;
this.UpdatedDatetime = source.UpdatedDatetime;
if (includeSystemFields)
{
this.CreatedDatetime = source.CreatedDatetime;
this.CreatedBy = source.CreatedBy;
this.UpdatedDatetime = source.UpdatedDatetime;
this.CreatedDatetime = source.CreatedDatetime;
this.UpdatedBy = source.UpdatedBy;
this.UpdatedDatetime = source.UpdatedDatetime;
}
}
@@ -167,7 +172,7 @@ namespace CloudBuilder.Master.Entity
public string GetSelectTopFromByMySql(int limit, int start,string orderby,string orderbytag, string sqlWhere)
{
if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc";
if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_TREE_ID ;
if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_CHILDREN_ID ;
int offset = limit * (start - 1);
return $" select {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_FAMILY_TREE_CHILDREN_MAP} where 1=1 {sqlWhere} ) a where num> {offset} LIMIT {limit} ";
}
@@ -175,7 +180,7 @@ namespace CloudBuilder.Master.Entity
public string GetSelectTopFromBySqlServer(int limit, int start,string orderby,string orderbytag, string sqlWhere)
{
if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc";
if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_TREE_ID ;
if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_CHILDREN_ID ;
string top = limit > 0 ? $"top {limit}" : "";
return $" select {top} {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_FAMILY_TREE_CHILDREN_MAP} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}";
}