Skip to content

Commit

Permalink
[Core] [Manager] Support some functions (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
qianmoQ committed May 22, 2023
2 parents 9e14384 + 3eef453 commit a0ebb8c
Show file tree
Hide file tree
Showing 17 changed files with 673 additions and 182 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ private String getSelect()
SelectBuilder.SELECT(applySelectColumns());
SelectBuilder.FROM(applyDatabaseAndTable());

if (StringUtils.isNotEmpty(configure.getWhere())) {
SelectBuilder.WHERE(configure.getWhere());
}

if (ObjectUtils.isNotEmpty(configure.getOrders())) {
SelectBuilder.ORDER_BY(applyOrderByColumns());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ public class SqlBody
private List<SqlColumn> orders;
private int limit = 10;
private int offset = 1;
private String where;
private SqlType type;
}
10 changes: 10 additions & 0 deletions core/datacap-server/src/main/resources/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ GROUP BY
COLUMN_TYPE', 'Gets the data column classification collection based on the provided database and data table', 'H2',
'[{"column":"database","type":"String","expression":"${database:String}"},{"column":"table","type":"String","expression":"${table:String}"}]', TRUE),
('FindColumnByDatabaseAndTableAndType', 'SELECT
''${database:String}'' AS TABLE_CATALOG,
''${table:String}'' AS TABLE_NAME,
COLUMN_NAME,
COLUMN_TYPE,
DATA_TYPE
Expand Down Expand Up @@ -232,6 +234,8 @@ GROUP BY
COLUMN_TYPE', 'Gets the data column classification collection based on the provided database and data table', 'MySQL',
'[{"column":"database","type":"String","expression":"${database:String}"},{"column":"table","type":"String","expression":"${table:String}"}]', TRUE),
('FindColumnByDatabaseAndTableAndType', 'SELECT
''${database:String}'' AS TABLE_CATALOG,
''${table:String}'' AS TABLE_NAME,
COLUMN_NAME,
COLUMN_TYPE,
DATA_TYPE
Expand Down Expand Up @@ -285,6 +289,8 @@ FROM
WHERE
COLUMN_TYPE LIKE ''%${type:String}%''
GROUP BY
TABLE_CATALOG,
TABLE_NAME,
COLUMN_NAME,
COLUMN_TYPE,
DATA_TYPE
Expand Down Expand Up @@ -361,6 +367,8 @@ GROUP BY
COLUMN_TYPE', 'Gets the data column classification collection based on the provided database and data table', 'ClickHouse',
'[{"column":"database","type":"String","expression":"${database:String}"},{"column":"table","type":"String","expression":"${table:String}"}]', TRUE),
('FindColumnByDatabaseAndTableAndType', 'SELECT
''${database:String}'' AS TABLE_CATALOG,
''${table:String}'' AS TABLE_NAME,
COLUMN_NAME,
COLUMN_TYPE,
DATA_TYPE
Expand Down Expand Up @@ -389,6 +397,8 @@ FROM
WHERE
COLUMN_TYPE LIKE ''%${type:String}%''
GROUP BY
TABLE_CATALOG,
TABLE_NAME,
COLUMN_NAME,
COLUMN_TYPE,
DATA_TYPE
Expand Down
8 changes: 4 additions & 4 deletions core/datacap-server/src/main/resources/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ CREATE TABLE IF NOT EXISTS users
TRUNCATE TABLE users;
ALTER TABLE users
ALTER COLUMN id RESTART WITH 1;
INSERT INTO users (username, password, create_time)
VALUES ('admin', '$2a$10$ee2yg.Te14GpHppDUROAi.HzYR5Q.q2/5vrZvAr4TFY3J2iT663JG', NULL);
INSERT INTO users (username, password, create_time)
VALUES ('datacap', '$2a$10$bZ4XBRlYUjKfkBovWT9TuuXlEF7lpRxVrXS8iqyCjCHUqy4RPTL8.', NULL);
INSERT INTO users (username, password)
VALUES ('admin', '$2a$10$ee2yg.Te14GpHppDUROAi.HzYR5Q.q2/5vrZvAr4TFY3J2iT663JG');
INSERT INTO users (username, password)
VALUES ('datacap', '$2a$10$bZ4XBRlYUjKfkBovWT9TuuXlEF7lpRxVrXS8iqyCjCHUqy4RPTL8.');
Loading

0 comments on commit a0ebb8c

Please sign in to comment.