|
@@ -96,11 +96,11 @@ object CompanyDynamic {
|
|
|
//既需根据cid补全cname字段数据;还需在data字段中根据其中的cid添加对应cname数据
|
|
|
case 2 =>
|
|
|
s"""
|
|
|
- |SELECT cid, ${colsExclusiveSome.mkString(",")},old_data, cname, str_to_map(replace(concat_ws(',',data),'},{',',')) AS data
|
|
|
+ |SELECT cid, ${colsExclusiveSome.mkString(",")},old_data, cname, STR_TO_MAP(regexp_replace(concat_ws(',',data),'[{"}]',''),',',':') AS data
|
|
|
|FROM(
|
|
|
| SELECT new_cid AS cid, ${colsExclusiveSome.mkString(",")},to_json(old_data) AS old_data, COLLECT_SET(cname)[0] AS cname, COLLECT_SET(to_json(data)) AS data
|
|
|
| FROM(
|
|
|
- | SELECT new_cid, ${colsExclusiveSome.map("A." + _).mkString(",")}, A.cid, IF(A.data IS NULL, STR_TO_MAP(CONCAT('cname:',cname),',',':'), A.data) AS data, old_data, IF(A.new_cid=A.cid,B.cname,null) AS cname
|
|
|
+ | SELECT new_cid, ${colsExclusiveSome.map("A." + _).mkString(",")}, A.cid, IF(A.data IS NULL, STR_TO_MAP(CONCAT('cname:',IF(cname IS NULL, '',cname)),',',':'), A.data) AS data, old_data, IF(A.new_cid=A.cid,B.cname,null) AS cname
|
|
|
| FROM(
|
|
|
| SELECT cid AS new_cid, cid, ${colsExclusiveSome.mkString(",")},data, old_data
|
|
|
| FROM(
|