|
|
|
@ -1350,6 +1350,65 @@ public class BaseServices<TEntity, TEntityDto, TInsertDto, TEditDto> : IBaseServ |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#region 处理json查询条件 |
|
|
|
|
public string DealConditions(string conditions, string name, string value) |
|
|
|
|
{ |
|
|
|
|
var jsonParam = JsonHelper.JsonToObj<JsonParam>(value); |
|
|
|
|
switch (jsonParam.operationKey) |
|
|
|
|
{ |
|
|
|
|
case "Include": |
|
|
|
|
conditions += $" AND {name} LIKE '%{jsonParam.columnValue}%'"; |
|
|
|
|
break; |
|
|
|
|
case "NotInclude": |
|
|
|
|
conditions += $" AND {name} NOT LIKE '%{jsonParam.columnValue}%'"; |
|
|
|
|
break; |
|
|
|
|
case "IsNull": |
|
|
|
|
conditions += $" AND {name} IS NULL"; |
|
|
|
|
break; |
|
|
|
|
case "NotNull": |
|
|
|
|
conditions += $" AND {name} IS NOT NULL"; |
|
|
|
|
break; |
|
|
|
|
case "Equal": |
|
|
|
|
conditions += $" AND {name} ='{jsonParam.columnValue}'"; |
|
|
|
|
break; |
|
|
|
|
case "NotEqual": |
|
|
|
|
conditions += $" AND {name} !='{jsonParam.columnValue}'"; |
|
|
|
|
break; |
|
|
|
|
case "GreaterOrEqual"://大于等于 |
|
|
|
|
conditions += $" AND {name} >='{jsonParam.columnValue}'"; |
|
|
|
|
break; |
|
|
|
|
case "Greater"://大于 |
|
|
|
|
conditions += $" AND {name} >'{jsonParam.columnValue}'"; |
|
|
|
|
break; |
|
|
|
|
case "LessOrEqual"://小于等于 |
|
|
|
|
conditions += $" AND {name} <='{jsonParam.columnValue}'"; |
|
|
|
|
break; |
|
|
|
|
case "Less"://小于 |
|
|
|
|
conditions += $" AND {name} <'{jsonParam.columnValue}'"; |
|
|
|
|
break; |
|
|
|
|
case "EqualAny":// |
|
|
|
|
if (jsonParam.columnValue != null) |
|
|
|
|
{ |
|
|
|
|
var ids1 = JsonHelper.JsonToObj<List<string>>(jsonParam.columnValue.ToString()); |
|
|
|
|
|
|
|
|
|
conditions += $" AND {name} IN ({string.Join(",", ids1.Select(id => "'" + id + "'"))})"; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case "NotEqualAny":// |
|
|
|
|
if (jsonParam.columnValue != null) |
|
|
|
|
{ |
|
|
|
|
var ids1 = JsonHelper.JsonToObj<List<string>>(jsonParam.columnValue.ToString()); |
|
|
|
|
|
|
|
|
|
conditions += $" AND ({name} NOT IN ({string.Join(",", ids1.Select(id => "'" + id + "'"))}) OR {name} IS NULL)"; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
return conditions; |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
public string GetQueryString(string sqlSelect, int? currentPage = null, int? pageSize = null, string sortField = null, string sortDirection = null) |
|
|
|
|
{ |
|
|
|
|
string queryString = string.Empty; |
|
|
|
|