From 7122485899d2dab7ee4c82f3ac402e7baf229b20 Mon Sep 17 00:00:00 2001 From: 2881099 <2881099@qq.com> Date: Wed, 27 Sep 2023 21:33:26 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BF=AE=E5=A4=8D=20Reposition.InsertOrUpd?= =?UTF-8?q?ate=20=E6=9B=B4=E6=96=B0=E6=9C=AA=E5=8F=98=E5=8C=96=E6=97=B6?= =?UTF-8?q?=E7=9A=84=20SQL=20=E9=94=99=E8=AF=AF=EF=BC=9B#1630?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Examples/base_entity/Program.cs | 253 +++++++++++++++++++++++++- FreeSql.DbContext/DbSet/DbSetAsync.cs | 2 +- FreeSql.DbContext/DbSet/DbSetSync.cs | 2 +- 3 files changed, 254 insertions(+), 3 deletions(-) diff --git a/Examples/base_entity/Program.cs b/Examples/base_entity/Program.cs index b09362ba..f4177221 100644 --- a/Examples/base_entity/Program.cs +++ b/Examples/base_entity/Program.cs @@ -561,7 +561,7 @@ namespace base_entity .UseConnectionString(FreeSql.DataType.MySql, "Data Source=127.0.0.1;Port=3306;User ID=root;Password=root;Initial Catalog=cccddd;Charset=utf8;SslMode=none;min pool size=1;Max pool size=3;AllowLoadLocalInfile=true") - //.UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=.;Integrated Security=True;Initial Catalog=freesqlTest;Pooling=true;Max Pool Size=3;TrustServerCertificate=true") + .UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=.;Integrated Security=True;Initial Catalog=freesqlTest;Pooling=true;Max Pool Size=3;TrustServerCertificate=true") //.UseConnectionString(FreeSql.DataType.PostgreSQL, "Host=192.168.164.10;Port=5432;Username=postgres;Password=123456;Database=tedb;Pooling=true;Maximum Pool Size=2") ////.UseConnectionString(FreeSql.DataType.PostgreSQL, "Host=192.168.164.10;Port=5432;Username=postgres;Password=123456;Database=toc;Pooling=true;Maximum Pool Size=2") @@ -600,6 +600,12 @@ namespace base_entity BaseEntity.Initialization(fsql, () => _asyncUow.Value); #endregion + var risWorkListRepo = fsql.GetRepository(); + risWorkListRepo.InsertOrUpdate(new EBH_RisWorkList + { + RequisitionID = "xxx" + }); + var tqq01 = fsql.Select().Where(a => a.IsDeleted || a.IsDeleted || a.IsDeleted).ToSql(); fsql.GlobalFilter.Apply("test01", a => a.IsDeleted == false); @@ -2678,4 +2684,249 @@ class FormLocking { public string Value { get; set; } public string Text { get; set; } +} +[JsonObject(MemberSerialization.OptIn), Table(Name = "RIS_WORKLIST")] +public class EBH_RisWorkList +{ + [JsonProperty, Column(DbType = "varchar(64)", IsPrimary = true)] + public string RequisitionID { get; set; } + + [JsonProperty, Column(Name = "accession_number", DbType = "varchar(32)")] + public string Accession_number { get; set; } + + [JsonProperty, Column(DbType = "varchar(128)")] + public string Address { get; set; } + + [JsonProperty] + public int? AFCID { get; set; } + + [JsonProperty, Column(IsIdentity = true)] + public int AutoIndex { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string Birthday { get; set; } + + [JsonProperty, Column(DbType = "varchar(8)")] + public string BirthTime { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string CertificateID { get; set; } + + [JsonProperty, Column(DbType = "varchar(512)")] + public string CheckSTDescribed { get; set; } + + [JsonProperty, Column(DbType = "varchar(2048)")] + public string ClinicDiagnose { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string ClinicID { get; set; } + + [JsonProperty] + public int? Confidentiality { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string CustomCheckNumber { get; set; } + + [JsonProperty] + public int DepartmentID { get; set; } + + [JsonProperty] + public int EmergencyID { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string EndoscopyType { get; set; } + + [JsonProperty, Column(DbType = "varchar(128)")] + public string ExamBodyPart { get; set; } + + [JsonProperty] + public int? ExamBodyPartNum { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string ExamDate { get; set; } + + [JsonProperty, Column(DbType = "varchar(128)")] + public string ExamMethod { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string ExamParameter { get; set; } + + [JsonProperty, Column(Name = "exampath", DbType = "varchar(50)")] + public string Exampath { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string ExamTime { get; set; } + + [JsonProperty, Column(DbType = "varchar(128)")] + public string FamilyTelephe { get; set; } + + [JsonProperty, Column(DbType = "varchar(64)")] + public string FeeTypeName { get; set; } + + [JsonProperty] + public int? FollowFlag { get; set; } + + [JsonProperty] + public int? HaveImage { get; set; } + + [JsonProperty] + public int? HaveRemark { get; set; } + + [JsonProperty, Column(DbType = "varchar(50)")] + public string HospitalAreaName { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string HospitalID { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string ImageName { get; set; } + + [JsonProperty, Column(DbType = "varchar(128)")] + public string ImagePath { get; set; } + + [JsonProperty, Column(Name = "imagequality", DbType = "varchar(32)")] + public string Imagequality { get; set; } + + [JsonProperty] + public int? InAdvanceQueue { get; set; } + + [JsonProperty] + public int? InDeedQueue { get; set; } + + [JsonProperty, Column(Name = "isAddPatient", DbType = "varchar(2)")] + public string IsAddPatient { get; set; } + + [JsonProperty, Column(Name = "isChangeDate", DbType = "varchar(2)")] + public string IsChangeDate { get; set; } + + [JsonProperty, Column(Name = "isIBD", DbType = "varchar(2)")] + public string IsIBD { get; set; } + + [JsonProperty] + public int? IsNotCallNumber { get; set; } + + [JsonProperty] + public int? IsNotNOScreen { get; set; } + + [JsonProperty, Column(Name = "isOverTime", DbType = "varchar(2)")] + public string IsOverTime { get; set; } + + [JsonProperty] + public int? IsPaSSNumber { get; set; } + + [JsonProperty, Column(Name = "isSEZCJ", DbType = "varchar(2)")] + public string IsSEZCJ { get; set; } + + [JsonProperty] + public int IsSpePatientSign { get; set; } + + [JsonProperty] + public int? IsTexu { get; set; } + + [JsonProperty, Column(Name = "isZhiLiao", DbType = "varchar(2)")] + public string IsZhiLiao { get; set; } + + [JsonProperty] + public DateTime? LastTryForImage { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string MedicalCardNumber { get; set; } + + [JsonProperty, Column(DbType = "varchar(4096)")] + public string MedicalHistory { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string MIcardNumber { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string ModalityAE { get; set; } + + [JsonProperty] + public int? ModalityID { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string ModalityName { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string ModalityRemark { get; set; } + + [JsonProperty] + public int? ModalityRoomID { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string ModalityType { get; set; } + + [JsonProperty] + public int? NurseStationFlag { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string PathologicID { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string PatientID { get; set; } + + [JsonProperty] + public int PatientTypeID { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string PhysicalExamID { get; set; } + + [JsonProperty, Column(DbType = "varchar(128)")] + public string PhysicianRequirements { get; set; } + + [JsonProperty] + public int PrintFlag { get; set; } + + [JsonProperty] + public int? PrintNoticeFlag { get; set; } + + [JsonProperty, Column(DbType = "varchar(128)")] + public string PTN_NAME { get; set; } + + [JsonProperty, Column(DbType = "varchar(128)")] + public string PY { get; set; } + + [JsonProperty] + public int QueueStateID { get; set; } + + [JsonProperty, Column(DbType = "varchar(2048)")] + public string Remarks { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string ReqDepartment { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string ReqHospital { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string ReqPhysician { get; set; } + + [JsonProperty] + public int? ResourceID { get; set; } + + [JsonProperty] + public int? SendRepFlag { get; set; } + + [JsonProperty, Column(Name = "SEX", DbType = "varchar(32)")] + public string Sex { get; set; } + + [JsonProperty, Column(DbType = "varchar(50)")] + public string SickbedID { get; set; } + + [JsonProperty] + public int? StateID { get; set; } + + [JsonProperty] + public int? StationID { get; set; } + + [JsonProperty, Column(DbType = "varchar(32)")] + public string Telephone { get; set; } + + [JsonProperty] + public double? Weight { get; set; } + + [JsonProperty, Column(DbType = "varchar(128)")] + public string WorkStationAddress { get; set; } + + } \ No newline at end of file diff --git a/FreeSql.DbContext/DbSet/DbSetAsync.cs b/FreeSql.DbContext/DbSet/DbSetAsync.cs index 18763e4e..aa35bdf8 100644 --- a/FreeSql.DbContext/DbSet/DbSetAsync.cs +++ b/FreeSql.DbContext/DbSet/DbSetAsync.cs @@ -404,7 +404,7 @@ namespace FreeSql if (data?.Count > 0) { - if (cuig.Length == _table.Columns.Count) + if (cuig.Length == _table.Columns.Count - _table.Primarys.Length) return ups.Length == data.Count ? -998 : -997; var update = this.OrmUpdate(data.Select(a => a.Value)).IgnoreColumns(cuig); diff --git a/FreeSql.DbContext/DbSet/DbSetSync.cs b/FreeSql.DbContext/DbSet/DbSetSync.cs index 19bcc519..50bef5a2 100644 --- a/FreeSql.DbContext/DbSet/DbSetSync.cs +++ b/FreeSql.DbContext/DbSet/DbSetSync.cs @@ -438,7 +438,7 @@ namespace FreeSql if (data?.Count > 0) { - if (cuig.Length == _table.Columns.Count) + if (cuig.Length == _table.Columns.Count - _table.Primarys.Length) return ups.Length == data.Count ? -998 : -997; var update = this.OrmUpdate(data.Select(a => a.Value)).IgnoreColumns(cuig);