Program.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. using OASystem.Domain.Entities.Resource;
  2. using SqlSugar;
  3. var db = new SqlSugarClient(new ConnectionConfig()
  4. {
  5. ConnectionString = "server=132.232.92.186;uid=sa;pwd=Yjx@158291;database=OA2023DB;Encrypt=True;TrustServerCertificate=True;",
  6. DbType = DbType.SqlServer,
  7. IsAutoCloseConnection = true,
  8. InitKeyType = InitKeyType.Attribute
  9. },
  10. provider =>
  11. {
  12. provider.Aop.OnLogExecuting = (sql, pars) =>
  13. {
  14. Console.WriteLine(sql); // 输出生成的 SQL
  15. };
  16. });
  17. #region Aop
  18. //db.Aop.OnLogExecuting = (sql, pars) =>
  19. //{
  20. // Console.WriteLine(sql + "" + Db.Utilities.SerializeObject
  21. // (pars.ToDictionary(it => it.ParameterName, it => it.Value)));
  22. // Console.WriteLine();
  23. //};
  24. #endregion
  25. #region 对话框
  26. Console.WriteLine("是否确定同步数据库表结构?(同名数据表将会被备份,生产环境慎用,回车确认)");
  27. var str = Console.ReadKey();
  28. if (str.Key == ConsoleKey.Enter)
  29. {
  30. Console.WriteLine("同步中,请稍后...");
  31. }
  32. else
  33. {
  34. Console.WriteLine("\r\n输入错误,已退出...");
  35. return;
  36. }
  37. #endregion
  38. //同步数据表结构
  39. db.DbMaintenance.CreateDatabase();
  40. db.CodeFirst.SetStringDefaultLength(50).BackupTable().InitTables(new Type[]
  41. {
  42. //typeof(Sys_PageFunctionPermission)
  43. //,typeof(Sys_SystemMenuAndFunction)
  44. //,typeof(Sys_SystemMenuPermission)
  45. //,typeof(Sys_JobPostAuthority)
  46. //,typeof(Sys_UserAuthority)
  47. //typeof(Crm_CustomerCert),
  48. //typeof(Crm_CustomerCompany),
  49. //typeof(Crm_CustomerFile),
  50. //typeof(Crm_DeleClient)
  51. //typeof(Crm_VisaCustomerCompany),
  52. //typeof(Crm_VisaCustomerFamily),
  53. //typeof(Crm_VisaCustomerSchool)
  54. //typeof(Grp_AirInquiry),
  55. //typeof(Grp_AirPrice),
  56. //typeof(Grp_CreditCardPayment),
  57. //typeof(Grp_DeleFile),
  58. //typeof(Grp_DelegationInfo),
  59. //typeof(Grp_DelegationJoinCustomer),
  60. //typeof(Grp_DeleMeetingNeeds),
  61. //typeof(Grp_HotelReservations),
  62. //typeof(Grp_VisaProgress),
  63. //typeof(Grp_DeleClientNeeds),
  64. //typeof(Res_AirCompany),
  65. //typeof(Res_AirTicketAgent),
  66. //typeof(Res_HotelData),
  67. //typeof(Res_ThreeCode)
  68. //typeof(Res_ScenicSpotInfo),
  69. //typeof(Res_CarGuides),
  70. //typeof(Res_CarInfo),
  71. //typeof(Res_GuidesInfo)
  72. //typeof(Res_CarData),
  73. //typeof(Res_LocalGuideData)
  74. //typeof(Grp_ScheduleInfo),
  75. //typeof(Grp_ScheduleDetailInfo),
  76. //typeof(Grp_SchedulePersonInfo)
  77. //typeof(Sys_Message),
  78. //typeof(Sys_MessageReadAuth)
  79. //typeof(Crm_DeleClient)
  80. //typeof(Crm_NewClientData)
  81. //typeof(Crm_ClientDataAndUser),
  82. //typeof(Crm_ClientDataAndBusiness),
  83. //typeof(Res_ItemDetailInfo),
  84. //typeof(Res_ItemVendor)
  85. //typeof(Res_ItemTypeInfo)
  86. //typeof(Bus_ConfItemInfo)
  87. //typeof(Bus_ConfItemListInfo)
  88. //typeof(Res_CountryFeeCost)
  89. //typeof(Res_MemoInfo),
  90. //typeof(Fin_DailyFeePayment), // 财务 - 日付申请
  91. //typeof(Fin_DailyFeePaymentContent),// 财务 - 日付申请详细类
  92. //typeof(Grp_GroupsTaskAssignment),
  93. //typeof(Grp_AirTicketReservations),
  94. //typeof(Grp_GroupCostParameter),
  95. //typeof(Grp_TeamRate), // 团组汇率
  96. //typeof(Fin_ForeignReceivables), // 对外收款账单
  97. //typeof(Fin_ProceedsReceived), // 已收款项
  98. //typeof(Fin_OtherPrice), // 其他款项
  99. //typeof(Res_OfficialActivities) //公务出访
  100. //typeof(Res_AskData),//请示数据库
  101. //typeof(Grp_DelegationEnData),
  102. //typeof(Grp_EnterExitCost),
  103. //typeof(Grp_DayAndCost),
  104. //typeof(Grp_NationalTravelFee),
  105. //typeof(Air_TicketBlackCode),
  106. //typeof(Pm_WageSheet) //人事模块 工资表单
  107. //typeof(Grp_VisaProgressCustomer),
  108. //typeof(Grp_VisaProgressCustomerPicture)
  109. //typeof(Grp_CheckBoxs) //成本选中
  110. //typeof(Grp_GroupCost) //成本数据信息
  111. //typeof(Grp_CostTypeHotelNumber)//分段房间数量
  112. //typeof(Grp_VisaInfo)
  113. //typeof(Grp_CarTouristGuideGroundReservations),
  114. //typeof(Grp_CarTouristGuideGroundReservationsContent),//
  115. //typeof(Fin_PaymentRefundAndOtherMoney),
  116. //typeof(Grp_InsuranceCost),
  117. //typeof(Grp_TourClientList), //接团客户名单
  118. //typeof(Dis_Intercontinental), //洲
  119. //typeof(Dis_Country), //国家
  120. //typeof(Dis_City), //城市
  121. //typeof(Fin_GroupExtraCost), //超支费用
  122. //typeof(Pm_TaskAllocation), //任务分配
  123. //typeof(Pm_TaskRelevanceUser), //任务分配关联人员(完成者)
  124. //typeof(Pm_TaskJobRelevancy), //任务分配关联人员(完成者)
  125. //typeof(Crm_TableOperationRecord), //表操作记录
  126. //typeof(Grp_InvertedList), //倒推表
  127. //typeof(Grp_InvertedListVisaCountry), //倒推表签证国家
  128. //typeof(Grp_VisaFeeInfo), //签证费用info
  129. //typeof(Grp_HotelInquiry), //酒店询价
  130. //typeof(Grp_HotelReservationsContent), //酒店费用子表
  131. //typeof(Grp_VisitingClients), //拜访团组客户
  132. //typeof(Grp_ApprovalTravelDetails), //公务出访表
  133. //typeof(Sys_Countries), //洲
  134. //typeof(Sys_Continent), //国家
  135. //typeof(Sys_Cities), //城市
  136. //typeof(Grp_GroupModelFile),//团组文件
  137. //typeof(Grp_VisaCommission),//签证费用录入
  138. //typeof(Pm_GoodsReceive),//物品领用表
  139. //typeof(Pm_GoodsStorage),//物品入库表
  140. //typeof(Pm_GoodsInfo),//物品详细表
  141. //typeof(Grp_Opinionaire),//团组接待意见调查
  142. //typeof(Sys_ExchangeRateRecord),//团组接待意见调查
  143. //typeof(Res_TranslatorLibrary),//翻译人员库
  144. //typeof(Grp_OfficialDutyLinkTranslator),//公务信息关联翻译人员
  145. //typeof(Sys_DeviceToken),
  146. //typeof(Res_MediaSuppliers),//策划部供应商资料
  147. //typeof(Res_BasicInsuranceCost)//保险国家基础费用
  148. //typeof(Grp_EnterExitCostPermission),//团组 - 出入境费用 --> 操作权限
  149. //typeof(Grp_EnterExitCostDraftPermission)//团组 - 出入境费用 --> 操作权限-草稿
  150. //typeof(Grp_RestaurantInfo),
  151. //ypeof(Grp_EnterExitCostQuote), //团组 - 出入境费用报价表
  152. //ypeof(Grp_EnterExitCostQuoteItem), //团组 - 出入境费用报价表
  153. //typeof(Sys_FormTemp), //表单模板
  154. //typeof(Grp_OrderPreInfo), //团组下单前信息
  155. //typeof(Grp_OrderPreItem), //团组下单前信息Item
  156. //typeof(Grp_GroupShareFile),//团组共享文件
  157. //typeof(Pm_GoodsAudit),//物品确认审核表
  158. //typeof(Pm_GoodsReceiveDetails),//物品领用明细表
  159. /*审核流程相关表*/
  160. //typeof(Sys_AuditFlow),//审核流程表
  161. //typeof(Sys_AuditRecord),//审核记录表
  162. //typeof(Sys_AuditTemplate),//审核模板表
  163. //typeof(Sys_AuditTemplateNode),//审核模板节点表
  164. //typeof(Sys_AuditTemplateNodeUser),//审核模板节点人员表
  165. //typeof(Fin_ApplicationLinkGoods),//日服申请单物品关联表
  166. //typeof(Grp_GamesBudgetMaster‌),//世运会成本预算明细
  167. typeof(Res_VisaFeeStandard),//签证费用标准
  168. typeof(Res_VisaFeeStandardDetails),//签证费用标准详情
  169. });
  170. Console.WriteLine("数据库结构同步完成!");