Program.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. using OASystem.Domain.Entities;
  2. using OASystem.Domain.Entities.Business;
  3. using OASystem.Domain.Entities.Customer;
  4. using OASystem.Domain.Entities.District;
  5. using OASystem.Domain.Entities.Financial;
  6. using OASystem.Domain.Entities.Groups;
  7. using OASystem.Domain.Entities.PersonnelModule;
  8. using OASystem.Domain.Entities.Resource;
  9. using OASystem.Domain.Entities.System;
  10. using SqlSugar;
  11. var db = new SqlSugarClient(new ConnectionConfig()
  12. {
  13. ConnectionString = "server=132.232.92.186;uid=sa;pwd=Yjx@158291;database=OA2023DB;",
  14. DbType = SqlSugar.DbType.SqlServer,
  15. IsAutoCloseConnection = true,
  16. InitKeyType = InitKeyType.Attribute
  17. });
  18. #region Aop
  19. //db.Aop.OnLogExecuting = (sql, pars) =>
  20. //{
  21. // Console.WriteLine(sql + "" + Db.Utilities.SerializeObject
  22. // (pars.ToDictionary(it => it.ParameterName, it => it.Value)));
  23. // Console.WriteLine();
  24. //};
  25. #endregion
  26. #region 对话框
  27. Console.WriteLine("是否确定同步数据库表结构?(同名数据表将会被备份,生产环境慎用,回车确认)");
  28. var str = Console.ReadKey();
  29. if (str.Key == ConsoleKey.Enter)
  30. {
  31. Console.WriteLine("同步中,请稍后...");
  32. }
  33. else
  34. {
  35. Console.WriteLine("\r\n输入错误,已退出...");
  36. return;
  37. }
  38. #endregion
  39. //同步数据表结构
  40. db.DbMaintenance.CreateDatabase();
  41. db.CodeFirst.SetStringDefaultLength(50).BackupTable().InitTables(new Type[]
  42. {
  43. //typeof(Sys_PageFunctionPermission)
  44. //,typeof(Sys_SystemMenuAndFunction)
  45. //,typeof(Sys_SystemMenuPermission)
  46. //,typeof(Sys_JobPostAuthority)
  47. //,typeof(Sys_UserAuthority)
  48. //typeof(Crm_CustomerCert),
  49. //typeof(Crm_CustomerCompany),
  50. //typeof(Crm_CustomerFile),
  51. //typeof(Crm_DeleClient)
  52. //typeof(Crm_VisaCustomerCompany),
  53. //typeof(Crm_VisaCustomerFamily),
  54. //typeof(Crm_VisaCustomerSchool)
  55. //typeof(Grp_AirInquiry),
  56. //typeof(Grp_AirPrice),
  57. //typeof(Grp_CreditCardPayment),
  58. //typeof(Grp_DeleFile),
  59. //typeof(Grp_DelegationInfo),
  60. //typeof(Grp_DelegationJoinCustomer),
  61. //typeof(Grp_DeleMeetingNeeds),
  62. //typeof(Grp_HotelReservations),
  63. //typeof(Grp_VisaProgress),
  64. //typeof(Grp_DeleClientNeeds),
  65. //typeof(Res_AirCompany),
  66. //typeof(Res_AirTicketAgent),
  67. //typeof(Res_HotelData),
  68. //typeof(Res_ThreeCode)
  69. //typeof(Res_ScenicSpotInfo),
  70. //typeof(Res_CarGuides),
  71. //typeof(Res_CarInfo),
  72. //typeof(Res_GuidesInfo)
  73. //typeof(Res_CarData),
  74. //typeof(Res_LocalGuideData)
  75. //typeof(Grp_ScheduleInfo),
  76. //typeof(Grp_ScheduleDetailInfo),
  77. //typeof(Grp_SchedulePersonInfo)
  78. //typeof(Sys_Message),
  79. //typeof(Sys_MessageReadAuth)
  80. //typeof(Crm_DeleClient)
  81. //typeof(Crm_NewClientData)
  82. //typeof(Crm_ClientDataAndUser),
  83. //typeof(Crm_ClientDataAndBusiness),
  84. //typeof(Res_ItemDetailInfo),
  85. //typeof(Res_ItemVendor)
  86. //typeof(Res_ItemTypeInfo)
  87. //typeof(Bus_ConfItemInfo)
  88. //typeof(Bus_ConfItemListInfo)
  89. //typeof(Res_CountryFeeCost)
  90. //typeof(Res_MemoInfo),
  91. //typeof(Fin_DailyFeePayment), // 财务 - 日付申请
  92. //typeof(Fin_DailyFeePaymentContent),// 财务 - 日付申请详细类
  93. //typeof(Grp_GroupsTaskAssignment),
  94. //typeof(Grp_AirTicketReservations),
  95. //typeof(Grp_GroupCostParameter),
  96. //typeof(Grp_TeamRate), // 团组汇率
  97. //typeof(Fin_ForeignReceivables), // 对外收款账单
  98. //typeof(Fin_ProceedsReceived), // 已收款项
  99. //typeof(Fin_OtherPrice), // 其他款项
  100. //typeof(Res_OfficialActivities) //公务出访
  101. //typeof(Res_AskData),//请示数据库
  102. //typeof(Grp_DelegationEnData),
  103. //typeof(Grp_EnterExitCost),
  104. //typeof(Grp_DayAndCost),
  105. //typeof(Grp_NationalTravelFee),
  106. //typeof(Air_TicketBlackCode),
  107. //typeof(Pm_WageSheet) //人事模块 工资表单
  108. //typeof(Grp_VisaProgressCustomer),
  109. //typeof(Grp_VisaProgressCustomerPicture)
  110. //typeof(Grp_CheckBoxs) //成本选中
  111. //typeof(Grp_GroupCost) //成本数据信息
  112. //typeof(Grp_CostTypeHotelNumber)//分段房间数量
  113. //typeof(Grp_VisaInfo)
  114. //typeof(Grp_CarTouristGuideGroundReservations),
  115. //typeof(Grp_CarTouristGuideGroundReservationsContent),//
  116. //typeof(Fin_PaymentRefundAndOtherMoney),
  117. //typeof(Grp_InsuranceCost),
  118. //typeof(Grp_TourClientList), //接团客户名单
  119. typeof(Dis_Intercontinental), //洲
  120. typeof(Dis_Country), //国家
  121. typeof(Dis_City), //城市
  122. });
  123. Console.WriteLine("数据库结构同步完成!");