|
@@ -4,17 +4,25 @@ import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.util.*;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
+import com.alibaba.fastjson2.JSONException;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
+import com.zkqy.common.core.domain.TreeSelectStrId;
|
|
|
+import com.zkqy.common.core.domain.TreeSelectValueLabel;
|
|
|
+import com.zkqy.common.core.domain.TreeSelectWithParentId;
|
|
|
import com.zkqy.common.utils.CollectionUtil;
|
|
|
import com.zkqy.common.utils.DateUtils;
|
|
|
import com.zkqy.common.utils.StringUtils;
|
|
|
+import com.zkqy.common.entity.TreeComponentDTO;
|
|
|
+import com.zkqy.common.utils.TreeBuilder;
|
|
|
import com.zkqy.system.entity.vo.MobilePageDesignDataSubTableVo;
|
|
|
+import org.apache.commons.lang3.StringEscapeUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -152,15 +160,21 @@ public class MobilePageDesignDataServiceImpl implements IMobilePageDesignDataSer
|
|
|
public String fillUpdateJsonPageData(MobilePageDesignData fromDesignData,MobilePageDesignData toDesignData, Long searchId) {
|
|
|
//得到列名 + 表名
|
|
|
String primaryTable = findPrimaryTableByPageJson(fromDesignData.getPageJson());
|
|
|
- String querySqlWhere = String.format(" and %s.id = %d",primaryTable,searchId);
|
|
|
String pageJson = toDesignData.getPageJson();
|
|
|
+ String pageJsonFrom = fromDesignData.getPageJson();
|
|
|
+ JSONArray columnsFrom = JSONArray.parseArray(pageJsonFrom);
|
|
|
+ JSONArray columnsFromRes = null;
|
|
|
+ for (JSONObject pageConfig : columnsFrom.toJavaList(JSONObject.class)) {
|
|
|
+ columnsFromRes = pageConfig.getJSONArray("columns");
|
|
|
+ }
|
|
|
JSONArray columns = JSONArray.parseArray(pageJson);
|
|
|
+
|
|
|
// 构建SELECT部分
|
|
|
String selectSql = buildSelectClause(columns);
|
|
|
// 构建FROM和JOIN部分
|
|
|
- String fromSql = buildFromClause(columns);
|
|
|
+ String fromSql = buildFromClause(columnsFromRes);
|
|
|
// 构建where部分
|
|
|
- String whereSql = " where " + primaryTable +".del_flag='0'";
|
|
|
+ String whereSql = " where " + primaryTable + ".del_flag='0' and "+ primaryTable + ".id =" + searchId;
|
|
|
String querySql = selectSql + " " + fromSql + whereSql ;
|
|
|
|
|
|
if (StringUtils.isBlank(querySql)){
|
|
@@ -196,18 +210,28 @@ public class MobilePageDesignDataServiceImpl implements IMobilePageDesignDataSer
|
|
|
if (field == null || field.equals("")){
|
|
|
continue;
|
|
|
}
|
|
|
- //从结果的map中遍历,得到结果
|
|
|
-// for (Map<String, String> map : maps) {
|
|
|
Object fieldValue = maps.get(field);
|
|
|
if (fieldValue != null && !String.valueOf(fieldValue).equals("")&& StringUtils.isNotBlank(String.valueOf(fieldValue))){
|
|
|
- jsonObject.put("value",fieldValue);
|
|
|
+ String strValue = String.valueOf(fieldValue);
|
|
|
+ try {
|
|
|
+ // 尝试解析成 JSONArray
|
|
|
+ if (strValue.startsWith("[") && strValue.endsWith("]")) {
|
|
|
+ JSONArray array = JSON.parseArray(strValue); // 按逗号分割
|
|
|
+ jsonObject.put("value", array);
|
|
|
+ } else {
|
|
|
+ jsonObject.put("value", fieldValue);
|
|
|
+ }
|
|
|
+ } catch (JSONException e) {
|
|
|
+ // 如果不是合法的 JSON 数组,直接存原值
|
|
|
+ jsonObject.put("value", fieldValue);
|
|
|
+ }
|
|
|
}
|
|
|
-// }
|
|
|
}
|
|
|
//替换html的rule数据
|
|
|
+
|
|
|
htmlDecode = htmlDecode.replace(
|
|
|
"rule: formCreate.parseJson('" + oldRuleJson + "')",
|
|
|
- "rule: formCreate.parseJson('" + jsonArray + "')"
|
|
|
+ "rule: formCreate.parseJson('" + StringEscapeUtils.unescapeJava(jsonArray.toString()) + "')"
|
|
|
);
|
|
|
}
|
|
|
}
|
|
@@ -255,6 +279,7 @@ public class MobilePageDesignDataServiceImpl implements IMobilePageDesignDataSer
|
|
|
//构建 构建insert
|
|
|
StringBuilder sqlBuilder = new StringBuilder();
|
|
|
Map<String, Object> primaryMap = resultMap.get(primaryTableName);
|
|
|
+ primaryMap.put("del_flag","0");
|
|
|
resultMap.remove(primaryTableName);
|
|
|
List<String> extraList = new ArrayList<>();
|
|
|
for (Map.Entry<String, Map<String, Object>> entry : resultMap.entrySet()) {
|
|
@@ -271,6 +296,8 @@ public class MobilePageDesignDataServiceImpl implements IMobilePageDesignDataSer
|
|
|
fields.add(fieldName);
|
|
|
values.add(processFieldValue(fieldValue));
|
|
|
}
|
|
|
+ fields.add("del_flag");
|
|
|
+ values.add("0");
|
|
|
// 构建 INSERT SQL
|
|
|
sqlBuilder.append("INSERT INTO ")
|
|
|
.append("{DBNAME}.").append(tableName)
|
|
@@ -301,26 +328,37 @@ public class MobilePageDesignDataServiceImpl implements IMobilePageDesignDataSer
|
|
|
String primaryTable = findPrimaryTable(columns);
|
|
|
Map<String, MobilePageDesignDataSubTableVo> subTableMap = findSubTableMap(columns);
|
|
|
// 分三段拼接出 update set 和 where 语法
|
|
|
- List<String> collect = subTableMap.keySet().stream().collect(Collectors.toList());
|
|
|
- StringBuilder update = new StringBuilder("UPDATE ")
|
|
|
- .append("{DBNAME}.").append(primaryTable);
|
|
|
- collect.forEach(tableName -> update.append(",").append("{DBNAME}.").append(tableName));
|
|
|
- String updateSql = update.toString();
|
|
|
+ StringBuilder updateSql = getUpdateSql(primaryTable, subTableMap);
|
|
|
//从datamap中提取出 where判断的id
|
|
|
Number id = (Number) dataMap.get(primaryTable + "@id");
|
|
|
dataMap.remove(primaryTable + "@id");
|
|
|
Map<String, Object> stringObjectMap = convertKeysFromFirstUnderLineToDot(dataMap);
|
|
|
String setSql = " SET " + stringObjectMap.entrySet().stream()
|
|
|
- .map(entry -> entry.getKey() + "='" + entry.getValue()+"'")
|
|
|
- .collect(Collectors.joining(", ")); // 自动处理逗号分隔
|
|
|
+ .map(entry -> {
|
|
|
+ Object value = entry.getValue();
|
|
|
+ String valueStr;
|
|
|
+ // 处理数组或集合类型
|
|
|
+ if (value instanceof Collection || value != null && value.getClass().isArray()) {
|
|
|
+ // 将数组或集合转为 Stream,再拼接成无空格的字符串
|
|
|
+ List<?> list = (List<?>) value;
|
|
|
+ valueStr = "[" + list.stream().filter(str -> str!= null && !str.equals(""))
|
|
|
+ .map(str -> {
|
|
|
+ if (str instanceof String) {
|
|
|
+ return "\"" + str + "\""; // 如果是String类型,加上双引号
|
|
|
+ }
|
|
|
+ return str.toString();
|
|
|
+ })
|
|
|
+ .collect(Collectors.joining(",")) + "]" ;
|
|
|
+ } else {
|
|
|
+ // 普通类型直接转字符串
|
|
|
+ valueStr = value.toString();
|
|
|
+ }
|
|
|
+ return entry.getKey() + "='" + valueStr + "'";
|
|
|
+ })
|
|
|
+ .collect(Collectors.joining(","));
|
|
|
// 拼接 where条件 (关联的表 + 主键该行的id)
|
|
|
- String idSql = primaryTable +".id" +"=" + id;
|
|
|
- String whereSql = subTableMap.entrySet().stream()
|
|
|
- .map(entry -> primaryTable + "." + entry.getValue().getPrimaryKey() +
|
|
|
- "=" + entry.getKey() + "." + entry.getValue().getSubKey())
|
|
|
- .collect(Collectors.joining(" and ")) ;
|
|
|
- whereSql = " where " + (StringUtils.isBlank(whereSql) ? idSql : whereSql + " and " + idSql);
|
|
|
- fullUpdateSql = updateSql + setSql + whereSql;
|
|
|
+ String idSql = " where " + primaryTable +".id" +"=" + id;
|
|
|
+ fullUpdateSql = updateSql + setSql + idSql;
|
|
|
}
|
|
|
return fullUpdateSql;
|
|
|
}
|
|
@@ -337,11 +375,7 @@ public class MobilePageDesignDataServiceImpl implements IMobilePageDesignDataSer
|
|
|
String primaryTable = findPrimaryTable(columns);
|
|
|
Map<String, MobilePageDesignDataSubTableVo> subTableMap = findSubTableMap(columns);
|
|
|
// 分三段拼接出 update set 和 where 语法
|
|
|
- List<String> collect = subTableMap.keySet().stream().collect(Collectors.toList());
|
|
|
- StringBuilder update = new StringBuilder("UPDATE ")
|
|
|
- .append("{DBNAME}.").append(primaryTable);
|
|
|
- collect.forEach(tableName -> update.append(",").append("{DBNAME}.").append(tableName));
|
|
|
- String updateSql = update.toString();
|
|
|
+ StringBuilder updateSql = getUpdateSql(primaryTable, subTableMap);
|
|
|
String DELFLAG = ".del_flag = '2' ";
|
|
|
String setSQL = " SET " + primaryTable + DELFLAG + " ";
|
|
|
subTableMap.entrySet().stream()
|
|
@@ -349,16 +383,13 @@ public class MobilePageDesignDataServiceImpl implements IMobilePageDesignDataSer
|
|
|
.collect(Collectors.joining(", "));
|
|
|
// 拼接 where条件 (关联的表 + 主键该行的id)
|
|
|
String idSql = primaryTable +".id" +"=" + lineId;
|
|
|
- String whereSql = subTableMap.entrySet().stream()
|
|
|
- .map(entry -> primaryTable + "." + entry.getValue().getPrimaryKey() +
|
|
|
- "=" + entry.getKey() + "." + entry.getValue().getSubKey())
|
|
|
- .collect(Collectors.joining(" and "));
|
|
|
- whereSql = " where " + (StringUtils.isBlank(whereSql) ? idSql : whereSql + " and " + idSql);
|
|
|
+ String whereSql = " where "+ idSql;
|
|
|
fullUpdateSql = updateSql + setSQL + whereSql;
|
|
|
}
|
|
|
return fullUpdateSql;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public String mapToQuerySql(String pageJson) {
|
|
|
JSONArray pageConfigs = JSON.parseArray(pageJson);
|
|
@@ -386,7 +417,7 @@ public class MobilePageDesignDataServiceImpl implements IMobilePageDesignDataSer
|
|
|
Long id = mobilePageDesignData.getId();
|
|
|
String htmlData = mobilePageDesignData.getHtmlData();
|
|
|
htmlData = URLDecoder.decode(htmlData);
|
|
|
- Pattern pattern = Pattern.compile("options:\\s*formCreate\\.parseJson\\('(.*?)'\\)");
|
|
|
+ Pattern pattern = Pattern.compile("rule:\\s*formCreate\\.parseJson\\('(.*?)'\\)");
|
|
|
Matcher matcher = pattern.matcher(htmlData);
|
|
|
|
|
|
if (!matcher.find()) {
|
|
@@ -394,11 +425,19 @@ public class MobilePageDesignDataServiceImpl implements IMobilePageDesignDataSer
|
|
|
}
|
|
|
|
|
|
String oldJsonStr = matcher.group(1);
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(oldJsonStr);
|
|
|
- JSONObject form = jsonObject.getJSONObject("form");
|
|
|
- form.put("pageId",id);
|
|
|
- jsonObject.put("form",form);
|
|
|
- String newJsonStr = jsonObject.toString();
|
|
|
+ JSONArray jsonArray = JSON.parseArray(oldJsonStr);
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
+ if (jsonObject.get("type") != null && jsonObject.get("type").equals("zkqyTable") && jsonObject.getJSONObject("props") != null){
|
|
|
+ JSONObject jsonObject1 = jsonObject.getJSONObject("props");
|
|
|
+ jsonObject1.put("pageId",id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+// JSONObject jsonObject = JSONObject.parseObject(oldJsonStr);
|
|
|
+// JSONObject form = jsonObject.getJSONObject("form");
|
|
|
+// form.put("pageId",id);
|
|
|
+// jsonObject.put("form",form);
|
|
|
+ String newJsonStr = jsonArray.toString();
|
|
|
String newHtmlData = htmlData.replace(oldJsonStr,newJsonStr);
|
|
|
String encodeHtml = "";
|
|
|
try {
|
|
@@ -409,7 +448,7 @@ public class MobilePageDesignDataServiceImpl implements IMobilePageDesignDataSer
|
|
|
}
|
|
|
mobilePageDesignData.setHtmlData(encodeHtml);
|
|
|
// 给pageOption里面也加上
|
|
|
- mobilePageDesignData.setPageOptions(newJsonStr);
|
|
|
+ mobilePageDesignData.setPageJson(newJsonStr);
|
|
|
}
|
|
|
|
|
|
private String buildSelectClause(JSONArray columns) {
|
|
@@ -433,19 +472,21 @@ public class MobilePageDesignDataServiceImpl implements IMobilePageDesignDataSer
|
|
|
if (primaryTable == null) {
|
|
|
return ""; // 或者抛出异常,根据业务需求决定
|
|
|
}
|
|
|
-
|
|
|
StringBuilder fromBuilder = new StringBuilder(" from ").append("{DBNAME}.").append(primaryTable);
|
|
|
-
|
|
|
+ HashSet<String> set = new HashSet<>();
|
|
|
for (JSONObject column : columns.toJavaList(JSONObject.class)) {
|
|
|
String tableType = column.getString("tableType");
|
|
|
if (!"sub".equals(tableType)) {
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
String tableName = column.getString("tableName");
|
|
|
String subKey = column.getString("subKey");
|
|
|
String primaryKey = column.getString("primaryKey");
|
|
|
-
|
|
|
+ if (set.contains(tableName)){
|
|
|
+ continue;
|
|
|
+ }else{
|
|
|
+ set.add(tableName);
|
|
|
+ }
|
|
|
fromBuilder.append(" left join ")
|
|
|
.append("{DBNAME}.").append(tableName)
|
|
|
.append(" on ")
|
|
@@ -512,7 +553,6 @@ public class MobilePageDesignDataServiceImpl implements IMobilePageDesignDataSer
|
|
|
String tableName,
|
|
|
Map<String, Object> dataMap,
|
|
|
List<String> extraFields) {
|
|
|
-
|
|
|
// 合并所有字段名(dataMap 的 key + extraFields)
|
|
|
List<String> allFields = new ArrayList<>(dataMap.keySet());
|
|
|
allFields.addAll(extraFields);
|
|
@@ -545,6 +585,17 @@ public class MobilePageDesignDataServiceImpl implements IMobilePageDesignDataSer
|
|
|
return "'" + escapeSqlString(value.toString()) + "'";
|
|
|
} else if (value instanceof Number || value instanceof Boolean) {
|
|
|
return value.toString();
|
|
|
+ } else if (value instanceof List) {
|
|
|
+ List<?> list = (List<?>) value;
|
|
|
+ String collect = "'[" + list.stream().filter(str -> str!= null && !str.equals(""))
|
|
|
+ .map(str -> {
|
|
|
+ if (str instanceof String) {
|
|
|
+ return "\"" + str + "\""; // 如果是String类型,加上双引号
|
|
|
+ }
|
|
|
+ return str.toString();
|
|
|
+ })
|
|
|
+ .collect(Collectors.joining(",")) + "]'" ;
|
|
|
+ return collect;
|
|
|
}
|
|
|
return "NULL";
|
|
|
}
|
|
@@ -567,4 +618,134 @@ public class MobilePageDesignDataServiceImpl implements IMobilePageDesignDataSer
|
|
|
}
|
|
|
return key; // 如果没有下划线,保持原样
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<TreeSelectStrId> getSingleTableTree(TreeComponentDTO treeComponentDTO) {
|
|
|
+ // 构建查询的sql
|
|
|
+ String tableName = treeComponentDTO.getTableName();
|
|
|
+ String primaryIdField = treeComponentDTO.getPrimaryIdField();
|
|
|
+ String parentIdField = treeComponentDTO.getParentIdField();
|
|
|
+ String showValue = treeComponentDTO.getShowValue();
|
|
|
+ if (StringUtils.isNotBlank(tableName) && StringUtils.isNotBlank(primaryIdField) && StringUtils.isNotBlank(parentIdField) && StringUtils.isNotBlank(showValue)){
|
|
|
+ List<Map<String,Object>> dataList = mobilePageDesignDataMapper.getSingleTableTree(tableName,primaryIdField,parentIdField,showValue);
|
|
|
+ // 前面查询的时候已经将列转换过了,所以这里可以指定列名
|
|
|
+ List<Map<String, ?>> maps = TreeBuilder.buildTree(dataList, "0", "id", "parentId");
|
|
|
+ List<TreeSelectStrId> convert = TreeBuilder.convert(maps);
|
|
|
+ return convert;
|
|
|
+ }else{
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<TreeSelectStrId> getMultiTableTree(TreeComponentDTO dto) {
|
|
|
+ // 1. 查询根节点
|
|
|
+ List<TreeSelectStrId> rootNodes = mobilePageDesignDataMapper.selectRootNodes(dto);
|
|
|
+ // 2. 递归构建子节点
|
|
|
+ if (dto.getChildrenTree() != null) {
|
|
|
+ buildChildNodes(rootNodes, dto.getChildrenTree());
|
|
|
+ }
|
|
|
+ return rootNodes;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void buildChildNodes(List<TreeSelectStrId> parentNodes, TreeComponentDTO childDto) {
|
|
|
+ // 1. 提取父节点的原始ID(去掉@前缀部分)用于查询
|
|
|
+ List<String> parentOriginalIds = parentNodes.stream()
|
|
|
+ .map(node -> {
|
|
|
+ // 获取最后一个@后的部分(原始ID)
|
|
|
+ String idWithPath = node.getId();
|
|
|
+ return idWithPath.contains("@")
|
|
|
+ ? idWithPath.substring(idWithPath.lastIndexOf("@") + 1)
|
|
|
+ : idWithPath;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 2. 查询子节点数据(用原始parentId匹配数据库)
|
|
|
+ List<TreeSelectWithParentId> childNodes = mobilePageDesignDataMapper.selectChildNodes(childDto, parentOriginalIds);
|
|
|
+
|
|
|
+ // 3. 建立父子关系
|
|
|
+ Map<String, TreeSelectStrId> parentNodeMap = parentNodes.stream()
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ node -> {
|
|
|
+ // 用同样的逻辑提取原始ID作为Map的Key
|
|
|
+ String idWithPath = node.getId();
|
|
|
+ return idWithPath.contains("@")
|
|
|
+ ? idWithPath.substring(idWithPath.lastIndexOf("@") + 1)
|
|
|
+ : idWithPath;
|
|
|
+ },
|
|
|
+ Function.identity()
|
|
|
+ ));
|
|
|
+
|
|
|
+ for (TreeSelectWithParentId child : childNodes) {
|
|
|
+ // 根据child的parentId(原始ID)找到父节点
|
|
|
+ TreeSelectStrId parent = parentNodeMap.get(child.getParentId());
|
|
|
+ if (parent != null) {
|
|
|
+ if (parent.getChildren() == null) {
|
|
|
+ parent.setChildren(new ArrayList<>());
|
|
|
+ }
|
|
|
+ // 生成带路径的子节点ID:父节点路径 + @ + 子节点原始ID
|
|
|
+ String childIdWithPath = parent.getId() + "@" + child.getId();
|
|
|
+ child.setId(childIdWithPath); // 修改为带路径的ID
|
|
|
+ parent.getChildren().add(child);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 4. 递归处理子节点
|
|
|
+ if (childDto.getChildrenTree() != null) {
|
|
|
+ List<TreeSelectStrId> nodesWithChildren = parentNodes.stream()
|
|
|
+ .filter(node -> node.getChildren() != null && !node.getChildren().isEmpty())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ for (TreeSelectStrId parent : nodesWithChildren) {
|
|
|
+ buildChildNodes(parent.getChildren(), childDto.getChildrenTree());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<TreeSelectValueLabel> convertTreeStrIdToValueLabel(List<TreeSelectStrId> originalTree) {
|
|
|
+ return originalTree.stream()
|
|
|
+ .map(node -> convertNodeStrId(node))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void fillTableIdToForm(int i, List<Long> tableIds) {
|
|
|
+ if (tableIds != null && !tableIds.isEmpty()){
|
|
|
+ mobilePageDesignDataMapper.fillTableIdToForm(i,tableIds);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private static TreeSelectValueLabel convertNodeStrId(TreeSelectStrId originalNode) {
|
|
|
+ TreeSelectValueLabel converted = new TreeSelectValueLabel();
|
|
|
+ converted.setValue(originalNode.getId());
|
|
|
+ converted.setLabel(originalNode.getLabel());
|
|
|
+
|
|
|
+ if (originalNode.getChildren() != null) {
|
|
|
+ List<TreeSelectValueLabel> children = originalNode.getChildren().stream()
|
|
|
+ .map(node -> convertNodeStrId(node))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ converted.setChildren(children);
|
|
|
+ }
|
|
|
+
|
|
|
+ return converted;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param primaryTable 主表
|
|
|
+ * @param subTableMap 子表集合
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public StringBuilder getUpdateSql(String primaryTable,Map<String,MobilePageDesignDataSubTableVo> subTableMap){
|
|
|
+ StringBuilder updateSql = new StringBuilder("UPDATE ")
|
|
|
+ .append("{DBNAME}.").append(primaryTable);
|
|
|
+ // 添加LEFT JOIN部分
|
|
|
+ for (Map.Entry<String, MobilePageDesignDataSubTableVo> entry : subTableMap.entrySet()) {
|
|
|
+ String subTableName = entry.getKey();
|
|
|
+ MobilePageDesignDataSubTableVo subTableVo = entry.getValue();
|
|
|
+ updateSql.append(" LEFT JOIN {DBNAME}.").append(subTableName)
|
|
|
+ .append(" ON ").append(primaryTable).append(".").append(subTableVo.getPrimaryKey())
|
|
|
+ .append(" = ").append(subTableName).append(".").append(subTableVo.getSubKey());
|
|
|
+ }
|
|
|
+ return updateSql;
|
|
|
+ }
|
|
|
+
|
|
|
}
|