From e61e8194d68c7526e173b9487d3794fed7b01b45 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Thu, 9 Mar 2023 15:55:01 +0800 Subject: [PATCH] Synchronization code --- .../SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs | 1 + .../SqlSugar/Abstract/SqlBuilderProvider/SqlBuilderProvider.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs index 087f2c18a..b7da256b6 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs @@ -1203,6 +1203,7 @@ namespace SqlSugar public ISugarQueryable SplitTable(DateTime beginTime, DateTime endTime) { var splitColumn = this.EntityInfo.Columns.FirstOrDefault(it => it.PropertyInfo.GetCustomAttribute() != null); + Check.ExceptionEasy(splitColumn==null,"[SplitFieldAttribute] need to be added to the table field", "需要在分表字段加上属性[SplitFieldAttribute]"); var columnName = this.SqlBuilder.GetTranslationColumnName(splitColumn.DbColumnName); var sqlParameterKeyWord = this.SqlBuilder.SqlParameterKeyWord; return this.Where($" {columnName}>={sqlParameterKeyWord}spBeginTime AND {columnName}<= {sqlParameterKeyWord}spEndTime",new { spBeginTime = beginTime , spEndTime = endTime}).SplitTable(tas => { diff --git a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/SqlBuilderProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/SqlBuilderProvider.cs index 8a4e7b390..fb538a0f6 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/SqlBuilderProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/SqlBuilderProvider.cs @@ -102,7 +102,7 @@ namespace SqlSugar public string GetWhere(string fieldName,string conditionalType,int? parameterIndex=null) { - return string.Format(" {0} {1} {2}{3} ",fieldName,conditionalType,this.SqlParameterKeyWord,fieldName+ parameterIndex); + return string.Format(" {0} {1} {2}{3} ",this.GetTranslationColumnName(fieldName),conditionalType,this.SqlParameterKeyWord,fieldName+ parameterIndex); } public virtual string GetUnionAllSql(List sqlList) {