duheng
2024-09-09 c04ea620c30dd8c54ece14b9f788684f0de5a0cc
增加sqllite库
已修改2个文件
已添加12个文件
669 ■■■■■ 文件已修改
Service/HStation.Service.Assets.Core/04-dal/03-sqlite/PumpGroup.cs 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Assets.Core/04-dal/03-sqlite/PumpMain.cs 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Assets.Core/04-dal/03-sqlite/PumpMainAndPartMap.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Assets.Core/04-dal/03-sqlite/PumpMapGroupAndMain.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Assets.Core/04-dal/03-sqlite/PumpPart.cs 159 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Assets.Core/04-dal/03-sqlite/PumpPropContent.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Assets.Core/04-dal/03-sqlite/PumpSeries.cs 122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Assets.Core/04-dal/03-sqlite/PumpType.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Assets.Core/04-dal/03-sqlite/PumpTypeSeriesMap.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Assets.Core/HStation.Service.Assets.Core.csproj 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Organize.Core/04-dal/03-sqlite/EmployeeMain.cs 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Organize.Core/04-dal/03-sqlite/LoginUserMain.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Organize.Core/04-dal/03-sqlite/UserLoginMap.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/03-mgr/XhsProjectMgrPage.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Assets.Core/04-dal/03-sqlite/PumpGroup.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,79 @@
using Yw.DAL.SQLite;
namespace HStation.DAL.SQLite
{
    /// <summary>
    ///
    /// </summary>
    public partial class PumpGroup : BaseDAL_Paras_Flags_TagName_Sorter<Entity.PumpGroup>, IPumpGroup
    {
        /// <summary>
        ///
        /// </summary>
        public override ConnectionConfig ConnectionConfig
        {
            get { return Assets.ConfigHelper.PostgreSqlConnectionConfig; }
        }
        //删除拓展
        public bool DeleteEx(long ID)
        {
            if (ID < 0)
            {
                return default;
            }
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                try
                {
                    db.BeginTran();
                    var group = db.Queryable<Entity.PumpGroup>().ToList().Find(x => x.ID == ID);
                    var groupresult = db.Deleteable(group).ExecuteCommand() > 0;
                    if (!groupresult)
                    {
                        db.RollbackTran();
                        return default;
                    }
                    else
                    {
                        var idlist = db.Queryable<Entity.PumpGroupAndMainMap>()
                        .Where(x => x.PumpGroupID == group.ID)
                        .Select(x => x.PumpMainID) // å‡è®¾ PumpGroupID æ˜¯ä¸Ž PumpMain å…³è”的外键
                        .ToList();
                        var main = db.Queryable<Entity.PumpGroupAndMainMap>()
                       .Where(x => x.PumpGroupID == group.ID)
                        .ToList();
                        if (main.Count > 0)
                        {
                            var Modelresult = db.Deleteable(main).ExecuteCommand() > 0;
                            if (!Modelresult)
                            {
                                db.RollbackTran();
                                return default;
                            }
                            else
                            {
                                var Map = db.Queryable<Entity.PumpMain>().ToList();
                                var Mapresult = db.Deleteable<Entity.PumpMain>()
                                .In(x => x.ID, idlist)
                                .ExecuteCommand() > 0;
                                if (!Mapresult)
                                {
                                    db.RollbackTran();
                                    return default;
                                }
                            }
                        }
                    }
                    db.CommitTran();
                    return groupresult;
                }
                catch (Exception ex)
                {
                    db.RollbackTran();
                    throw;
                }
            }
        }
    }
}
Service/HStation.Service.Assets.Core/04-dal/03-sqlite/PumpMain.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,103 @@
using Yw.DAL.SQLite;
namespace HStation.DAL.SQLite
{
    /// <summary>
    ///
    /// </summary>
    public partial class PumpMain : BaseDAL_Paras_Flags_TagName_Sorter<Entity.PumpMain>, IPumpMain
    {
        /// <summary>
        ///
        /// </summary>
        public override ConnectionConfig ConnectionConfig
        {
            get { return Assets.ConfigHelper.PostgreSqlConnectionConfig; }
        }
        //删除拓展
        public bool DeleteEx(long ID)
        {
            if (ID <= 0)
            {
                return default;
            }
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                try
                {
                    db.BeginTran();
                    var main = db.Queryable<Entity.PumpMain>().ToList().Find(x => x.ID == ID);
                    var result = db.Deleteable(main).ExecuteCommand() > 0;
                    if (!result)
                    {
                        db.RollbackTran();
                        return default;
                    }
                    else
                    {
                        var map = db.Queryable<Entity.PumpGroupAndMainMap>().ToList().Find(x => x.PumpMainID == ID);
                        if (map != null)
                        {
                            var mapresult = db.Deleteable(map).ExecuteCommand() > 0;
                            if (!mapresult)
                            {
                                db.RollbackTran();
                                return default;
                            }
                        }
                    }
                    db.CommitTran();
                    return true;
                }
                catch (Exception ex)
                {
                    db.RollbackTran();
                    throw;
                }
            }
        }
        //插入拓展
        public long InsertsEx(Entity.PumpMain pumpMain, Entity.PumpGroupAndMainMap pumpGroupAndMainMap)
        {
            if (pumpMain == null)
            {
                return default;
            }
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                try
                {
                    db.BeginTran();
                    var result = db.Insertable(pumpMain).ExecuteReturnSnowflakeId();
                    if (result < 0)
                    {
                        db.RollbackTran();
                        return default;
                    }
                    else
                    {
                        if (pumpGroupAndMainMap != null)
                        {
                            pumpGroupAndMainMap.PumpMainID = result;
                            var mapresult = db.Insertable(pumpGroupAndMainMap).ExecuteReturnSnowflakeId();
                            if (mapresult < 0)
                            {
                                db.RollbackTran();
                                return default;
                            }
                        }
                    }
                    db.CommitTran();
                    return result;
                }
                catch (Exception ex)
                {
                    db.RollbackTran();
                    throw;
                }
            }
        }
    }
}
Service/HStation.Service.Assets.Core/04-dal/03-sqlite/PumpMainAndPartMap.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
using Yw.DAL.SQLite;
namespace HStation.DAL.SQLite
{
    /// <summary>
    ///
    /// </summary>
    public partial class PumpMainAndPartMap : BaseDAL<Entity.PumpMainAndPartMap>, IPumpMainAndPartMap
    {
        /// <summary>
        ///
        /// </summary>
        public override ConnectionConfig ConnectionConfig
        {
            get { return Assets.ConfigHelper.PostgreSqlConnectionConfig; }
        }
    }
}
Service/HStation.Service.Assets.Core/04-dal/03-sqlite/PumpMapGroupAndMain.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
using Yw.DAL.SQLite;
namespace HStation.DAL.SQLite
{
    /// <summary>
    ///
    /// </summary>
    public partial class PumpGroupAndMainMap : BaseDAL_Paras_Flags_TagName<Entity.PumpGroupAndMainMap>, IPumpGroupAndMainMap
    {
        /// <summary>
        ///
        /// </summary>
        public override ConnectionConfig ConnectionConfig
        {
            get { return Assets.ConfigHelper.PostgreSqlConnectionConfig; }
        }
    }
}
Service/HStation.Service.Assets.Core/04-dal/03-sqlite/PumpPart.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,159 @@
using Yw.DAL.SQLite;
namespace HStation.DAL.SQLite
{
    /// <summary>
    ///
    /// </summary>
    public partial class PumpPartMain : BaseDAL_Sorter<Entity.PumpPartMain>, IPumpPartMain
    {
        /// <summary>
        ///
        /// </summary>
        public override ConnectionConfig ConnectionConfig
        {
            get { return Assets.ConfigHelper.PostgreSqlConnectionConfig; }
        }
        //插入拓展
        public long InsertsEx(Entity.PumpPartMain part, List<Entity.PumpPropContent> pumpPropContents, Entity.PumpMainAndPartMap partmap)
        {
            if (part == null)
            {
                return default;
            }
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                try
                {
                    db.BeginTran();
                    var result = db.Insertable(part).ExecuteReturnSnowflakeId();
                    if (result < 0)
                    {
                        db.RollbackTran();
                        return default;
                    }
                    else
                    {
                        if (partmap != null)
                        {
                            partmap.PumpPartID = result;
                            var mainandpartmap = db.Insertable(partmap).ExecuteReturnSnowflakeId();
                            if (mainandpartmap < 0)
                            {
                                db.RollbackTran();
                                return default;
                            }
                            else
                            {
                                if (pumpPropContents != null)
                                {
                                    foreach (var item in pumpPropContents)
                                    {
                                        item.PartID = result;
                                    }
                                    var content = db.Insertable(pumpPropContents).ExecuteReturnSnowflakeId();
                                    if (content < 0)
                                    {
                                        db.RollbackTran();
                                        return default;
                                    }
                                }
                            }
                        }
                    }
                    db.CommitTran();
                    return result;
                }
                catch (Exception ex)
                {
                    db.RollbackTran();
                    throw;
                }
            }
        }
        //编辑拓展
        public bool UpdateEx(Entity.PumpPartMain part, List<Entity.PumpPropContent> pumpPropContents)
        {
            if (part == null)
            {
                return default;
            }
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                try
                {
                    db.BeginTran();
                    var result = db.Updateable(part).ExecuteCommandHasChange();
                    if (!result)
                    {
                        db.RollbackTran();
                        return default;
                    }
                    else
                    {
                        if (pumpPropContents != null)
                        {
                            var propresult = db.Updateable(pumpPropContents).ExecuteCommandHasChange();
                            if (!propresult)
                            {
                                db.RollbackTran();
                                return default;
                            }
                        }
                    }
                    db.CommitTran();
                    return result;
                }
                catch (Exception ex)
                {
                    db.RollbackTran();
                    throw;
                }
            }
        }
        //删除拓展 (删除产品表及属性表)
        public bool DeleteEx(Entity.PumpPartMain part, List<Entity.PumpPropContent> pumpPropContents)
        {
            if (part == null)
            {
                return default;
            }
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                try
                {
                    db.BeginTran();
                    var result = db.Deleteable(part).ExecuteCommand() > 0;
                    if (!result)
                    {
                        db.RollbackTran();
                        return default;
                    }
                    else
                    {
                        if (pumpPropContents != null)
                        {
                            var propresult = db.Deleteable(pumpPropContents).ExecuteCommand() > 0;
                            if (!propresult)
                            {
                                db.RollbackTran();
                                return default;
                            }
                        }
                    }
                    db.CommitTran();
                    return result;
                }
                catch (Exception ex)
                {
                    db.RollbackTran();
                    throw;
                }
            }
        }
    }
}
Service/HStation.Service.Assets.Core/04-dal/03-sqlite/PumpPropContent.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
using Yw.DAL.SQLite;
namespace HStation.DAL.SQLite
{
    /// <summary>
    ///
    /// </summary>
    public partial class PumpPropContent : BaseDAL<Entity.PumpPropContent>, IPumpPropContent
    {
        /// <summary>
        ///
        /// </summary>
        public override ConnectionConfig ConnectionConfig
        {
            get { return Assets.ConfigHelper.PostgreSqlConnectionConfig; }
        }
    }
}
Service/HStation.Service.Assets.Core/04-dal/03-sqlite/PumpSeries.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,122 @@
using Yw.DAL.SQLite;
namespace HStation.DAL.SQLite
{
    /// <summary>
    ///
    /// </summary>
    public partial class PumpSeries : BaseDAL_Paras_Flags_TagName_Sorter_UseStatus<Entity.PumpSeries>, IPumpSeries
    {
        /// <summary>
        ///
        /// </summary>
        public override ConnectionConfig ConnectionConfig
        {
            get { return Assets.ConfigHelper.PostgreSqlConnectionConfig; }
        }
        //删除拓展
        public bool DeleteEx(long ID)
        {
            if (ID < 0)
            {
                return default;
            }
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                try
                {
                    db.BeginTran();
                    var project = db.Queryable<Entity.PumpSeries>().ToList().Find(x => x.ID == ID);
                    var result = db.Deleteable(project).ExecuteCommand() > 0;
                    if (!result)
                    {
                        db.RollbackTran();
                        return default;
                    }
                    else
                    {
                        var group = db.Queryable<Entity.PumpGroup>().ToList().Find(x => x.PumpSeriesID == project.ID);
                        if (group != null)
                        {
                            var groupresult = db.Deleteable(group).ExecuteCommand() > 0;
                            if (!groupresult)
                            {
                                db.RollbackTran();
                                return default;
                            }
                            else
                            {
                                var map = db.Queryable<Entity.PumpGroupAndMainMap>()
                                .Where(x => x.PumpGroupID == group.ID)
                                 .ToList();
                                var listid = db.Queryable<Entity.PumpGroupAndMainMap>()
                                .Where(x => x.PumpGroupID == group.ID)
                                .Select(x => x.PumpMainID)
                                .ToList();
                                if (map.Count > 0)
                                {
                                    var Modelresult = db.Deleteable(map).ExecuteCommand() > 0;
                                    if (!Modelresult)
                                    {
                                        db.RollbackTran();
                                        return default;
                                    }
                                    else
                                    {
                                        var main = db.Queryable<Entity.PumpMain>().ToList();
                                        foreach (var item in main)
                                        {
                                            if (item.PumpSeriesID == project.ID)
                                            {
                                                listid.Add(item.ID);
                                            }
                                        }
                                        var mainresult = db.Deleteable<Entity.PumpMain>()
                                        .In(x => x.ID, listid)
                                        .ExecuteCommand() > 0;
                                        if (!mainresult)
                                        {
                                            db.RollbackTran();
                                            return default;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            var listid = new List<long>();
                            var main = db.Queryable<Entity.PumpMain>().ToList();
                            foreach (var item in main)
                            {
                                if (item.PumpSeriesID == project.ID)
                                {
                                    listid.Add(item.ID);
                                }
                            }
                            if (listid.Count > 0)
                            {
                                var mainresult = db.Deleteable<Entity.PumpMain>()
                                .In(x => x.ID, listid)
                                .ExecuteCommand() > 0;
                                if (!mainresult)
                                {
                                    db.RollbackTran();
                                    return default;
                                }
                            }
                        }
                        db.CommitTran();
                        return result;
                    }
                }
                catch (Exception ex)
                {
                    db.RollbackTran();
                    throw;
                }
            }
        }
    }
}
Service/HStation.Service.Assets.Core/04-dal/03-sqlite/PumpType.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
using Yw.DAL.SQLite;
namespace HStation.DAL.SQLite
{
    /// <summary>
    ///
    /// </summary>
    public partial class PumpType : BaseDAL_Sorter<Entity.PumpType>, IPumpType
    {
        /// <summary>
        ///
        /// </summary>
        public override ConnectionConfig ConnectionConfig
        {
            get { return Assets.ConfigHelper.PostgreSqlConnectionConfig; }
        }
    }
}
Service/HStation.Service.Assets.Core/04-dal/03-sqlite/PumpTypeSeriesMap.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
using Yw.DAL.SQLite;
namespace HStation.DAL.SQLite
{
    /// <summary>
    ///
    /// </summary>
    public partial class PumpTypeSeriesMap : BaseDAL_Sorter<Entity.PumpTypeSeriesMap>, IPumpTypeSeriesMap
    {
        /// <summary>
        ///
        /// </summary>
        public override ConnectionConfig ConnectionConfig
        {
            get { return Assets.ConfigHelper.PostgreSqlConnectionConfig; }
        }
    }
}
Service/HStation.Service.Assets.Core/HStation.Service.Assets.Core.csproj
@@ -13,10 +13,6 @@
  </ItemGroup>
  <ItemGroup>
    <Folder Include="04-dal\03-sqlite\" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Yw.Service.Basic.Core" Version="3.2.8" />
  </ItemGroup>
Service/HStation.Service.Organize.Core/04-dal/03-sqlite/EmployeeMain.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,73 @@
using Yw.DAL.SQLite;
namespace HStation.DAL.SQLite
{
    /// <summary>
    ///
    /// </summary>:
    public partial class EmployeeMain : BaseDAL_Paras_Flags_TagName_Sorter<Entity.EmployeeMain>, IEmployeeMain
    {
        /// <summary>
        ///
        /// </summary>
        public override ConnectionConfig ConnectionConfig
        {
            get { return Organize.ConfigHelper.PostgreSqlConnectionConfig; }
        }
        //插入拓展
        public long InsertEx(Entity.EmployeeMain employeeMain, Entity.UserLoginAccount userLogin, Entity.UserLoginMap loginmap)
        {
            if (employeeMain == null)
            {
                return default;
            }
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                try
                {
                    db.BeginTran();
                    employeeMain.AddTime = DateTime.Now.ToString();
                    var result = db.Insertable(employeeMain).ExecuteReturnSnowflakeId();
                    if (result < 0)
                    {
                        db.RollbackTran();
                        return default;
                    }
                    else
                    {
                        if (userLogin != null)
                        {
                            userLogin.CreateTime = DateTime.Now.ToString();
                            var logjinresult = db.Insertable(userLogin).ExecuteReturnSnowflakeId();
                            if (logjinresult < 0)
                            {
                                db.RollbackTran();
                                return default;
                            }
                            else
                            {
                                loginmap.LoginID = logjinresult;
                                loginmap.ObjectID = result;
                                loginmap.ObjectType = 0;
                                var mapresult = db.Insertable(loginmap).ExecuteReturnSnowflakeId();
                                if (mapresult < 0)
                                {
                                    db.RollbackTran();
                                    return default;
                                }
                            }
                        }
                    }
                    db.CommitTran();
                    return result;
                }
                catch (Exception ex)
                {
                    db.RollbackTran();
                    throw;
                }
            }
        }
    }
}
Service/HStation.Service.Organize.Core/04-dal/03-sqlite/LoginUserMain.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
using Yw.DAL.SQLite;
namespace HStation.DAL.SQLite
{
    /// <summary>
    ///
    /// </summary>:
    public partial class LoginUserMain : BaseDAL<Entity.UserLoginAccount>, ILoginUserMain
    {
        /// <summary>
        ///
        /// </summary>
        public override ConnectionConfig ConnectionConfig
        {
            get { return Organize.ConfigHelper.PostgreSqlConnectionConfig; }
        }
    }
}
Service/HStation.Service.Organize.Core/04-dal/03-sqlite/UserLoginMap.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
using Yw.DAL.SQLite;
namespace HStation.DAL.SQLite
{
    /// <summary>
    ///
    /// </summary>:
    public partial class UserLoginMap : BaseDAL<Entity.UserLoginMap>, IUserLoginMap
    {
        /// <summary>
        ///
        /// </summary>
        public override ConnectionConfig ConnectionConfig
        {
            get { return Organize.ConfigHelper.PostgreSqlConnectionConfig; }
        }
    }
}
WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/03-mgr/XhsProjectMgrPage.cs
@@ -21,7 +21,8 @@
            this.Load += XhsProjectMgrPage_Load;
        }
        private void XhsProjectMgrPage_Load(object sender, EventArgs e)
        private void XhsProjectMgrPage_Load
            (object sender, EventArgs e)
        {
            repositoryItemImageComboBox1.Items.AddEnum(typeof(XhsProjectMgrViewModel.eFileStatus));
            var a = typeof(XhsProjectMgrViewModel.eFileStatus);