Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
eeb0869d
o2oa
项目概览
ghsby
/
o2oa
落后 Fork 源项目 2880 个版本
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
eeb0869d
编写于
10月 22, 2020
作者:
O
o2sword
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
自建表导入优化
上级
6ec3c976
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
75 addition
and
56 deletion
+75
-56
o2server/x_query_assemble_designer/src/main/java/com/x/query/assemble/designer/jaxrs/input/ActionCover.java
...om/x/query/assemble/designer/jaxrs/input/ActionCover.java
+4
-56
o2server/x_query_assemble_designer/src/main/java/com/x/query/assemble/designer/jaxrs/input/ActionCreate.java
...m/x/query/assemble/designer/jaxrs/input/ActionCreate.java
+15
-0
o2server/x_query_assemble_designer/src/main/java/com/x/query/assemble/designer/jaxrs/input/BaseAction.java
...com/x/query/assemble/designer/jaxrs/input/BaseAction.java
+56
-0
未找到文件。
o2server/x_query_assemble_designer/src/main/java/com/x/query/assemble/designer/jaxrs/input/ActionCover.java
浏览文件 @
eeb0869d
...
...
@@ -128,10 +128,10 @@ class ActionCover extends BaseAction {
}
if
(
StringUtils
.
isNotEmpty
(
obj
.
getAlias
()))
{
obj
.
setAlias
(
this
.
idleAliasWithQuery
(
business
,
query
.
getId
()
,
obj
.
getAlias
(),
Table
.
class
,
obj
.
getId
()));
this
.
idleAliasWithQuery
(
business
,
null
,
obj
.
getAlias
(),
Table
.
class
,
obj
.
getId
()));
}
if
(
StringUtils
.
isNotEmpty
(
obj
.
getName
()))
{
obj
.
setName
(
this
.
idleNameWithQuery
(
business
,
query
.
getId
()
,
obj
.
getName
(),
Table
.
class
,
obj
.
getId
()));
obj
.
setName
(
this
.
idleNameWithQuery
(
business
,
null
,
obj
.
getName
(),
Table
.
class
,
obj
.
getId
()));
}
obj
.
setQuery
(
query
.
getId
());
}
...
...
@@ -145,10 +145,10 @@ class ActionCover extends BaseAction {
}
if
(
StringUtils
.
isNotEmpty
(
obj
.
getAlias
()))
{
obj
.
setAlias
(
this
.
idleAliasWithQuery
(
business
,
query
.
getId
()
,
obj
.
getAlias
(),
Statement
.
class
,
obj
.
getId
()));
this
.
idleAliasWithQuery
(
business
,
null
,
obj
.
getAlias
(),
Statement
.
class
,
obj
.
getId
()));
}
if
(
StringUtils
.
isNotEmpty
(
obj
.
getName
()))
{
obj
.
setName
(
this
.
idleNameWithQuery
(
business
,
query
.
getId
()
,
obj
.
getName
(),
Statement
.
class
,
obj
.
getId
()));
obj
.
setName
(
this
.
idleNameWithQuery
(
business
,
null
,
obj
.
getName
(),
Statement
.
class
,
obj
.
getId
()));
}
obj
.
setQuery
(
query
.
getId
());
}
...
...
@@ -181,58 +181,6 @@ class ActionCover extends BaseAction {
return
query
;
}
private
<
T
extends
JpaObject
>
String
idleNameWithQuery
(
Business
business
,
String
queryId
,
String
name
,
Class
<
T
>
cls
,
String
excludeId
)
throws
Exception
{
if
(
StringUtils
.
isEmpty
(
name
))
{
return
""
;
}
List
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
name
);
for
(
int
i
=
1
;
i
<
99
;
i
++)
{
list
.
add
(
name
+
String
.
format
(
"%02d"
,
i
));
}
list
.
add
(
StringTools
.
uniqueToken
());
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
cls
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
T
>
root
=
cq
.
from
(
cls
);
Predicate
p
=
root
.
get
(
"name"
).
in
(
list
);
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
"query"
),
queryId
));
if
(
StringUtils
.
isNotEmpty
(
excludeId
))
{
p
=
cb
.
and
(
p
,
cb
.
notEqual
(
root
.
get
(
JpaObject
.
id_FIELDNAME
),
excludeId
));
}
cq
.
select
(
root
.
get
(
"name"
)).
where
(
p
);
List
<
String
>
os
=
em
.
createQuery
(
cq
).
getResultList
();
list
=
ListUtils
.
subtract
(
list
,
os
);
return
list
.
get
(
0
);
}
private
<
T
extends
JpaObject
>
String
idleAliasWithQuery
(
Business
business
,
String
queryId
,
String
alias
,
Class
<
T
>
cls
,
String
excludeId
)
throws
Exception
{
if
(
StringUtils
.
isEmpty
(
alias
))
{
return
""
;
}
List
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
alias
);
for
(
int
i
=
1
;
i
<
99
;
i
++)
{
list
.
add
(
alias
+
String
.
format
(
"%02d"
,
i
));
}
list
.
add
(
StringTools
.
uniqueToken
());
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
cls
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
T
>
root
=
cq
.
from
(
cls
);
Predicate
p
=
root
.
get
(
"alias"
).
in
(
list
);
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
"query"
),
queryId
));
if
(
StringUtils
.
isNotEmpty
(
excludeId
))
{
p
=
cb
.
and
(
p
,
cb
.
notEqual
(
root
.
get
(
JpaObject
.
id_FIELDNAME
),
excludeId
));
}
cq
.
select
(
root
.
get
(
"alias"
)).
where
(
p
);
List
<
String
>
os
=
em
.
createQuery
(
cq
).
getResultList
();
list
=
ListUtils
.
subtract
(
list
,
os
);
return
list
.
get
(
0
);
}
public
static
class
Wi
extends
WrapQuery
{
private
static
final
long
serialVersionUID
=
-
4612391443319365035L
;
...
...
o2server/x_query_assemble_designer/src/main/java/com/x/query/assemble/designer/jaxrs/input/ActionCreate.java
浏览文件 @
eeb0869d
...
...
@@ -22,6 +22,7 @@ import com.x.query.core.entity.View;
import
com.x.query.core.entity.schema.Statement
;
import
com.x.query.core.entity.schema.Table
;
import
com.x.query.core.entity.wrap.*
;
import
org.apache.commons.lang3.StringUtils
;
class
ActionCreate
extends
BaseAction
{
...
...
@@ -79,6 +80,13 @@ class ActionCreate extends BaseAction {
}
obj
=
WrapTable
.
inCopier
.
copy
(
_o
);
obj
.
setQuery
(
query
.
getId
());
if
(
StringUtils
.
isNotEmpty
(
obj
.
getAlias
()))
{
obj
.
setAlias
(
this
.
idleAliasWithQuery
(
business
,
null
,
obj
.
getAlias
(),
Table
.
class
,
obj
.
getId
()));
}
if
(
StringUtils
.
isNotEmpty
(
obj
.
getName
()))
{
obj
.
setName
(
this
.
idleNameWithQuery
(
business
,
null
,
obj
.
getName
(),
Table
.
class
,
obj
.
getId
()));
}
persistObjects
.
add
(
obj
);
}
for
(
WrapStatement
_o
:
wi
.
getStatementList
())
{
...
...
@@ -88,6 +96,13 @@ class ActionCreate extends BaseAction {
}
obj
=
WrapStatement
.
inCopier
.
copy
(
_o
);
obj
.
setQuery
(
query
.
getId
());
if
(
StringUtils
.
isNotEmpty
(
obj
.
getAlias
()))
{
obj
.
setAlias
(
this
.
idleAliasWithQuery
(
business
,
null
,
obj
.
getAlias
(),
Statement
.
class
,
obj
.
getId
()));
}
if
(
StringUtils
.
isNotEmpty
(
obj
.
getName
()))
{
obj
.
setName
(
this
.
idleNameWithQuery
(
business
,
null
,
obj
.
getName
(),
Statement
.
class
,
obj
.
getId
()));
}
persistObjects
.
add
(
obj
);
}
for
(
WrapReveal
_o
:
wi
.
getRevealList
())
{
...
...
o2server/x_query_assemble_designer/src/main/java/com/x/query/assemble/designer/jaxrs/input/BaseAction.java
浏览文件 @
eeb0869d
...
...
@@ -95,4 +95,60 @@ abstract class BaseAction extends StandardJaxrsAction {
return
list
.
get
(
0
);
}
protected
<
T
extends
JpaObject
>
String
idleNameWithQuery
(
Business
business
,
String
queryId
,
String
name
,
Class
<
T
>
cls
,
String
excludeId
)
throws
Exception
{
if
(
StringUtils
.
isEmpty
(
name
))
{
return
""
;
}
List
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
name
);
for
(
int
i
=
1
;
i
<
99
;
i
++)
{
list
.
add
(
name
+
String
.
format
(
"%02d"
,
i
));
}
list
.
add
(
StringTools
.
uniqueToken
());
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
cls
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
T
>
root
=
cq
.
from
(
cls
);
Predicate
p
=
root
.
get
(
"name"
).
in
(
list
);
if
(
StringUtils
.
isNotEmpty
(
queryId
))
{
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
"query"
),
queryId
));
}
if
(
StringUtils
.
isNotEmpty
(
excludeId
))
{
p
=
cb
.
and
(
p
,
cb
.
notEqual
(
root
.
get
(
JpaObject
.
id_FIELDNAME
),
excludeId
));
}
cq
.
select
(
root
.
get
(
"name"
)).
where
(
p
);
List
<
String
>
os
=
em
.
createQuery
(
cq
).
getResultList
();
list
=
ListUtils
.
subtract
(
list
,
os
);
return
list
.
get
(
0
);
}
protected
<
T
extends
JpaObject
>
String
idleAliasWithQuery
(
Business
business
,
String
queryId
,
String
alias
,
Class
<
T
>
cls
,
String
excludeId
)
throws
Exception
{
if
(
StringUtils
.
isEmpty
(
alias
))
{
return
""
;
}
List
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
alias
);
for
(
int
i
=
1
;
i
<
99
;
i
++)
{
list
.
add
(
alias
+
String
.
format
(
"%02d"
,
i
));
}
list
.
add
(
StringTools
.
uniqueToken
());
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
cls
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
T
>
root
=
cq
.
from
(
cls
);
Predicate
p
=
root
.
get
(
"alias"
).
in
(
list
);
if
(
StringUtils
.
isNotEmpty
(
queryId
))
{
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
"query"
),
queryId
));
}
if
(
StringUtils
.
isNotEmpty
(
excludeId
))
{
p
=
cb
.
and
(
p
,
cb
.
notEqual
(
root
.
get
(
JpaObject
.
id_FIELDNAME
),
excludeId
));
}
cq
.
select
(
root
.
get
(
"alias"
)).
where
(
p
);
List
<
String
>
os
=
em
.
createQuery
(
cq
).
getResultList
();
list
=
ListUtils
.
subtract
(
list
,
os
);
return
list
.
get
(
0
);
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录