Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
schbrain-parent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
framework
schbrain-parent
Commits
1eebb5d0
Commit
1eebb5d0
authored
Jan 04, 2024
by
liaozan
🏀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine struct
parent
5102d7e6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
15 deletions
+13
-15
starters/starrocks-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/starrocks/operation/StarrocksService.java
...k/autoconfigure/starrocks/operation/StarrocksService.java
+4
-5
starters/starrocks-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/starrocks/operation/StarrocksServiceImpl.java
...toconfigure/starrocks/operation/StarrocksServiceImpl.java
+3
-3
starters/starrocks-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/starrocks/operation/StarrocksStreamLoadHandler.java
...igure/starrocks/operation/StarrocksStreamLoadHandler.java
+5
-6
starters/starrocks-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/starrocks/util/ConvertUtils.java
.../framework/autoconfigure/starrocks/util/ConvertUtils.java
+1
-1
No files found.
starters/starrocks-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/starrocks/operation/StarrocksService.java
View file @
1eebb5d0
package
com.schbrain.framework.autoconfigure.starrocks.operation
;
package
com.schbrain.framework.autoconfigure.starrocks.operation
;
import
java.util.List
;
import
java.util.*
;
import
java.util.Map
;
/**
/**
* @author liaozan
* @author liaozan
...
@@ -17,7 +16,7 @@ public interface StarrocksService<T> {
...
@@ -17,7 +16,7 @@ public interface StarrocksService<T> {
/**
/**
* 批量保存/更新
* 批量保存/更新
*/
*/
void
upsertBatch
(
List
<
T
>
entityList
);
void
upsertBatch
(
Collection
<
T
>
entityList
);
/**
/**
* 单个保存/更新,传入 columns 只会处理相应的 columns
* 单个保存/更新,传入 columns 只会处理相应的 columns
...
@@ -27,7 +26,7 @@ public interface StarrocksService<T> {
...
@@ -27,7 +26,7 @@ public interface StarrocksService<T> {
/**
/**
* 批量保存/更新,传入 columns 只会处理相应的 columns
* 批量保存/更新,传入 columns 只会处理相应的 columns
*/
*/
void
upsertBatch
(
List
<
T
>
entityList
,
List
<
String
>
columns
);
void
upsertBatch
(
Collection
<
T
>
entityList
,
List
<
String
>
columns
);
/**
/**
* 删除
* 删除
...
@@ -37,7 +36,7 @@ public interface StarrocksService<T> {
...
@@ -37,7 +36,7 @@ public interface StarrocksService<T> {
/**
/**
* 批量删除
* 批量删除
*/
*/
void
deleteBatch
(
List
<
T
>
entityList
);
void
deleteBatch
(
Collection
<
T
>
entityList
);
/**
/**
* 根据 sql 查询
* 根据 sql 查询
...
...
starters/starrocks-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/starrocks/operation/StarrocksServiceImpl.java
View file @
1eebb5d0
...
@@ -44,7 +44,7 @@ public class StarrocksServiceImpl<T> implements StarrocksService<T>, Initializin
...
@@ -44,7 +44,7 @@ public class StarrocksServiceImpl<T> implements StarrocksService<T>, Initializin
}
}
@Override
@Override
public
void
upsertBatch
(
List
<
T
>
entityList
)
{
public
void
upsertBatch
(
Collection
<
T
>
entityList
)
{
upsertBatch
(
entityList
,
Collections
.
emptyList
());
upsertBatch
(
entityList
,
Collections
.
emptyList
());
}
}
...
@@ -54,7 +54,7 @@ public class StarrocksServiceImpl<T> implements StarrocksService<T>, Initializin
...
@@ -54,7 +54,7 @@ public class StarrocksServiceImpl<T> implements StarrocksService<T>, Initializin
}
}
@Override
@Override
public
void
upsertBatch
(
List
<
T
>
entityList
,
List
<
String
>
columns
)
{
public
void
upsertBatch
(
Collection
<
T
>
entityList
,
List
<
String
>
columns
)
{
handler
.
upsertBatch
(
ValidateUtils
.
notEmpty
(
entityList
,
"entityList不能为空"
),
columns
);
handler
.
upsertBatch
(
ValidateUtils
.
notEmpty
(
entityList
,
"entityList不能为空"
),
columns
);
}
}
...
@@ -64,7 +64,7 @@ public class StarrocksServiceImpl<T> implements StarrocksService<T>, Initializin
...
@@ -64,7 +64,7 @@ public class StarrocksServiceImpl<T> implements StarrocksService<T>, Initializin
}
}
@Override
@Override
public
void
deleteBatch
(
List
<
T
>
entityList
)
{
public
void
deleteBatch
(
Collection
<
T
>
entityList
)
{
handler
.
deleteBatch
(
ValidateUtils
.
notNull
(
entityList
,
"entityList不能为空"
));
handler
.
deleteBatch
(
ValidateUtils
.
notNull
(
entityList
,
"entityList不能为空"
));
}
}
...
...
starters/starrocks-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/starrocks/operation/StarrocksStreamLoadHandler.java
View file @
1eebb5d0
...
@@ -7,8 +7,7 @@ import com.schbrain.common.util.JacksonUtils;
...
@@ -7,8 +7,7 @@ import com.schbrain.common.util.JacksonUtils;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
java.util.List
;
import
java.util.*
;
import
java.util.Optional
;
/**
/**
* @author liaozan
* @author liaozan
...
@@ -27,8 +26,8 @@ public class StarrocksStreamLoadHandler {
...
@@ -27,8 +26,8 @@ public class StarrocksStreamLoadHandler {
this
.
password
=
password
;
this
.
password
=
password
;
}
}
public
<
T
>
void
upsertBatch
(
List
<
T
>
entityList
,
List
<
String
>
columns
)
{
public
<
T
>
void
upsertBatch
(
Collection
<
T
>
entityList
,
List
<
String
>
columns
)
{
log
.
info
(
"Starrocks upsert, dataSize: {}, sample data: {}"
,
entityList
.
size
(),
entityList
.
get
(
0
));
log
.
info
(
"Starrocks upsert, dataSize: {}, sample data: {}"
,
entityList
.
size
(),
entityList
.
iterator
().
next
(
));
String
content
=
JacksonUtils
.
toJsonString
(
entityList
);
String
content
=
JacksonUtils
.
toJsonString
(
entityList
);
String
upsertResult
=
createUpsertRequest
(
content
,
columns
).
execute
().
body
();
String
upsertResult
=
createUpsertRequest
(
content
,
columns
).
execute
().
body
();
...
@@ -40,8 +39,8 @@ public class StarrocksStreamLoadHandler {
...
@@ -40,8 +39,8 @@ public class StarrocksStreamLoadHandler {
checkResponse
(
upsertResult
);
checkResponse
(
upsertResult
);
}
}
public
<
T
>
void
deleteBatch
(
List
<
T
>
entityList
)
{
public
<
T
>
void
deleteBatch
(
Collection
<
T
>
entityList
)
{
log
.
info
(
"Starrocks delete, dataSize: {}, sample data: {}"
,
entityList
.
size
(),
entityList
.
get
(
0
));
log
.
info
(
"Starrocks delete, dataSize: {}, sample data: {}"
,
entityList
.
size
(),
entityList
.
iterator
().
next
(
));
String
content
=
JacksonUtils
.
toJsonString
(
entityList
);
String
content
=
JacksonUtils
.
toJsonString
(
entityList
);
String
deleteResult
=
createCommonRequest
(
content
).
header
(
"columns"
,
"__op='delete'"
).
execute
().
body
();
String
deleteResult
=
createCommonRequest
(
content
).
header
(
"columns"
,
"__op='delete'"
).
execute
().
body
();
...
...
starters/starrocks-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/starrocks/
helper
/ConvertUtils.java
→
starters/starrocks-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/starrocks/
util
/ConvertUtils.java
View file @
1eebb5d0
package
com.schbrain.framework.autoconfigure.starrocks.
helper
;
package
com.schbrain.framework.autoconfigure.starrocks.
util
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.PropertyNamingStrategies
;
import
com.fasterxml.jackson.databind.PropertyNamingStrategies
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment