Browse Source

ConditionalType Add NoLike

pull/12/MERGE
sunkaixuan 7 years ago
parent
commit
7a30fa8d43
  1. 3
      Src/Asp.Net/SqlSugar/Enum/ConditionalType.cs
  2. 4
      Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs

3
Src/Asp.Net/SqlSugar/Enum/ConditionalType.cs

@ -19,6 +19,7 @@ namespace SqlSugar
LikeRight=9, LikeRight=9,
NoEqual=10, NoEqual=10,
IsNullOrEmpty=11, IsNullOrEmpty=11,
IsNot=12 IsNot=12,
NoLike = 13,
} }
} }

4
Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs

@ -388,6 +388,10 @@ namespace SqlSugar
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.NoLike:
builder.AppendFormat(temp, type, item.FieldName.ToSqlFilter(), " NOT LIKE", parameterName);
parameters.Add(new SugarParameter(parameterName, item.FieldValue + "%"));
break;
case ConditionalType.LikeRight: case ConditionalType.LikeRight:
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));

Loading…
Cancel
Save