Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'master' of https://github.com/liaozb/APIJSON.NET
# Conflicts:
#	APIJSON.NET/APIJSONCommon/ApiJson.Common.csproj
0.0.7 修复not in的缺陷,增加~ 不等于的支持
  • Loading branch information
haptear committed Sep 25, 2019
commit f67884ec4aa2b27d50ddc1ff3ddfa4a830f51da3
5 changes: 3 additions & 2 deletions APIJSON.NET/APIJSONCommon/ApiJson.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>0.0.6</Version>
<Description>0.0.6 增加ToSql接口,处理sql注入的情况
<Version>0.0.7</Version>
<Description>0.0.7 修复not in的缺陷,增加~ 不等于的支持
0.0.6 增加ToSql接口,处理sql注入的情况
通用查询组件</Description>
<PackageId>ApiJson.Common.Core</PackageId>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
Expand Down
17 changes: 13 additions & 4 deletions APIJSON.NET/APIJSONCommon/SelectTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ private string ToSql(string subtable, int page, int count, int query, string jso
values.Remove("page");
values.Remove("count");
subtable = _tableMapper.GetTableName(subtable);
var tb = sugarQueryable(subtable, "*", values,null);
var xx= tb.Skip((page - 1) * count).Take(10).ToSql();
var tb = sugarQueryable(subtable, "*", values, null);
var xx = tb.Skip((page - 1) * count).Take(10).ToSql();
return xx.Key;
}
/// <summary>
Expand Down Expand Up @@ -249,7 +249,7 @@ public string ToSql(JObject queryObj)

if (key.EndsWith("[]"))
{
return ToSql(item);
return ToSql(item);
}
}
return string.Empty;
Expand Down Expand Up @@ -509,6 +509,10 @@ private ISugarQueryable<ExpandoObject> sugarQueryable(string subtable, string se
conModels.Add(new ConditionalModel() { FieldName = vakey.TrimEnd('@'), ConditionalType = ConditionalType.Equal, FieldValue = value });

}
else if (vakey.EndsWith("~"))//不等于
{
conModels.Add(new ConditionalModel() { FieldName = vakey.TrimEnd('~'), ConditionalType = ConditionalType.NoEqual, FieldValue = fieldValue });
}
else if (IsCol(subtable, vakey)) //其他where条件
{
conModels.Add(new ConditionalModel() { FieldName = vakey, ConditionalType = ConditionalType.Equal, FieldValue = fieldValue });
Expand Down Expand Up @@ -695,7 +699,12 @@ private void ConditionQuery(string subtable, List<IConditionalModel> conModels,
inValues.Add(cm.ToString());
}

conModels.Add(new ConditionalModel() { FieldName = field, ConditionalType = field.EndsWith("!") ? ConditionalType.NotIn : ConditionalType.In, FieldValue = string.Join(",", inValues) });
conModels.Add(new ConditionalModel()
{
FieldName = field.TrimEnd("!".ToCharArray()),
ConditionalType = field.EndsWith("!") ? ConditionalType.NotIn : ConditionalType.In,
FieldValue = string.Join(",", inValues)
});

}
else
Expand Down
2 changes: 1 addition & 1 deletion APIJSON.NET/APIJSONCommon/Services/IIdentityService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public interface IIdentityService
/// </summary>
/// <param name="table"></param>
/// <returns></returns>
(bool, string) GetSelectRole(string table);
Tuple<bool, string> GetSelectRole(string table);


bool ColIsRole(string col, string[] selectrole);
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.