JAVA开发2021日常笔记

3 篇文章 0 订阅
随便写写,记录遇到的难题,以及怎么解决的。。。

1、JAVA

1、字符串转list
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>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值