From c028147459937293de78f20e640e33643c3d82e0 Mon Sep 17 00:00:00 2001 From: 05412 <2738076308@qq.com> Date: Thu, 25 Jul 2024 13:54:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E8=AF=A2=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/dev/surl/surl/service/SurlService.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/surl/surl/service/SurlService.kt b/src/main/java/dev/surl/surl/service/SurlService.kt index 3314295..988257b 100644 --- a/src/main/java/dev/surl/surl/service/SurlService.kt +++ b/src/main/java/dev/surl/surl/service/SurlService.kt @@ -39,6 +39,7 @@ class SurlService { * 批量添加短链接 * @param baseurls 原始链接列表 */ + @Suppress("UNUSED") fun batchAddSurl(baseurls: List) = transaction { Surls.batchInsert(baseurls, shouldReturnGeneratedValues = false) { this[Surls.url] = it @@ -61,10 +62,11 @@ class SurlService { /** * 根据用户名获取短链接列表 * @param username 用户名 + * @return 短链接列表 */ fun getUrlsByUser(username: String): List> { return transaction { - Users.leftJoin(Surls).select(Surls.id, Surls.url).where { + Users.innerJoin(Surls).select(Surls.id, Surls.url).where { Users.username eq username }.map { KeyValuePair(numberToKey(it[Surls.id].value), it[Surls.url])