Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zcq
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
zcq
Commits
f66a5333
提交
f66a5333
authored
8月 05, 2019
作者:
renjiancai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
5941249a
显示空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
156 行增加
和
52 行删除
+156
-52
ResourceTypeEnum.java
...e/src/main/java/com/zrqx/core/enums/ResourceTypeEnum.java
+1
-1
IsExistForm.java
...com/zrqx/core/form/resource/bg/recommend/IsExistForm.java
+0
-4
SaveRecommendForm.java
...qx/core/form/resource/bg/recommend/SaveRecommendForm.java
+0
-4
ArticleLibraryController.java
...g/controller/articlelibrary/ArticleLibraryController.java
+17
-5
EbookController.java
...om/zrqx/resource/bg/controller/ebook/EbookController.java
+20
-8
ImageLibraryController.java
...ce/bg/controller/imagelibrary/ImageLibraryController.java
+22
-6
PdfLibraryController.java
...ce/bg/controller/pdffilelibrary/PdfLibraryController.java
+1
-1
ArticleResourceMapper.java
...ource/bg/mapper/articlelibrary/ArticleResourceMapper.java
+22
-0
EbookResourceMapper.java
...om/zrqx/resource/bg/mapper/ebook/EbookResourceMapper.java
+21
-0
ArticleLibrarySerivceImpl.java
.../bg/service/articlelibrary/ArticleLibrarySerivceImpl.java
+16
-18
EbookResourceService.java
.../zrqx/resource/bg/service/ebook/EbookResourceService.java
+1
-0
EbookResourceServiceImpl.java
...x/resource/bg/service/ebook/EbookResourceServiceImpl.java
+12
-0
EbookServiceImpl.java
.../com/zrqx/resource/bg/service/ebook/EbookServiceImpl.java
+2
-1
Swagger2Config.java
...java/com/zrqx/resource/commons/config/Swagger2Config.java
+20
-4
bootstrap.yml
com.zrqx.resource/src/main/resources/bootstrap.yml
+1
-0
没有找到文件。
com.zrqx.core/src/main/java/com/zrqx/core/enums/ResourceTypeEnum.java
浏览文件 @
f66a5333
...
...
@@ -17,7 +17,7 @@ public enum ResourceTypeEnum {
*/
ARTICLE
(
2
,
"文章"
),
/**
*
文章
*
作者
*/
AUTHOR
(
3
,
"作者"
),
/**
...
...
com.zrqx.core/src/main/java/com/zrqx/core/form/resource/bg/recommend/IsExistForm.java
浏览文件 @
f66a5333
...
...
@@ -9,8 +9,4 @@ public class IsExistForm {
private
String
name
;
@ApiModelProperty
(
value
=
"推荐位代码"
)
private
String
code
;
@ApiModelProperty
(
value
=
"民族 1蒙古族 2侗族 3藏族 4朝鲜族 5土家族 6回族 7满族 8汉族"
,
required
=
true
)
private
Integer
nationsType
;
@ApiModelProperty
(
value
=
"推荐位类型:1公共推荐位 2民族推荐位 3民族主页推荐位"
,
required
=
true
)
private
Integer
recommendType
;
}
com.zrqx.core/src/main/java/com/zrqx/core/form/resource/bg/recommend/SaveRecommendForm.java
浏览文件 @
f66a5333
...
...
@@ -23,8 +23,4 @@ public class SaveRecommendForm {
private
String
descriptions
;
@ApiModelProperty
(
"状态:0禁用,1启用"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"民族 1蒙古族 2侗族 3藏族 4朝鲜族 5土家族 6回族 7满族 8汉族"
)
private
Integer
nationsType
;
@ApiModelProperty
(
value
=
"推荐位类型:1公共推荐位 2民族推荐位 3民族主页推荐位"
)
private
Integer
recommendType
;
}
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/articlelibrary/ArticleLibraryController.java
浏览文件 @
f66a5333
...
...
@@ -170,15 +170,15 @@ public class ArticleLibraryController {
public
CallBack
<
Boolean
>
delete
(
@PathVariable
String
oid
)
{
ArticleLibrary
entity
=
service
.
selectByPrimaryKey
(
oid
);
if
(
entity
.
getBookId
()
!=
null
)
{
throw
new
BusinessValidateException
(
"图书内拆分出来的文章不支持
单独上、下架、
删除操作"
);
throw
new
BusinessValidateException
(
"图书内拆分出来的文章不支持删除操作"
);
}
if
(
entity
.
getStatus
()
==
LibraryStatusEnum
.
STATUS_1
.
getCode
())
{
throw
new
BusinessValidateException
(
"不能删除已上架的资源"
);
}
//这里需要级联删除其他接口关联资源
//----推荐位内容
recommendResourceService
.
delectByResourceIds
(
Arrays
.
asList
(
oid
),
entity
.
getResourceType
());
return
CallBack
.
success
(
service
.
deleteByPrimaryKey
(
oid
)
);
if
(!
service
.
batchDelete
(
Arrays
.
asList
(
oid
)))
{
throw
new
BusinessValidateException
(
"操作失败"
);
}
return
CallBack
.
success
(
true
);
}
@ApiOperation
(
value
=
"批量删除"
,
notes
=
"批量删除"
)
@PostMapping
(
value
=
ResourceRequestPath
.
BATCH
+
ResourceRequestPath
.
DELETE
)
...
...
@@ -186,11 +186,23 @@ public class ArticleLibraryController {
if
(
ids
.
size
()
==
0
)
{
throw
new
ParameterValidateException
(
ResponseCodeEnum
.
MISS_EXCEPTION
.
getCode
(),
"没有选中任何数据,请重新选择"
);
}
Example
example
=
service
.
createExample
();
example
.
createCriteria
().
andIn
(
"id"
,
ids
);
List
<
ArticleLibrary
>
list
=
service
.
selectByExample
(
example
);
for
(
ArticleLibrary
entity
:
list
)
{
if
(
entity
.
getBookId
()
!=
null
){
throw
new
BusinessValidateException
(
"图书内拆分出来的文章不支持删除操作"
);
}
if
(
entity
.
getStatus
()
==
LibraryStatusEnum
.
STATUS_1
.
getCode
())
{
throw
new
BusinessValidateException
(
"不能删除已上架的资源"
);
}
}
if
(!
service
.
batchDelete
(
ids
))
{
throw
new
BusinessValidateException
(
"操作失败"
);
}
return
CallBack
.
success
();
}
@ApiOperation
(
value
=
"查询"
,
notes
=
"根据ID查询"
)
@GetMapping
(
value
=
ResourceRequestPath
.
GET_OID
)
public
CallBack
<
ArticleLibraryOneVO
>
getById
(
@PathVariable
String
oid
)
{
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/ebook/EbookController.java
浏览文件 @
f66a5333
...
...
@@ -5,6 +5,7 @@ import java.util.ArrayList;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -61,6 +62,7 @@ import com.zrqx.resource.bg.service.ebook.EbookService;
import
com.zrqx.resource.bg.service.imagelibrary.ImageLibraryDiyTypeRelationService
;
import
com.zrqx.resource.bg.service.imagelibrary.ImageLibraryService
;
import
com.zrqx.resource.bg.service.pdffilelibrary.PdfLibraryService
;
import
com.zrqx.resource.bg.service.recommend.RecommendResourceService
;
import
com.zrqx.resource.commons.Redis
;
import
io.swagger.annotations.Api
;
...
...
@@ -102,7 +104,9 @@ public class EbookController {
private
ResourceRelationService
resourceRelationService
;
@Autowired
private
ArticleLibraryService
articleLibraryService
;
/** 推荐位内容 */
@Autowired
private
RecommendResourceService
recommendResourceService
;
@ApiOperation
(
"保存/更新电子书"
)
@PostMapping
(
ResourceRequestPath
.
SAVE
)
public
CallBack
<?>
saveBook
(
@RequestBody
SaveUpdateEbookForm
form
)
{
...
...
@@ -223,19 +227,27 @@ public class EbookController {
@ApiOperation
(
value
=
"批量删除"
,
notes
=
"批量删除"
)
@PostMapping
(
value
=
ResourceRequestPath
.
BATCH_DELETE
)
public
CallBack
<
Boolean
>
delete
(
@RequestBody
List
<
String
>
ids
)
{
if
(!
listDelete
(
ids
,
EbookStatusEnum
.
_6
,
true
,
EbookStatusEnum
.
_4
))
{
// 如果状态是
// 4已上架
// 不能变更为6逻辑删除
throw
new
BusinessValidateException
(
"请先下架,再删除数据。"
);
}
// 文章
// 修改文章状态
// 这里需要级联删除其他接口关联资源
// ----推荐位内容
recommendResourceService
.
delectByResourceIds
(
ids
,
AllResourceTypeEnum
.
TUSHU
.
getCode
());
//
resourceService
.
delectByResourceIds
(
ids
,
AllResourceTypeEnum
.
TUSHU
.
getCode
());
// 删除文章
Example
example
=
alservice
.
createExample
();
example
.
createCriteria
().
andIn
(
"bookId"
,
ids
);
ArticleLibrary
article
=
new
ArticleLibrary
();
article
.
setStatus
(
1
);
alservice
.
UpdateByExampleSelective
(
article
,
example
);
List
<
ArticleLibrary
>
articleList
=
alservice
.
selectByExample
(
example
);
List
<
String
>
articleIds
=
articleList
.
stream
().
map
(
ArticleLibrary
::
getId
).
collect
(
Collectors
.
toList
());
alservice
.
batchDelete
(
articleIds
);
// 删除图片
example
=
ilService
.
createExample
();
example
.
createCriteria
().
andIn
(
"bookId"
,
ids
);
List
<
ImageLibrary
>
imageList
=
ilService
.
selectByExample
(
example
);
List
<
Integer
>
imageIds
=
imageList
.
stream
().
map
(
ImageLibrary
::
getId
).
collect
(
Collectors
.
toList
());
ilService
.
batchDelete
(
imageIds
);
return
CallBack
.
success
();
}
@ApiOperation
(
"查询电子书列表"
)
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/imagelibrary/ImageLibraryController.java
浏览文件 @
f66a5333
...
...
@@ -129,17 +129,33 @@ public class ImageLibraryController {
public
CallBack
<
Boolean
>
delete
(
@PathVariable
Integer
oid
){
ImageLibrary
entity
=
service
.
selectByPrimaryKey
(
oid
);
if
(
entity
.
getBookId
()
!=
null
){
throw
new
BusinessValidateException
(
"图书内拆分出来的文章不支持单独
上、下架、
删除操作"
);
throw
new
BusinessValidateException
(
"图书内拆分出来的文章不支持单独删除操作"
);
}
//还需删除与自定义分类关系
Example
example
=
idrService
.
createExample
();
example
.
createCriteria
().
andIn
(
"ilId"
,
Arrays
.
asList
(
oid
));
idrService
.
deleteByExample
(
example
);
return
CallBack
.
success
(
service
.
deleteByPrimaryKey
(
oid
));
if
(
entity
.
getStatus
()
==
LibraryStatusEnum
.
STATUS_1
.
getCode
())
{
throw
new
BusinessValidateException
(
"不能删除已上架的资源"
);
}
if
(!
service
.
batchDelete
(
Arrays
.
asList
(
oid
)))
{
throw
new
BusinessValidateException
(
"操作失败"
);
}
return
CallBack
.
success
(
true
);
}
@ApiOperation
(
value
=
"批量删除"
,
notes
=
"批量删除"
)
@PostMapping
(
value
=
ResourceRequestPath
.
BATCH_DELETE
)
public
CallBack
<
Boolean
>
deleteByIds
(
@RequestBody
List
<
Integer
>
ids
)
{
if
(
ids
.
size
()
==
0
)
{
throw
new
ParameterValidateException
(
ResponseCodeEnum
.
MISS_EXCEPTION
.
getCode
(),
"没有选中任何数据,请重新选择"
);
}
Example
example
=
service
.
createExample
();
example
.
createCriteria
().
andIn
(
"id"
,
ids
);
List
<
ImageLibrary
>
list
=
service
.
selectByExample
(
example
);
for
(
ImageLibrary
entity
:
list
)
{
if
(
entity
.
getBookId
()
!=
null
){
throw
new
BusinessValidateException
(
"图书内拆分出来的图片不支持单独删除操作"
);
}
if
(
entity
.
getStatus
()
==
LibraryStatusEnum
.
STATUS_1
.
getCode
())
{
throw
new
BusinessValidateException
(
"不能删除已上架的资源"
);
}
}
return
CallBack
.
success
(
service
.
batchDelete
(
ids
));
}
@ApiOperation
(
value
=
"查询"
,
notes
=
"根据ID查询"
)
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/pdffilelibrary/PdfLibraryController.java
浏览文件 @
f66a5333
...
...
@@ -125,7 +125,7 @@ public class PdfLibraryController {
}
@ApiOperation
(
value
=
"查询"
,
notes
=
"根据ID查询"
)
@GetMapping
(
value
=
ResourceRequestPath
.
GET_OID
)
public
CallBack
<
PdfLibraryOneVO
>
getById
(
@PathVariable
Integer
oid
)
{
public
CallBack
<
PdfLibraryOneVO
>
getById
(
@PathVariable
String
oid
)
{
PdfLibrary
entity
=
service
.
selectByPrimaryKey
(
oid
);
PdfLibraryOneVO
vo
=
new
PdfLibraryOneVO
();
BeanUtils
.
copyProperties
(
entity
,
vo
);
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/mapper/articlelibrary/ArticleResourceMapper.java
浏览文件 @
f66a5333
...
...
@@ -2,6 +2,7 @@ package com.zrqx.resource.bg.mapper.articlelibrary;
import
java.util.List
;
import
org.apache.ibatis.annotations.Delete
;
import
org.apache.ibatis.annotations.Select
;
import
com.zrqx.core.form.resource.bg.QueryResourceRelationForm
;
...
...
@@ -29,4 +30,25 @@ public interface ArticleResourceMapper extends BaseMapper<ArticleResource> {
+
"where objectId = #{objectId} and resourceId = #{resourceId}"
+
"</script>"
)
List
<
ArticleResource
>
queryByid
(
@Param
(
"objectId"
)
String
objectId
,
@Param
(
"resourceId"
)
String
resourceId
);
@Delete
(
"<script>"
+
"delete from res_article_resource "
+
"where 1 = 1 "
+
"<if test='type != null' >"
+
"and resourceType = #{type} "
+
"</if>"
+
"<if test='ids != null and ids.size > 0'>"
+
"and resourceId in "
+
" <foreach collection=\"ids\" index=\"index\" item=\"id\" open=\"(\" separator=\",\" close=\")\">"
+
"#{id}"
+
"</foreach>"
+
"</if>"
+
"<if test='ids != null and ids.size > 0'>"
+
"or ( articleId in "
+
" <foreach collection=\"ids\" index=\"index\" item=\"id\" open=\"(\" separator=\",\" close=\"))\">"
+
"#{id}"
+
"</foreach>"
+
"</if>"
+
"</script>"
)
boolean
delectByResourceIds
(
@Param
(
"ids"
)
List
<
String
>
ids
,
@Param
(
"type"
)
Integer
type
);
}
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/mapper/ebook/EbookResourceMapper.java
浏览文件 @
f66a5333
...
...
@@ -2,6 +2,7 @@ package com.zrqx.resource.bg.mapper.ebook;
import
java.util.List
;
import
org.apache.ibatis.annotations.Delete
;
import
org.apache.ibatis.annotations.Select
;
import
com.zrqx.core.form.resource.bg.QueryResourceRelationForm
;
...
...
@@ -30,4 +31,24 @@ public interface EbookResourceMapper extends BaseMapper<EbookResource> {
+
"where objectId = #{objectId} and resourceId = #{resourceId}"
+
"</script>"
)
List
<
EbookResource
>
queryByid
(
@Param
(
"objectId"
)
String
objectId
,
@Param
(
"resourceId"
)
String
resourceId
);
@Delete
(
"<script>"
+
"delete from res_ebook_resource "
+
"where 1 = 1 "
+
"<if test='type != null' >"
+
"and resourceType = #{type} "
+
"</if>"
+
"<if test='ids != null and ids.size > 0'>"
+
"and resourceId in "
+
" <foreach collection=\"ids\" index=\"index\" item=\"id\" open=\"(\" separator=\",\" close=\")\">"
+
"#{id}"
+
"</foreach>"
+
"</if>"
+
"<if test='ids != null and ids.size > 0'>"
+
"or ( ebookId in "
+
" <foreach collection=\"ids\" index=\"index\" item=\"id\" open=\"(\" separator=\",\" close=\"))\">"
+
"#{id}"
+
"</foreach>"
+
"</if>"
+
"</script>"
)
boolean
delectByResourceIds
(
@Param
(
"ids"
)
List
<
String
>
ids
,
@Param
(
"type"
)
Integer
type
);
}
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/service/articlelibrary/ArticleLibrarySerivceImpl.java
浏览文件 @
f66a5333
...
...
@@ -9,11 +9,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
com.zrqx.core.enums.ArticleTypeEnum
;
import
com.zrqx.core.enums.AuditStatusEnum
;
import
com.zrqx.core.enums.ResponseCodeEnum
;
import
com.zrqx.core.enums.resource.LibraryStatusEnum
;
import
com.zrqx.core.enums.resource.SalesWayEnum
;
import
com.zrqx.core.exception.BusinessValidateException
;
import
com.zrqx.core.exception.ParameterValidateException
;
import
com.zrqx.core.form.resource.bg.QueryResourceForPoPForm
;
import
com.zrqx.core.form.resource.bg.articlelibrary.QueryArticleLibraryForm
;
...
...
@@ -21,9 +18,7 @@ import com.zrqx.core.form.resource.bg.articlelibrary.SaveUpdateArticleLibraryFor
import
com.zrqx.core.mapper.BaseMapper
;
import
com.zrqx.core.model.resource.articlelibrary.ArticleLibrary
;
import
com.zrqx.core.model.resource.articlelibrary.ArticleLibraryDiyType
;
import
com.zrqx.core.model.resource.audiolibrary.AudioLibrary
;
import
com.zrqx.core.model.resource.pdffilelibrary.PdfLibrary
;
import
com.zrqx.core.model.resource.videolibrary.VideoLibrary
;
import
com.zrqx.core.model.resource.articlelibrary.ArticleLibraryLabelContentDiyType
;
import
com.zrqx.core.service.BaseServiceImpl
;
import
com.zrqx.core.util.page.PageInfo
;
import
com.zrqx.core.util.page.PageParam
;
...
...
@@ -32,8 +27,10 @@ import com.zrqx.core.vo.resource.articlelibrary.ArticleLibraryListVO;
import
com.zrqx.resource.bg.mapper.articlelibrary.ArticleLibraryDiyTypeMapper
;
import
com.zrqx.resource.bg.mapper.articlelibrary.ArticleLibraryLabelContentDiyTypeMapper
;
import
com.zrqx.resource.bg.mapper.articlelibrary.ArticleLibraryMapper
;
import
com.zrqx.resource.bg.mapper.articlelibrary.ArticleResourceMapper
;
import
com.zrqx.resource.bg.mapper.audiolibrary.AudioLibraryMapper
;
import
com.zrqx.resource.bg.mapper.pdffilelibrary.PdfLibraryMapper
;
import
com.zrqx.resource.bg.mapper.recommend.RecommendResourceMapper
;
import
com.zrqx.resource.bg.mapper.videolibrary.VideoLibraryMapper
;
import
tk.mybatis.mapper.entity.Example
;
...
...
@@ -56,6 +53,11 @@ public class ArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,St
private
PdfLibraryMapper
pdfLibraryMapper
;
@Autowired
private
VideoLibraryMapper
videoLibraryMapper
;
@Autowired
private
ArticleResourceMapper
arMapper
;
@Autowired
private
RecommendResourceMapper
recommendResourceMapper
;
@Override
public
BaseMapper
<
ArticleLibrary
>
getMapper
()
{
return
mapper
;
...
...
@@ -105,22 +107,18 @@ public class ArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,St
}
Example
example
=
createExample
();
example
.
createCriteria
().
andIn
(
"id"
,
ids
);
List
<
ArticleLibrary
>
list
=
mapper
.
selectByExample
(
example
);
for
(
ArticleLibrary
entity
:
list
)
{
if
(
entity
.
getBookId
()
!=
null
&&
entity
.
getBookId
()
!=
""
){
throw
new
BusinessValidateException
(
"图书内拆分出来的文章不支持单独上、下架、删除操作"
);
}
if
(
entity
.
getStatus
()
==
LibraryStatusEnum
.
STATUS_1
.
getCode
())
{
throw
new
BusinessValidateException
(
"不能删除已上架的资源"
);
}
//逻辑删除文章
entity
.
setIsDelete
(
2
);
mapper
.
updateByPrimaryKey
(
entity
);
mapper
.
deleteByExample
(
example
);
//还需删除与自定义分类关系
example
=
new
Example
(
ArticleLibraryDiyType
.
class
);
example
.
createCriteria
().
andIn
(
"alId"
,
ids
);
adrMapper
.
deleteByExample
(
example
);
}
//还需删除与标签关系
example
=
new
Example
(
ArticleLibraryLabelContentDiyType
.
class
);
example
.
createCriteria
().
andIn
(
"alId"
,
ids
);
alcdMapper
.
deleteByExample
(
example
);
// 删除推荐位,促销,关联资源
recommendResourceMapper
.
delectByResourceIds
(
ids
,
null
);
arMapper
.
delectByResourceIds
(
ids
,
null
);
return
true
;
}
@Override
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/service/ebook/EbookResourceService.java
浏览文件 @
f66a5333
...
...
@@ -33,4 +33,5 @@ public interface EbookResourceService extends BaseService<EbookResource, Integer
*/
Integer
getMaxOrderNum
();
public
List
<
EbookResource
>
queryByid
(
String
objectId
,
String
resourceId
);
boolean
delectByResourceIds
(
List
<
String
>
ids
,
Integer
type
);
}
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/service/ebook/EbookResourceServiceImpl.java
浏览文件 @
f66a5333
...
...
@@ -7,6 +7,7 @@ import org.springframework.stereotype.Service;
import
com.github.pagehelper.PageHelper
;
import
com.zrqx.core.exception.BaseException
;
import
com.zrqx.core.exception.ParameterValidateException
;
import
com.zrqx.core.form.resource.bg.QueryResourceRelationForm
;
import
com.zrqx.core.mapper.BaseMapper
;
import
com.zrqx.core.model.resource.ebook.EbookResource
;
...
...
@@ -59,4 +60,15 @@ public class EbookResourceServiceImpl extends BaseServiceImpl<EbookResource, Int
return
bookResourceMapper
.
queryByid
(
objectId
,
resourceId
);
}
@Override
public
boolean
delectByResourceIds
(
List
<
String
>
ids
,
Integer
type
)
{
if
(
ids
==
null
||
ids
.
size
()
==
0
){
throw
new
ParameterValidateException
(
1
,
"id不能为空"
);
}
if
(
type
==
null
){
throw
new
ParameterValidateException
(
2
,
"资源类型不能为空"
);
}
return
bookResourceMapper
.
delectByResourceIds
(
ids
,
type
);
}
}
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/service/ebook/EbookServiceImpl.java
浏览文件 @
f66a5333
...
...
@@ -135,7 +135,8 @@ public class EbookServiceImpl extends BaseServiceImpl<Ebook, String> implements
@Override
public
PageInfo
<
EbookListVO
>
page
(
QueryEbookInfoForm
form
,
PageParam
pageParam
)
{
startPage
(
pageParam
);
List
<
EbookListVO
>
list
=
ebookMapper
.
page
(
form
);
List
<
EbookListVO
>
list
=
ebookMapper
.
page
(
form
);
return
new
PageInfo
<
EbookListVO
>(
list
);
}
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/commons/config/Swagger2Config.java
浏览文件 @
f66a5333
package
com
.
zrqx
.
resource
.
commons
.
config
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
springfox.documentation.builders.ApiInfoBuilder
;
import
springfox.documentation.builders.ParameterBuilder
;
import
springfox.documentation.builders.PathSelectors
;
import
springfox.documentation.builders.RequestHandlerSelectors
;
import
springfox.documentation.schema.ModelRef
;
import
springfox.documentation.service.ApiInfo
;
import
springfox.documentation.service.Contact
;
import
springfox.documentation.service.Parameter
;
import
springfox.documentation.spi.DocumentationType
;
import
springfox.documentation.spring.web.plugins.Docket
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
...
...
@@ -44,21 +49,32 @@ public class Swagger2Config {
@Bean
public
Docket
createRestApi
()
{
//添加head参数start
ParameterBuilder
tokenPar
=
new
ParameterBuilder
();
List
<
Parameter
>
pars
=
new
ArrayList
<
Parameter
>();
tokenPar
.
name
(
"y-token"
).
description
(
"y令牌"
).
modelRef
(
new
ModelRef
(
"string"
)).
parameterType
(
"header"
).
required
(
false
).
build
();
pars
.
add
(
tokenPar
.
build
());
tokenPar
.
name
(
"x-token"
).
description
(
"x令牌"
).
modelRef
(
new
ModelRef
(
"string"
)).
parameterType
(
"header"
).
required
(
false
).
build
();
pars
.
add
(
tokenPar
.
build
());
//添加head参数end
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
apiInfo
(
apiInfo
())
.
select
()
//为当前包路径
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.zrqx"
))
.
paths
(
PathSelectors
.
any
())
.
build
();
.
build
()
.
globalOperationParameters
(
pars
);
}
//构建 api文档的详细信息函数
private
ApiInfo
apiInfo
()
{
return
new
ApiInfoBuilder
()
//页面标题
.
title
(
"
resource
测试使用 Swagger2 构建RESTful API"
)
.
title
(
"
sysUser
测试使用 Swagger2 构建RESTful API"
)
//描述
.
description
(
"
resource
服务 API 描述"
)
.
description
(
"
sysUser
服务 API 描述"
)
//创建人
.
contact
(
new
Contact
(
"陈新昌"
,
"www.baidu.com"
,
"cxinchang@126.com"
))
//版本号
...
...
com.zrqx.resource/src/main/resources/bootstrap.yml
浏览文件 @
f66a5333
...
...
@@ -10,3 +10,4 @@ spring:
data
:
solr
:
host
:
http://admin:admin@localhost:8983/solr/zcq
solr-quartz
:
true
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论