|
|
|
@ -3,6 +3,7 @@ package apelet.common.online.abstractplugin; |
|
|
|
import apelet.common.core.object.MyOrderParam; |
|
|
|
import apelet.common.core.object.MyOrderParam; |
|
|
|
import apelet.common.core.object.ObjectCollection; |
|
|
|
import apelet.common.core.object.ObjectCollection; |
|
|
|
import apelet.common.core.object.ResponseResult; |
|
|
|
import apelet.common.core.object.ResponseResult; |
|
|
|
|
|
|
|
import apelet.common.core.object.TokenData; |
|
|
|
import apelet.common.online.abstractplugin.model.GridData; |
|
|
|
import apelet.common.online.abstractplugin.model.GridData; |
|
|
|
import apelet.common.online.dto.OnlineEventPluginExecuteDto; |
|
|
|
import apelet.common.online.dto.OnlineEventPluginExecuteDto; |
|
|
|
import apelet.common.online.dto.OnlineFilterDto; |
|
|
|
import apelet.common.online.dto.OnlineFilterDto; |
|
|
|
@ -12,7 +13,9 @@ import apelet.common.online.model.constant.FieldFilterType; |
|
|
|
import apelet.common.online.model.constant.RelationType; |
|
|
|
import apelet.common.online.model.constant.RelationType; |
|
|
|
import apelet.common.orm.impl.*; |
|
|
|
import apelet.common.orm.impl.*; |
|
|
|
import apelet.common.orm.parser.FilterParser; |
|
|
|
import apelet.common.orm.parser.FilterParser; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
|
|
|
|
import cn.hutool.core.util.ReUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
@ -84,6 +87,9 @@ public class ListDataOrmService extends ListDataService { |
|
|
|
getOrmSelector(widgetList, selectorSet, masterTable, new HashMap<>()); |
|
|
|
getOrmSelector(widgetList, selectorSet, masterTable, new HashMap<>()); |
|
|
|
Filter filter = getFilter(); |
|
|
|
Filter filter = getFilter(); |
|
|
|
if (StrUtil.isNotBlank(conditionExpression)) { |
|
|
|
if (StrUtil.isNotBlank(conditionExpression)) { |
|
|
|
|
|
|
|
TokenData tokenData = TokenData.takeFromRequest(); |
|
|
|
|
|
|
|
// 解析 conditionExpression 中的 ${字段名} 占位符,从 tokenData 中取值填充
|
|
|
|
|
|
|
|
conditionExpression = resolvePlaceholders(conditionExpression, tokenData); |
|
|
|
Filter parsed = FilterParser.parse(conditionExpression); |
|
|
|
Filter parsed = FilterParser.parse(conditionExpression); |
|
|
|
if (CollUtil.isNotEmpty(parsed.getItems())) { |
|
|
|
if (CollUtil.isNotEmpty(parsed.getItems())) { |
|
|
|
for (FilterItem item : parsed.getItems()) { |
|
|
|
for (FilterItem item : parsed.getItems()) { |
|
|
|
@ -102,7 +108,6 @@ public class ListDataOrmService extends ListDataService { |
|
|
|
} |
|
|
|
} |
|
|
|
if (!sorter.startsWithKey("create_time")) { |
|
|
|
if (!sorter.startsWithKey("create_time")) { |
|
|
|
SorterItem sorterItem = new SorterItem("create_time"); |
|
|
|
SorterItem sorterItem = new SorterItem("create_time"); |
|
|
|
; |
|
|
|
|
|
|
|
sorterItem.setSortType(SortType._DESC); |
|
|
|
sorterItem.setSortType(SortType._DESC); |
|
|
|
sorter.add(sorterItem); |
|
|
|
sorter.add(sorterItem); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -125,6 +130,21 @@ public class ListDataOrmService extends ListDataService { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 解析 conditionExpression 中的 ${字段名} 占位符,从 tokenData 中取值填充。 |
|
|
|
|
|
|
|
* 如 ${loginName} → 当前登录用户名,${deptId} → 当前用户部门ID。 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private String resolvePlaceholders(String expression, TokenData tokenData) { |
|
|
|
|
|
|
|
List<String> varNames = ReUtil.findAll("\\$\\{(\\w+)\\}", expression, 1); |
|
|
|
|
|
|
|
for (String fieldName : varNames) { |
|
|
|
|
|
|
|
Object value = BeanUtil.getProperty(tokenData, fieldName); |
|
|
|
|
|
|
|
if (value != null) { |
|
|
|
|
|
|
|
expression = expression.replace("${" + fieldName + "}", value.toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return expression; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void getOrmSelector(JSONObject jsonObject, Set<String> selectorSet, OnlineTable masterTable, Map<String, Object> entryIdMap) { |
|
|
|
public void getOrmSelector(JSONObject jsonObject, Set<String> selectorSet, OnlineTable masterTable, Map<String, Object> entryIdMap) { |
|
|
|
Map<Long, OnlineColumn> columnMap = masterTable.getColumnMap(); |
|
|
|
Map<Long, OnlineColumn> columnMap = masterTable.getColumnMap(); |
|
|
|
JSONArray array = jsonObject.getJSONArray("childWidgetList"); |
|
|
|
JSONArray array = jsonObject.getJSONArray("childWidgetList"); |
|
|
|
|