Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzlite
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzlite
提交
081bcf8d
提交
081bcf8d
编写于
9月 15, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
zhouweidong 发布系统代码
上级
919c8a3f
变更
5
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
440 行增加
和
2 行删除
+440
-2
h2_table.xml
ibzlite-core/src/main/resources/liquibase/h2_table.xml
+2
-2
MetaEntityDTO.java
...r-api/src/main/java/cn/ibizlab/api/dto/MetaEntityDTO.java
+163
-0
MetaEntityMapping.java
...c/main/java/cn/ibizlab/api/mapping/MetaEntityMapping.java
+16
-0
MetaEntityResource.java
...src/main/java/cn/ibizlab/api/rest/MetaEntityResource.java
+160
-0
SwaggerConfiguration.java
...rc/main/java/cn/ibizlab/swagger/SwaggerConfiguration.java
+99
-0
未找到文件。
ibzlite-core/src/main/resources/liquibase/h2_table.xml
浏览文件 @
081bcf8d
...
@@ -156,7 +156,7 @@
...
@@ -156,7 +156,7 @@
<!--输出实体[META_ENTITY]数据结构 -->
<!--输出实体[META_ENTITY]数据结构 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-meta_entity-3
0
-8"
>
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-meta_entity-3
3
-8"
>
<createTable
tableName=
"IBZENTITY"
>
<createTable
tableName=
"IBZENTITY"
>
<column
name=
"ENTITYID"
remarks=
""
type=
"VARCHAR(100)"
>
<column
name=
"ENTITYID"
remarks=
""
type=
"VARCHAR(100)"
>
<constraints
primaryKey=
"true"
primaryKeyName=
"PK_META_ENTITY_ENTITYID"
/>
<constraints
primaryKey=
"true"
primaryKeyName=
"PK_META_ENTITY_ENTITYID"
/>
...
@@ -292,7 +292,7 @@
...
@@ -292,7 +292,7 @@
<!--输出实体[DST_VIEW]外键关系 -->
<!--输出实体[DST_VIEW]外键关系 -->
<!--输出实体[META_DATASET]外键关系 -->
<!--输出实体[META_DATASET]外键关系 -->
<!--输出实体[META_ENTITY]外键关系 -->
<!--输出实体[META_ENTITY]外键关系 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"fk-meta_entity-3
0
-13"
>
<changeSet
author=
"a_A_5d9d78509"
id=
"fk-meta_entity-3
3
-13"
>
<addForeignKeyConstraint
baseColumnNames=
"DSID"
baseTableName=
"IBZENTITY"
constraintName=
"DER1N_META_ENTITY_DST_DATASOUR"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"DSID"
referencedTableName=
"IBZDATASOURCE"
validate=
"true"
/>
<addForeignKeyConstraint
baseColumnNames=
"DSID"
baseTableName=
"IBZENTITY"
constraintName=
"DER1N_META_ENTITY_DST_DATASOUR"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"DSID"
referencedTableName=
"IBZDATASOURCE"
validate=
"true"
/>
</changeSet>
</changeSet>
<!--输出实体[META_FIELD]外键关系 -->
<!--输出实体[META_FIELD]外键关系 -->
...
...
ibzlite-provider/ibzlite-provider-api/src/main/java/cn/ibizlab/api/dto/MetaEntityDTO.java
0 → 100644
浏览文件 @
081bcf8d
package
cn
.
ibizlab
.
api
.
dto
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.math.BigInteger
;
import
java.util.Map
;
import
java.util.HashMap
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Size
;
import
cn.ibizlab.util.domain.DTOBase
;
import
cn.ibizlab.util.domain.DTOClient
;
import
lombok.Data
;
/**
* 服务DTO对象[MetaEntityDTO]
*/
@Data
public
class
MetaEntityDTO
extends
DTOBase
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 属性 [ENTITYID]
*
*/
@JSONField
(
name
=
"entity_id"
)
@JsonProperty
(
"entity_id"
)
@Size
(
min
=
0
,
max
=
100
,
message
=
"内容长度必须小于等于[100]"
)
private
String
entityId
;
/**
* 属性 [ENTITYNAME]
*
*/
@JSONField
(
name
=
"entity_name"
)
@JsonProperty
(
"entity_name"
)
@Size
(
min
=
0
,
max
=
100
,
message
=
"内容长度必须小于等于[100]"
)
private
String
entityName
;
/**
* 属性 [LOGICNAME]
*
*/
@JSONField
(
name
=
"logic_name"
)
@JsonProperty
(
"logic_name"
)
@Size
(
min
=
0
,
max
=
100
,
message
=
"内容长度必须小于等于[100]"
)
private
String
logicName
;
/**
* 属性 [CODENAME]
*
*/
@JSONField
(
name
=
"code_name"
)
@JsonProperty
(
"code_name"
)
@Size
(
min
=
0
,
max
=
100
,
message
=
"内容长度必须小于等于[100]"
)
private
String
codeName
;
/**
* 属性 [TABLENAME]
*
*/
@JSONField
(
name
=
"table_name"
)
@JsonProperty
(
"table_name"
)
@Size
(
min
=
0
,
max
=
100
,
message
=
"内容长度必须小于等于[100]"
)
private
String
tableName
;
/**
* 属性 [SYSTEMID]
*
*/
@JSONField
(
name
=
"system_id"
)
@JsonProperty
(
"system_id"
)
@Size
(
min
=
0
,
max
=
100
,
message
=
"内容长度必须小于等于[100]"
)
private
String
systemId
;
/**
* 属性 [SYSTEMNAME]
*
*/
@JSONField
(
name
=
"system_name"
)
@JsonProperty
(
"system_name"
)
@Size
(
min
=
0
,
max
=
100
,
message
=
"内容长度必须小于等于[100]"
)
private
String
systemName
;
/**
* 属性 [DSID]
*
*/
@JSONField
(
name
=
"ds_id"
)
@JsonProperty
(
"ds_id"
)
@Size
(
min
=
0
,
max
=
100
,
message
=
"内容长度必须小于等于[100]"
)
private
String
dsId
;
/**
* 属性 [DSNAME]
*
*/
@JSONField
(
name
=
"ds_name"
)
@JsonProperty
(
"ds_name"
)
@Size
(
min
=
0
,
max
=
100
,
message
=
"内容长度必须小于等于[100]"
)
private
String
dsName
;
/**
* 设置 [ENTITYNAME]
*/
public
void
setEntityName
(
String
entityName
){
this
.
entityName
=
entityName
;
this
.
modify
(
"entityname"
,
entityName
);
}
/**
* 设置 [LOGICNAME]
*/
public
void
setLogicName
(
String
logicName
){
this
.
logicName
=
logicName
;
this
.
modify
(
"logicname"
,
logicName
);
}
/**
* 设置 [CODENAME]
*/
public
void
setCodeName
(
String
codeName
){
this
.
codeName
=
codeName
;
this
.
modify
(
"codename"
,
codeName
);
}
/**
* 设置 [TABLENAME]
*/
public
void
setTableName
(
String
tableName
){
this
.
tableName
=
tableName
;
this
.
modify
(
"tablename"
,
tableName
);
}
/**
* 设置 [SYSTEMID]
*/
public
void
setSystemId
(
String
systemId
){
this
.
systemId
=
systemId
;
this
.
modify
(
"systemid"
,
systemId
);
}
/**
* 设置 [DSID]
*/
public
void
setDsId
(
String
dsId
){
this
.
dsId
=
dsId
;
this
.
modify
(
"dsid"
,
dsId
);
}
}
ibzlite-provider/ibzlite-provider-api/src/main/java/cn/ibizlab/api/mapping/MetaEntityMapping.java
0 → 100644
浏览文件 @
081bcf8d
package
cn
.
ibizlab
.
api
.
mapping
;
import
org.mapstruct.*
;
import
cn.ibizlab.core.lite.domain.MetaEntity
;
import
cn.ibizlab.api.dto.MetaEntityDTO
;
import
cn.ibizlab.util.domain.MappingBase
;
import
org.mapstruct.factory.Mappers
;
@Mapper
(
componentModel
=
"spring"
,
uses
=
{},
implementationName
=
"apiMetaEntityMapping"
,
nullValuePropertyMappingStrategy
=
NullValuePropertyMappingStrategy
.
IGNORE
,
nullValueCheckStrategy
=
NullValueCheckStrategy
.
ALWAYS
)
public
interface
MetaEntityMapping
extends
MappingBase
<
MetaEntityDTO
,
MetaEntity
>
{
}
ibzlite-provider/ibzlite-provider-api/src/main/java/cn/ibizlab/api/rest/MetaEntityResource.java
0 → 100644
浏览文件 @
081bcf8d
package
cn
.
ibizlab
.
api
.
rest
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.math.BigInteger
;
import
java.util.HashMap
;
import
lombok.extern.slf4j.Slf4j
;
import
com.alibaba.fastjson.JSONObject
;
import
javax.servlet.ServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cglib.beans.BeanCopier
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.util.StringUtils
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PostAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
cn.ibizlab.api.dto.*
;
import
cn.ibizlab.api.mapping.*
;
import
cn.ibizlab.core.lite.domain.MetaEntity
;
import
cn.ibizlab.core.lite.service.IMetaEntityService
;
import
cn.ibizlab.core.lite.filter.MetaEntitySearchContext
;
import
cn.ibizlab.util.annotation.VersionCheck
;
@Slf4j
@Api
(
tags
=
{
"实体"
})
@RestController
(
"api-metaentity"
)
@RequestMapping
(
""
)
public
class
MetaEntityResource
{
@Autowired
public
IMetaEntityService
metaentityService
;
@Autowired
@Lazy
public
MetaEntityMapping
metaentityMapping
;
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaEntity-Create-all')"
)
@ApiOperation
(
value
=
"新建实体"
,
tags
=
{
"实体"
},
notes
=
"新建实体"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/metaentities"
)
public
ResponseEntity
<
MetaEntityDTO
>
create
(
@Validated
@RequestBody
MetaEntityDTO
metaentitydto
)
{
MetaEntity
domain
=
metaentityMapping
.
toDomain
(
metaentitydto
);
metaentityService
.
create
(
domain
);
MetaEntityDTO
dto
=
metaentityMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaEntity-Create-all')"
)
@ApiOperation
(
value
=
"批量新建实体"
,
tags
=
{
"实体"
},
notes
=
"批量新建实体"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/metaentities/batch"
)
public
ResponseEntity
<
Boolean
>
createBatch
(
@RequestBody
List
<
MetaEntityDTO
>
metaentitydtos
)
{
metaentityService
.
createBatch
(
metaentityMapping
.
toDomain
(
metaentitydtos
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaEntity-Update-all')"
)
@ApiOperation
(
value
=
"更新实体"
,
tags
=
{
"实体"
},
notes
=
"更新实体"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/metaentities/{metaentity_id}"
)
public
ResponseEntity
<
MetaEntityDTO
>
update
(
@PathVariable
(
"metaentity_id"
)
String
metaentity_id
,
@RequestBody
MetaEntityDTO
metaentitydto
)
{
MetaEntity
domain
=
metaentityMapping
.
toDomain
(
metaentitydto
);
domain
.
setEntityId
(
metaentity_id
);
metaentityService
.
update
(
domain
);
MetaEntityDTO
dto
=
metaentityMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaEntity-Update-all')"
)
@ApiOperation
(
value
=
"批量更新实体"
,
tags
=
{
"实体"
},
notes
=
"批量更新实体"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/metaentities/batch"
)
public
ResponseEntity
<
Boolean
>
updateBatch
(
@RequestBody
List
<
MetaEntityDTO
>
metaentitydtos
)
{
metaentityService
.
updateBatch
(
metaentityMapping
.
toDomain
(
metaentitydtos
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaEntity-Remove-all')"
)
@ApiOperation
(
value
=
"删除实体"
,
tags
=
{
"实体"
},
notes
=
"删除实体"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/metaentities/{metaentity_id}"
)
public
ResponseEntity
<
Boolean
>
remove
(
@PathVariable
(
"metaentity_id"
)
String
metaentity_id
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
metaentityService
.
remove
(
metaentity_id
));
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaEntity-Remove-all')"
)
@ApiOperation
(
value
=
"批量删除实体"
,
tags
=
{
"实体"
},
notes
=
"批量删除实体"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/metaentities/batch"
)
public
ResponseEntity
<
Boolean
>
removeBatch
(
@RequestBody
List
<
String
>
ids
)
{
metaentityService
.
removeBatch
(
ids
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaEntity-Get-all')"
)
@ApiOperation
(
value
=
"获取实体"
,
tags
=
{
"实体"
},
notes
=
"获取实体"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/metaentities/{metaentity_id}"
)
public
ResponseEntity
<
MetaEntityDTO
>
get
(
@PathVariable
(
"metaentity_id"
)
String
metaentity_id
)
{
MetaEntity
domain
=
metaentityService
.
get
(
metaentity_id
);
MetaEntityDTO
dto
=
metaentityMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@ApiOperation
(
value
=
"获取实体草稿"
,
tags
=
{
"实体"
},
notes
=
"获取实体草稿"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/metaentities/getdraft"
)
public
ResponseEntity
<
MetaEntityDTO
>
getDraft
()
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
metaentityMapping
.
toDto
(
metaentityService
.
getDraft
(
new
MetaEntity
())));
}
@ApiOperation
(
value
=
"检查实体"
,
tags
=
{
"实体"
},
notes
=
"检查实体"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/metaentities/checkkey"
)
public
ResponseEntity
<
Boolean
>
checkKey
(
@RequestBody
MetaEntityDTO
metaentitydto
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
metaentityService
.
checkKey
(
metaentityMapping
.
toDomain
(
metaentitydto
)));
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaEntity-Save-all')"
)
@ApiOperation
(
value
=
"保存实体"
,
tags
=
{
"实体"
},
notes
=
"保存实体"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/metaentities/save"
)
public
ResponseEntity
<
Boolean
>
save
(
@RequestBody
MetaEntityDTO
metaentitydto
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
metaentityService
.
save
(
metaentityMapping
.
toDomain
(
metaentitydto
)));
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaEntity-Save-all')"
)
@ApiOperation
(
value
=
"批量保存实体"
,
tags
=
{
"实体"
},
notes
=
"批量保存实体"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/metaentities/savebatch"
)
public
ResponseEntity
<
Boolean
>
saveBatch
(
@RequestBody
List
<
MetaEntityDTO
>
metaentitydtos
)
{
metaentityService
.
saveBatch
(
metaentityMapping
.
toDomain
(
metaentitydtos
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaEntity-searchDefault-all')"
)
@ApiOperation
(
value
=
"获取数据集"
,
tags
=
{
"实体"
}
,
notes
=
"获取数据集"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/metaentities/fetchdefault"
)
public
ResponseEntity
<
List
<
MetaEntityDTO
>>
fetchDefault
(
MetaEntitySearchContext
context
)
{
Page
<
MetaEntity
>
domains
=
metaentityService
.
searchDefault
(
context
)
;
List
<
MetaEntityDTO
>
list
=
metaentityMapping
.
toDto
(
domains
.
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
(
domains
.
getTotalElements
()))
.
body
(
list
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaEntity-searchDefault-all')"
)
@ApiOperation
(
value
=
"查询数据集"
,
tags
=
{
"实体"
}
,
notes
=
"查询数据集"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/metaentities/searchdefault"
)
public
ResponseEntity
<
Page
<
MetaEntityDTO
>>
searchDefault
(
@RequestBody
MetaEntitySearchContext
context
)
{
Page
<
MetaEntity
>
domains
=
metaentityService
.
searchDefault
(
context
)
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
body
(
new
PageImpl
(
metaentityMapping
.
toDto
(
domains
.
getContent
()),
context
.
getPageable
(),
domains
.
getTotalElements
()));
}
}
ibzlite-provider/ibzlite-provider-api/src/main/java/cn/ibizlab/swagger/SwaggerConfiguration.java
0 → 100644
浏览文件 @
081bcf8d
package
cn
.
ibizlab
.
swagger
;
import
cn.ibizlab.util.security.SpringContextHolder
;
import
cn.ibizlab.util.web.IBZOperationParameterReader
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.plugin.core.PluginRegistry
;
import
org.springframework.plugin.core.PluginRegistrySupport
;
import
springfox.documentation.builders.ApiInfoBuilder
;
import
springfox.documentation.builders.PathSelectors
;
import
springfox.documentation.builders.RequestHandlerSelectors
;
import
springfox.documentation.spi.DocumentationType
;
import
springfox.documentation.spi.schema.EnumTypeDeterminer
;
import
springfox.documentation.spi.service.OperationBuilderPlugin
;
import
springfox.documentation.spring.web.plugins.Docket
;
import
springfox.documentation.spring.web.readers.operation.OperationParameterReader
;
import
springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
import
java.lang.reflect.Field
;
import
java.util.ArrayList
;
import
java.util.List
;
@Configuration
@EnableSwagger2
@ConditionalOnExpression
(
"${swagger.enable:false}"
)
public
class
SwaggerConfiguration
{
@Bean
public
Docket
docket
()
{
Docket
docket
=
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
groupName
(
"DEFAULT"
)
.
pathMapping
(
"/"
)
.
apiInfo
(
new
ApiInfoBuilder
()
.
title
(
"DEFAULT"
)
.
build
()
)
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"cn.ibizlab"
))
//.paths(or(regex("/rest/.*")))
.
paths
(
PathSelectors
.
any
())
.
build
()
;
removeDefaultPlugin
();
return
docket
;
}
@Bean
public
Docket
apiDocket
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
groupName
(
"micorservice"
)
.
pathMapping
(
"/"
)
.
apiInfo
(
new
ApiInfoBuilder
()
.
title
(
"micorservice"
)
.
version
(
"1"
)
.
build
()
)
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"cn.ibizlab.api"
))
//.paths(or(regex("/rest/api/.*")))
.
paths
(
PathSelectors
.
any
())
.
build
()
;
}
private
void
removeDefaultPlugin
()
{
// 从spring容器中获取swagger插件注册表
PluginRegistry
<
OperationBuilderPlugin
,
DocumentationType
>
pluginRegistry
=
SpringContextHolder
.
getBean
(
"operationBuilderPluginRegistry"
);
// 插件集合
List
<
OperationBuilderPlugin
>
plugins
=
pluginRegistry
.
getPlugins
();
// 从spring容器中获取需要删除的插件
OperationParameterReader
operationParameterReader
=
SpringContextHolder
.
getBean
(
OperationParameterReader
.
class
);
if
(
operationParameterReader
==
null
)
return
;
// 原plugins集合不能修改,创建新集合,通过反射替换
if
(
pluginRegistry
.
contains
(
operationParameterReader
))
{
List
<
OperationBuilderPlugin
>
plugins_new
=
new
ArrayList
<
OperationBuilderPlugin
>(
plugins
);
plugins_new
.
remove
(
operationParameterReader
);
try
{
Field
field
=
PluginRegistrySupport
.
class
.
getDeclaredField
(
"plugins"
);
field
.
setAccessible
(
true
);
field
.
set
(
pluginRegistry
,
plugins_new
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
@Bean
public
IBZOperationParameterReader
iBZOperationParameterReader
(
ModelAttributeParameterExpander
expander
,
EnumTypeDeterminer
enumTypeDeterminer
){
IBZOperationParameterReader
iBZOperationParameterReader
=
new
IBZOperationParameterReader
(
expander
,
enumTypeDeterminer
)
;
return
iBZOperationParameterReader
;
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录