lixiaojun
2024-07-19 2415c4eedaa96532ffc7eb1c7e5d018106115bf4
Service/HStation.Service.Xhs.Core/04-dal/03-sqlite/XhsProject.cs
@@ -18,9 +18,9 @@
        /// <summary>
        /// 插入拓展
        /// </summary>
        public long InsertEx(Entity.XhsProject project, Entity.XhsProjectSite site)
        public long InsertEx(Entity.XhsProject entityProject, List<Entity.XhsProjectSite> entityProjectSiteList)
        {
            if (project == null)
            if (entityProject == null)
            {
                return default;
            }
@@ -29,10 +29,10 @@
                try
                {
                    db.BeginTran();
                    if (project.ID < 1)
                    if (entityProject.ID < 1)
                    {
                        project.ID = db.Insertable(project).ExecuteReturnSnowflakeId();
                        if (project.ID < 1)
                        entityProject.ID = db.Insertable(entityProject).ExecuteReturnSnowflakeId();
                        if (entityProject.ID < 1)
                        {
                            db.RollbackTran();
                            return default;
@@ -40,7 +40,7 @@
                    }
                    else
                    {
                        var bol = db.Insertable(project).ExecuteCommand() > 0;
                        var bol = db.Insertable(entityProject).ExecuteCommand() > 0;
                        if (!bol)
                        {
                            db.RollbackTran();
@@ -48,30 +48,33 @@
                        }
                    }
                    if (site != null)
                    if (entityProjectSiteList != null && entityProjectSiteList.Count > 0)
                    {
                        site.ProjectID = project.ID;
                        if (site.ID < 1)
                        foreach (var entityProjectSite in entityProjectSiteList)
                        {
                            site.ID = db.Insertable(site).ExecuteReturnSnowflakeId();
                            if (site.ID < 1)
                            entityProjectSite.ProjectID = entityProject.ID;
                            if (entityProjectSite.ID < 1)
                            {
                                db.RollbackTran();
                                return default;
                                entityProjectSite.ID = db.Insertable(entityProjectSite).ExecuteReturnSnowflakeId();
                                if (entityProjectSite.ID < 1)
                                {
                                    db.RollbackTran();
                                    return default;
                                }
                            }
                        }
                        else
                        {
                            var bol = db.Insertable(site).ExecuteCommand() >= 0;
                            if (!bol)
                            else
                            {
                                db.RollbackTran();
                                return default;
                                var bol = db.Insertable(entityProjectSite).ExecuteCommand() >= 0;
                                if (!bol)
                                {
                                    db.RollbackTran();
                                    return default;
                                }
                            }
                        }
                    }
                    return project.ID;
                    db.CommitTran();
                    return entityProject.ID;
                }
                catch
                {
@@ -84,13 +87,13 @@
        /// <summary>
        /// 编辑拓展
        /// </summary>
        public bool UpdateEx(Entity.XhsProject project, Entity.XhsProjectSite site)
        public bool UpdateEx(Entity.XhsProject entityProject, List<Entity.XhsProjectSite> entityProjectSiteList)
        {
            if (project == null)
            if (entityProject == null)
            {
                return false;
            }
            if (project.ID < 1)
            if (entityProject.ID < 1)
            {
                return false;
            }
@@ -99,27 +102,31 @@
                try
                {
                    db.BeginTran();
                    var bol = db.Updateable(project).ExecuteCommandHasChange();
                    var bol = db.Updateable(entityProject).ExecuteCommandHasChange();
                    if (!bol)
                    {
                        db.RollbackTran();
                        return false;
                    }
                    if (site != null)
                    if (entityProjectSiteList != null && entityProjectSiteList.Count > 0)
                    {
                        site.ProjectID = project.ID;
                        if (site.ID < 1)
                        foreach (var entityProjectSite in entityProjectSiteList)
                        {
                            db.RollbackTran();
                            return false;
                        }
                        bol = db.Updateable(site).ExecuteCommandHasChange();
                        if (!bol)
                        {
                            db.RollbackTran();
                            return false;
                            entityProjectSite.ProjectID = entityProject.ID;
                            if (entityProjectSite.ID < 1)
                            {
                                db.RollbackTran();
                                return false;
                            }
                            bol = db.Updateable(entityProjectSite).ExecuteCommandHasChange();
                            if (!bol)
                            {
                                db.RollbackTran();
                                return false;
                            }
                        }
                    }
                    db.CommitTran();
                    return true;
                }
                catch