List<String> value =Arrays.asList(e.get("value").toString().split(","));
2、PGSQL
1、分组排序
SELECT
res.coords
FROM
(
SELECT
concat (
s.address ->> 'longitude',
',',
s.address ->> 'latitude'
) AS coords,
s.address ->> 'provinceCode' AS provinceCode,
ROW_NUMBER () OVER (
PARTITION BY s.address ->> 'provinceCode'
) RANK //序列号
FROM
t_report_member s
WHERE
s.identity_code = '汽修厂'
AND s.data_time = (
SELECT
MAX (data_time)
FROM
t_report_member
)
) res
WHERE
res. RANK = 1
2、replace into
<foreach item="item" collection="saveList">
WITH upsert AS (
UPDATE t_preferences_recommand
SET preference =
<choose>
<when test="item.preference != null and item.preference != ''">#{item.preference}</when>
<otherwise>''</otherwise>
</choose>
, val =
<choose>
<when test="item.val != null and item.val != ''">#{item.val}</when>
<otherwise>''</otherwise>
</choose>,update_time = now()
WHERE
user_id = #{item.userId} RETURNING *
) INSERT INTO t_preferences_recommand SELECT
#{item.userId},
<choose>
<when test="item.preference != null and item.preference != ''">#{item.preference}</when>
<otherwise>''</otherwise>
</choose>
,
<choose>
<when test="item.val != null and item.val != ''">#{item.val}</when>
<otherwise>''</otherwise>
</choose>, now(), null
WHERE NOT EXISTS ( SELECT 1 FROM upsert WHERE user_id = #{item.userId} );
</foreach>