duheng
2025-02-17 26f45822a2a84af81e20ca543da98d3b822c5afd
Service/HStation.Service.Xhs.Core/04-dal/02-postgresql/XhsProject.cs
@@ -73,7 +73,7 @@
                            }
                        }
                    }
                    db.CommitTran();
                    return entityProject.ID;
                }
                catch
@@ -126,65 +126,6 @@
                            }
                        }
                    }
                    return true;
                }
                catch
                {
                    db.RollbackTran();
                    throw;
                }
            }
        }
        /// <summary>
        /// 更新开始时间
        /// </summary>
        public virtual bool UpdateStartTime(long ID, DateTime StartTime)
        {
            using (SqlSugarClient db = new(ConnectionConfig))
            {
                return db.Updateable<Entity.XhsProject>()
                    .SetColumns(x => x.StartTime == StartTime)
                    .Where(x => x.ID == ID)
                    .ExecuteCommand() > 0;
            }
        }
        /// <summary>
        /// 更新结束时间
        /// </summary>
        public virtual bool UpdateEndTime(long ID, DateTime EndTime)
        {
            using (SqlSugarClient db = new(ConnectionConfig))
            {
                return db.Updateable<Entity.XhsProject>()
                    .SetColumns(x => x.EndTime == EndTime)
                    .Where(x => x.ID == ID)
                    .ExecuteCommand() > 0;
            }
        }
        /// <summary>
        /// 通过 ID 删除 (拓展)
        /// </summary>
        public bool DeleteExByID(long ID)
        {
            if (ID < 1)
            {
                return false;
            }
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                try
                {
                    db.BeginTran();
                    var bol = db.Deleteable<Entity.XhsProject>().Where(x => x.ID == ID).ExecuteCommandHasChange();
                    if (!bol)
                    {
                        db.RollbackTran();
                        return false;
                    }
                    db.Deleteable<Entity.XhsProjectSite>().Where(x => x.ProjectID == ID).ExecuteCommandHasChange();
                    db.CommitTran();
                    return true;
                }
@@ -197,5 +138,6 @@
        }
    }
}