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])