Program.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. using OASystem.Domain.Entities;
  2. using OASystem.Domain.Entities.Business;
  3. using OASystem.Domain.Entities.Customer;
  4. using OASystem.Domain.Entities.Financial;
  5. using OASystem.Domain.Entities.Groups;
  6. using OASystem.Domain.Entities.Resource;
  7. using OASystem.Domain.Entities.System;
  8. using SqlSugar;
  9. var db = new SqlSugarClient(new ConnectionConfig()
  10. {
  11. ConnectionString = "server=132.232.92.186;uid=sa;pwd=Yjx@158291;database=OA2023DB;",
  12. DbType = SqlSugar.DbType.SqlServer,
  13. IsAutoCloseConnection = true,
  14. InitKeyType = InitKeyType.Attribute
  15. });
  16. #region Aop
  17. //db.Aop.OnLogExecuting = (sql, pars) =>
  18. //{
  19. // Console.WriteLine(sql + "" + Db.Utilities.SerializeObject
  20. // (pars.ToDictionary(it => it.ParameterName, it => it.Value)));
  21. // Console.WriteLine();
  22. //};
  23. #endregion
  24. #region 对话框
  25. Console.WriteLine("是否确定同步数据库表结构?(同名数据表将会被备份,生产环境慎用,回车确认)");
  26. var str = Console.ReadKey();
  27. if (str.Key == ConsoleKey.Enter)
  28. {
  29. Console.WriteLine("同步中,请稍后...");
  30. }
  31. else
  32. {
  33. Console.WriteLine("\r\n输入错误,已退出...");
  34. return;
  35. }
  36. #endregion
  37. //同步数据表结构
  38. db.DbMaintenance.CreateDatabase();
  39. db.CodeFirst.SetStringDefaultLength(50).BackupTable().InitTables(new Type[]
  40. {
  41. //typeof(Sys_PageFunctionPermission)
  42. //,typeof(Sys_SystemMenuAndFunction)
  43. //,typeof(Sys_SystemMenuPermission)
  44. //,typeof(Sys_JobPostAuthority)
  45. //,typeof(Sys_UserAuthority)
  46. //typeof(Crm_CustomerCert),
  47. //typeof(Crm_CustomerCompany),
  48. //typeof(Crm_CustomerFile),
  49. //typeof(Crm_DeleClient)
  50. //typeof(Crm_VisaCustomerCompany),
  51. //typeof(Crm_VisaCustomerFamily),
  52. //typeof(Crm_VisaCustomerSchool)
  53. //typeof(Grp_AirInquiry),
  54. //typeof(Grp_AirPrice),
  55. //typeof(Grp_CreditCardPayment),
  56. //typeof(Grp_DeleFile),
  57. //typeof(Grp_DelegationInfo),
  58. //typeof(Grp_DelegationJoinCustomer),
  59. //typeof(Grp_DeleMeetingNeeds),
  60. //typeof(Grp_HotelReservations),
  61. //typeof(Grp_VisaProgress),
  62. //typeof(Grp_DeleClientNeeds),
  63. //typeof(Res_AirCompany),
  64. //typeof(Res_AirTicketAgent),
  65. //typeof(Res_HotelData),
  66. //typeof(Res_ThreeCode)
  67. //typeof(Res_ScenicSpotInfo),
  68. //typeof(Res_CarGuides),
  69. //typeof(Res_CarInfo),
  70. //typeof(Res_GuidesInfo)
  71. //typeof(Res_CarData),
  72. //typeof(Res_LocalGuideData)
  73. //typeof(Grp_ScheduleInfo),
  74. //typeof(Grp_ScheduleDetailInfo),
  75. //typeof(Grp_SchedulePersonInfo)
  76. //typeof(Sys_Message),
  77. //typeof(Sys_MessageReadAuth)
  78. //typeof(Crm_DeleClient)
  79. //typeof(Crm_NewClientData)
  80. //typeof(Crm_ClientDataAndUser),
  81. //typeof(Crm_ClientDataAndBusiness),
  82. //typeof(Res_ItemDetailInfo),
  83. //typeof(Res_ItemVendor)
  84. //typeof(Res_ItemTypeInfo)
  85. //typeof(Bus_ConfItemInfo)
  86. //typeof(Bus_ConfItemListInfo)
  87. //typeof(Res_CountryFeeCost)
  88. //typeof(Res_MemoInfo),
  89. //typeof(Fin_DailyFeePayment), // 财务 - 日付申请
  90. //typeof(Fin_DailyFeePaymentContent), // 财务 - 日付申请详细类
  91. //typeof(Grp_GroupsTaskAssignment),
  92. //typeof(Grp_AirTicketReservations),
  93. //typeof(Grp_GroupCostParameter),
  94. //typeof(Grp_TeamRate), // 团组汇率
  95. //typeof(Fin_ForeignReceivables), //对外收款账单
  96. //typeof(Fin_ProceedsReceived), //已收款项
  97. //typeof( Fin_OtherPrice), //其他款项
  98. });
  99. Console.WriteLine("数据库结构同步完成!");