Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdata
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdata
提交
294a10fa
提交
294a10fa
编写于
8月 27, 2021
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
url改造
上级
d43bc8ba
变更
16
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
320 行增加
和
198 行删除
+320
-198
DevBootApplication.java
...ata-boot/src/main/java/cn/ibizlab/DevBootApplication.java
+2
-3
DevBootSecurityConfig.java
...rc/main/java/cn/ibizlab/config/DevBootSecurityConfig.java
+13
-3
DevUrlRedirectFilter.java
...src/main/java/cn/ibizlab/config/DevUrlRedirectFilter.java
+55
-0
application-boot.yml
ibzdata-boot/src/main/resources/application-boot.yml
+61
-0
BaseData.java
...core/src/main/java/cn/ibizlab/core/data/dto/BaseData.java
+18
-0
FilterData.java
...re/src/main/java/cn/ibizlab/core/data/dto/FilterData.java
+12
-1
DynamicModelService.java
...n/java/cn/ibizlab/core/data/lite/DynamicModelService.java
+4
-1
POSchema.java
...re/src/main/java/cn/ibizlab/core/data/model/POSchema.java
+54
-10
PojoSchema.java
.../src/main/java/cn/ibizlab/core/data/model/PojoSchema.java
+7
-0
TransUtils.java
.../src/main/java/cn/ibizlab/core/data/model/TransUtils.java
+1
-1
DataResource.java
...src/main/java/cn/ibizlab/core/data/rest/DataResource.java
+65
-119
ModelService.java
.../main/java/cn/ibizlab/core/data/service/ModelService.java
+23
-2
DbDataServiceImpl.java
.../cn/ibizlab/core/data/service/impl/DbDataServiceImpl.java
+1
-1
FilterDataResolver.java
.../java/cn/ibizlab/core/util/config/FilterDataResolver.java
+0
-53
DbDataMapper.xml
...re/src/main/resources/mapper/data/DbData/DbDataMapper.xml
+3
-3
AppController.java
...til/src/main/java/cn/ibizlab/util/rest/AppController.java
+1
-1
未找到文件。
ibzdata-boot/src/main/java/cn/ibizlab/DevBootApplication.java
浏览文件 @
294a10fa
package
cn
.
ibizlab
;
import
cn.ibizlab.core.util.config.FilterDataResolver
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
...
...
@@ -40,7 +39,7 @@ public class DevBootApplication extends WebMvcConfigurerAdapter {
@Autowired
FilterDataResolver
filterDataR
esolver
;
SearchContextHandlerMethodArgumentResolver
r
esolver
;
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
DevBootApplication
.
class
,
args
);
...
...
@@ -49,6 +48,6 @@ public class DevBootApplication extends WebMvcConfigurerAdapter {
@Override
public
void
addArgumentResolvers
(
List
<
HandlerMethodArgumentResolver
>
argumentResolvers
)
{
super
.
addArgumentResolvers
(
argumentResolvers
);
argumentResolvers
.
add
(
filterDataR
esolver
);
argumentResolvers
.
add
(
r
esolver
);
}
}
ibzdata-boot/src/main/java/cn/ibizlab/config/DevBootSecurityConfig.java
浏览文件 @
294a10fa
...
...
@@ -115,10 +115,20 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
.
antMatchers
(
HttpMethod
.
GET
,
"/"
+
logoutPath
).
permitAll
()
// 文件操作
.
antMatchers
(
"/"
+
downloadpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/ibiz-repository/**"
).
permitAll
()
.
antMatchers
(
"/ibiz-repo/**"
).
permitAll
()
.
antMatchers
(
"/"
+
uploadpath
).
permitAll
()
.
antMatchers
(
"/"
+
previewpath
+
"/**"
).
permitAll
();
.
antMatchers
(
"/"
+
previewpath
+
"/**"
).
permitAll
()
.
antMatchers
(
HttpMethod
.
POST
,
"/ibiz-repo**/**/"
+
loginPath
).
permitAll
()
//放行注销请求
.
antMatchers
(
HttpMethod
.
GET
,
"/ibiz-repo**/**/"
+
logoutPath
).
permitAll
()
// 文件操作
.
antMatchers
(
"/ibiz-repo**/**/"
+
downloadpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/ibiz-repo**/**/"
+
uploadpath
).
permitAll
()
.
antMatchers
(
"/ibiz-repo**/**/"
+
previewpath
+
"/**"
).
permitAll
()
;
for
(
String
excludePattern
:
excludesPattern
)
{
...
...
ibzdata-boot/src/main/java/cn/ibizlab/config/DevUrlRedirectFilter.java
0 → 100644
浏览文件 @
294a10fa
package
cn
.
ibizlab
.
config
;
import
java.util.HashMap
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.cloud.netflix.zuul.filters.support.FilterConstants
;
import
org.springframework.stereotype.Component
;
import
com.netflix.zuul.ZuulFilter
;
import
com.netflix.zuul.context.RequestContext
;
@Component
public
class
DevUrlRedirectFilter
extends
ZuulFilter
{
@Override
public
Object
run
()
{
RequestContext
ctx
=
RequestContext
.
getCurrentContext
();
HttpServletRequest
request
=
ctx
.
getRequest
();
String
url
=
request
.
getRequestURI
();
if
(
url
.
startsWith
(
"/ibiz-repo"
))
{
String
[]
split
=
url
.
split
(
"/"
);
if
(
split
.
length
>
2
)
{
url
=
url
.
replaceFirst
(
"/"
+
split
[
1
]+
"/"
+
split
[
2
]+
"/"
,
"/"
);
ctx
.
put
(
FilterConstants
.
REQUEST_URI_KEY
,
url
);
}
}
return
null
;
}
@Override
public
boolean
shouldFilter
()
{
return
true
;
}
@Override
public
int
filterOrder
()
{
return
1
;
}
@Override
public
String
filterType
()
{
return
FilterConstants
.
ROUTE_TYPE
;
}
}
\ No newline at end of file
ibzdata-boot/src/main/resources/application-boot.yml
浏览文件 @
294a10fa
spring
:
jackson
:
date-format
:
yyyy-MM-dd HH:mm:ss
time-zone
:
GMT+8
datasource
:
username
:
root
password
:
root
...
...
@@ -43,3 +46,61 @@ spring:
cache
:
caffeine
:
spec
:
initialCapacity=5,maximumSize=50000,expireAfterWrite=3600s
zuul
:
routes
:
repo-loginv7
:
path
:
/ibiz-repo**/**/v7/login
serviceId
:
${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix
:
true
repo-changepwd
:
path
:
/ibiz-rep**/**/v7/changepwd
serviceId
:
${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix
:
false
repo-uaa
:
path
:
/ibiz-rep**/**/uaa/**
serviceId
:
${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix
:
false
repo-config
:
path
:
/ibiz-rep**/**/configs/**
serviceId
:
${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix
:
false
repo-oucore
:
path
:
/ibiz-rep**/**/ibzorganizations/**
serviceId
:
${ibiz.ref.service.ou:ibzou-api}
stripPrefix
:
false
repo-oudict
:
path
:
/ibiz-rep**/**/dictionarys/**/Ibzou**
serviceId
:
${ibiz.ref.service.ou:ibzou-api}
stripPrefix
:
false
repo-ou
:
path
:
/ibiz-rep**/**/ibzdepartments/**
serviceId
:
${ibiz.ref.service.ou:ibzou-api}
stripPrefix
:
false
repo-uaadict
:
path
:
/ibiz-rep**/**/dictionarys/**/SysOperator
serviceId
:
${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix
:
false
repo-dict
:
path
:
/ibiz-rep**/**/dictionarys/**
serviceId
:
${ibiz.ref.service.dict:ibzdict-api}
stripPrefix
:
false
repo-disk
:
path
:
/ibiz-rep**/**/net-disk/**
serviceId
:
${ibiz.ref.service.disk:ibzdisk-api}
stripPrefix
:
false
repo-ou_sys_org
:
path
:
/ibiz-rep**/**/sysorganizations/**
serviceId
:
${ibiz.ref.service.ou:ibzou-api}
stripPrefix
:
false
repo-ou_sys_dept
:
path
:
/ibiz-rep**/**/sysdepartments/**
serviceId
:
${ibiz.ref.service.ou:ibzou-api}
stripPrefix
:
false
repo-lite-core
:
path
:
/ibiz-rep**/**/lite/**
serviceId
:
${ibiz.ref.service.lite:ibzlite-api}
stripPrefix
:
false
repo-sysauthlog
:
path
:
/ibiz-rep**/**/sysauthlogs
serviceId
:
${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix
:
false
\ No newline at end of file
ibzdata-core/src/main/java/cn/ibizlab/core/data/dto/BaseData.java
浏览文件 @
294a10fa
...
...
@@ -8,6 +8,7 @@ import com.alibaba.fastjson.annotation.JSONField;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
org.springframework.util.ObjectUtils
;
import
java.io.Serializable
;
import
java.util.Map
;
...
...
@@ -41,6 +42,12 @@ public class BaseData extends DataObj
return
this
;
}
@Override
public
BaseData
remove
(
Object
key
)
{
super
.
remove
(
key
);
return
this
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
POSchema
_poschema
;
...
...
@@ -121,4 +128,15 @@ public class BaseData extends DataObj
{
return
getSerializableValue
(
"_key"
);
}
public
static
BaseData
fromContext
(
Map
map
)
{
if
(
map
==
null
)
return
null
;
map
.
remove
(
"datasource"
);
if
(
map
.
size
()==
0
)
return
null
;
return
new
BaseData
().
setAll
(
map
);
}
}
ibzdata-core/src/main/java/cn/ibizlab/core/data/dto/FilterData.java
浏览文件 @
294a10fa
...
...
@@ -291,7 +291,7 @@ public class FilterData<T> extends BaseData
{
if
(!
StringUtils
.
isEmpty
(
this
.
getQuery
()))
{
if
(
ObjectUtils
.
isEmpty
(
this
.
getPOSchema
().
getQuickSearch
()))
if
(
!
ObjectUtils
.
isEmpty
(
this
.
getPOSchema
().
getQuickSearch
()))
{
searchCond
.
and
(
qw
->
{
int
i
=
0
;
...
...
@@ -376,4 +376,15 @@ public class FilterData<T> extends BaseData
return
sql
;
}
public
static
FilterData
fromContext
(
Map
map
)
{
if
(
map
==
null
)
return
null
;
map
.
remove
(
"datasource"
);
if
(
map
.
size
()==
0
)
return
null
;
return
new
FilterData
().
setAll
(
map
);
}
}
ibzdata-core/src/main/java/cn/ibizlab/core/data/lite/DynamicModelService.java
浏览文件 @
294a10fa
...
...
@@ -219,13 +219,16 @@ public class DynamicModelService {
for
(
IPSDEField
defield:
dataEntity
.
getAllPSDEFields
())
{
String
dict
=
null
;
try
{
dict
=
defield
.
getPSCodeList
()!=
null
?
defield
.
getPSCodeList
().
getCodeName
():
null
;
}
catch
(
Exception
ex
){}
FieldModel
fieldModel
=
new
FieldModel
();
MetaFieldModel
metaFieldModel
=
new
MetaFieldModel
();
metaFieldModel
.
setFieldId
(
defield
.
getId
()).
setFieldName
(
defield
.
getName
()).
setCodeName
(
defield
.
getCodeName
()).
setFieldLogicName
(
defield
.
getLogicName
())
.
setEntityId
(
dataEntity
.
getId
()).
setEntityCodeName
(
dataEntity
.
getCodeName
()).
setEntityName
(
dataEntity
.
getName
()).
setSystemId
(
metaEntityModel
.
getSystemId
())
.
setFieldUniName
(
dataEntity
.
getName
()+
"."
+
defield
.
getName
()).
setFieldShowName
(
String
.
format
(
"%1$s-%2$s[%3$s]"
,
defield
.
getName
(),
defield
.
getLogicName
(),
dataEntity
.
getName
()))
.
setKeyField
(
defield
.
isKeyDEField
()?
1
:
null
).
setMajorField
(
defield
.
isMajorDEField
()?
1
:
null
).
setUnionKey
(
defield
.
getUnionKeyValue
()).
setFieldType
(
defield
.
getDataType
())
.
setPredefined
(
defield
.
getPredefinedType
()).
setDict
(
d
efield
.
getPSCodeList
()!=
null
?
defield
.
getPSCodeList
().
getCodeName
():
null
).
setNullable
(
defield
.
isAllowEmpty
()?
1
:
0
)
.
setPredefined
(
defield
.
getPredefinedType
()).
setDict
(
d
ict
).
setNullable
(
defield
.
isAllowEmpty
()?
1
:
0
)
.
setPhysicalField
(
defield
.
isPhisicalDEField
()?
1
:
0
).
setDataType
(
DataType
.
findTypeName
(
defield
.
getStdDataType
())).
setDataLength
(
defield
.
getLength
()).
setDataPreci
(
defield
.
getPrecision
())
.
setIsEnableAudit
(
defield
.
isEnableAudit
()?
1
:
null
).
setShowOrder
(
defield
.
getImportOrder
());
...
...
ibzdata-core/src/main/java/cn/ibizlab/core/data/model/POSchema.java
浏览文件 @
294a10fa
...
...
@@ -556,7 +556,7 @@ public class POSchema {
@Accessors
(
chain
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
static
class
Segment
{
public
static
class
Segment
{
private
String
name
;
private
String
vendorProvider
;
private
String
declare
;
...
...
@@ -564,13 +564,21 @@ public class POSchema {
private
String
format
;
private
Map
params
;
public
Segment
setVendorProvider
(
String
vendorProvider
)
{
if
(!
StringUtils
.
isEmpty
(
vendorProvider
))
this
.
vendorProvider
=
provider
.
get
(
vendorProvider
.
toLowerCase
());
public
Segment
setVendorProvider
(
String
vendorProvider
)
{
if
(!
StringUtils
.
isEmpty
(
vendorProvider
))
this
.
vendorProvider
=
provider
.
get
(
vendorProvider
.
toLowerCase
());
return
this
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
String
getSql
()
{
if
(!
StringUtils
.
isEmpty
(
format
))
return
String
.
format
(
format
,
body
);
return
body
;
}
}
...
...
@@ -622,7 +630,7 @@ public class POSchema {
@JSONField
(
ordinal
=
12
)
public
Segment
defaultQueryScript
;
public
POSchema
setDefaultQueryScript
(
String
sql
)
public
POSchema
setDefaultQueryScript
SQL
(
String
sql
)
{
defaultQueryScript
=
new
Segment
().
setName
(
"default_query_script"
).
setVendorProvider
(
""
).
setBody
(
sql
);
return
this
;
...
...
@@ -637,7 +645,7 @@ public class POSchema {
segment
=
this
.
getSegment
(
"dq-default-"
,
this
.
getDsType
());
if
(
segment
!=
null
)
{
setDefaultQueryScript
(
segment
.
getBody
());
setDefaultQueryScript
SQL
(
segment
.
getBody
());
return
defaultQueryScript
;
}
else
if
(!
StringUtils
.
isEmpty
(
this
.
getDsType
()))
...
...
@@ -647,7 +655,7 @@ public class POSchema {
segment
=
this
.
getSegment
(
"dq-default-"
,
""
);
if
(
segment
!=
null
)
{
setDefaultQueryScript
(
segment
.
getBody
().
replace
(
"`"
,
""
).
replace
(
"["
,
""
).
replace
(
"]"
,
""
));
setDefaultQueryScript
SQL
(
segment
.
getBody
().
replace
(
"`"
,
""
).
replace
(
"["
,
""
).
replace
(
"]"
,
""
));
return
defaultQueryScript
;
}
}
...
...
@@ -707,13 +715,30 @@ public class POSchema {
public
BaseData
trans
(
BaseData
source
)
{
if
(!
needTrans
)
{
for
(
String
key
:
resultMap
.
keySet
())
{
if
(!
source
.
keySet
().
contains
(
key
))
{
if
((!
key
.
equals
(
key
.
toUpperCase
()))&&
source
.
keySet
().
contains
(
key
.
toUpperCase
()))
{
needTrans
=
true
;
break
;
}
else
if
((!
key
.
equals
(
key
.
toLowerCase
()))&&
source
.
keySet
().
contains
(
key
.
toLowerCase
()))
{
needTrans
=
true
;
break
;
}
}
}
}
if
(!
needTrans
)
return
source
;
else
{
BaseData
target
=
new
BaseData
();
for
(
Map
.
Entry
<
String
,
String
>
entry
:
resultMap
.
entrySet
())
{
if
(
source
.
keySet
().
contains
(
entry
.
getKey
()))
target
.
set
(
entry
.
getValue
(),
source
.
get
(
entry
.
getKey
()));
target
.
set
(
entry
.
getValue
().
toLowerCase
(),
source
.
get
(
entry
.
getKey
()));
}
return
target
;
}
...
...
@@ -721,6 +746,25 @@ public class POSchema {
public
List
<
BaseData
>
trans
(
List
<
BaseData
>
source
)
{
if
(!
needTrans
&&
source
.
size
()>
0
)
{
BaseData
src
=
source
.
get
(
0
);
for
(
String
key
:
resultMap
.
keySet
())
{
if
(!
src
.
keySet
().
contains
(
key
))
{
if
((!
key
.
equals
(
key
.
toUpperCase
()))&&
src
.
keySet
().
contains
(
key
.
toUpperCase
()))
{
needTrans
=
true
;
break
;
}
else
if
((!
key
.
equals
(
key
.
toLowerCase
()))&&
src
.
keySet
().
contains
(
key
.
toLowerCase
()))
{
needTrans
=
true
;
break
;
}
}
}
}
if
(!
needTrans
)
return
source
;
else
{
...
...
ibzdata-core/src/main/java/cn/ibizlab/core/data/model/PojoSchema.java
浏览文件 @
294a10fa
...
...
@@ -63,6 +63,13 @@ public class PojoSchema {
return
this
;
}
@JSONField
(
serialize
=
false
)
@JsonIgnore
public
String
getCodeName
()
{
return
this
.
getOptions
()==
null
?
this
.
getName
():
this
.
getOptions
().
getStringValue
(
"code_name"
,
this
.
getName
());
}
@JSONField
(
serialize
=
false
)
@JsonIgnore
public
String
getSystem
()
...
...
ibzdata-core/src/main/java/cn/ibizlab/core/data/model/TransUtils.java
浏览文件 @
294a10fa
...
...
@@ -297,7 +297,7 @@ public class TransUtils {
}
String
defaultQueryScript
=
pojoSchema
.
getOptions
().
getDefaultQueryScript
();
if
(!
StringUtils
.
isEmpty
(
defaultQueryScript
))
poSchema
.
setDefaultQueryScript
(
defaultQueryScript
);
poSchema
.
setDefaultQueryScript
SQL
(
defaultQueryScript
);
return
poSchema
;
}
...
...
ibzdata-core/src/main/java/cn/ibizlab/core/data/rest/DataResource.java
浏览文件 @
294a10fa
...
...
@@ -24,15 +24,14 @@ import java.util.Map;
@Slf4j
@Api
(
tags
=
{
"数据"
})
@RestController
(
"api-data"
)
@RequestMapping
(
""
)
@RequestMapping
(
{
"/ibiz-repository/{system}/{scope}"
,
"/ibiz-repo/{system}"
}
)
public
class
DataResource
{
@Autowired
public
IDataService
dataService
;
@ApiOperation
(
value
=
"callMethod数据"
,
tags
=
{
"数据"
},
notes
=
"callMethod数据"
)
@RequestMapping
(
method
=
{
RequestMethod
.
GET
},
value
=
{
"/ibiz-repository/{system}/{scope}/{entity}/{method}"
,
"/ibiz-repo/{system}/{entity}/{method}"
,
"/ibiz-repository/{system}/{scope}/{entity}/{key}/{method}"
,
"/ibiz-repo/{system}/{entity}/{key}/{method}"
})
@RequestMapping
(
method
=
{
RequestMethod
.
GET
},
value
=
{
"/{entity}/call{method}"
,
"/{entity}/{key}/call{method}"
})
public
ResponseEntity
call
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
...
...
@@ -40,14 +39,12 @@ public class DataResource
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestParam
Map
map
)
{
RequestData
requestData
=
new
RequestData
().
setAll
(
map
);
ResponseData
responseData
=
dataService
.
call
(
system
,
scope
,
entity
,
datasource
,
method
,
requestData
.
setKey
(
key
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
responseData
.
getBody
());
return
doCall
(
system
,
scope
,
entity
,
datasource
,
method
,
key
,
requestData
);
}
@ApiOperation
(
value
=
"callMethod数据"
,
tags
=
{
"数据"
},
notes
=
"callMethod数据"
)
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
{
"/ibiz-repository/{system}/{scope}/{entity}/{method}"
,
"/ibiz-repo/{system}/{entity}/{method}"
,
"/ibiz-repository/{system}/{scope}/{entity}/{key}/{method}"
,
"/ibiz-repo/{system}/{entity}/{key}/{method}"
})
public
ResponseEntity
callPost
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
{
"/{entity}/call{method}"
,
"/{entity}/{key}/call{method}"
})
public
ResponseEntity
doCall
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"method"
,
required
=
true
)
String
method
,
...
...
@@ -59,7 +56,7 @@ public class DataResource
}
@ApiOperation
(
value
=
"批量callMethod数据"
,
tags
=
{
"数据"
},
notes
=
"批量callMethod数据"
)
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
{
"/
ibiz-repository/{system}/{scope}/{entity}/{method}batch"
,
"/ibiz-repo/{system}/{entity}/
{method}batch"
})
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
{
"/
{entity}/call
{method}batch"
})
public
ResponseEntity
callBatch
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@PathVariable
(
name
=
"scope"
,
required
=
false
)
String
scope
,
@PathVariable
(
name
=
"entity"
,
required
=
true
)
String
entity
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
...
...
@@ -72,8 +69,7 @@ public class DataResource
@ApiOperation
(
value
=
"新建数据"
,
tags
=
{
"数据"
},
notes
=
"新建数据"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/ibiz-repository/{system}/{scope}/{entity}"
,
"/ibiz-repo/{system}/{entity}"
,
"/ibiz-repository/{system}/{scope}/{entity}/create"
,
"/ibiz-repo/{system}/{entity}/create"
})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}"
,
"/{entity}/create"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@Validated
@RequestBody
BaseData
baseData
)
{
...
...
@@ -82,8 +78,7 @@ public class DataResource
}
@ApiOperation
(
value
=
"批量新建数据"
,
tags
=
{
"数据"
},
notes
=
"批量新建数据"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/ibiz-repository/{system}/{scope}/{entity}/batch"
,
"/ibiz-repo/{system}/{entity}/batch"
,
"/ibiz-repository/{system}/{scope}/{entity}/createbatch"
,
"/ibiz-repo/{system}/{entity}/createbatch"
})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/batch"
,
"/{entity}/createbatch"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestBody
List
<
BaseData
>
baseDatas
)
{
...
...
@@ -92,17 +87,18 @@ public class DataResource
}
@ApiOperation
(
value
=
"获取数据"
,
tags
=
{
"数据"
},
notes
=
"获取数据"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
{
"/
ibiz-repository/{system}/{scope}/{entity}/{key}"
,
"/ibiz-repo/{system}
/{entity}/{key}"
})
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
{
"/
{entity}"
,
"
/{entity}/{key}"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
true
)
String
key
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dataService
.
get
(
system
,
scope
,
entity
,
datasource
,
key
));
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestParam
Map
map
)
{
BaseData
baseData
=
BaseData
.
fromContext
(
map
);
return
doGet
(
system
,
scope
,
entity
,
datasource
,
key
,
baseData
);
}
@ApiOperation
(
value
=
"获取数据"
,
tags
=
{
"数据"
},
notes
=
"获取数据"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/ibiz-repository/{system}/{scope}/{entity}/get"
,
"/ibiz-repo/{system}/{entity}/get"
,
"/ibiz-repository/{system}/{scope}/{entity}/{key}/get"
,
"/ibiz-repo/{system}/{entity}/{key}/get"
})
public
ResponseEntity
<
BaseData
>
get
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/get"
,
"/{entity}/{key}/get"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@Validated
@RequestBody
(
required
=
false
)
BaseData
baseData
)
{
...
...
@@ -116,25 +112,18 @@ public class DataResource
}
@ApiOperation
(
value
=
"删除数据"
,
tags
=
{
"数据"
},
notes
=
"删除数据"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
{
"/ibiz-repository/{system}/{scope}/{entity}/{key}"
,
"/ibiz-repo/{system}/{entity}/{key}"
,
"/ibiz-repository/{system}/{scope}/{entity}"
,
"/ibiz-repo/{system}/{entity}"
})
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
{
"/{entity}"
,
"/{entity}/{key}"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestBody
(
required
=
false
)
BaseData
baseData
)
{
if
(
baseData
==
null
)
{
if
(
StringUtils
.
isEmpty
(
key
))
throw
new
BadRequestAlertException
(
"未找到要删除的键值信息"
,
entity
,
null
);
baseData
=
new
BaseData
();
}
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dataService
.
removeByMap
(
system
,
scope
,
entity
,
datasource
,
baseData
.
setKey
(
key
)));
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestParam
Map
map
)
{
BaseData
baseData
=
BaseData
.
fromContext
(
map
);
return
doRemove
(
system
,
scope
,
entity
,
datasource
,
key
,
baseData
);
}
@ApiOperation
(
value
=
"删除数据"
,
tags
=
{
"数据"
},
notes
=
"删除数据"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/ibiz-repository/{system}/{scope}/{entity}/remove"
,
"/ibiz-repo/{system}/{entity}/remove"
,
"/ibiz-repository/{system}/{scope}/{entity}/{key}/remove"
,
"/ibiz-repo/{system}/{entity}/{key}/remove"
})
public
ResponseEntity
<
Boolean
>
removePost
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/remove"
,
"/{entity}/{key}/remove"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@Validated
@RequestBody
(
required
=
false
)
BaseData
baseData
)
{
...
...
@@ -148,17 +137,16 @@ public class DataResource
}
@ApiOperation
(
value
=
"批量删除数据"
,
tags
=
{
"数据"
},
notes
=
"批量删除数据"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
{
"/
ibiz-repository/{system}/{scope}/{entity}/batch"
,
"/ibiz-repo/{system}/
{entity}/batch"
})
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
{
"/{entity}/batch"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestBody
List
ids
)
{
dataService
.
removeBatch
(
system
,
scope
,
entity
,
datasource
,
ids
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
return
doRemoveBatch
(
system
,
scope
,
entity
,
datasource
,
ids
);
}
@ApiOperation
(
value
=
"批量删除数据"
,
tags
=
{
"数据"
},
notes
=
"批量删除数据"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/
ibiz-repository/{system}/{scope}/{entity}/removebatch"
,
"/ibiz-repo/{system}/
{entity}/removebatch"
})
public
ResponseEntity
<
Boolean
>
removeBatchPost
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/removebatch"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestBody
List
ids
)
{
dataService
.
removeBatch
(
system
,
scope
,
entity
,
datasource
,
ids
);
...
...
@@ -166,20 +154,17 @@ public class DataResource
}
@ApiOperation
(
value
=
"更新数据"
,
tags
=
{
"数据"
},
notes
=
"更新数据"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
{
"/ibiz-repository/{system}/{scope}/{entity}/{key}"
,
"/ibiz-repo/{system}/{entity}/{key}"
,
"/ibiz-repository/{system}/{scope}/{entity}"
,
"/ibiz-repo/{system}/{entity}"
})
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
{
"/{entity}"
,
"/{entity}/{key}"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestBody
BaseData
baseData
)
{
dataService
.
update
(
system
,
scope
,
entity
,
datasource
,
baseData
.
setKey
(
key
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
baseData
);
return
doUpdate
(
system
,
scope
,
entity
,
datasource
,
key
,
baseData
);
}
@ApiOperation
(
value
=
"更新数据"
,
tags
=
{
"数据"
},
notes
=
"更新数据"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/ibiz-repository/{system}/{scope}/{entity}/update"
,
"/ibiz-repo/{system}/{entity}/update"
,
"/ibiz-repository/{system}/{scope}/{entity}/{key}/update"
,
"/ibiz-repo/{system}/{entity}/{key}/update"
})
public
ResponseEntity
<
BaseData
>
updatePost
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/update"
,
"/{entity}/{key}/update"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestBody
BaseData
baseData
)
{
...
...
@@ -188,17 +173,16 @@ public class DataResource
}
@ApiOperation
(
value
=
"批量更新数据"
,
tags
=
{
"数据"
},
notes
=
"批量更新数据"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
{
"/
ibiz-repository/{system}/{scope}/{entity}/batch"
,
"/ibiz-repo/{system}/
{entity}/batch"
})
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
{
"/{entity}/batch"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestBody
List
<
BaseData
>
baseDatas
)
{
dataService
.
updateBatch
(
system
,
scope
,
entity
,
datasource
,
baseDatas
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
return
doUpdateBatch
(
system
,
scope
,
entity
,
datasource
,
baseDatas
);
}
@ApiOperation
(
value
=
"批量更新数据"
,
tags
=
{
"数据"
},
notes
=
"批量更新数据"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/
ibiz-repository/{system}/{scope}/{entity}/updatebatch"
,
"/ibiz-repo/{system}/
{entity}/updatebatch"
})
public
ResponseEntity
<
Boolean
>
updateBatchPost
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/updatebatch"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestBody
List
<
BaseData
>
baseDatas
)
{
dataService
.
updateBatch
(
system
,
scope
,
entity
,
datasource
,
baseDatas
);
...
...
@@ -206,26 +190,19 @@ public class DataResource
}
@ApiOperation
(
value
=
"检查数据"
,
tags
=
{
"数据"
},
notes
=
"检查数据"
)
@RequestMapping
(
method
=
{
RequestMethod
.
GET
},
value
=
{
"/ibiz-repository/{system}/{scope}/{entity}/checkkey"
,
"/ibiz-repo/{system}/{entity}/checkkey"
,
"/ibiz-repository/{system}/{scope}/{entity}/{key}/checkkey"
,
"/ibiz-repo/{system}/{entity}/{key}/checkkey"
})
@RequestMapping
(
method
=
{
RequestMethod
.
GET
},
value
=
{
"/{entity}/checkkey"
,
"/{entity}/{key}/checkkey"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestParam
Map
map
)
{
BaseData
baseData
=
new
BaseData
().
setAll
(
map
);
if
(
baseData
.
size
()==
0
)
{
if
(
StringUtils
.
isEmpty
(
key
))
throw
new
BadRequestAlertException
(
"未找到要检查的键值信息"
,
entity
,
null
);
}
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dataService
.
checkKey
(
system
,
scope
,
entity
,
datasource
,
baseData
.
setKey
(
key
)));
BaseData
baseData
=
BaseData
.
fromContext
(
map
);
return
doCheckKey
(
system
,
scope
,
entity
,
datasource
,
key
,
baseData
);
}
@ApiOperation
(
value
=
"检查数据"
,
tags
=
{
"数据"
},
notes
=
"检查数据"
)
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
{
"/ibiz-repository/{system}/{scope}/{entity}/checkkey"
,
"/ibiz-repo/{system}/{entity}/checkkey"
,
"/ibiz-repository/{system}/{scope}/{entity}/{key}/checkkey"
,
"/ibiz-repo/{system}/{entity}/{key}/checkkey"
})
public
ResponseEntity
<
Boolean
>
checkKeyPost
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
{
"/{entity}/checkkey"
,
"/{entity}/{key}/checkkey"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestBody
(
required
=
false
)
BaseData
baseData
)
{
...
...
@@ -240,21 +217,19 @@ public class DataResource
@ApiOperation
(
value
=
"获取数据草稿"
,
tags
=
{
"数据"
},
notes
=
"获取数据草稿"
)
@RequestMapping
(
method
=
{
RequestMethod
.
GET
},
value
=
{
"/ibiz-repository/{system}/{scope}/{entity}/getdraft"
,
"/ibiz-repo/{system}/{entity}/getdraft"
,
"/ibiz-repository/{system}/{scope}/{entity}/{key}/getdraft"
,
"/ibiz-repo/{system}/{entity}/{key}/getdraft"
})
@RequestMapping
(
method
=
{
RequestMethod
.
GET
},
value
=
{
"/{entity}/getdraft"
,
"/{entity}/{key}/getdraft"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestParam
Map
map
)
{
BaseData
baseData
=
new
BaseData
().
setAll
(
map
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dataService
.
getDraft
(
system
,
scope
,
entity
,
datasource
,
baseData
.
setKey
(
key
))
);
BaseData
baseData
=
BaseData
.
fromContext
(
map
);
return
doGetDraft
(
system
,
scope
,
entity
,
datasource
,
key
,
baseData
);
}
@ApiOperation
(
value
=
"获取数据草稿"
,
tags
=
{
"数据"
},
notes
=
"获取数据草稿"
)
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
{
"/ibiz-repository/{system}/{scope}/{entity}/getdraft"
,
"/ibiz-repo/{system}/{entity}/getdraft"
,
"/ibiz-repository/{system}/{scope}/{entity}/{key}/getdraft"
,
"/ibiz-repo/{system}/{entity}/{key}/getdraft"
})
public
ResponseEntity
<
BaseData
>
getDraftPost
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
{
"/{entity}/getdraft"
,
"/{entity}/{key}/getdraft"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
,
@RequestBody
(
required
=
false
)
BaseData
baseData
)
{
...
...
@@ -263,8 +238,7 @@ public class DataResource
}
@ApiOperation
(
value
=
"保存数据"
,
tags
=
{
"数据"
},
notes
=
"保存数据,自动判断插入和更新"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/ibiz-repository/{system}/{scope}/{entity}/save"
,
"/ibiz-repo/{system}/{entity}/save"
,
"/ibiz-repository/{system}/{scope}/{entity}/{key}/save"
,
"/ibiz-repo/{system}/{entity}/{key}/save"
})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/save"
,
"/{entity}/{key}/save"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
...
...
@@ -274,7 +248,7 @@ public class DataResource
}
@ApiOperation
(
value
=
"批量保存数据"
,
tags
=
{
"数据"
},
notes
=
"批量保存数据,自动判断插入和更新"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/
ibiz-repository/{system}/{scope}/{entity}/savebatch"
,
"/ibiz-repo/{system}/
{entity}/savebatch"
})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
{
"/{entity}/savebatch"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@RequestBody
List
<
BaseData
>
baseDatas
)
{
...
...
@@ -283,37 +257,22 @@ public class DataResource
}
@ApiOperation
(
value
=
"获取数据集"
,
tags
=
{
"数据"
}
,
notes
=
"获取数据集,GET,返回body<list>+header<page,total>"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
={
"/
ibiz-repository/{system}/{scope}/{entity}/fetch{dataset}"
,
"/ibiz-repo/{system}/
{entity}/fetch{dataset}"
})
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
={
"/{entity}/fetch{dataset}"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataset"
,
required
=
true
)
String
dataset
,
@RequestParam
Map
map
)
{
FilterData
context
=
new
FilterData
().
setAll
(
map
);
if
(
context
.
needPage
())
{
Page
<
BaseData
>
baseDatas
=
dataService
.
fetch
(
system
,
scope
,
entity
,
context
.
getDataSource
(),
dataset
,
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
.
fetch
(
system
,
scope
,
entity
,
datasource
,
dataset
,
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
);
}
FilterData
context
=
FilterData
.
fromContext
(
map
);
return
doFetch
(
system
,
scope
,
entity
,
datasource
,
dataset
,
context
);
}
@ApiOperation
(
value
=
"获取数据集"
,
tags
=
{
"数据"
}
,
notes
=
"获取数据集,POST,返回body<list>+header<page,total>"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
={
"/
ibiz-repository/{system}/{scope}/{entity}/fetch{dataset}"
,
"/ibiz-repo/{system}
/{entity}/fetch{dataset}"
})
public
ResponseEntity
<
List
<
BaseData
>>
fetchPost
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
={
"/
{entity}/fetch{dataset}"
,
"
/{entity}/fetch{dataset}"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataset"
,
required
=
true
)
String
dataset
,
@RequestBody
FilterData
context
)
{
@RequestBody
(
required
=
false
)
FilterData
context
)
{
if
(
context
==
null
)
context
=
new
FilterData
();
if
(
context
.
needPage
())
{
Page
<
BaseData
>
baseDatas
=
dataService
.
fetch
(
system
,
scope
,
entity
,
datasource
,
dataset
,
context
,
context
.
getPageable
());
List
<
BaseData
>
list
=
baseDatas
.
getContent
();
...
...
@@ -334,11 +293,12 @@ public class DataResource
}
@ApiOperation
(
value
=
"获取数据集"
,
tags
=
{
"数据"
}
,
notes
=
"获取数据集,POST,返回body<page,total,list>"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
={
"/
ibiz-repository/{system}/{scope}/{entity}/search{dataset}"
,
"/ibiz-repo/{system}
/{entity}/search{dataset}"
})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
={
"/
{entity}/search{dataset}"
,
"
/{entity}/search{dataset}"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataset"
,
required
=
true
)
String
dataset
,
@RequestBody
FilterData
context
)
{
@RequestBody
(
required
=
false
)
FilterData
context
)
{
if
(
context
==
null
)
context
=
new
FilterData
();
Page
<
BaseData
>
baseDatas
=
dataService
.
fetch
(
system
,
scope
,
entity
,
datasource
,
dataset
,
context
,
context
.
getPageable
())
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
body
(
new
PageImpl
(
baseDatas
.
getContent
(),
context
.
getPageable
(),
baseDatas
.
getTotalElements
()));
...
...
@@ -347,37 +307,22 @@ public class DataResource
@ApiOperation
(
value
=
"查询数据"
,
tags
=
{
"数据"
}
,
notes
=
"查询数据,GET,返回body<list>+header<page,total>"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
={
"/
ibiz-repository/{system}/{scope}/{entity}/query{dataquery}"
,
"/ibiz-repo/{system}
/{entity}/query{dataquery}"
})
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
={
"/
{entity}/query{dataquery}"
,
"
/{entity}/query{dataquery}"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataquery"
,
required
=
true
)
String
dataquery
,
@RequestParam
Map
map
)
{
FilterData
context
=
new
FilterData
().
setAll
(
map
);
if
(
context
.
needPage
())
{
Page
<
BaseData
>
baseDatas
=
dataService
.
fetch
(
system
,
scope
,
entity
,
context
.
getDataSource
(),
dataquery
,
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
.
query
(
system
,
scope
,
entity
,
datasource
,
dataquery
,
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
);
}
FilterData
context
=
FilterData
.
fromContext
(
map
);
return
doQuery
(
system
,
scope
,
entity
,
datasource
,
dataquery
,
context
);
}
@ApiOperation
(
value
=
"查询数据"
,
tags
=
{
"数据"
}
,
notes
=
"查询数据,POST,返回body<list>+header<page,total>"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
={
"/
ibiz-repository/{system}/{scope}/{entity}/query{dataquery}"
,
"/ibiz-repo/{system}
/{entity}/query{dataquery}"
})
public
ResponseEntity
<
List
<
BaseData
>>
queryPost
(
@PathVariable
(
name
=
"system"
,
required
=
true
)
String
system
,
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
={
"/
{entity}/query{dataquery}"
,
"
/{entity}/query{dataquery}"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataquery"
,
required
=
true
)
String
dataquery
,
@RequestBody
FilterData
context
)
{
@RequestBody
(
required
=
false
)
FilterData
context
)
{
if
(
context
==
null
)
context
=
new
FilterData
();
if
(
context
.
needPage
())
{
Page
<
BaseData
>
baseDatas
=
dataService
.
query
(
system
,
scope
,
entity
,
datasource
,
dataquery
,
context
,
context
.
getPageable
())
;
List
<
BaseData
>
list
=
baseDatas
.
getContent
();
...
...
@@ -398,11 +343,12 @@ public class DataResource
}
@ApiOperation
(
value
=
"查询数据"
,
tags
=
{
"数据"
}
,
notes
=
"查询数据,POST,返回body<page,total,list>"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
={
"/
ibiz-repository/{system}/{scope}/{entity}/page{dataquery}"
,
"/ibiz-repo/{system}
/{entity}/page{dataquery}"
})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
={
"/
{entity}/page{dataquery}"
,
"
/{entity}/page{dataquery}"
})
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
,
@RequestParam
(
name
=
"datasource"
,
required
=
false
)
String
datasource
,
@PathVariable
(
name
=
"dataquery"
,
required
=
true
)
String
dataquery
,
@RequestBody
FilterData
context
)
{
@RequestBody
(
required
=
false
)
FilterData
context
)
{
if
(
context
==
null
)
context
=
new
FilterData
();
Page
<
BaseData
>
baseDatas
=
dataService
.
fetch
(
system
,
scope
,
entity
,
datasource
,
dataquery
,
context
,
context
.
getPageable
())
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
body
(
new
PageImpl
(
baseDatas
.
getContent
(),
context
.
getPageable
(),
baseDatas
.
getTotalElements
()));
...
...
ibzdata-core/src/main/java/cn/ibizlab/core/data/service/ModelService.java
浏览文件 @
294a10fa
...
...
@@ -165,8 +165,29 @@ public class ModelService {
String
entityName
=
file
.
getName
().
replace
(
".json"
,
""
);
String
id
=
system
.
concat
(
".domain."
).
concat
(
entityName
);
if
(!
entities
.
containsKey
(
entityName
.
toLowerCase
()))
entities
.
put
(
entityName
.
toLowerCase
(),
id
);
if
(!
entities
.
containsKey
(
entityName
.
toLowerCase
()))
{
entities
.
put
(
entityName
.
toLowerCase
(),
id
);
try
{
PojoSchema
pojoSchema
=
PojoSchema
.
fromPath
(
file
.
toPath
());
entityName
=
pojoSchema
.
getName
();
if
((
StringUtils
.
isEmpty
(
entityName
))&&(!
entities
.
containsKey
(
pojoSchema
.
getName
())))
{
entities
.
put
(
pojoSchema
.
getName
(),
id
);
}
String
codeName
=
pojoSchema
.
getCodeName
();
if
((
StringUtils
.
isEmpty
(
codeName
))&&(!
entities
.
containsKey
(
codeName
)))
{
entities
.
put
(
codeName
,
id
);
if
(!
codeName
.
equals
(
codeName
.
toLowerCase
()))
entities
.
put
(
codeName
.
toLowerCase
(),
id
);
String
pluralize
=
Inflector
.
getInstance
().
pluralize
(
codeName
).
toLowerCase
();
if
(!
entities
.
containsKey
(
pluralize
))
{
entities
.
put
(
pluralize
,
id
);
}
}
}
catch
(
Exception
ex
){}
}
}
}
...
...
ibzdata-core/src/main/java/cn/ibizlab/core/data/service/impl/DbDataServiceImpl.java
浏览文件 @
294a10fa
...
...
@@ -240,7 +240,7 @@ public class DbDataServiceImpl implements IDataService {
@Override
public
BaseData
getDraft
(
DOModel
model
,
String
scope
,
String
datasource
,
BaseData
et
)
{
return
null
;
return
et
;
}
@Override
...
...
ibzdata-core/src/main/java/cn/ibizlab/core/util/config/FilterDataResolver.java
已删除
100644 → 0
浏览文件 @
d43bc8ba
package
cn
.
ibizlab
.
core
.
util
.
config
;
import
cn.ibizlab.core.data.dto.BaseData
;
import
cn.ibizlab.core.data.dto.FilterData
;
import
cn.ibizlab.core.data.filter.SearchContextBase
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.web.bind.support.WebDataBinderFactory
;
import
org.springframework.web.context.request.NativeWebRequest
;
import
org.springframework.web.method.support.HandlerMethodArgumentResolver
;
import
org.springframework.web.method.support.ModelAndViewContainer
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
@Slf4j
@Configuration
public
class
FilterDataResolver
implements
HandlerMethodArgumentResolver
{
@Value
(
"${ibiz.pageLimit:1000}"
)
private
int
pageLimit
=
1000
;
private
static
ObjectMapper
objectMapper
=
new
ObjectMapper
();
@Override
public
boolean
supportsParameter
(
MethodParameter
parameter
)
{
Class
<?>
type
=
parameter
.
getParameterType
();
return
SearchContextBase
.
class
==
type
||
FilterData
.
class
==
type
||
BaseData
.
class
==
type
;
}
@Override
public
Object
resolveArgument
(
MethodParameter
parameter
,
ModelAndViewContainer
mavContainer
,
NativeWebRequest
webRequest
,
WebDataBinderFactory
binderFactory
)
throws
Exception
{
Map
<
String
,
String
[]>
params
=
webRequest
.
getParameterMap
();
LinkedHashMap
<
String
,
Object
>
set
=
new
LinkedHashMap
<>();
for
(
String
key
:
params
.
keySet
())
{
set
.
put
(
key
,
params
.
get
(
key
)[
0
]);
}
if
(
SearchContextBase
.
class
.
isAssignableFrom
(
parameter
.
getParameterType
())
&&
(!
set
.
containsKey
(
"size"
))){
set
.
put
(
"size"
,
pageLimit
);
}
if
(
FilterData
.
class
.
isAssignableFrom
(
parameter
.
getParameterType
())
&&
(!
set
.
containsKey
(
"size"
))){
set
.
put
(
"size"
,
pageLimit
);
}
String
json
=
objectMapper
.
writeValueAsString
(
set
);
return
objectMapper
.
readValue
(
json
,
parameter
.
getParameterType
());
}
}
\ No newline at end of file
ibzdata-core/src/main/resources/mapper/data/DbData/DbDataMapper.xml
浏览文件 @
294a10fa
...
...
@@ -32,7 +32,7 @@
select t1.* from
<choose>
<when
test=
"schema.defaultQueryScript!=null"
>
( ${schema.defaultQueryScript.
body
} ) t1 where
( ${schema.defaultQueryScript.
sql
} ) t1 where
</when>
<otherwise>
${schema.name} t1 where
...
...
@@ -50,7 +50,7 @@
select t1.* from
<choose>
<when
test=
"schema.defaultQueryScript!=null"
>
( ${schema.defaultQueryScript.
body
} ) t1 where
( ${schema.defaultQueryScript.
sql
} ) t1 where
</when>
<otherwise>
${schema.name} t1 where
...
...
@@ -74,7 +74,7 @@
select t1.* from
<choose>
<when
test=
"schema.defaultQueryScript!=null"
>
( ${schema.defaultQueryScript.
body
} ) t1 where
( ${schema.defaultQueryScript.
sql
} ) t1 where
</when>
<otherwise>
${schema.name} t1 where
...
...
ibzdata-util/src/main/java/cn/ibizlab/util/rest/AppController.java
浏览文件 @
294a10fa
...
...
@@ -29,7 +29,7 @@ public class AppController {
@Autowired
private
AuthenticationUserService
userDetailsService
;
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/appdata"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
{
"/ibiz-repository/{system}/{scope}/appdata"
,
"/ibiz-repo/{system}/appdata"
,
"/appdata"
}
)
public
ResponseEntity
<
JSONObject
>
getAppData
()
{
JSONObject
appData
=
new
JSONObject
()
;
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录