|
1 | 1 | package io.edurt.datacap.plugin |
2 | 2 |
|
| 3 | +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings |
3 | 4 | import io.edurt.datacap.spi.PluginService |
4 | 5 | import io.edurt.datacap.spi.generator.definition.TableDefinition |
5 | 6 | import io.edurt.datacap.spi.model.Configure |
6 | 7 | import io.edurt.datacap.spi.model.Response |
7 | 8 |
|
8 | | -class StarRocksService : PluginService { |
9 | | - override fun connectType(): String { |
| 9 | +@SuppressFBWarnings(value = ["NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"]) |
| 10 | +class StarRocksService : PluginService |
| 11 | +{ |
| 12 | + override fun connectType(): String |
| 13 | + { |
10 | 14 | return "mysql" |
11 | 15 | } |
12 | 16 |
|
13 | | - override fun driver(): String { |
| 17 | + override fun driver(): String |
| 18 | + { |
14 | 19 | return "com.mysql.cj.jdbc.Driver" |
15 | 20 | } |
16 | 21 |
|
17 | | - override fun isSupportMeta(): Boolean { |
| 22 | + override fun isSupportMeta(): Boolean |
| 23 | + { |
18 | 24 | return true |
19 | 25 | } |
20 | 26 |
|
21 | | - override fun getTables(configure: Configure?, database: String?): Response { |
| 27 | + override fun getTables(configure: Configure?, database: String?): Response |
| 28 | + { |
22 | 29 | val sql = """SELECT |
23 | 30 | CASE |
24 | 31 | WHEN type = 'BASE TABLE' THEN 'table' |
@@ -81,10 +88,11 @@ class StarRocksService : PluginService { |
81 | 88 | END, |
82 | 89 | object_name;""" |
83 | 90 |
|
84 | | - return this.execute(configure, sql.replace("{0}", database!!)) |
| 91 | + return this.execute(configure, sql.replace("{0}", database !!)) |
85 | 92 | } |
86 | 93 |
|
87 | | - override fun getColumns(configure: Configure?, database: String?, table: String?): Response { |
| 94 | + override fun getColumns(configure: Configure?, database: String?, table: String?): Response |
| 95 | + { |
88 | 96 | val sql = """SELECT detail.* |
89 | 97 | FROM ( |
90 | 98 | -- 列信息 |
@@ -183,12 +191,13 @@ class StarRocksService : PluginService { |
183 | 191 |
|
184 | 192 | return this.execute( |
185 | 193 | configure, |
186 | | - sql.replace("{0}", database!!) |
187 | | - .replace("{1}", table!!) |
| 194 | + sql.replace("{0}", database !!) |
| 195 | + .replace("{1}", table !!) |
188 | 196 | ) |
189 | 197 | } |
190 | 198 |
|
191 | | - override fun getSuggests(configure: Configure?, keyword: String?): Response { |
| 199 | + override fun getSuggests(configure: Configure?, keyword: String?): Response |
| 200 | + { |
192 | 201 | val sql = """SELECT * FROM ( |
193 | 202 | -- 数据库 |
194 | 203 | SELECT |
@@ -286,14 +295,15 @@ class StarRocksService : PluginService { |
286 | 295 | ORDER BY sort_order, object_name limit 10;""" |
287 | 296 | return this.execute( |
288 | 297 | configure, |
289 | | - sql.replace("{0}", keyword!!) |
| 298 | + sql.replace("{0}", keyword !!) |
290 | 299 | ) |
291 | 300 | } |
292 | 301 |
|
293 | | - override fun getColumn(configure: Configure?, definition: TableDefinition?): Response { |
294 | | - val column = definition!!.columns.stream().findAny() |
| 302 | + override fun getColumn(configure: Configure?, definition: TableDefinition?): Response |
| 303 | + { |
| 304 | + val column = definition !!.columns.stream().findAny() |
295 | 305 |
|
296 | | - require(!column.isEmpty) { "Column must be specified" } |
| 306 | + require(! column.isEmpty) { "Column must be specified" } |
297 | 307 |
|
298 | 308 | val sql = """SELECT |
299 | 309 | detail.* |
|
0 commit comments