devin.zhu@doverfs.com 1 год назад
Родитель
Сommit
87216eb9f0

+ 43 - 8
src/XF.Common.Api/Pages/GasStation/Index.razor

@@ -21,6 +21,25 @@
                   RequiredMark=@ChosenRequiredMark>
                 <Row>
                     <GridCol Span="8">
+
+                        @*  <Select Mode="multiple"
+                        DataSource="@SelectParbu"
+                        @bind-Values="@context.ParentName"
+                        LabelName="@nameof(SiteListVm.Bu_Name)"
+                        ValueName="@nameof(SiteListVm.Bu_Name)">
+                        </Select> *@
+                        @*  <Select @bind-Value="@context.ParentName"
+                        TItemValue="string"
+                        TItem="string"
+                        DefaultActiveFirstOption="false"
+                        Placeholder="Select an option and the input above will be changed">
+                        <SelectOptions>
+                        @foreach (var item in SelectParbu)
+                        {
+                        <SelectOption TItemValue="string" TItem="string" Value="@(item.Business_unit_info_id)" Label="@item.Bu_Name" />
+                        }
+                        </SelectOptions>
+                        </Select> *@
                         <FormItem Label="集团名称" Required>
                             <Input @bind-Value="@context.ParentName" />
                         </FormItem>
@@ -115,7 +134,7 @@
                         </FormItem>
                     </GridCol>
                 </Row>
-                <Row><GridCol Span="4"></GridCol>  <GridCol Span="4"><Button Size="@_size" Type="primary" Disabled="save_load" Style="width:260px;" Loading="@save_load"  OnClick="Save">生成新站</Button></GridCol><GridCol Span="2"></GridCol> <GridCol Span="4"><Button Size="@_size" Type="primary" Style="width:260px;">配置FCC</Button></GridCol></Row>
+                <Row><GridCol Span="4"></GridCol>  <GridCol Span="4"><Button Size="@_size" Type="primary" Disabled="save_load" Style="width:260px;" Loading="@save_load" OnClick="Save">生成新站</Button></GridCol><GridCol Span="2"></GridCol> <GridCol Span="4"><Button Size="@_size" Type="primary" Style="width:260px;">配置FCC</Button></GridCol></Row>
             </Form>
         </Card>
     </ChildContent>
@@ -156,19 +175,31 @@
     bool pro_main = true;
     bool wx = true;
     bool fccAccount = true;
-
+    IEnumerable<SiteListVm> SelectParbu = new List<SiteListVm>();
     //注入需要调用后端的业务方法
     [Inject] ISiteServer server { get; set; }
 
     //商品基础对象
     Dictionary<string, bool> checkProducts = new();
 
+
+    protected override void OnInitialized()
+    {
+
+        base.OnInitialized();
+
+    }
     private SiteSaveVm model = new SiteSaveVm()
         {
             BaseProduct = true
         };
 
 
+    private void OnGenderChanged(string gender)
+    {
+
+    }
+
     /// <summary>
     /// 获取页面Check box 选中赋值
     /// </summary>
@@ -205,15 +236,19 @@
         }
     }
 
+    public void init()
+    {
+
+    }
+
     /// <summary>
     /// 站点新增保存
     /// </summary>
     public void Save()
     {
-       save_load = true;
-       SetcheckBox(model);
-       server.SaveSite(model);
-       save_load = false;
+        save_load = true;
+        SetcheckBox(model);
+        server.SaveSite(model);
+        save_load = false;
     }
-}
-
+}

+ 1 - 1
src/XF.Common.Api/Server/Core/Model/BusinessUnitInfo.cs → src/XF.Common.Api/Server/Core/Model/Business_unit_info.cs

@@ -6,7 +6,7 @@ namespace XF.Common.Core.Model
     /// BU实体
     /// </summary>
     [Table("BusinessUnitInfo")]
-    public class BusinessUnitInfo
+    public class Business_unit_info
     {
         /// <summary>
         /// Id

+ 6 - 1
src/XF.Common.Api/Server/Core/Options/ConnectionOption.cs

@@ -11,10 +11,15 @@ namespace XF.Common.Core.Options
         /// <summary>
         /// sqlite连接字符串
         /// </summary>
-        public static string Sqlite { get; set; }
+        public static string FCCSqlite { get; set; }
         /// <summary>
         /// pg链接字符串
         /// </summary>
         public static string Postgres { get; set; }
+
+        /// <summary>
+        /// pg链接字符串
+        /// </summary>
+        public static string MysqlAccounting { get; set; }
     }
 }

