|
@ -114,9 +114,9 @@ namespace SqlSugar |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
if (readerValues.ContainsKey(name)) |
|
|
if (readerValues.Any(it => it.Key.Equals(name, StringComparison.CurrentCultureIgnoreCase))) |
|
|
{ |
|
|
{ |
|
|
var addValue = readerValues[name]; |
|
|
var addValue = readerValues.ContainsKey(name) ? readerValues[name] : readerValues[name.ToUpper()]; |
|
|
if (addValue == DBNull.Value) |
|
|
if (addValue == DBNull.Value) |
|
|
{ |
|
|
{ |
|
|
if (item.PropertyType.IsIn(UtilConstants.IntType, UtilConstants.DecType, UtilConstants.DobType, UtilConstants.ByteType)) |
|
|
if (item.PropertyType.IsIn(UtilConstants.IntType, UtilConstants.DecType, UtilConstants.DobType, UtilConstants.ByteType)) |
|
@ -296,23 +296,23 @@ namespace SqlSugar |
|
|
{ |
|
|
{ |
|
|
if (models.IsNullOrEmpty()) return new KeyValuePair<string, SugarParameter[]>(); |
|
|
if (models.IsNullOrEmpty()) return new KeyValuePair<string, SugarParameter[]>(); |
|
|
StringBuilder builder = new StringBuilder(); |
|
|
StringBuilder builder = new StringBuilder(); |
|
|
List<SugarParameter> parameters = new List<SugarParameter>() ; |
|
|
List<SugarParameter> parameters = new List<SugarParameter>(); |
|
|
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig); |
|
|
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig); |
|
|
foreach (var item in models) |
|
|
foreach (var item in models) |
|
|
{ |
|
|
{ |
|
|
var index = models.IndexOf(item); |
|
|
var index = models.IndexOf(item); |
|
|
var type = index == 0?"":"AND"; |
|
|
var type = index == 0 ? "" : "AND"; |
|
|
string temp = " {0} {1} {2} {3} "; |
|
|
string temp = " {0} {1} {2} {3} "; |
|
|
string parameterName = string.Format("{0}Conditional{1}{2}",sqlBuilder.SqlParameterKeyWord,item.FieldName,index); |
|
|
string parameterName = string.Format("{0}Conditional{1}{2}", sqlBuilder.SqlParameterKeyWord, item.FieldName, index); |
|
|
switch (item.ConditionalType) |
|
|
switch (item.ConditionalType) |
|
|
{ |
|
|
{ |
|
|
case ConditionalType.Equal: |
|
|
case ConditionalType.Equal: |
|
|
builder.AppendFormat(temp,type,item.FieldName.ToSqlFilter(),"=", parameterName); |
|
|
builder.AppendFormat(temp, type, item.FieldName.ToSqlFilter(), "=", parameterName); |
|
|
parameters.Add(new SugarParameter(parameterName,item.FieldValue)); |
|
|
parameters.Add(new SugarParameter(parameterName, item.FieldValue)); |
|
|
break; |
|
|
break; |
|
|
case ConditionalType.Like: |
|
|
case ConditionalType.Like: |
|
|
builder.AppendFormat(temp, type, item.FieldName.ToSqlFilter(), "LIKE", parameterName); |
|
|
builder.AppendFormat(temp, type, item.FieldName.ToSqlFilter(), "LIKE", parameterName); |
|
|
parameters.Add(new SugarParameter(parameterName, "%"+item.FieldValue+"%")); |
|
|
parameters.Add(new SugarParameter(parameterName, "%" + item.FieldValue + "%")); |
|
|
break; |
|
|
break; |
|
|
case ConditionalType.GreaterThan: |
|
|
case ConditionalType.GreaterThan: |
|
|
builder.AppendFormat(temp, type, item.FieldName.ToSqlFilter(), ">", parameterName); |
|
|
builder.AppendFormat(temp, type, item.FieldName.ToSqlFilter(), ">", parameterName); |
|
|