Skip to content

Commit edd2707

Browse files
committed
##
1 parent fc49052 commit edd2707

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

APIJSON.NET/APIJSON.NET/SelectTable.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,12 @@ public bool IsTable(string table)
3535
/// <returns></returns>
3636
public bool IsCol(string table, string col)
3737
{
38-
return db.Db.DbMaintenance.GetColumnInfosByTableName(table).Any(it => it.DbColumnName.Equals(table, StringComparison.CurrentCultureIgnoreCase));
38+
return db.Db.DbMaintenance.GetColumnInfosByTableName(table).Any(it => it.DbColumnName.Equals(col, StringComparison.CurrentCultureIgnoreCase));
3939
}
4040

4141
public (dynamic,int) GetTableData(string subtable, int page, int count, string json, JObject dd)
4242
{
43-
if (!IsTable(subtable))
44-
{
45-
throw new Exception($"表名{subtable}不正确!");
46-
}
43+
4744
var role = _identitySvc.GetSelectRole(subtable);
4845
if (!role.Item1)//没有权限返回异常
4946
{
@@ -70,10 +67,7 @@ public bool IsCol(string table, string col)
7067
}
7168
public dynamic GetFirstData(string subtable, string json, JObject dd)
7269
{
73-
if (IsTable(subtable))
74-
{
75-
throw new Exception($"表名{subtable}不正确!");
76-
}
70+
7771
var role = _identitySvc.GetSelectRole(subtable);
7872
if (!role.Item1)//没有权限返回异常
7973
{
@@ -90,6 +84,10 @@ public dynamic GetFirstData(string subtable, string json, JObject dd)
9084
}
9185
private ISugarQueryable<System.Dynamic.ExpandoObject> sugarQueryable(string subtable, string selectrole, JObject values, JObject dd)
9286
{
87+
if (!IsTable(subtable))
88+
{
89+
throw new Exception($"表名{subtable}不正确!");
90+
}
9391
var tb = db.Db.Queryable(subtable, "tb");
9492
if (values["@column"].IsValue())
9593
{

0 commit comments

Comments
 (0)