+ 1 - 1
src/XF.Common.Api/Server/Core/Repositories/IBusinessUnitInfoReponse.cs

@@ -6,7 +6,7 @@ namespace XF.Common.Server.Core.Repositories
     /// <summary>
     /// bu info
     /// </summary>
-    public interface IBusinessUnitInfoReponse : IRepository<BusinessUnitInfo>
+    public interface IBusiness_unit_infoReponse : IRepository<Business_unit_info>
     {
         Task<object> GetObject();
     }

+ 4 - 3
src/XF.Common.Api/Server/Core/VM/GasStation/SiteListVm.cs

@@ -8,16 +8,17 @@
         /// <summary>
         /// 父集站点
         /// </summary>
-        public Guid ParBuid { get; set; }
+        public string Parent_bu_id { get; set; }
 
         /// <summary>
         /// buid
         /// </summary>
-        public Guid Buid { get; set; }
+        public string Business_unit_info_id { get; set; }
 
         /// <summary>
         /// 站点名称
         /// </summary>
-        public string Name { get; set; }
+        public string Bu_Name { get; set; }
+
     }
 }

+ 2 - 2
src/XF.Common.Api/Server/Repositories/Mysql/AccountDB/AccountingDbContext.cs

@@ -11,7 +11,7 @@ namespace ThaiOK.Inventory.Context
         {
         }
 
-        public DbSet<BusinessUnitInfo> Sites { get; set; }
+        public DbSet<Business_unit_info> Sites { get; set; }
 
         //public DbSet<User> Users { get; set; }
 
