Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdata
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdata
提交
277ba0e5
提交
277ba0e5
编写于
8月 29, 2021
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
支持多级地址栏参数,mongodb实现
上级
294a10fa
变更
11
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
1129 行增加
和
180 行删除
+1129
-180
DOModel.java
...re/src/main/java/cn/ibizlab/core/data/domain/DOModel.java
+26
-25
BaseData.java
...core/src/main/java/cn/ibizlab/core/data/dto/BaseData.java
+96
-2
FilterData.java
...re/src/main/java/cn/ibizlab/core/data/dto/FilterData.java
+25
-63
RequestData.java
...e/src/main/java/cn/ibizlab/core/data/dto/RequestData.java
+6
-0
DSLink.java
...core/src/main/java/cn/ibizlab/core/data/model/DSLink.java
+11
-0
DynamicMongoContextHolder.java
.../ibizlab/core/data/mongodb/DynamicMongoContextHolder.java
+72
-0
DynamicMongoTemplate.java
...va/cn/ibizlab/core/data/mongodb/DynamicMongoTemplate.java
+20
-0
MongoDataRepository.java
...ava/cn/ibizlab/core/data/mongodb/MongoDataRepository.java
+524
-0
DataResource.java
...src/main/java/cn/ibizlab/core/data/rest/DataResource.java
+330
-86
DSSettingServiceImpl.java
.../ibizlab/core/data/service/impl/DSSettingServiceImpl.java
+16
-4
MongoDataServiceImpl.java
.../ibizlab/core/data/service/impl/MongoDataServiceImpl.java
+3
-0
未找到文件。
ibzdata-core/src/main/java/cn/ibizlab/core/data/domain/DOModel.java
浏览文件 @
277ba0e5
...
@@ -175,18 +175,18 @@ public class DOModel implements Serializable {
...
@@ -175,18 +175,18 @@ public class DOModel implements Serializable {
Map
<
String
,
PojoSchema
>
keyMap
=
this
.
getKeyMap
();
Map
<
String
,
PojoSchema
>
keyMap
=
this
.
getKeyMap
();
if
(
keyMap
!=
null
)
if
(
keyMap
!=
null
)
{
{
if
(
keyMap
.
size
()==
1
)
PojoSchema
keyProperty
=
this
.
getKeyProperty
();
String
keyPropertyName
=
keyProperty
.
getName
().
toLowerCase
();
Object
key
=
data
.
get
(
keyPropertyName
);
if
(
ObjectUtils
.
isEmpty
(
key
))
{
{
PojoSchema
keyProperty
=
this
.
getKeyProperty
();
key
=
data
.
getKey
();
String
keyPropertyName
=
keyProperty
.
getName
().
toLowerCase
();
if
(!
ObjectUtils
.
isEmpty
(
key
))
Object
key
=
data
.
get
(
keyPropertyName
);
data
.
set
(
keyPropertyName
,
key
);
if
(
ObjectUtils
.
isEmpty
(
key
))
}
{
if
(
ObjectUtils
.
isEmpty
(
key
))
key
=
data
.
getKey
();
{
if
(!
ObjectUtils
.
isEmpty
(
key
))
if
(
keyMap
.
size
()==
1
)
data
.
set
(
keyPropertyName
,
key
);
}
if
(
ObjectUtils
.
isEmpty
(
key
))
{
{
if
(
genKeyWhenNotExists
)
if
(
genKeyWhenNotExists
)
{
{
...
@@ -213,28 +213,28 @@ public class DOModel implements Serializable {
...
@@ -213,28 +213,28 @@ public class DOModel implements Serializable {
}
}
data
.
set
(
keyPropertyName
,
key
);
data
.
set
(
keyPropertyName
,
key
);
data
.
setKey
(
key
);
}
}
else
else
return
null
;
return
null
;
}
}
return
(
Serializable
)
key
;
else
if
(
keyMap
.
size
()>
1
)
}
else
if
(
keyMap
.
size
()>
1
)
{
String
key
=
""
;
for
(
PojoSchema
keySchema:
keyMap
.
values
())
{
{
if
(
ObjectUtils
.
isEmpty
(
data
.
get
(
keySchema
.
getName
().
toLowerCase
())))
for
(
PojoSchema
keySchema:
keyMap
.
values
())
return
null
;
{
if
(!
StringUtils
.
isEmpty
(
key
))
if
(
ObjectUtils
.
isEmpty
(
data
.
get
(
keySchema
.
getName
().
toLowerCase
())))
key
+=
"||"
;
return
null
;
else
if
(!
StringUtils
.
isEmpty
(
key
))
key
+=
data
.
getStringValue
(
keySchema
.
getName
().
toLowerCase
());
key
+=
"||"
;
else
key
+=
data
.
getStringValue
(
keySchema
.
getName
().
toLowerCase
());
}
data
.
setKey
(
key
);
}
}
return
key
;
}
}
return
(
Serializable
)
key
;
}
}
return
null
;
return
null
;
}
}
...
@@ -246,6 +246,7 @@ public class DOModel implements Serializable {
...
@@ -246,6 +246,7 @@ public class DOModel implements Serializable {
public
BaseData
setKeyValue
(
BaseData
data
,
Object
keyValue
)
public
BaseData
setKeyValue
(
BaseData
data
,
Object
keyValue
)
{
{
Map
<
String
,
PojoSchema
>
keyMap
=
this
.
getKeyMap
();
Map
<
String
,
PojoSchema
>
keyMap
=
this
.
getKeyMap
();
data
.
setKey
(
keyValue
);
if
(
keyMap
!=
null
)
if
(
keyMap
!=
null
)
{
{
if
(
keyMap
.
size
()==
1
)
if
(
keyMap
.
size
()==
1
)
...
...
ibzdata-core/src/main/java/cn/ibizlab/core/data/dto/BaseData.java
浏览文件 @
277ba0e5
...
@@ -4,13 +4,16 @@ import cn.ibizlab.core.data.domain.DOModel;
...
@@ -4,13 +4,16 @@ import cn.ibizlab.core.data.domain.DOModel;
import
cn.ibizlab.core.data.domain.DTOModel
;
import
cn.ibizlab.core.data.domain.DTOModel
;
import
cn.ibizlab.core.data.model.POSchema
;
import
cn.ibizlab.core.data.model.POSchema
;
import
cn.ibizlab.core.data.model.PojoSchema
;
import
cn.ibizlab.core.data.model.PojoSchema
;
import
cn.ibizlab.util.security.AuthenticationUser
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.Map
;
@JsonInclude
(
JsonInclude
.
Include
.
ALWAYS
)
@JsonInclude
(
JsonInclude
.
Include
.
ALWAYS
)
...
@@ -119,14 +122,105 @@ public class BaseData extends DataObj
...
@@ -119,14 +122,105 @@ public class BaseData extends DataObj
return
_pojoschema
;
return
_pojoschema
;
}
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
BaseData
getParams
()
{
BaseData
param
=
null
;
Object
obj
=
this
.
get
(
"params"
);
if
(
obj
!=
null
)
{
if
(
obj
instanceof
BaseData
)
param
=(
BaseData
)
obj
;
else
if
(
obj
instanceof
Map
)
{
param
=
new
BaseData
().
setAll
((
Map
)
obj
);
this
.
set
(
"params"
,
param
);
}
}
else
{
return
this
;
}
return
param
;
}
public
BaseData
setParams
(
BaseData
params
)
{
return
this
.
set
(
"params"
,
params
);
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
BaseData
getDatacontext
()
{
return
getParams
();
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
BaseData
getWebcontext
()
{
return
getParams
();
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
BaseData
sessioncontext
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
BaseData
getSessioncontext
()
{
if
(
sessioncontext
==
null
)
sessioncontext
=
new
BaseData
().
setAll
(
AuthenticationUser
.
getAuthenticationUser
().
getSessionParams
());
return
sessioncontext
;
}
@Override
public
Object
get
(
Object
key
)
{
if
(
key
==
null
)
return
null
;
if
(
key
.
toString
().
equalsIgnoreCase
(
"datacontext"
))
return
getDatacontext
();
else
if
(
key
.
toString
().
equalsIgnoreCase
(
"webcontext"
))
return
getWebcontext
();
else
if
(
key
.
toString
().
equalsIgnoreCase
(
"sessioncontext"
))
return
getSessioncontext
();
return
super
.
get
(
key
);
}
public
BaseData
setKey
(
Object
key
)
public
BaseData
setKey
(
Object
key
)
{
{
return
this
.
set
(
"_
key
"
,
key
);
return
this
.
set
(
"_
id
"
,
key
);
}
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
Serializable
getKey
()
public
Serializable
getKey
()
{
{
return
getSerializableValue
(
"_key"
);
return
getSerializableValue
(
"_id"
);
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
Map
<
String
,
BaseData
>
parentDatas
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
Map
<
String
,
BaseData
>
getParentData
()
{
return
parentDatas
;
}
public
BaseData
addParent
(
String
entity
,
String
key
)
{
if
(
StringUtils
.
isEmpty
(
entity
)||
StringUtils
.
isEmpty
(
key
))
return
this
;
if
(
parentDatas
==
null
)
parentDatas
=
new
LinkedHashMap
<>();
parentDatas
.
put
(
entity
,
new
BaseData
().
setKey
(
key
));
return
this
;
}
}
...
...
ibzdata-core/src/main/java/cn/ibizlab/core/data/dto/FilterData.java
浏览文件 @
277ba0e5
package
cn
.
ibizlab
.
core
.
data
.
dto
;
package
cn
.
ibizlab
.
core
.
data
.
dto
;
import
cn.ibizlab.core.data.filter.QueryBuildContext
;
import
cn.ibizlab.core.data.model.POSchema
;
import
cn.ibizlab.core.data.model.POSchema
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
cn.ibizlab.core.data.filter.QueryFilter
;
import
cn.ibizlab.core.data.filter.QueryFilter
;
...
@@ -11,6 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...
@@ -11,6 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.metadata.OrderItem
;
import
com.baomidou.mybatisplus.core.metadata.OrderItem
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.mongodb.QueryBuilder
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.domain.Sort
;
...
@@ -129,72 +131,12 @@ public class FilterData<T> extends BaseData
...
@@ -129,72 +131,12 @@ public class FilterData<T> extends BaseData
return
this
;
return
this
;
}
}
public
BaseData
getParams
(
)
public
FilterData
addParent
(
String
entity
,
String
key
)
{
{
BaseData
param
=
null
;
super
.
addParent
(
entity
,
key
);
Object
obj
=
this
.
get
(
"params"
);
return
this
;
if
(
obj
!=
null
)
{
if
(
obj
instanceof
BaseData
)
param
=(
BaseData
)
obj
;
else
if
(
obj
instanceof
Map
)
{
param
=
new
BaseData
().
setAll
((
Map
)
obj
);
this
.
set
(
"params"
,
param
);
}
}
else
{
return
this
;
}
return
param
;
}
public
FilterData
setParams
(
BaseData
params
)
{
return
this
.
set
(
"params"
,
params
);
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
BaseData
getDatacontext
()
{
return
getParams
();
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
BaseData
getWebcontext
()
{
return
getParams
();
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
BaseData
sessioncontext
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
BaseData
getSessioncontext
()
{
if
(
sessioncontext
==
null
)
sessioncontext
=
new
BaseData
().
setAll
(
AuthenticationUser
.
getAuthenticationUser
().
getSessionParams
());
return
sessioncontext
;
}
@Override
public
Object
get
(
Object
key
)
{
if
(
key
==
null
)
return
null
;
if
(
key
.
toString
().
equalsIgnoreCase
(
"datacontext"
))
return
getDatacontext
();
else
if
(
key
.
toString
().
equalsIgnoreCase
(
"webcontext"
))
return
getWebcontext
();
else
if
(
key
.
toString
().
equalsIgnoreCase
(
"sessioncontext"
))
return
getSessioncontext
();
return
super
.
get
(
key
);
}
}
public
String
getUserTaskId
()
{
public
String
getUserTaskId
()
{
return
this
.
getStringValue
(
"userTaskId"
,
this
.
getParams
().
getStringValue
(
"userTaskId"
));
return
this
.
getStringValue
(
"userTaskId"
,
this
.
getParams
().
getStringValue
(
"userTaskId"
));
}
}
...
@@ -354,6 +296,26 @@ public class FilterData<T> extends BaseData
...
@@ -354,6 +296,26 @@ public class FilterData<T> extends BaseData
return
searchCond
;
return
searchCond
;
}
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
QueryBuilder
queryBuilder
=
null
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
QueryBuilder
getQueryBuilder
()
{
if
(
queryBuilder
==
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
filter
)){
QueryBuildContext
context
=
new
QueryBuildContext
();
context
.
setFilter
(
this
.
getFilter
());
queryBuilder
=
context
.
getSelectCond
();
}
else
queryBuilder
=
new
QueryBuilder
();
}
return
queryBuilder
;
}
public
String
getSql
(
String
codename
)
public
String
getSql
(
String
codename
)
{
{
if
(
getPOSchema
()==
null
)
if
(
getPOSchema
()==
null
)
...
...
ibzdata-core/src/main/java/cn/ibizlab/core/data/dto/RequestData.java
浏览文件 @
277ba0e5
...
@@ -124,4 +124,10 @@ public class RequestData<T> extends BaseData
...
@@ -124,4 +124,10 @@ public class RequestData<T> extends BaseData
}
}
public
RequestData
addParent
(
String
entity
,
String
key
)
{
getBaseData
().
addParent
(
entity
,
key
);
return
this
;
}
}
}
ibzdata-core/src/main/java/cn/ibizlab/core/data/model/DSLink.java
浏览文件 @
277ba0e5
...
@@ -70,6 +70,17 @@ public class DSLink
...
@@ -70,6 +70,17 @@ public class DSLink
return
this
;
return
this
;
}
}
@JSONField
(
serialize
=
false
)
@JsonIgnore
public
Object
source
;
public
DSLink
setSource
(
Object
source
)
{
this
.
source
=
source
;
return
this
;
}
private
static
DSLink
defaultLink
;
private
static
DSLink
defaultLink
;
public
static
DSLink
getDefaultLink
()
public
static
DSLink
getDefaultLink
()
{
{
...
...
ibzdata-core/src/main/java/cn/ibizlab/core/data/mongodb/DynamicMongoContextHolder.java
0 → 100644
浏览文件 @
277ba0e5
package
cn
.
ibizlab
.
core
.
data
.
mongodb
;
import
cn.ibizlab.core.data.model.DSLink
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.data.mongodb.MongoDbFactory
;
import
org.springframework.data.mongodb.core.SimpleMongoClientDbFactory
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
import
javax.annotation.PostConstruct
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Map
;
@Component
public
class
DynamicMongoContextHolder
{
private
static
final
Map
<
String
,
MongoDbFactory
>
MONGO_CLIENT_DB_FACTORY_MAP
=
new
HashMap
<>();
private
static
final
ThreadLocal
<
MongoDbFactory
>
MONGO_DB_FACTORY_THREAD_LOCAL
=
new
ThreadLocal
<>();
public
static
MongoDbFactory
getMongoDbFactory
()
{
return
MONGO_DB_FACTORY_THREAD_LOCAL
.
get
();
}
public
static
void
push
(
String
name
)
{
MONGO_DB_FACTORY_THREAD_LOCAL
.
set
(
MONGO_CLIENT_DB_FACTORY_MAP
.
get
(
name
));
}
public
static
void
poll
()
{
MONGO_DB_FACTORY_THREAD_LOCAL
.
remove
();
}
public
static
synchronized
void
addFactory
(
String
ds
,
DSLink
link
)
{
addFactory
(
ds
,
link
.
getUrl
());
}
public
static
synchronized
void
addFactory
(
String
ds
,
String
uri
)
{
MONGO_CLIENT_DB_FACTORY_MAP
.
put
(
ds
,
new
SimpleMongoClientDbFactory
(
uri
));
}
public
static
synchronized
void
removeFactory
(
String
ds
)
{
MONGO_CLIENT_DB_FACTORY_MAP
.
remove
(
ds
);
}
@Value
(
"${spring.data.mongodb.uri}"
)
private
String
uri
;
@PostConstruct
public
void
init
()
{
if
(!
StringUtils
.
isEmpty
(
uri
))
{
addFactory
(
"master"
,
uri
);
}
}
@Bean
(
name
=
"mongoTemplate"
)
public
DynamicMongoTemplate
dynamicMongoTemplate
()
{
Iterator
<
MongoDbFactory
>
iterator
=
MONGO_CLIENT_DB_FACTORY_MAP
.
values
().
iterator
();
return
new
DynamicMongoTemplate
(
iterator
.
next
());
}
@Bean
(
name
=
"mongoDbFactory"
)
public
MongoDbFactory
mongoDbFactory
()
{
Iterator
<
MongoDbFactory
>
iterator
=
MONGO_CLIENT_DB_FACTORY_MAP
.
values
().
iterator
();
return
iterator
.
next
();
}
}
ibzdata-core/src/main/java/cn/ibizlab/core/data/mongodb/DynamicMongoTemplate.java
0 → 100644
浏览文件 @
277ba0e5
package
cn
.
ibizlab
.
core
.
data
.
mongodb
;
import
com.mongodb.client.MongoDatabase
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.data.mongodb.MongoDbFactory
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
@Slf4j
public
class
DynamicMongoTemplate
extends
MongoTemplate
{
public
DynamicMongoTemplate
(
MongoDbFactory
mongoDbFactory
)
{
super
(
mongoDbFactory
);
}
@Override
protected
MongoDatabase
doGetDatabase
()
{
MongoDbFactory
mongoDbFactory
=
DynamicMongoContextHolder
.
getMongoDbFactory
();
return
mongoDbFactory
==
null
?
super
.
doGetDatabase
()
:
mongoDbFactory
.
getDb
();
}
}
ibzdata-core/src/main/java/cn/ibizlab/core/data/mongodb/MongoDataRepository.java
0 → 100644
浏览文件 @
277ba0e5
package
cn
.
ibizlab
.
core
.
data
.
mongodb
;
import
cn.ibizlab.core.data.dto.BaseData
;
import
cn.ibizlab.core.data.dto.FilterData
;
import
cn.ibizlab.core.data.model.POSchema
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.*
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.query.BasicQuery
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Update
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.*
;
@Slf4j
public
abstract
class
MongoDataRepository
{
@Autowired
private
MongoTemplate
mongoTemplate
;
/**
* 反射获取泛型类型
*
* @return
*/
protected
abstract
Class
<
BaseData
>
getEntityClass
();
/**
* 保存
*
* @param t
* @param collectionName 集合名称
*/
public
void
save
(
BaseData
t
,
String
collectionName
)
{
this
.
mongoTemplate
.
save
(
t
,
collectionName
);
}
/**
* 批量保存
* @param objectsToSave
* @param collectionName
*/
public
Collection
<
BaseData
>
batchSave
(
Collection
<
BaseData
>
objectsToSave
,
String
collectionName
)
{
log
.
info
(
"-------------->MongoDB batch save start"
);
return
this
.
mongoTemplate
.
insert
(
objectsToSave
,
collectionName
);
}
/**
* 根据id从几何中查询对象
* @param id
* @param collectionName
* @return
*/
public
BaseData
queryById
(
String
id
,
String
collectionName
)
{
Query
query
=
new
Query
(
Criteria
.
where
(
"_id"
).
is
(
id
));
log
.
info
(
"-------------->MongoDB find start"
);
return
this
.
mongoTemplate
.
findOne
(
query
,
this
.
getEntityClass
(),
collectionName
);
}
/**
* 根据条件查询集合
* @param object
* @param collectionName
* @return
*/
public
List
<
BaseData
>
queryList
(
BaseData
object
,
String
collectionName
)
{
Query
query
=
getQueryByObject
(
object
);
log
.
info
(
"-------------->MongoDB find start"
);
return
mongoTemplate
.
find
(
query
,
this
.
getEntityClass
(),
collectionName
);
}
/**
* 根据条件查询只返回一个文档
* @param object
* @param collectionName
* @return
*/
public
BaseData
queryOne
(
BaseData
object
,
String
collectionName
)
{
Query
query
=
getQueryByObject
(
object
);
log
.
info
(
"-------------->MongoDB find start"
);
return
mongoTemplate
.
findOne
(
query
,
this
.
getEntityClass
(),
collectionName
);
}
/**
* 根据条件分页查询
* @param object
* @param start
* @param size
* @param collectionName
* @return
*/
public
List
<
BaseData
>
getPage
(
BaseData
object
,
int
start
,
int
size
,
String
collectionName
)
{
Query
query
=
getQueryByObject
(
object
);
if
(
start
>
0
)
{
start
--;
}
query
.
skip
(
start
);
query
.
limit
(
size
);
log
.
info
(
"-------------->MongoDB queryPage start"
);
return
this
.
mongoTemplate
.
find
(
query
,
this
.
getEntityClass
(),
collectionName
);
}
/**
* 根据条件查询库中符合条件的记录数量
* @param object
* @param collectionName
* @return
*/
public
Long
getCount
(
BaseData
object
,
String
collectionName
)
{
Query
query
=
getQueryByObject
(
object
);
log
.
info
(
"-------------->MongoDB Count start"
);
return
this
.
mongoTemplate
.
count
(
query
,
this
.
getEntityClass
(),
collectionName
);
}
/*MongoDB中更新操作分为三种
* 1:updateFirst 修改第一条
* 2:updateMulti 修改所有匹配的记录
* 3:upsert 修改时如果不存在则进行添加操作
* */
/**
* 删除对象
*
* @param t
* @param collectionName
* @return
*/
public
int
delete
(
BaseData
t
,
String
collectionName
)
{
log
.
info
(
"-------------->MongoDB delete start"
);
return
(
int
)
this
.
mongoTemplate
.
remove
(
t
,
collectionName
).
getDeletedCount
();
}
/**
* 根据id列表批量删除
* @param ids
* @param collectionName
* @return
*/
public
int
delete
(
List
<
String
>
ids
,
String
collectionName
)
{
Criteria
criteria
=
Criteria
.
where
(
"_id"
).
in
(
ids
);
Query
query
=
new
Query
(
criteria
);
return
(
int
)
this
.
mongoTemplate
.
remove
(
query
,
this
.
getEntityClass
(),
collectionName
).
getDeletedCount
();
}
/**
* 根据id删除
*
* @param id
* @param collectionName 集合名称
*/
public
void
deleteById
(
String
id
,
String
collectionName
)
{
Criteria
criteria
=
Criteria
.
where
(
"_id"
).
is
(
id
);
if
(
null
!=
criteria
)
{
Query
query
=
new
Query
(
criteria
);
BaseData
obj
=
this
.
mongoTemplate
.
findOne
(
query
,
this
.
getEntityClass
(),
collectionName
);
log
.
info
(
"-------------->MongoDB deleteById start"
);
if
(
obj
!=
null
)
{
this
.
delete
(
obj
,
collectionName
);
}
}
}
/**
* 修改匹配到的第一条记录
*
* @param srcObj
* @param targetObj
* @param collectionName 集合名称
*/
public
void
updateFirst
(
BaseData
srcObj
,
BaseData
targetObj
,
String
collectionName
)
{
Query
query
=
getQueryByObject
(
srcObj
);
Update
update
=
getUpdateByObject
(
targetObj
);
log
.
info
(
"-------------->MongoDB updateFirst start"
);
this
.
mongoTemplate
.
updateFirst
(
query
,
update
,
collectionName
);
}
/**
* 修改匹配到的所有记录
*
* @param srcObj
* @param targetObj
* @param collectionName 集合名称
*/
public
void
updateMulti
(
BaseData
srcObj
,
BaseData
targetObj
,
String
collectionName
)
{
Query
query
=
getQueryByObject
(
srcObj
);
Update
update
=
getUpdateByObject
(
targetObj
);
log
.
info
(
"-------------->MongoDB updateFirst start"
);
this
.
mongoTemplate
.
updateMulti
(
query
,
update
,
collectionName
);
}
/**
* 修改匹配到的记录,若不存在该记录则进行添加
*
* @param srcObj
* @param targetObj
* @param collectionName 集合名字
*/
public
void
updateInsert
(
BaseData
srcObj
,
BaseData
targetObj
,
String
collectionName
)
{
Query
query
=
getQueryByObject
(
srcObj
);
Update
update
=
getUpdateByObject
(
targetObj
);
log
.
info
(
"-------------->MongoDB updateInsert start"
);
this
.
mongoTemplate
.
upsert
(
query
,
update
,
collectionName
);
}
/**
* 将查询条件对象转换为query
*
* @param object
* @return
* @author Jason
*/
private
Query
getQueryByObject
(
BaseData
object
)
{
Query
query
=
new
Query
();
Map
<
String
,
Object
>
dataMap
=
(
Map
)
object
;
Criteria
criteria
=
new
Criteria
();
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
dataMap
.
entrySet
())
{
criteria
.
and
(
entry
.
getKey
()).
is
(
entry
.
getValue
());
}
query
.
addCriteria
(
criteria
);
return
query
;
}
/**
* 将查询条件对象转换为update
*
* @param object
* @return
* @author Jason
*/
private
Update
getUpdateByObject
(
BaseData
object
)
{
Update
update
=
new
Update
();
Map
<
String
,
Object
>
dataMap
=
(
Map
)
object
;
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
dataMap
.
entrySet
())
{
update
.
set
(
entry
.
getKey
(),
entry
.
getValue
());
}
return
update
;
}
public
Query
getKeyQuery
(
POSchema
schema
,
BaseData
data
)
{
Query
query
=
new
Query
();
if
(!
ObjectUtils
.
isEmpty
(
data
.
getKey
()))
return
query
.
addCriteria
(
new
Criteria
().
and
(
"_id"
).
is
(
data
.
getKey
()));
Criteria
criteria
=
new
Criteria
();
if
(!
ObjectUtils
.
isEmpty
(
schema
.
getKeyMap
()))
{
for
(
Map
.
Entry
<
String
,
String
>
entry:
schema
.
getKeyMap
().
entrySet
())
{
Object
obj
=
data
.
get
(
entry
.
getValue
());
if
(!
ObjectUtils
.
isEmpty
(
obj
))
criteria
.
and
(
entry
.
getKey
()).
is
(
obj
);
else
throw
new
BadRequestAlertException
(
"未找到主键"
,
schema
.
getName
(),
entry
.
getValue
());
}
}
query
.
addCriteria
(
criteria
);
return
query
;
}
public
Query
getKeyQuery
(
POSchema
schema
,
List
list
)
{
Query
query
=
new
Query
();
if
(
ObjectUtils
.
isEmpty
(
list
))
return
query
;
List
<
String
>
ids
=
new
ArrayList
<>();
if
(
list
.
get
(
0
)
instanceof
BaseData
)
{
list
.
forEach
(
item
->
{
BaseData
data
=
(
BaseData
)
item
;
if
(
ObjectUtils
.
isEmpty
(
data
.
getKey
()))
{
if
(!
ObjectUtils
.
isEmpty
(
schema
.
getKeyMap
()))
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
schema
.
getKeyMap
().
entrySet
())
{
Object
obj
=
data
.
get
(
entry
.
getValue
());
if
(
ObjectUtils
.
isEmpty
(
obj
))
throw
new
BadRequestAlertException
(
"未找到主键"
,
schema
.
getName
(),
entry
.
getValue
());
}
}
}
if
(!
ObjectUtils
.
isEmpty
(
data
.
getKey
()))
ids
.
add
(
data
.
getKey
().
toString
());
});
}
else
ids
.
addAll
(
list
);
return
query
.
addCriteria
(
new
Criteria
().
and
(
"_id"
).
in
(
ids
));
}
public
void
insertData
(
String
ds
,
POSchema
schema
,
BaseData
data
){
try
{
DynamicDataSourceContextHolder
.
push
(
ds
);
this
.
mongoTemplate
.
save
(
data
,
schema
.
getName
());
}
finally
{
DynamicDataSourceContextHolder
.
poll
();
}
}
public
void
insertBathData
(
String
ds
,
POSchema
schema
,
List
<
BaseData
>
list
){
try
{
DynamicDataSourceContextHolder
.
push
(
ds
);
this
.
mongoTemplate
.
insert
(
list
,
schema
.
getName
());
}
finally
{
DynamicDataSourceContextHolder
.
poll
();
}
}
public
int
updateData
(
String
ds
,
POSchema
schema
,
BaseData
data
){
try
{
DynamicDataSourceContextHolder
.
push
(
ds
);
Query
query
=
getKeyQuery
(
schema
,
data
);
Update
update
=
getUpdateByObject
(
data
);
return
(
int
)
this
.
mongoTemplate
.
updateFirst
(
query
,
update
,
schema
.
getName
()).
getModifiedCount
();
}
finally
{
DynamicDataSourceContextHolder
.
poll
();
}
}
public
void
updateBathData
(
String
ds
,
POSchema
schema
,
List
<
BaseData
>
list
){
try
{
DynamicDataSourceContextHolder
.
push
(
ds
);
list
.
forEach
(
data
->
{
Query
query
=
getKeyQuery
(
schema
,
data
);
Update
update
=
getUpdateByObject
(
data
);
this
.
mongoTemplate
.
updateFirst
(
query
,
update
,
schema
.
getName
());
});
}
finally
{
DynamicDataSourceContextHolder
.
poll
();
}
}
public
int
removeData
(
String
ds
,
POSchema
schema
,
BaseData
data
){
try
{
DynamicDataSourceContextHolder
.
push
(
ds
);
return
(
int
)
this
.
mongoTemplate
.
remove
(
getKeyQuery
(
schema
,
data
),
schema
.
getName
()).
getDeletedCount
();
}
finally
{
DynamicDataSourceContextHolder
.
poll
();
}
}
public
int
removeBathData
(
String
ds
,
POSchema
schema
,
List
list
){
try
{
DynamicDataSourceContextHolder
.
push
(
ds
);
return
(
int
)
mongoTemplate
.
remove
(
getKeyQuery
(
schema
,
list
),
schema
.
getName
()).
getDeletedCount
();
}
finally
{
DynamicDataSourceContextHolder
.
poll
();
}
}
public
int
save
(
String
ds
,
POSchema
schema
,
BaseData
data
){
try
{
DynamicDataSourceContextHolder
.
push
(
ds
);
Query
query
=
getKeyQuery
(
schema
,
data
);
Update
update
=
getUpdateByObject
(
data
);
return
(
int
)
this
.
mongoTemplate
.
upsert
(
query
,
update
,
schema
.
getName
()).
getModifiedCount
();
}
finally
{
DynamicDataSourceContextHolder
.
poll
();
}
}
public
void
saveBatch
(
String
ds
,
POSchema
schema
,
List
<
BaseData
>
list
){
try
{
DynamicDataSourceContextHolder
.
push
(
ds
);
list
.
forEach
(
data
->
{
Query
query
=
getKeyQuery
(
schema
,
data
);
Update
update
=
getUpdateByObject
(
data
);
mongoTemplate
.
upsert
(
query
,
update
,
schema
.
getName
());
});
}
finally
{
DynamicDataSourceContextHolder
.
poll
();
}
}
public
int
countData
(
String
ds
,
POSchema
schema
,
BaseData
data
){
try
{
DynamicDataSourceContextHolder
.
push
(
ds
);
return
(
int
)
mongoTemplate
.
count
(
getQueryByObject
(
data
),
schema
.
getName
());
}
finally
{
DynamicDataSourceContextHolder
.
poll
();
}
}
public
List
<
BaseData
>
getData
(
String
ds
,
POSchema
schema
,
BaseData
data
){
try
{
DynamicDataSourceContextHolder
.
push
(
ds
);
return
mongoTemplate
.
find
(
getKeyQuery
(
schema
,
data
),
getEntityClass
(),
schema
.
getName
());
}
finally
{
DynamicDataSourceContextHolder
.
poll
();
}
}
public
List
<
BaseData
>
getBatchData
(
String
ds
,
POSchema
schema
,
List
<
BaseData
>
list
){
try
{
DynamicDataSourceContextHolder
.
push
(
ds
);
return
mongoTemplate
.
find
(
getKeyQuery
(
schema
,
list
),
getEntityClass
(),
schema
.
getName
());
}
finally
{
DynamicDataSourceContextHolder
.
poll
();
}
}
public
List
<
BaseData
>
getBatchKey
(
String
ds
,
POSchema
schema
,
List
<
BaseData
>
list
){
try
{
DynamicDataSourceContextHolder
.
push
(
ds
);
return
mongoTemplate
.
find
(
getKeyQuery
(
schema
,
list
),
getEntityClass
(),
schema
.
getName
());
}
finally
{
DynamicDataSourceContextHolder
.
poll
();
}
}
public
List
<
BaseData
>
selectData
(
String
ds
,
POSchema
schema
,
BaseData
data
){
try
{
DynamicDataSourceContextHolder
.
push
(
ds
);
return
mongoTemplate
.
find
(
getQueryByObject
(
data
),
getEntityClass
(),
schema
.
getName
());
}
finally
{
DynamicDataSourceContextHolder
.
poll
();
}
}
public
Page
<
BaseData
>
selectData
(
String
ds
,
POSchema
schema
,
BaseData
data
,
Pageable
page
){
try
{
DynamicDataSourceContextHolder
.
push
(
ds
);
if
(
page
==
null
)
page
=
PageRequest
.
of
(
0
,
20
,
Sort
.
unsorted
());
Query
query
=
getQueryByObject
(
data
);
long
total
=
mongoTemplate
.
count
(
query
,
BaseData
.
class
,
schema
.
getName
());
List
<
BaseData
>
list
=
mongoTemplate
.
find
(
query
.
with
(
page
),
BaseData
.
class
,
schema
.
getName
());
return
new
PageImpl
<
BaseData
>(
list
,
page
,
total
);
}
finally
{
DynamicDataSourceContextHolder
.
poll
();
}
}
public
List
<
BaseData
>
queryData
(
String
ds
,
POSchema
schema
,
String
sql
,
FilterData
context
){
try
{
DynamicDataSourceContextHolder
.
push
(
ds
);
Query
query
=
new
BasicQuery
(
context
.
getQueryBuilder
().
get
().
toString
());
return
mongoTemplate
.
find
(
query
,
BaseData
.
class
,
schema
.
getName
());
}
finally
{
DynamicDataSourceContextHolder
.
poll
();
}
}
public
Page
<
BaseData
>
queryData
(
String
ds
,
POSchema
schema
,
String
sql
,
FilterData
context
,
Pageable
page
){
try
{
DynamicDataSourceContextHolder
.
push
(
ds
);
if
(
page
==
null
)
page
=
context
.
getPageable
();
else
context
.
setPageable
(
page
);
Query
query
=
new
BasicQuery
(
context
.
getQueryBuilder
().
get
().
toString
());
long
total
=
mongoTemplate
.
count
(
query
,
BaseData
.
class
,
schema
.
getName
());
List
<
BaseData
>
list
=
mongoTemplate
.
find
(
query
.
with
(
page
),
BaseData
.
class
,
schema
.
getName
());
return
new
PageImpl
<
BaseData
>(
list
,
page
,
total
);
}
finally
{
DynamicDataSourceContextHolder
.
poll
();
}
}
}
ibzdata-core/src/main/java/cn/ibizlab/core/data/rest/DataResource.java
浏览文件 @
277ba0e5
...
@@ -24,7 +24,9 @@ import java.util.Map;
...
@@ -24,7 +24,9 @@ import java.util.Map;
@Slf4j
@Slf4j
@Api
(
tags
=
{
"数据"
})
@Api
(
tags
=
{
"数据"
})
@RestController
(
"api-data"
)
@RestController
(
"api-data"
)
@RequestMapping
({
"/ibiz-repository/{system}/{scope}"
,
"/ibiz-repo/{system}"
})
@RequestMapping
({
"/ibiz-repository/{system}/{scope}"
,
"/ibiz-repo/{system}"
,
"/ibiz-repository/{system}/{scope}/{parentEntity}/{parentKey}"
,
"/ibiz-repo/{system}/parentEntity}/{parentKey}"
,
"/ibiz-repository/{system}/{scope}/{parentEntity}/{parentKey}/{parentEntity2}/{parentKey2}"
,
"/ibiz-repo/{system}/{parentEntity}/{parentKey}/{parentEntity2}/{parentKey2}"
})
public
class
DataResource
public
class
DataResource
{
{
@Autowired
@Autowired
...
@@ -33,36 +35,56 @@ public class DataResource
...
@@ -33,36 +35,56 @@ public class DataResource
@ApiOperation
(
value
=
"callMethod数据"
,
tags
=
{
"数据"
},
notes
=
"callMethod数据"
)
@ApiOperation
(
value
=
"callMethod数据"
,
tags
=
{
"数据"
},
notes
=
"callMethod数据"
)
@RequestMapping
(
method
=
{
RequestMethod
.
GET
},
value
=
{
"/{entity}/call{method}"
,
"/{entity}/{key}/call{method}"
})
@RequestMapping
(
method
=
{
RequestMethod
.
GET
},
value
=
{
"/{entity}/call{method}"
,
"/{entity}/{key}/call{method}"
})
public
ResponseEntity
call
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
call
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"method"
,
required
=
true
)
String
method
,
@PathVariable
(
name
=
"method"
,
required
=
true
)
String
method
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestParam
Map
map
)
{
@RequestParam
Map
map
)
{
RequestData
requestData
=
new
RequestData
().
setAll
(
map
);
RequestData
requestData
=
new
RequestData
().
setAll
(
map
);
return
doCall
(
system
,
scope
,
entity
,
datasource
,
method
,
key
,
requestData
);
if
(
requestData
!=
null
)
requestData
.
addParent
(
parentEntity
,
parentKey
).
addParent
(
parentEntity2
,
parentKey2
);
return
doCall
(
system
,
scope
,
entity
,
parentEntity
,
parentKey
,
parentEntity2
,
parentKey2
,
datasource
,
method
,
key
,
requestData
);
}
}
@ApiOperation
(
value
=
"callMethod数据"
,
tags
=
{
"数据"
},
notes
=
"callMethod数据"
)
@ApiOperation
(
value
=
"callMethod数据"
,
tags
=
{
"数据"
},
notes
=
"callMethod数据"
)
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
{
"/{entity}/call{method}"
,
"/{entity}/{key}/call{method}"
})
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
{
"/{entity}/call{method}"
,
"/{entity}/{key}/call{method}"
})
public
ResponseEntity
doCall
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
doCall
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"method"
,
required
=
true
)
String
method
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestBody
(
required
=
false
)
RequestData
requestData
)
{
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"method"
,
required
=
true
)
String
method
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestBody
(
required
=
false
)
RequestData
requestData
)
{
if
(
requestData
==
null
)
if
(
requestData
==
null
)
requestData
=
new
RequestData
();
requestData
=
new
RequestData
();
ResponseData
responseData
=
dataService
.
call
(
system
,
scope
,
entity
,
datasource
,
method
,
requestData
.
setKey
(
key
));
ResponseData
responseData
=
dataService
.
call
(
system
,
scope
,
entity
,
datasource
,
method
,
requestData
.
setKey
(
key
).
addParent
(
parentEntity
,
parentKey
).
addParent
(
parentEntity2
,
parentKey2
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
responseData
.
getBody
());
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
responseData
.
getBody
());
}
}
@ApiOperation
(
value
=
"批量callMethod数据"
,
tags
=
{
"数据"
},
notes
=
"批量callMethod数据"
)
@ApiOperation
(
value
=
"批量callMethod数据"
,
tags
=
{
"数据"
},
notes
=
"批量callMethod数据"
)
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
{
"/{entity}/call{method}batch"
})
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
{
"/{entity}/call{method}batch"
})
public
ResponseEntity
callBatch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
callBatch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"method"
,
required
=
true
)
String
method
,
@RequestBody
List
<
RequestData
>
requestDatas
)
{
@PathVariable
(
name
=
"method"
,
required
=
true
)
String
method
,
@RequestBody
List
<
RequestData
>
requestDatas
)
{
if
(
requestDatas
!=
null
)
if
(
requestDatas
!=
null
)
requestDatas
.
forEach
(
requestData
->
dataService
.
call
(
system
,
scope
,
entity
,
datasource
,
method
,
requestData
)
);
requestDatas
.
forEach
(
requestData
->
dataService
.
call
(
system
,
scope
,
entity
,
datasource
,
method
,
requestData
.
addParent
(
parentEntity
,
parentKey
).
addParent
(
parentEntity2
,
parentKey2
))
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
}
...
@@ -71,17 +93,31 @@ public class DataResource
...
@@ -71,17 +93,31 @@ public class DataResource
@ApiOperation
(
value
=
"新建数据"
,
tags
=
{
"数据"
},
notes
=
"新建数据"
)
@ApiOperation
(
value
=
"新建数据"
,
tags
=
{
"数据"
},
notes
=
"新建数据"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}"
,
"/{entity}/create"
})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}"
,
"/{entity}/create"
})
public
ResponseEntity
<
BaseData
>
create
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
BaseData
>
create
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@Validated
@RequestBody
BaseData
baseData
)
{
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
dataService
.
create
(
system
,
scope
,
entity
,
datasource
,
baseData
);
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@Validated
@RequestBody
BaseData
baseData
)
{
dataService
.
create
(
system
,
scope
,
entity
,
datasource
,
baseData
.
addParent
(
parentEntity
,
parentKey
).
addParent
(
parentEntity2
,
parentKey2
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
baseData
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
baseData
);
}
}
@ApiOperation
(
value
=
"批量新建数据"
,
tags
=
{
"数据"
},
notes
=
"批量新建数据"
)
@ApiOperation
(
value
=
"批量新建数据"
,
tags
=
{
"数据"
},
notes
=
"批量新建数据"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/batch"
,
"/{entity}/createbatch"
})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/batch"
,
"/{entity}/createbatch"
})
public
ResponseEntity
<
Boolean
>
createBatch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
Boolean
>
createBatch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestBody
List
<
BaseData
>
baseDatas
)
{
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestBody
List
<
BaseData
>
baseDatas
)
{
baseDatas
.
forEach
(
item
->
item
.
addParent
(
parentEntity
,
parentKey
).
addParent
(
parentEntity2
,
parentKey2
));
dataService
.
createBatch
(
system
,
scope
,
entity
,
datasource
,
baseDatas
);
dataService
.
createBatch
(
system
,
scope
,
entity
,
datasource
,
baseDatas
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
}
...
@@ -89,66 +125,119 @@ public class DataResource
...
@@ -89,66 +125,119 @@ public class DataResource
@ApiOperation
(
value
=
"获取数据"
,
tags
=
{
"数据"
},
notes
=
"获取数据"
)
@ApiOperation
(
value
=
"获取数据"
,
tags
=
{
"数据"
},
notes
=
"获取数据"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
{
"/{entity}"
,
"/{entity}/{key}"
})
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
{
"/{entity}"
,
"/{entity}/{key}"
})
public
ResponseEntity
<
BaseData
>
get
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
BaseData
>
get
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestParam
Map
map
)
{
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestParam
Map
map
)
{
BaseData
baseData
=
BaseData
.
fromContext
(
map
);
BaseData
baseData
=
BaseData
.
fromContext
(
map
);
return
doGet
(
system
,
scope
,
entity
,
datasource
,
key
,
baseData
);
return
doGet
(
system
,
scope
,
entity
,
parentEntity
,
parentKey
,
parentEntity2
,
parentKey2
,
datasource
,
key
,
baseData
);
}
}
@ApiOperation
(
value
=
"获取数据"
,
tags
=
{
"数据"
},
notes
=
"获取数据"
)
@ApiOperation
(
value
=
"获取数据"
,
tags
=
{
"数据"
},
notes
=
"获取数据"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/get"
,
"/{entity}/{key}/get"
})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/get"
,
"/{entity}/{key}/get"
})
public
ResponseEntity
<
BaseData
>
doGet
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
BaseData
>
doGet
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@Validated
@RequestBody
(
required
=
false
)
BaseData
baseData
)
{
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@Validated
@RequestBody
(
required
=
false
)
BaseData
baseData
)
{
if
(
baseData
==
null
)
if
(
baseData
==
null
)
{
{
if
(
StringUtils
.
isEmpty
(
key
))
if
(
StringUtils
.
isEmpty
(
key
))
throw
new
BadRequestAlertException
(
"未找到要获取的键值信息"
,
entity
,
null
);
throw
new
BadRequestAlertException
(
"未找到要获取的键值信息"
,
entity
,
null
);
baseData
=
new
BaseData
();
baseData
=
new
BaseData
();
}
}
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dataService
.
getByMap
(
system
,
scope
,
entity
,
datasource
,
baseData
.
setKey
(
key
)));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dataService
.
getByMap
(
system
,
scope
,
entity
,
datasource
,
baseData
.
setKey
(
key
)
.
addParent
(
parentEntity
,
parentKey
).
addParent
(
parentEntity2
,
parentKey2
)));
}
@ApiOperation
(
value
=
"批量删除数据"
,
tags
=
{
"数据"
},
notes
=
"批量删除数据"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/getbatch"
})
public
ResponseEntity
<
List
<
BaseData
>>
getBatch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestBody
List
ids
)
{
List
<
BaseData
>
list
=
dataService
.
getBatch
(
system
,
scope
,
entity
,
datasource
,
ids
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
list
);
}
}
@ApiOperation
(
value
=
"删除数据"
,
tags
=
{
"数据"
},
notes
=
"删除数据"
)
@ApiOperation
(
value
=
"删除数据"
,
tags
=
{
"数据"
},
notes
=
"删除数据"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
{
"/{entity}"
,
"/{entity}/{key}"
})
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
{
"/{entity}"
,
"/{entity}/{key}"
})
public
ResponseEntity
<
Boolean
>
remove
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
Boolean
>
remove
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestParam
Map
map
)
{
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestParam
Map
map
)
{
BaseData
baseData
=
BaseData
.
fromContext
(
map
);
BaseData
baseData
=
BaseData
.
fromContext
(
map
);
return
doRemove
(
system
,
scope
,
entity
,
datasource
,
key
,
baseData
);
return
doRemove
(
system
,
scope
,
entity
,
parentEntity
,
parentKey
,
parentEntity2
,
parentKey2
,
datasource
,
key
,
baseData
);
}
}
@ApiOperation
(
value
=
"删除数据"
,
tags
=
{
"数据"
},
notes
=
"删除数据"
)
@ApiOperation
(
value
=
"删除数据"
,
tags
=
{
"数据"
},
notes
=
"删除数据"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/remove"
,
"/{entity}/{key}/remove"
})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/remove"
,
"/{entity}/{key}/remove"
})
public
ResponseEntity
<
Boolean
>
doRemove
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
Boolean
>
doRemove
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@Validated
@RequestBody
(
required
=
false
)
BaseData
baseData
)
{
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestBody
(
required
=
false
)
BaseData
baseData
)
{
if
(
baseData
==
null
)
if
(
baseData
==
null
)
{
{
if
(
StringUtils
.
isEmpty
(
key
))
if
(
StringUtils
.
isEmpty
(
key
))
throw
new
BadRequestAlertException
(
"未找到要删除的键值信息"
,
entity
,
null
);
throw
new
BadRequestAlertException
(
"未找到要删除的键值信息"
,
entity
,
null
);
baseData
=
new
BaseData
();
baseData
=
new
BaseData
();
}
}
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dataService
.
removeByMap
(
system
,
scope
,
entity
,
datasource
,
baseData
.
setKey
(
key
)));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dataService
.
removeByMap
(
system
,
scope
,
entity
,
datasource
,
baseData
.
setKey
(
key
)
.
addParent
(
parentEntity
,
parentKey
).
addParent
(
parentEntity2
,
parentKey2
)));
}
}
@ApiOperation
(
value
=
"批量删除数据"
,
tags
=
{
"数据"
},
notes
=
"批量删除数据"
)
@ApiOperation
(
value
=
"批量删除数据"
,
tags
=
{
"数据"
},
notes
=
"批量删除数据"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
{
"/{entity}/batch"
})
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
{
"/{entity}/batch"
})
public
ResponseEntity
<
Boolean
>
removeBatch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
Boolean
>
removeBatch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestBody
List
ids
)
{
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
return
doRemoveBatch
(
system
,
scope
,
entity
,
datasource
,
ids
);
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestBody
List
ids
)
{
return
doRemoveBatch
(
system
,
scope
,
entity
,
parentEntity
,
parentKey
,
parentEntity2
,
parentKey2
,
datasource
,
ids
);
}
}
@ApiOperation
(
value
=
"批量删除数据"
,
tags
=
{
"数据"
},
notes
=
"批量删除数据"
)
@ApiOperation
(
value
=
"批量删除数据"
,
tags
=
{
"数据"
},
notes
=
"批量删除数据"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/removebatch"
})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/removebatch"
})
public
ResponseEntity
<
Boolean
>
doRemoveBatch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
Boolean
>
doRemoveBatch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestBody
List
ids
)
{
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestBody
List
ids
)
{
dataService
.
removeBatch
(
system
,
scope
,
entity
,
datasource
,
ids
);
dataService
.
removeBatch
(
system
,
scope
,
entity
,
datasource
,
ids
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
}
...
@@ -156,35 +245,61 @@ public class DataResource
...
@@ -156,35 +245,61 @@ public class DataResource
@ApiOperation
(
value
=
"更新数据"
,
tags
=
{
"数据"
},
notes
=
"更新数据"
)
@ApiOperation
(
value
=
"更新数据"
,
tags
=
{
"数据"
},
notes
=
"更新数据"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
{
"/{entity}"
,
"/{entity}/{key}"
})
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
{
"/{entity}"
,
"/{entity}/{key}"
})
public
ResponseEntity
<
BaseData
>
update
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
BaseData
>
update
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestBody
BaseData
baseData
)
{
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
return
doUpdate
(
system
,
scope
,
entity
,
datasource
,
key
,
baseData
);
@RequestBody
BaseData
baseData
)
{
return
doUpdate
(
system
,
scope
,
entity
,
parentEntity
,
parentKey
,
parentEntity2
,
parentKey2
,
datasource
,
key
,
baseData
);
}
}
@ApiOperation
(
value
=
"更新数据"
,
tags
=
{
"数据"
},
notes
=
"更新数据"
)
@ApiOperation
(
value
=
"更新数据"
,
tags
=
{
"数据"
},
notes
=
"更新数据"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/update"
,
"/{entity}/{key}/update"
})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/update"
,
"/{entity}/{key}/update"
})
public
ResponseEntity
<
BaseData
>
doUpdate
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
BaseData
>
doUpdate
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestBody
BaseData
baseData
)
{
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
dataService
.
update
(
system
,
scope
,
entity
,
datasource
,
baseData
.
setKey
(
key
));
@RequestBody
BaseData
baseData
)
{
dataService
.
update
(
system
,
scope
,
entity
,
datasource
,
baseData
.
setKey
(
key
)
.
addParent
(
parentEntity
,
parentKey
).
addParent
(
parentEntity2
,
parentKey2
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
baseData
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
baseData
);
}
}
@ApiOperation
(
value
=
"批量更新数据"
,
tags
=
{
"数据"
},
notes
=
"批量更新数据"
)
@ApiOperation
(
value
=
"批量更新数据"
,
tags
=
{
"数据"
},
notes
=
"批量更新数据"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
{
"/{entity}/batch"
})
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
{
"/{entity}/batch"
})
public
ResponseEntity
<
Boolean
>
updateBatch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
Boolean
>
updateBatch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestBody
List
<
BaseData
>
baseDatas
)
{
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
return
doUpdateBatch
(
system
,
scope
,
entity
,
datasource
,
baseDatas
);
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestBody
List
<
BaseData
>
baseDatas
)
{
return
doUpdateBatch
(
system
,
scope
,
entity
,
parentEntity
,
parentKey
,
parentEntity2
,
parentKey2
,
datasource
,
baseDatas
);
}
}
@ApiOperation
(
value
=
"批量更新数据"
,
tags
=
{
"数据"
},
notes
=
"批量更新数据"
)
@ApiOperation
(
value
=
"批量更新数据"
,
tags
=
{
"数据"
},
notes
=
"批量更新数据"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/updatebatch"
})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/updatebatch"
})
public
ResponseEntity
<
Boolean
>
doUpdateBatch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
Boolean
>
doUpdateBatch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestBody
List
<
BaseData
>
baseDatas
)
{
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestBody
List
<
BaseData
>
baseDatas
)
{
baseDatas
.
forEach
(
item
->
item
.
addParent
(
parentEntity
,
parentKey
).
addParent
(
parentEntity2
,
parentKey2
));
dataService
.
updateBatch
(
system
,
scope
,
entity
,
datasource
,
baseDatas
);
dataService
.
updateBatch
(
system
,
scope
,
entity
,
datasource
,
baseDatas
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
}
...
@@ -192,87 +307,189 @@ public class DataResource
...
@@ -192,87 +307,189 @@ public class DataResource
@ApiOperation
(
value
=
"检查数据"
,
tags
=
{
"数据"
},
notes
=
"检查数据"
)
@ApiOperation
(
value
=
"检查数据"
,
tags
=
{
"数据"
},
notes
=
"检查数据"
)
@RequestMapping
(
method
=
{
RequestMethod
.
GET
},
value
=
{
"/{entity}/checkkey"
,
"/{entity}/{key}/checkkey"
})
@RequestMapping
(
method
=
{
RequestMethod
.
GET
},
value
=
{
"/{entity}/checkkey"
,
"/{entity}/{key}/checkkey"
})
public
ResponseEntity
<
Boolean
>
checkKey
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
Boolean
>
checkKey
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestParam
Map
map
)
{
@RequestParam
Map
map
)
{
BaseData
baseData
=
BaseData
.
fromContext
(
map
);
BaseData
baseData
=
BaseData
.
fromContext
(
map
);
return
doCheckKey
(
system
,
scope
,
entity
,
datasource
,
key
,
baseData
);
return
doCheckKey
(
system
,
scope
,
entity
,
parentEntity
,
parentKey
,
parentEntity2
,
parentKey2
,
datasource
,
key
,
baseData
);
}
}
@ApiOperation
(
value
=
"检查数据"
,
tags
=
{
"数据"
},
notes
=
"检查数据"
)
@ApiOperation
(
value
=
"检查数据"
,
tags
=
{
"数据"
},
notes
=
"检查数据"
)
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
{
"/{entity}/checkkey"
,
"/{entity}/{key}/checkkey"
})
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
{
"/{entity}/checkkey"
,
"/{entity}/{key}/checkkey"
})
public
ResponseEntity
<
Boolean
>
doCheckKey
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
Boolean
>
doCheckKey
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestBody
(
required
=
false
)
BaseData
baseData
)
{
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestBody
(
required
=
false
)
BaseData
baseData
)
{
if
(
baseData
==
null
)
if
(
baseData
==
null
)
{
{
if
(
StringUtils
.
isEmpty
(
key
))
if
(
StringUtils
.
isEmpty
(
key
))
throw
new
BadRequestAlertException
(
"未找到要检查的键值信息"
,
entity
,
null
);
throw
new
BadRequestAlertException
(
"未找到要检查的键值信息"
,
entity
,
null
);
baseData
=
new
BaseData
();
baseData
=
new
BaseData
();
}
}
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dataService
.
checkKey
(
system
,
scope
,
entity
,
datasource
,
baseData
.
setKey
(
key
)));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dataService
.
checkKey
(
system
,
scope
,
entity
,
datasource
,
baseData
.
setKey
(
key
)
.
addParent
(
parentEntity
,
parentKey
).
addParent
(
parentEntity2
,
parentKey2
)));
}
}
@ApiOperation
(
value
=
"获取数据草稿"
,
tags
=
{
"数据"
},
notes
=
"获取数据草稿"
)
@ApiOperation
(
value
=
"获取数据草稿"
,
tags
=
{
"数据"
},
notes
=
"获取数据草稿"
)
@RequestMapping
(
method
=
{
RequestMethod
.
GET
},
value
=
{
"/{entity}/getdraft"
,
"/{entity}/{key}/getdraft"
})
@RequestMapping
(
method
=
{
RequestMethod
.
GET
},
value
=
{
"/{entity}/getdraft"
,
"/{entity}/{key}/getdraft"
})
public
ResponseEntity
<
BaseData
>
getDraft
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
BaseData
>
getDraft
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestParam
Map
map
)
{
@RequestParam
Map
map
)
{
BaseData
baseData
=
BaseData
.
fromContext
(
map
);
BaseData
baseData
=
BaseData
.
fromContext
(
map
);
return
doGetDraft
(
system
,
scope
,
entity
,
datasource
,
key
,
baseData
);
return
doGetDraft
(
system
,
scope
,
entity
,
parentEntity
,
parentKey
,
parentEntity2
,
parentKey2
,
datasource
,
key
,
baseData
);
}
}
@ApiOperation
(
value
=
"获取数据草稿"
,
tags
=
{
"数据"
},
notes
=
"获取数据草稿"
)
@ApiOperation
(
value
=
"获取数据草稿"
,
tags
=
{
"数据"
},
notes
=
"获取数据草稿"
)
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
{
"/{entity}/getdraft"
,
"/{entity}/{key}/getdraft"
})
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
{
"/{entity}/getdraft"
,
"/{entity}/{key}/getdraft"
})
public
ResponseEntity
<
BaseData
>
doGetDraft
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
BaseData
>
doGetDraft
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestBody
(
required
=
false
)
BaseData
baseData
)
{
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestBody
(
required
=
false
)
BaseData
baseData
)
{
if
(
baseData
==
null
)
baseData
=
new
BaseData
();
if
(
baseData
==
null
)
baseData
=
new
BaseData
();
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dataService
.
getDraft
(
system
,
scope
,
entity
,
datasource
,
baseData
.
setKey
(
key
)));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dataService
.
getDraft
(
system
,
scope
,
entity
,
datasource
,
baseData
.
setKey
(
key
)
.
addParent
(
parentEntity
,
parentKey
).
addParent
(
parentEntity2
,
parentKey2
)));
}
}
@ApiOperation
(
value
=
"保存数据"
,
tags
=
{
"数据"
},
notes
=
"保存数据,自动判断插入和更新"
)
@ApiOperation
(
value
=
"保存数据"
,
tags
=
{
"数据"
},
notes
=
"保存数据,自动判断插入和更新"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/save"
,
"/{entity}/{key}/save"
})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/save"
,
"/{entity}/{key}/save"
})
public
ResponseEntity
<
BaseData
>
save
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
BaseData
>
save
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestBody
BaseData
baseData
)
{
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
dataService
.
save
(
system
,
scope
,
entity
,
datasource
,
baseData
.
setKey
(
key
));
@RequestBody
BaseData
baseData
)
{
dataService
.
save
(
system
,
scope
,
entity
,
datasource
,
baseData
.
setKey
(
key
)
.
addParent
(
parentEntity
,
parentKey
).
addParent
(
parentEntity2
,
parentKey2
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
baseData
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
baseData
);
}
}
@ApiOperation
(
value
=
"批量保存数据"
,
tags
=
{
"数据"
},
notes
=
"批量保存数据,自动判断插入和更新"
)
@ApiOperation
(
value
=
"批量保存数据"
,
tags
=
{
"数据"
},
notes
=
"批量保存数据,自动判断插入和更新"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/savebatch"
})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/savebatch"
})
public
ResponseEntity
<
Boolean
>
saveBatch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
Boolean
>
saveBatch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestBody
List
<
BaseData
>
baseDatas
)
{
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestBody
List
<
BaseData
>
baseDatas
)
{
baseDatas
.
forEach
(
item
->
item
.
addParent
(
parentEntity
,
parentKey
).
addParent
(
parentEntity2
,
parentKey2
));
dataService
.
saveBatch
(
system
,
scope
,
entity
,
datasource
,
baseDatas
);
dataService
.
saveBatch
(
system
,
scope
,
entity
,
datasource
,
baseDatas
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
}
@ApiOperation
(
value
=
"Select查询数据"
,
tags
=
{
"数据"
}
,
notes
=
"Select查询数据,GET,返回body<list>+header<page,total>"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
={
"/{entity}/select"
})
public
ResponseEntity
<
List
<
BaseData
>>
select
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataquery"
,
required
=
true
)
String
dataquery
,
@RequestParam
Map
map
)
{
FilterData
context
=
FilterData
.
fromContext
(
map
);
return
doSelect
(
system
,
scope
,
entity
,
parentEntity
,
parentKey
,
parentEntity2
,
parentKey2
,
datasource
,
dataquery
,
context
);
}
@ApiOperation
(
value
=
"查询数据"
,
tags
=
{
"数据"
}
,
notes
=
"查询数据,POST,返回body<list>+header<page,total>"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
={
"/{entity}/select"
})
public
ResponseEntity
<
List
<
BaseData
>>
doSelect
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataquery"
,
required
=
true
)
String
dataquery
,
@RequestBody
(
required
=
false
)
FilterData
context
)
{
if
(
context
==
null
)
context
=
new
FilterData
();
context
.
addParent
(
parentEntity
,
parentKey
).
addParent
(
parentEntity2
,
parentKey2
);
if
(
context
.
needPage
())
{
Page
<
BaseData
>
baseDatas
=
dataService
.
select
(
system
,
scope
,
entity
,
datasource
,
context
,
context
.
getPageable
())
;
List
<
BaseData
>
list
=
baseDatas
.
getContent
();
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
header
(
"x-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageNumber
()))
.
header
(
"x-per-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageSize
()))
.
header
(
"x-total"
,
String
.
valueOf
(
baseDatas
.
getTotalElements
()))
.
body
(
list
);
}
else
{
List
<
BaseData
>
list
=
dataService
.
select
(
system
,
scope
,
entity
,
datasource
,
context
)
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
header
(
"x-page"
,
"0"
)
.
header
(
"x-per-page"
,
String
.
valueOf
(
list
.
size
()))
.
header
(
"x-total"
,
String
.
valueOf
(
list
.
size
()))
.
body
(
list
);
}
}
@ApiOperation
(
value
=
"获取数据集"
,
tags
=
{
"数据"
}
,
notes
=
"获取数据集,GET,返回body<list>+header<page,total>"
)
@ApiOperation
(
value
=
"获取数据集"
,
tags
=
{
"数据"
}
,
notes
=
"获取数据集,GET,返回body<list>+header<page,total>"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
={
"/{entity}/fetch{dataset}"
})
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
={
"/{entity}/fetch{dataset}"
})
public
ResponseEntity
<
List
<
BaseData
>>
fetch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
List
<
BaseData
>>
fetch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataset"
,
required
=
true
)
String
dataset
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataset"
,
required
=
true
)
String
dataset
,
@RequestParam
Map
map
)
{
@RequestParam
Map
map
)
{
FilterData
context
=
FilterData
.
fromContext
(
map
);
FilterData
context
=
FilterData
.
fromContext
(
map
);
return
doFetch
(
system
,
scope
,
entity
,
datasource
,
dataset
,
context
);
return
doFetch
(
system
,
scope
,
entity
,
parentEntity
,
parentKey
,
parentEntity2
,
parentKey2
,
datasource
,
dataset
,
context
);
}
}
@ApiOperation
(
value
=
"获取数据集"
,
tags
=
{
"数据"
}
,
notes
=
"获取数据集,POST,返回body<list>+header<page,total>"
)
@ApiOperation
(
value
=
"获取数据集"
,
tags
=
{
"数据"
}
,
notes
=
"获取数据集,POST,返回body<list>+header<page,total>"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
={
"/{entity}/fetch{dataset}"
,
"/{entity}/fetch{dataset}"
})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
={
"/{entity}/fetch{dataset}"
})
public
ResponseEntity
<
List
<
BaseData
>>
doFetch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
List
<
BaseData
>>
doFetch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataset"
,
required
=
true
)
String
dataset
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataset"
,
required
=
true
)
String
dataset
,
@RequestBody
(
required
=
false
)
FilterData
context
)
{
@RequestBody
(
required
=
false
)
FilterData
context
)
{
if
(
context
==
null
)
context
=
new
FilterData
();
if
(
context
==
null
)
context
=
new
FilterData
();
context
.
addParent
(
parentEntity
,
parentKey
).
addParent
(
parentEntity2
,
parentKey2
);
if
(
context
.
needPage
())
{
if
(
context
.
needPage
())
{
Page
<
BaseData
>
baseDatas
=
dataService
.
fetch
(
system
,
scope
,
entity
,
datasource
,
dataset
,
context
,
context
.
getPageable
());
Page
<
BaseData
>
baseDatas
=
dataService
.
fetch
(
system
,
scope
,
entity
,
datasource
,
dataset
,
context
,
context
.
getPageable
());
List
<
BaseData
>
list
=
baseDatas
.
getContent
();
List
<
BaseData
>
list
=
baseDatas
.
getContent
();
...
@@ -293,12 +510,19 @@ public class DataResource
...
@@ -293,12 +510,19 @@ public class DataResource
}
}
@ApiOperation
(
value
=
"获取数据集"
,
tags
=
{
"数据"
}
,
notes
=
"获取数据集,POST,返回body<page,total,list>"
)
@ApiOperation
(
value
=
"获取数据集"
,
tags
=
{
"数据"
}
,
notes
=
"获取数据集,POST,返回body<page,total,list>"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
={
"/{entity}/search{dataset}"
,
"/{entity}/search{dataset}"
})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
={
"/{entity}/search{dataset}"
})
public
ResponseEntity
<
Page
<
BaseData
>>
search
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
Page
<
BaseData
>>
search
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataset"
,
required
=
true
)
String
dataset
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataset"
,
required
=
true
)
String
dataset
,
@RequestBody
(
required
=
false
)
FilterData
context
)
{
@RequestBody
(
required
=
false
)
FilterData
context
)
{
if
(
context
==
null
)
context
=
new
FilterData
();
if
(
context
==
null
)
context
=
new
FilterData
();
context
.
addParent
(
parentEntity
,
parentKey
).
addParent
(
parentEntity2
,
parentKey2
);
Page
<
BaseData
>
baseDatas
=
dataService
.
fetch
(
system
,
scope
,
entity
,
datasource
,
dataset
,
context
,
context
.
getPageable
())
;
Page
<
BaseData
>
baseDatas
=
dataService
.
fetch
(
system
,
scope
,
entity
,
datasource
,
dataset
,
context
,
context
.
getPageable
())
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
body
(
new
PageImpl
(
baseDatas
.
getContent
(),
context
.
getPageable
(),
baseDatas
.
getTotalElements
()));
.
body
(
new
PageImpl
(
baseDatas
.
getContent
(),
context
.
getPageable
(),
baseDatas
.
getTotalElements
()));
...
@@ -307,22 +531,35 @@ public class DataResource
...
@@ -307,22 +531,35 @@ public class DataResource
@ApiOperation
(
value
=
"查询数据"
,
tags
=
{
"数据"
}
,
notes
=
"查询数据,GET,返回body<list>+header<page,total>"
)
@ApiOperation
(
value
=
"查询数据"
,
tags
=
{
"数据"
}
,
notes
=
"查询数据,GET,返回body<list>+header<page,total>"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
={
"/{entity}/query{dataquery}"
,
"/{entity}/query{dataquery}"
})
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
={
"/{entity}/query{dataquery}"
})
public
ResponseEntity
<
List
<
BaseData
>>
query
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
List
<
BaseData
>>
query
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataquery"
,
required
=
true
)
String
dataquery
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@RequestParam
Map
map
)
{
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataquery"
,
required
=
true
)
String
dataquery
,
@RequestParam
Map
map
)
{
FilterData
context
=
FilterData
.
fromContext
(
map
);
FilterData
context
=
FilterData
.
fromContext
(
map
);
return
doQuery
(
system
,
scope
,
entity
,
datasource
,
dataquery
,
context
);
return
doQuery
(
system
,
scope
,
entity
,
parentEntity
,
parentKey
,
parentEntity2
,
parentKey2
,
datasource
,
dataquery
,
context
);
}
}
@ApiOperation
(
value
=
"查询数据"
,
tags
=
{
"数据"
}
,
notes
=
"查询数据,POST,返回body<list>+header<page,total>"
)
@ApiOperation
(
value
=
"查询数据"
,
tags
=
{
"数据"
}
,
notes
=
"查询数据,POST,返回body<list>+header<page,total>"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
={
"/{entity}/query{dataquery}"
,
"/{entity}/query{dataquery}"
})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
={
"/{entity}/query{dataquery}"
})
public
ResponseEntity
<
List
<
BaseData
>>
doQuery
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
List
<
BaseData
>>
doQuery
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataquery"
,
required
=
true
)
String
dataquery
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@RequestBody
(
required
=
false
)
FilterData
context
)
{
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataquery"
,
required
=
true
)
String
dataquery
,
@RequestBody
(
required
=
false
)
FilterData
context
)
{
if
(
context
==
null
)
context
=
new
FilterData
();
if
(
context
==
null
)
context
=
new
FilterData
();
context
.
addParent
(
parentEntity
,
parentKey
).
addParent
(
parentEntity2
,
parentKey2
);
if
(
context
.
needPage
())
{
if
(
context
.
needPage
())
{
Page
<
BaseData
>
baseDatas
=
dataService
.
query
(
system
,
scope
,
entity
,
datasource
,
dataquery
,
context
,
context
.
getPageable
())
;
Page
<
BaseData
>
baseDatas
=
dataService
.
query
(
system
,
scope
,
entity
,
datasource
,
dataquery
,
context
,
context
.
getPageable
())
;
List
<
BaseData
>
list
=
baseDatas
.
getContent
();
List
<
BaseData
>
list
=
baseDatas
.
getContent
();
...
@@ -343,12 +580,19 @@ public class DataResource
...
@@ -343,12 +580,19 @@ public class DataResource
}
}
@ApiOperation
(
value
=
"查询数据"
,
tags
=
{
"数据"
}
,
notes
=
"查询数据,POST,返回body<page,total,list>"
)
@ApiOperation
(
value
=
"查询数据"
,
tags
=
{
"数据"
}
,
notes
=
"查询数据,POST,返回body<page,total,list>"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
={
"/{entity}/page{dataquery}"
,
"/{entity}/page{dataquery}"
})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
={
"/{entity}/page{dataquery}"
})
public
ResponseEntity
<
Page
<
BaseData
>>
queryPage
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
public
ResponseEntity
<
Page
<
BaseData
>>
queryPage
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataquery"
,
required
=
true
)
String
dataquery
,
@PathVariable
(
name
=
"parentEntity"
,
required
=
false
)
String
parentEntity
,
@RequestBody
(
required
=
false
)
FilterData
context
)
{
@PathVariable
(
name
=
"parentKey"
,
required
=
false
)
String
parentKey
,
@PathVariable
(
name
=
"parentEntity2"
,
required
=
false
)
String
parentEntity2
,
@PathVariable
(
name
=
"parentKey2"
,
required
=
false
)
String
parentKey2
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataquery"
,
required
=
true
)
String
dataquery
,
@RequestBody
(
required
=
false
)
FilterData
context
)
{
if
(
context
==
null
)
context
=
new
FilterData
();
if
(
context
==
null
)
context
=
new
FilterData
();
context
.
addParent
(
parentEntity
,
parentKey
).
addParent
(
parentEntity2
,
parentKey2
);
Page
<
BaseData
>
baseDatas
=
dataService
.
fetch
(
system
,
scope
,
entity
,
datasource
,
dataquery
,
context
,
context
.
getPageable
())
;
Page
<
BaseData
>
baseDatas
=
dataService
.
fetch
(
system
,
scope
,
entity
,
datasource
,
dataquery
,
context
,
context
.
getPageable
())
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
body
(
new
PageImpl
(
baseDatas
.
getContent
(),
context
.
getPageable
(),
baseDatas
.
getTotalElements
()));
.
body
(
new
PageImpl
(
baseDatas
.
getContent
(),
context
.
getPageable
(),
baseDatas
.
getTotalElements
()));
...
...
ibzdata-core/src/main/java/cn/ibizlab/core/data/service/impl/DSSettingServiceImpl.java
浏览文件 @
277ba0e5
...
@@ -8,6 +8,7 @@ import java.nio.file.StandardOpenOption;
...
@@ -8,6 +8,7 @@ import java.nio.file.StandardOpenOption;
import
java.util.*
;
import
java.util.*
;
import
cn.ibizlab.core.data.model.DSLink
;
import
cn.ibizlab.core.data.model.DSLink
;
import
cn.ibizlab.core.data.mongodb.DynamicMongoContextHolder
;
import
cn.ibizlab.core.data.service.ModelService
;
import
cn.ibizlab.core.data.service.ModelService
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
com.alibaba.fastjson.TypeReference
;
...
@@ -111,6 +112,8 @@ public class DSSettingServiceImpl implements IDSSettingService {
...
@@ -111,6 +112,8 @@ public class DSSettingServiceImpl implements IDSSettingService {
DynamicRoutingDataSource
ds
=
(
DynamicRoutingDataSource
)
dataSource
;
DynamicRoutingDataSource
ds
=
(
DynamicRoutingDataSource
)
dataSource
;
ds
.
removeDataSource
(
et
.
getDsId
());
ds
.
removeDataSource
(
et
.
getDsId
());
}
}
else
if
(
et
.
isMongodb
())
DynamicMongoContextHolder
.
removeFactory
(
et
.
getDsId
());
check
.
remove
(
et
.
getDsId
());
check
.
remove
(
et
.
getDsId
());
}
}
if
(!
et
.
getDsId
().
equals
(
et
.
getDsId
().
toLowerCase
()))
if
(!
et
.
getDsId
().
equals
(
et
.
getDsId
().
toLowerCase
()))
...
@@ -279,22 +282,29 @@ public class DSSettingServiceImpl implements IDSSettingService {
...
@@ -279,22 +282,29 @@ public class DSSettingServiceImpl implements IDSSettingService {
{
{
synchronized
(
lock
)
synchronized
(
lock
)
{
{
DSLink
dsLink
=
dstDataSource
.
getDSLinkConfig
();
if
(
dstDataSource
.
isDatabase
())
if
(
dstDataSource
.
isDatabase
())
{
{
DataSourceProperty
dataSourceProperty
=
dstDataSource
.
getDataSourceProperty
();
DataSourceProperty
dataSourceProperty
=
dstDataSource
.
getDataSourceProperty
();
DynamicRoutingDataSource
ds
=
dataSource
;
DynamicRoutingDataSource
ds
=
dataSource
;
DataSource
dataSource
=
druidDataSourceCreator
.
createDataSource
(
dataSourceProperty
);
DataSource
dataSource
=
druidDataSourceCreator
.
createDataSource
(
dataSourceProperty
);
ds
.
addDataSource
(
dstDataSource
.
getDsId
(),
dataSource
);
ds
.
addDataSource
(
dstDataSource
.
getDsId
(),
dataSource
);
dsLink
.
setSource
(
dataSource
);
}
}
check
.
put
(
dstDataSource
.
getDsId
(),
dstDataSource
.
getDSLinkConfig
());
else
if
(
dstDataSource
.
isMongodb
())
{
DynamicMongoContextHolder
.
addFactory
(
dstDataSource
.
getDsId
(),
dsLink
);
}
check
.
put
(
dstDataSource
.
getDsId
(),
dsLink
);
if
(!
dstDataSource
.
getDsId
().
equals
(
dstDataSource
.
getDsId
().
toLowerCase
()))
if
(!
dstDataSource
.
getDsId
().
equals
(
dstDataSource
.
getDsId
().
toLowerCase
()))
check
.
put
(
dstDataSource
.
getDsId
().
toLowerCase
(),
ds
tDataSource
.
getDSLinkConfig
()
);
check
.
put
(
dstDataSource
.
getDsId
().
toLowerCase
(),
ds
Link
);
if
(!
ObjectUtils
.
isEmpty
(
dstDataSource
.
getUsings
()))
if
(!
ObjectUtils
.
isEmpty
(
dstDataSource
.
getUsings
()))
{
{
dstDataSource
.
getUsings
().
forEach
(
using
->{
dstDataSource
.
getUsings
().
forEach
(
using
->{
check
.
put
(
using
,
ds
tDataSource
.
getDSLinkConfig
()
);
check
.
put
(
using
,
ds
Link
);
if
(!
using
.
equals
(
using
.
toLowerCase
()))
if
(!
using
.
equals
(
using
.
toLowerCase
()))
check
.
put
(
using
.
toLowerCase
(),
ds
tDataSource
.
getDSLinkConfig
()
);
check
.
put
(
using
.
toLowerCase
(),
ds
Link
);
});
});
}
}
}
}
...
@@ -337,6 +347,8 @@ public class DSSettingServiceImpl implements IDSSettingService {
...
@@ -337,6 +347,8 @@ public class DSSettingServiceImpl implements IDSSettingService {
return
new
PageImpl
<
DSSetting
>(
list
,
context
.
getPageable
(),
list
.
size
());
return
new
PageImpl
<
DSSetting
>(
list
,
context
.
getPageable
(),
list
.
size
());
}
}
}
}
ibzdata-core/src/main/java/cn/ibizlab/core/data/service/impl/MongoDataServiceImpl.java
浏览文件 @
277ba0e5
...
@@ -22,6 +22,8 @@ import java.util.List;
...
@@ -22,6 +22,8 @@ import java.util.List;
public
class
MongoDataServiceImpl
implements
IDataService
public
class
MongoDataServiceImpl
implements
IDataService
{
{
@Override
@Override
public
ResponseData
call
(
DOModel
model
,
String
scope
,
String
datasource
,
String
method
,
RequestData
requestData
)
public
ResponseData
call
(
DOModel
model
,
String
scope
,
String
datasource
,
String
method
,
RequestData
requestData
)
{
{
...
@@ -31,6 +33,7 @@ public class MongoDataServiceImpl implements IDataService
...
@@ -31,6 +33,7 @@ public class MongoDataServiceImpl implements IDataService
@Override
@Override
public
boolean
create
(
DOModel
model
,
String
scope
,
String
datasource
,
BaseData
et
)
public
boolean
create
(
DOModel
model
,
String
scope
,
String
datasource
,
BaseData
et
)
{
{
return
false
;
return
false
;
}
}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录