@@ -21,7 +21,7 @@ namespace ThaiOK.Inventory.Context
         {
             base.OnModelCreating(modelBuilder);
 
-            modelBuilder.Entity<BusinessUnitInfo>(e =>
+            modelBuilder.Entity<Business_unit_info>(e =>
             {
                 //e.Property(p => p.Options).HasConversion(
                 //        v => v.ToJson(),

+ 517 - 0
src/XF.Common.Api/Server/Repositories/Mysql/AccountDB/AccountingRepository.cs

@@ -0,0 +1,517 @@
+using SqlSugar;
+using System.Linq.Expressions;
+using XF.Common.Core;
+using XF.Common.Map;
+
+
+namespace XF.Common.Repositories.Base
+{
+    public class AccountingRepository<T> :  SimpleClient<T> where T : class   ,new()
+    {
+        public AccountingRepository(ISqlSugarClient context = null) : base(context)//注意这里要有默认值等于null
+        {
+            if (context == null)
+            {
+            }
+            //Sqlite.DbMaintenance.CreateDatabase();
+            //Sqlite.CodeFirst.InitTables(typeof(CodeFirstTable1));
+        }
+
+        //注意:如果使用Client不能写成静态的,Scope并发更高
+        public static SqlSugarScope Sqlite = SqlSugarHelper.PGSqlite;
+
+        public SimpleClient<T> CurrentDb
+        { get { return new SimpleClient<T>(Sqlite); } }//用来处理T表的常用操作
+
+        #region 通用方法
+
+        public virtual SqlSugarScope GetDB()
+        {
+            return Sqlite;
+        }
+
+        /// <summary>
+        /// 获取所有list
+        /// </summary>
+        /// <returns></returns>
+        public virtual List<T> GetList()
+        {
+            return CurrentDb.GetList();
+        }
+
+        /// <summary>
+        /// 获取所有list-异步
+        /// </summary>
+        /// <returns></returns>
+        public virtual async Task<List<T>> GetListAsync()
+        {
+            return await CurrentDb.GetListAsync();
+        }
+
+        /// <summary>
+        /// 根据lambda查询
+        /// </summary>
+        /// <param name="whereExpression"></param>
+        /// <returns></returns>
+        public virtual List<T> GetList(Expression<Func<T, bool>> whereExpression)
+        {
+            return CurrentDb.GetList(whereExpression);
+        }
+
+        /// <summary>
+        /// 根据lambda查询-异步
+        /// </summary>
+        /// <param name="whereExpression"></param>
+        /// <returns></returns>
+        public virtual async Task<List<T>> GetListAsync(Expression<Func<T, bool>> whereExpression)
+        {
+            return await CurrentDb.GetListAsync(whereExpression);
+        }
+
+        /// <summary>
+        /// 根据lambda表达式获取数量
+        /// </summary>
+        /// <param name="whereExpression"></param>
+        /// <returns></returns>
+        public virtual int Count(Expression<Func<T, bool>> whereExpression)
+        {
+            return CurrentDb.Count(whereExpression);
+        }
+
+        /// <summary>
+        /// 根据lambda表达式获取数量-异步
+        /// </summary>
+        /// <param name="whereExpression"></param>
+        /// <returns></returns>
+        public virtual async Task<int> CountAsync(Expression<Func<T, bool>> whereExpression)
+        {
+            return await CurrentDb.CountAsync(whereExpression);
+        }
+
+        /// <summary>
+        /// 获取分页
+        /// </summary>
+        /// <param name="whereExpression"></param>
+        /// <param name="page"></param>
+        /// <returns></returns>
+        public virtual PageList<T> GetPageList(Expression<Func<T, bool>> whereExpression, PageModel page)
+        {
+            PageList<T> list = new PageList<T>();
+            list.List = CurrentDb.GetPageList(whereExpression, page);
+            list.PageIndex = page.PageIndex;
+            list.PageSize = page.PageSize;
+            list.TotalCount = page.TotalCount;
+            return list;
+        }
+
+        public virtual PageList<P> GetPageList<P>(Expression<Func<T, bool>> whereExpression, PageModel page)
+        {
+            var result = CurrentDb.GetPageList(whereExpression, page);
+            var pageData = new PageList<P>
+            {
+                TotalCount = page.TotalCount,
+                PageIndex = page.PageIndex,
+                PageSize = page.PageSize,
+                List = result.ToDTOList<P>()
+            };
+            return pageData;
+        }
+
+        /// <summary>
+        /// 获取分页-异步
+        /// </summary>
+        /// <param name="whereExpression"></param>
+        /// <param name="page"></param>
+        /// <returns></returns>
+        public virtual async Task<PageList<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, PageModel page)
+        {
+            PageList<T> list = new PageList<T>();
+            list.List = await CurrentDb.GetPageListAsync(whereExpression, page);
+            list.PageIndex = page.PageIndex;
+            list.PageSize = page.PageSize;
+            list.TotalCount = page.TotalCount;
+            return list;
+        }
+
+        public virtual async Task<PageList<P>> GetPageListAsync<P>(Expression<Func<T, bool>> whereExpression, PageModel page)
+        {
+            var result = await CurrentDb.GetPageListAsync(whereExpression, page);
+            var pageData = new PageList<P>
+            {
+                TotalCount = page.TotalCount,
+                PageIndex = page.PageIndex,
+                PageSize = page.PageSize,
+                List = result.ToDTOList<P>()
+            };
+            return pageData;
+        }
+
+        public virtual PageList<T> GetPageList(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc)
+        {
+            PageList<T> list = new PageList<T>();
+            list.List = CurrentDb.GetPageList(whereExpression, page, orderByExpression, orderByType);
+            list.PageIndex = page.PageIndex;
+            list.PageSize = page.PageSize;
+            list.TotalCount = page.TotalCount;
+            return list;
+        }
+
+        public virtual async Task<PageList<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc)
+        {
+            PageList<T> list = new PageList<T>();
+            list.List = await CurrentDb.GetPageListAsync(whereExpression, page, orderByExpression, orderByType);
+            list.PageIndex = page.PageIndex;
+            list.PageSize = page.PageSize;
+            list.TotalCount = page.TotalCount;
+            return list;
+        }
+
+        public virtual PageList<P> GetPageList<P>(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc)
+        {
+            var result = CurrentDb.GetPageList(whereExpression, page, orderByExpression, orderByType);
+            var pageData = new PageList<P>
+            {
+                TotalCount = page.TotalCount,
+                PageIndex = page.PageIndex,
+                PageSize = page.PageSize,
+                List = result.ToDTOList<P>()
+            };
+            return pageData;
+        }
+
+        public virtual async Task<PageList<P>> GetPageListAsync<P>(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc)
+        {
+            var result = await CurrentDb.GetPageListAsync(whereExpression, page, orderByExpression, orderByType);
+            var pageData = new PageList<P>
+            {
+                TotalCount = page.TotalCount,
+                PageIndex = page.PageIndex,
+                PageSize = page.PageSize,
+                List = result.ToDTOList<P>()
+            };
+            return pageData;
+        }
+
+        public virtual PageList<T> GetPageList(List<IConditionalModel> conditionalList, PageModel page)
+        {
+            PageList<T> list = new PageList<T>();
+            list.List = CurrentDb.GetPageList(conditionalList, page);
+            list.PageIndex = page.PageIndex;
+            list.PageSize = page.PageSize;
+            list.TotalCount = page.TotalCount;
+            return list;
+        }
+
+        public virtual async Task<PageList<T>> GetPageListAsync(List<IConditionalModel> conditionalList, PageModel page)
+        {
+            PageList<T> list = new PageList<T>();
+            list.List = await CurrentDb.GetPageListAsync(conditionalList, page);
+            list.PageIndex = page.PageIndex;
+            list.PageSize = page.PageSize;
+            list.TotalCount = page.TotalCount;
+            return list;
+        }
+
+        public virtual PageList<T> GetPageList(List<IConditionalModel> conditionalList, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc)
+        {
+            PageList<T> list = new PageList<T>();
+            list.List = CurrentDb.GetPageList(conditionalList, page, orderByExpression, orderByType);
+            list.PageIndex = page.PageIndex;
+            list.PageSize = page.PageSize;
+            list.TotalCount = page.TotalCount;
+            return list;
+        }
+
+        public virtual async Task<PageList<T>> GetPageListAsync(List<IConditionalModel> conditionalList, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc)
+        {
+            PageList<T> list = new PageList<T>();
+            list.List = await CurrentDb.GetPageListAsync(conditionalList, page, orderByExpression, orderByType);
+            list.PageIndex = page.PageIndex;
+            list.PageSize = page.PageSize;
+            list.TotalCount = page.TotalCount;
+            return list;
+        }
+
+        /// <summary>
+        /// 根据id获取实体
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public virtual T GetById(dynamic id)
+        {
+            return CurrentDb.GetById(id);
+        }
+
+        /// <summary>
+        /// 根据id获取实体-异步
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public virtual async Task<T> GetByIdAsync(dynamic id)
+        {
+            return await CurrentDb.GetByIdAsync(id);
+        }
+
+        /// <summary>
+        /// 根据lambda获取单个对象 (注意,需要确保唯一,如果获取到2个会报错,这种场景需要使用GetFirst)
+        /// </summary>
+        /// <param name="whereExpression"></param>
+        /// <returns></returns>
+        public virtual T GetSingle(Expression<Func<T, bool>> whereExpression)
+        {
+            return CurrentDb.GetSingle(whereExpression); //Db.Queryable<T>().First(whereExpression);
+        }
+
+        /// <summary>
+        /// 根据lambda获取单个对象-异步  (注意,需要确保唯一,如果获取到2个会报错,这种场景需要使用GetFirst)
+        /// </summary>
+        /// <param name="whereExpression"></param>
+        /// <returns></returns>
+        public virtual async Task<T> GetSingleAsync(Expression<Func<T, bool>> whereExpression)
+        {
+            return await CurrentDb.GetSingleAsync(whereExpression); //await Db.Queryable<T>().FirstAsync(whereExpression);
+        }
+
+        /// <summary>
+        /// 根据lambda获取单个对象
+        /// </summary>
+        /// <param name="whereExpression"></param>
+        /// <returns></returns>
+        public virtual T GetFirst(Expression<Func<T, bool>> whereExpression)
+        {
+            return GetDB().Queryable<T>().First(whereExpression);
+        }
+
+        /// <summary>
+        /// 根据lambda获取单个对象 --异步
+        /// </summary>
+        /// <param name="whereExpression"></param>
+        /// <returns></returns>
+        public virtual async Task<T> GetFirstAsync(Expression<Func<T, bool>> whereExpression)
+        {
+            return await GetDB().Queryable<T>().FirstAsync(whereExpression);
+        }
+
+        /// <summary>
+        /// 实体插入
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public virtual bool Insert(T obj)
+        {
+            return CurrentDb.Insert(obj);
+        }
+
+        /// <summary>
+        /// 实体插入-异步
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public virtual async Task<bool> InsertAsync(T obj)
+        {
+            return await CurrentDb.InsertAsync(obj);
+        }
+
+        /// <summary>
+        /// 批量插入
+        /// </summary>
+        /// <param name="objs"></param>
+        /// <returns></returns>
+        public virtual bool InsertRange(List<T> objs)
+        {
+            return CurrentDb.InsertRange(objs);
+        }
+
+        /// <summary>
+        /// 批量插入-异步
+        /// </summary>
+        /// <param name="objs"></param>
+        /// <returns></returns>
+        public virtual async Task<bool> InsertRangeAsync(List<T> objs)
+        {
+            return await CurrentDb.InsertRangeAsync(objs);
+        }
+
+        /// <summary>
+        /// 插入返回自增列
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public virtual int InsertReturnIdentity(T obj)
+        {
+            return CurrentDb.InsertReturnIdentity(obj);
+        }
+
+        /// <summary>
+        /// 插入返回自增列-异步
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public virtual async Task<int> InsertReturnIdentityAsync(T obj)
+        {
+            return await CurrentDb.InsertReturnIdentityAsync(obj);
+        }
+
+        /// <summary>
+        /// 插入返回longid
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public virtual long InsertReturnBigIdentity(T obj)
+        {
+            return CurrentDb.InsertReturnBigIdentity(obj);
+        }
+
+        /// <summary>
+        /// 插入返回longid-异步
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public virtual async Task<long> InsertReturnBigIdentityAsync(T obj)
+        {
+            return await CurrentDb.InsertReturnBigIdentityAsync(obj);
+        }
+
+        /// <summary>
+        /// 批量删除
+        /// </summary>
+        /// <param name="ids"></param>
+        /// <returns></returns>
+        public virtual bool DeleteByIds(dynamic[] ids)
+        {
+            return CurrentDb.DeleteByIds(ids);
+        }
+
+        /// <summary>
+        /// 批量删除-异步
+        /// </summary>
+        /// <param name="ids"></param>
+        /// <returns></returns>
+        public virtual async Task<bool> DeleteByIdsAsync(dynamic[] ids)
+        {
+            return await CurrentDb.DeleteByIdsAsync(ids);
+        }
+
+        /// <summary>
+        /// 根据主键删除
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public virtual bool Delete(dynamic id)
+        {
+            return CurrentDb.DeleteById(id);
+        }
+
+        /// <summary>
+        /// 根据主键删除-异步
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public virtual async Task<bool> DeleteAsync(dynamic id)
+        {
+            return await CurrentDb.DeleteByIdAsync(id);
+        }
+
+        /// <summary>
+        /// 根据实体删除
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public virtual bool Delete(T obj)
+        {
+            return CurrentDb.Delete(obj);
+        }
+
+        /// <summary>
+        /// 根据实体删除-异步
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public virtual async Task<bool> DeleteAsync(T obj)
+        {
+            return await CurrentDb.DeleteAsync(obj);
+        }
+
+        /// <summary>
+        /// 根据表达式删除
+        /// </summary>
+        /// <param name="whereExpression"></param>
+        /// <returns></returns>
+        public virtual bool Delete(Expression<Func<T, bool>> whereExpression)
+        {
+            return CurrentDb.Delete(whereExpression);
+        }
+
+        /// <summary>
+        /// 根据表达式删除-异步
+        /// </summary>
+        /// <param name="whereExpression"></param>
+        /// <returns></returns>
+        public virtual async Task<bool> DeleteAsync(Expression<Func<T, bool>> whereExpression)
+        {
+            return await CurrentDb.DeleteAsync(whereExpression);
+        }
+
+        /// <summary>
+        /// 更新
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public virtual bool Update(T obj)
+        {
+            return CurrentDb.Update(obj);
+        }
+
+        /// <summary>
+        /// 更新-异步
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public virtual async Task<bool> UpdateAsync(T obj)
+        {
+            return await CurrentDb.UpdateAsync(obj);
+        }
+
+        /// <summary>
+        /// 批量更新
+        /// </summary>
+        /// <param name="objs"></param>
+        /// <returns></returns>
+        public virtual bool UpdateRange(List<T> objs)
+        {
+            return CurrentDb.UpdateRange(objs);
+        }
+
+        /// <summary>
+        /// 批量更新-异步
+        /// </summary>
+        /// <param name="objs"></param>
+        /// <returns></returns>
+        public virtual async Task<bool> UpdateRangeAsync(List<T> objs)
+        {
+            return await CurrentDb.UpdateRangeAsync(objs);
+        }
+
+        /// <summary>
+        /// 是否包含元素
+        /// </summary>
+        /// <param name="whereExpression"></param>
+        /// <returns></returns>
+        public virtual bool IsAny(Expression<Func<T, bool>> whereExpression)
+        {
+            return CurrentDb.IsAny(whereExpression);
+        }
+
+        /// <summary>
+        /// 是否包含元素-异步
+        /// </summary>
+        /// <param name="whereExpression"></param>
+        /// <returns></returns>
+        public virtual async Task<bool> IsAnyAsync(Expression<Func<T, bool>> whereExpression)
+        {
+            return await CurrentDb.IsAnyAsync(whereExpression);
+        }
+
+        #endregion 通用方法
+    }
+}

+ 26 - 0
src/XF.Common.Api/Server/Repositories/Mysql/AccountDB/BusinessUnitInfoReponse.cs

@@ -0,0 +1,26 @@
+using ThaiOK.Inventory.Context;
+using XF.Common.Core;
+using XF.Common.Core.Model;
+using XF.Common.Core.Server;
+using XF.Common.Repositories.Base;
+using XF.Common.Server.Core.Repositories;
+using ServiceLifetime = XF.Common.Core.ServiceLifetime;
+
+namespace XF.Common.Server.Repositories.Mysql.AccountDB
+{
+    /// <summary>
+    /// bu info
+    /// </summary>
+    [ServiceDescription(typeof(IBusiness_unit_infoReponse), ServiceLifetime.Scoped)]
+    public class Business_unit_infoReponse : AccountingRepository<Business_unit_info>, IBusiness_unit_infoReponse
+    {
+        public async Task<object> GetObject()
+        {
+            return GetPageList<Business_unit_info>(c => c.business_unit_info_id == "", new SqlSugar.PageModel()
+            {
+                PageSize = 100,
+                PageIndex = 0
+            });
+        }
+    }
+}

+ 58 - 0
src/XF.Common.Api/Server/Repositories/Mysql/AccountDB/IAccountingRepository.cs

@@ -0,0 +1,58 @@
+using SqlSugar;
+using System.Linq.Expressions;
+using XF.Common.Core;
+
+
+namespace XF.Common.Repositories.Base
+{
+    public interface IAccountingRepository<T>
+    {
+        SqlSugarScope GetDB();
+        List<T> GetList();
+        Task<List<T>> GetListAsync();
+        List<T> GetList(Expression<Func<T, bool>> whereExpression);
+        Task<List<T>> GetListAsync(Expression<Func<T, bool>> whereExpression);
+        int Count(Expression<Func<T, bool>> whereExpression);
+        Task<int> CountAsync(Expression<Func<T, bool>> whereExpression);
+        PageList<T> GetPageList(Expression<Func<T, bool>> whereExpression, PageModel page);
+        PageList<P> GetPageList<P>(Expression<Func<T, bool>> whereExpression, PageModel page);
+        Task<PageList<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, PageModel page);
+        Task<PageList<P>> GetPageListAsync<P>(Expression<Func<T, bool>> whereExpression, PageModel page);
+        PageList<T> GetPageList(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
+        Task<PageList<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
+        PageList<P> GetPageList<P>(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
+        Task<PageList<P>> GetPageListAsync<P>(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
+        PageList<T> GetPageList(List<IConditionalModel> conditionalList, PageModel page);
+        Task<PageList<T>> GetPageListAsync(List<IConditionalModel> conditionalList, PageModel page);
+        PageList<T> GetPageList(List<IConditionalModel> conditionalList, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
+        Task<PageList<T>> GetPageListAsync(List<IConditionalModel> conditionalList, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
+        T GetById(dynamic id);
+        Task<T> GetByIdAsync(dynamic id);
+        T GetSingle(Expression<Func<T, bool>> whereExpression);
+        Task<T> GetSingleAsync(Expression<Func<T, bool>> whereExpression);
+        T GetFirst(Expression<Func<T, bool>> whereExpression);
+        Task<T> GetFirstAsync(Expression<Func<T, bool>> whereExpression);
+        bool Insert(T obj);
+        Task<bool> InsertAsync(T obj);
+        bool InsertRange(List<T> objs);
+        Task<bool> InsertRangeAsync(List<T> objs);
+        int InsertReturnIdentity(T obj);
+        Task<int> InsertReturnIdentityAsync(T obj);
+        long InsertReturnBigIdentity(T obj);
+        Task<long> InsertReturnBigIdentityAsync(T obj);
+        bool DeleteByIds(dynamic[] ids);
+        Task<bool> DeleteByIdsAsync(dynamic[] ids);
+        bool Delete(dynamic id);
+        Task<bool> DeleteAsync(dynamic id);
+        bool Delete(T obj);
+        Task<bool> DeleteAsync(T obj);
+        bool Delete(Expression<Func<T, bool>> whereExpression);
+        Task<bool> DeleteAsync(Expression<Func<T, bool>> whereExpression);
+        bool Update(T obj);
+        Task<bool> UpdateAsync(T obj);
+        bool UpdateRange(List<T> objs);
+        Task<bool> UpdateRangeAsync(List<T> objs);
+        bool IsAny(Expression<Func<T, bool>> whereExpression);
+        Task<bool> IsAnyAsync(Expression<Func<T, bool>> whereExpression);
+    }
+}

+ 38 - 1
src/XF.Common.Api/Server/Repositories/PgSql/Base/SqlSugarHelper.cs

@@ -54,7 +54,7 @@ namespace XF.Common.Repositories.Base
         /// </summary>
         public static SqlSugarScope Sqlite = new SqlSugarScope(new ConnectionConfig()
         {
-            ConnectionString = ConnectionOption.Postgres,
+            ConnectionString = ConnectionOption.FCCSqlite,
             DbType = DbType.PostgreSQL,
             InitKeyType = InitKeyType.Attribute,//从特性读取主键和自增列信息
             IsAutoCloseConnection = true,
@@ -84,5 +84,42 @@ namespace XF.Common.Repositories.Base
                 }
             };
         });
+
+
+        /// <summary>
+        /// sqlserver连接
+        /// </summary>
+        public static SqlSugarScope Mysql = new SqlSugarScope(new ConnectionConfig()
+        {
+            ConnectionString = ConnectionOption.MysqlAccounting,
+            DbType = DbType.MySql,
+            InitKeyType = InitKeyType.Attribute,//从特性读取主键和自增列信息
+            IsAutoCloseConnection = true,
+            ConfigureExternalServices = new ConfigureExternalServices
+            {
+                //注意:  这儿AOP设置不能少
+                EntityService = (c, p) =>
+                {
+                    /***高版C#写法***/
+                    //支持string?和string  
+                    if (p.IsPrimarykey == false && new NullabilityInfoContext()
+                     .Create(c).WriteState is NullabilityState.Nullable)
+                    {
+                        p.IsNullable = true;
+                    }
+                }
+            }
+        }, Db =>
+        {
+            Db.Aop.OnLogExecuting = (sql, pars) =>
+            {
+                if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT").ConvertToString() == "Development")
+                {
+                    Console.WriteLine(sql + "\r\n" +
+                        Sqlite.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
+                    Console.WriteLine();
+                }
+            };
+        });
     }
 }

+ 3 - 3
src/XF.Common.Api/Server/Repositories/PgSql/BusinessUnitInfoReponse.cs

@@ -10,12 +10,12 @@ namespace XF.Common.Repositories
     /// <summary>
     /// bu info
     /// </summary>
-    [ServiceDescription(typeof(IBusinessUnitInfoReponse), ServiceLifetime.Scoped)]
-    public class BusinessUnitInfoReponse : LiteRepository<BusinessUnitInfo>, IBusinessUnitInfoReponse
+    [ServiceDescription(typeof(IBusiness_unit_infoReponse), ServiceLifetime.Scoped)]
+    public class BusinessUnitInfoReponse : LiteRepository<Business_unit_info>, IBusiness_unit_infoReponse
     {
         public async Task<object> GetObject()
         {
-            return GetPageList<BusinessUnitInfo>(c => c.business_unit_info_id == "", new SqlSugar.PageModel() { 
+            return GetPageList<Business_unit_info>(c => c.business_unit_info_id == "", new SqlSugar.PageModel() { 
                 PageSize=100,
                 PageIndex=0
             });

+ 28 - 8
src/XF.Common.Api/Server/Services/SiteServer.cs

@@ -5,6 +5,7 @@ using XF.Common.Map;
 using XF.Common.Repositories;
 using XF.Common.Server.Core.Repositories;
 using XF.Common.Server.Core.VM.GasStation;
+using XF.Common.Server.Repositories.Mysql.AccountDB;
 using ServiceLifetime = XF.Common.Core.ServiceLifetime;
 
 namespace XF.Common.Server
@@ -16,10 +17,10 @@ namespace XF.Common.Server
     public class SiteServer : ISiteServer
     {
 
-        public IBusinessUnitInfoReponse _businessUnitInfoReponse;
-        public SiteServer(IBusinessUnitInfoReponse businessUnitInfoReponse)
+        public IBusiness_unit_infoReponse _Business_unit_infoReponse;
+        public SiteServer(IBusiness_unit_infoReponse Business_unit_infoReponse)
         {
-            _businessUnitInfoReponse = businessUnitInfoReponse;
+            _Business_unit_infoReponse = Business_unit_infoReponse;
         }
 
         /// <summary>
@@ -28,9 +29,14 @@ namespace XF.Common.Server
         /// <returns></returns>
         public async Task<IEnumerable<SiteListVm>> GetParentBUData()
         {
-           var list=await _businessUnitInfoReponse.GetListAsync(k=>string.IsNullOrWhiteSpace(k.parent_bu_id));
-            return list.ToDTOList<SiteListVm>();
-          
+            var list = await _Business_unit_infoReponse.GetListAsync(k => true);
+            return list.Where(l => l.Bu_Name.Contains("集团")).Select(P => new SiteListVm()
+            {
+                Business_unit_info_id = P.business_unit_info_id,
+                Parent_bu_id = P.parent_bu_id,
+                Bu_Name = P.Bu_Name
+            });
+
         }
 
         /// <summary>
@@ -41,7 +47,7 @@ namespace XF.Common.Server
         /// <exception cref="NotImplementedException"></exception>
         public async Task<IEnumerable<SiteListVm>> GetStie(string buid)
         {
-            var list = await _businessUnitInfoReponse.GetListAsync(k =>k.business_unit_info_id==buid);
+            var list = await _Business_unit_infoReponse.GetListAsync(k => k.business_unit_info_id == buid);
             return list.ToDTOList<SiteListVm>();
         }
 
@@ -53,7 +59,7 @@ namespace XF.Common.Server
         /// <exception cref="NotImplementedException"></exception>
         public async Task<IEnumerable<SiteListVm>> GetStieByParBuid(string parBuid)
         {
-            var list = await _businessUnitInfoReponse.GetListAsync(k => k.parent_bu_id == parBuid);
+            var list = await _Business_unit_infoReponse.GetListAsync(k => k.parent_bu_id == parBuid);
             return list.ToDTOList<SiteListVm>();
         }
 
@@ -66,7 +72,21 @@ namespace XF.Common.Server
         /// <exception cref="NotImplementedException"></exception>
         public async Task<bool> SaveSite(SiteSaveVm Model)
         {
+            var objects = await GetParentBUData();
             return true;
         }
+
+
+        /// <summary>
+        ///  查询油站信息
+        /// </summary>
+        /// <param name="Model"></param>
+        /// <returns></returns>
+        /// <exception cref="NotImplementedException"></exception>
+        public async Task<SiteSaveVm> SiteInfos(SiteSaveVm Model)
+        {
+            var objects = await GetParentBUData();
+            return null;
+        }
     }
 }

+ 3 - 1
src/XF.Common.Api/appsettings.json

@@ -19,7 +19,9 @@
     "GenerateTestData": true
   },
   "ConnectionStrings": {
-    "Postgres": "Host=47.97.120.160;Port=5432;Database=FuelLite;Username=postgres;Password=Postgres3141"
+    "Postgres": "Server=47.101.220.106;database=AccountingService_Sun_0230AMMon03180930AM;port=5432;User Id=postgres;Password=Postgres3141",
+    "MysqlAccounting": "Server=47.101.220.106;user=root;database=AccountingService;port=3307;password=Wayne@123;SslMode=None",
+    "FCCSqlite": "Data Source=liteFccCore_sqlite_database.db;"
   },
   "Login": {
     "User": "admin",