Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zcq
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
zcq
Commits
9fc3bcbd
提交
9fc3bcbd
authored
8月 06, 2019
作者:
yucaiwei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
7651e89e
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
239 行增加
和
102 行删除
+239
-102
ResourceStart.java
...source/src/main/java/com/zrqx/resource/ResourceStart.java
+1
-1
ArticleLibraryController.java
...g/controller/articlelibrary/ArticleLibraryController.java
+22
-24
AuthorLibraryController.java
.../bg/controller/authorLibrary/AuthorLibraryController.java
+19
-18
EbookController.java
...om/zrqx/resource/bg/controller/ebook/EbookController.java
+20
-20
ImageLibraryController.java
...ce/bg/controller/imagelibrary/ImageLibraryController.java
+12
-15
ResourceRelationMapper.java
...a/com/zrqx/resource/bg/mapper/ResourceRelationMapper.java
+60
-0
EbookMapper.java
...n/java/com/zrqx/resource/bg/mapper/ebook/EbookMapper.java
+2
-2
ResourceRelationService.java
...com/zrqx/resource/bg/service/ResourceRelationService.java
+27
-1
ResourceRelationServiceImpl.java
...zrqx/resource/bg/service/ResourceRelationServiceImpl.java
+61
-6
ArticleLibrarySerivceImpl.java
.../bg/service/articlelibrary/ArticleLibrarySerivceImpl.java
+7
-5
ArticleResourceServiceImpl.java
...bg/service/articlelibrary/ArticleResourceServiceImpl.java
+4
-1
AuthorResourceServiceImpl.java
...e/bg/service/authorLibrary/AuthorResourceServiceImpl.java
+4
-0
ImageLibrarySerivceImpl.java
...urce/bg/service/imagelibrary/ImageLibrarySerivceImpl.java
+0
-9
没有找到文件。
com.zrqx.resource/src/main/java/com/zrqx/resource/ResourceStart.java
浏览文件 @
9fc3bcbd
...
...
@@ -17,7 +17,7 @@ import tk.mybatis.spring.annotation.MapperScan;
@EnableFeignClients
@EnableEurekaClient
@SpringBootApplication
// 系统会去入口类的同级包以及下级包中去扫描实体类,因此我们建议入口类的位置在groupId+arctifactID组合的包名下。
@MapperScan
(
basePackages
=
{
"com.zrqx.resource.*.mapper.*"
})
@MapperScan
(
basePackages
=
{
"com.zrqx.resource.*.mapper.*"
,
"com.zrqx.resource.*.mapper"
})
public
class
ResourceStart
{
@Value
(
"${spring.datasource.url}"
)
private
String
url
;
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/articlelibrary/ArticleLibraryController.java
浏览文件 @
9fc3bcbd
package
com
.
zrqx
.
resource
.
bg
.
controller
.
articlelibrary
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
...
...
@@ -15,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
tk.mybatis.mapper.entity.Example
;
import
com.zrqx.core.constant.BaseRequestPath
;
import
com.zrqx.core.constant.resource.ResourceRequestPath
;
import
com.zrqx.core.enums.ResponseCodeEnum
;
...
...
@@ -30,9 +35,9 @@ import com.zrqx.core.form.resource.bg.articlelibrary.SaveUpdateArticleLibraryFor
import
com.zrqx.core.form.resource.bg.articlelibrary.UpdateArticleImgForm
;
import
com.zrqx.core.form.resource.bg.audiolibrary.SaveUpdateAudioLibraryForm
;
import
com.zrqx.core.form.resource.bg.ebook.UpdateEbookRelationForm
;
import
com.zrqx.core.form.resource.bg.imagelibrary.SaveUpdateImageLibraryForm
;
import
com.zrqx.core.form.resource.bg.pdffilelibrary.SaveUpdatePdfLibraryForm
;
import
com.zrqx.core.form.resource.bg.videolibrary.SaveUpdateVideoLibraryForm
;
import
com.zrqx.core.model.resource.ResourceRelation
;
import
com.zrqx.core.model.resource.articlelibrary.ArticleLibrary
;
import
com.zrqx.core.model.resource.articlelibrary.ArticleLibraryDiyType
;
import
com.zrqx.core.model.resource.articlelibrary.ArticleResource
;
...
...
@@ -46,16 +51,11 @@ import com.zrqx.resource.bg.service.ResourceRelationService;
import
com.zrqx.resource.bg.service.articlelibrary.ArticleLibraryDiyTypeService
;
import
com.zrqx.resource.bg.service.articlelibrary.ArticleLibraryLabelContentDiyTypeService
;
import
com.zrqx.resource.bg.service.articlelibrary.ArticleLibraryService
;
import
com.zrqx.resource.bg.service.articlelibrary.ArticleResourceService
;
import
com.zrqx.resource.bg.service.audiolibrary.AudioLibraryService
;
import
com.zrqx.resource.bg.service.pdffilelibrary.PdfLibraryService
;
import
com.zrqx.resource.bg.service.recommend.RecommendResourceService
;
import
com.zrqx.resource.bg.service.videolibrary.VideoLibraryService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
tk.mybatis.mapper.entity.Example
;
/**
* 文章库Controller
*/
...
...
@@ -68,8 +68,8 @@ public class ArticleLibraryController {
private
ArticleLibraryService
service
;
@Autowired
private
ArticleLibraryDiyTypeService
adrService
;
@Autowired
private
ArticleResourceService
resourceService
;
//
@Autowired
//
private ArticleResourceService resourceService;
@Autowired
private
ResourceRelationService
resourceRelationService
;
@Autowired
...
...
@@ -241,11 +241,10 @@ public class ArticleLibraryController {
if
(
entity
==
null
||
entity
.
getId
()
==
null
)
{
throw
new
ParameterValidateException
(
ResponseCodeEnum
.
MISS_EXCEPTION
.
getCode
(),
"资源id不能为空!"
);
}
if
(
pageParam
.
getOrderBy
()==
null
)
{
pageParam
.
setOrderBy
(
"sort desc"
);
if
(
entity
.
getResourceType
()
!=
null
&&
entity
.
getResourceType
()
==
0
)
{
entity
.
setResourceType
(
null
);
}
List
<
ResourceRelationVo
>
list
=
resourceService
.
queryByIdAndResourceType
(
entity
,
pageParam
);
List
<
ResourceRelationVo
>
list
=
resourceRelationService
.
queryByIdAndResourceType
(
entity
,
pageParam
);
if
(
list
==
null
||
list
.
size
()
==
0
)
{
return
CallBack
.
success
(
new
PageInfo
<
ResourceRelationVo
>(
list
));
}
...
...
@@ -260,16 +259,16 @@ public class ArticleLibraryController {
throw
new
ParameterValidateException
(
ResponseCodeEnum
.
MISS_EXCEPTION
.
getCode
(),
"必须指定id、被关联的resourceId、资源类型"
);
}
for
(
int
i
=
0
;
i
<
entity
.
getResourceIds
().
size
();
i
++)
{
List
<
ArticleResource
>
list
=
resource
Service
.
queryByid
(
entity
.
getId
(),
entity
.
getResourceIds
().
get
(
i
));
List
<
ResourceRelation
>
list
=
resourceRelation
Service
.
queryByid
(
entity
.
getId
(),
entity
.
getResourceIds
().
get
(
i
));
if
(
list
==
null
||
list
.
size
()==
0
)
{
ArticleResource
e
=
new
ArticleResource
();
ResourceRelation
e
=
new
ResourceRelation
();
e
.
setObjectId
(
entity
.
getId
());
e
.
setResourceId
(
entity
.
getResourceIds
().
get
(
i
));
e
.
setCreateTime
(
new
Date
());
e
.
setResourceType
(
entity
.
getResourceType
());
Integer
maxOrderNum
=
resource
Service
.
getMaxOrderNum
(
);
Integer
maxOrderNum
=
resource
RelationService
.
getMaxOrderNum
(
entity
.
getId
()
);
e
.
setSort
(
maxOrderNum
+
1
);
resourceService
.
insert
(
e
);
resource
Relation
Service
.
insert
(
e
);
}
}
return
CallBack
.
success
();
...
...
@@ -278,11 +277,11 @@ public class ArticleLibraryController {
@PostMapping
(
value
=
BaseRequestPath
.
UPDATE_SORT
)
public
CallBack
<
Boolean
>
updateSort
(
@RequestBody
UpdateEbookRelationForm
form
)
{
if
(
form
.
getId
()
==
null
)
{
throw
new
ParameterValidateException
(
"
分类
不能为空"
);
throw
new
ParameterValidateException
(
"
id
不能为空"
);
}
ArticleResource
resource
=
resource
Service
.
selectByPrimaryKey
(
form
.
getId
());
ResourceRelation
resource
=
resourceRelation
Service
.
selectByPrimaryKey
(
form
.
getId
());
resource
.
setSort
(
form
.
getSort
());
resourceService
.
updateByPrimaryKeySelective
(
resource
);
resource
Relation
Service
.
updateByPrimaryKeySelective
(
resource
);
return
CallBack
.
success
();
}
@ApiOperation
(
value
=
"批量删除关联资源"
,
notes
=
"批量删除"
)
...
...
@@ -291,11 +290,10 @@ public class ArticleLibraryController {
if
(
ids
.
size
()
==
0
)
{
throw
new
BaseException
(-
7
,
"没有选中任何数据,请重新选择"
);
}
Example
example
=
resourceService
.
createExample
();
example
.
createCriteria
().
andIn
(
"id"
,
ids
);
List
<
ArticleResource
>
list
=
resourceService
.
selectByExample
(
example
);
for
(
ArticleResource
entity
:
list
)
{
resourceService
.
deleteByPrimaryKey
(
entity
);
Example
example
=
resourceRelationService
.
createExample
();
example
.
and
().
andIn
(
"id"
,
ids
);
if
(!
resourceRelationService
.
deleteByExample
(
example
))
{
throw
new
BusinessValidateException
(
"操作失败"
);
}
return
CallBack
.
success
();
}
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/authorLibrary/AuthorLibraryController.java
浏览文件 @
9fc3bcbd
...
...
@@ -32,6 +32,8 @@ import tk.mybatis.mapper.entity.Example.Criteria;
import
com.github.pagehelper.PageHelper
;
import
com.zrqx.core.constant.BaseRequestPath
;
import
com.zrqx.core.constant.resource.ResourceRequestPath
;
import
com.zrqx.core.enums.AllResourceTypeEnum
;
import
com.zrqx.core.enums.ResourceTypeEnum
;
import
com.zrqx.core.enums.ResponseCodeEnum
;
import
com.zrqx.core.enums.resource.LibraryStatusEnum
;
import
com.zrqx.core.enums.resource.author.DepartmentTypeEnum
;
...
...
@@ -40,18 +42,15 @@ import com.zrqx.core.enums.resource.author.TitleTypeEnum;
import
com.zrqx.core.exception.BaseException
;
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.QueryResourceRelationForm
;
import
com.zrqx.core.form.resource.bg.SaveResourceRelationForm
;
import
com.zrqx.core.form.resource.bg.articlelibrary.BatchUpdateArticleLibraryForm
;
import
com.zrqx.core.form.resource.bg.authorLibrary.QueryAuthorLibraryForm
;
import
com.zrqx.core.form.resource.bg.authorLibrary.SaveUpdateAuthorForm
;
import
com.zrqx.core.form.resource.bg.ebook.UpdateEbookRelationForm
;
import
com.zrqx.core.form.sysuser.bg.member.StatusForm
;
import
com.zrqx.core.model.resource.
articlelibrary.ArticleLibrary
;
import
com.zrqx.core.model.resource.
ResourceRelation
;
import
com.zrqx.core.model.resource.authorLibrary.AuthorLibrary
;
import
com.zrqx.core.model.resource.authorLibrary.AuthorLibraryDiytype
;
import
com.zrqx.core.model.resource.authorLibrary.AuthorResource
;
import
com.zrqx.core.util.page.PageInfo
;
import
com.zrqx.core.util.page.PageParam
;
import
com.zrqx.core.util.response.CallBack
;
...
...
@@ -193,7 +192,10 @@ public class AuthorLibraryController {
example
.
createCriteria
().
andIn
(
"id"
,
Arrays
.
asList
(
id
));
AuthorLibrary
author
=
new
AuthorLibrary
();
author
.
setIsDelete
(
2
);
return
CallBack
.
success
(
authorLibraryService
.
UpdateByExampleSelective
(
author
,
example
));
authorLibraryService
.
UpdateByExampleSelective
(
author
,
example
);
//----推荐位内容
recommendResourceService
.
delectByResourceIds
(
Arrays
.
asList
(
id
),
ResourceTypeEnum
.
AUTHOR
.
getCode
());
return
CallBack
.
success
(
true
);
}
...
...
@@ -214,7 +216,7 @@ public class AuthorLibraryController {
if
(
pageParam
.
getOrderBy
()==
null
)
{
pageParam
.
setOrderBy
(
"sort desc"
);
}
List
<
ResourceRelationVo
>
list
=
resourceService
.
queryByIdAndResourceType
(
entity
,
pageParam
);
List
<
ResourceRelationVo
>
list
=
resource
Relation
Service
.
queryByIdAndResourceType
(
entity
,
pageParam
);
if
(
list
==
null
||
list
.
size
()
==
0
)
{
return
CallBack
.
success
(
new
PageInfo
<
ResourceRelationVo
>(
list
));
}
...
...
@@ -228,16 +230,16 @@ public class AuthorLibraryController {
throw
new
ParameterValidateException
(
ResponseCodeEnum
.
MISS_EXCEPTION
.
getCode
(),
"必须指定id、被关联的resourceId、资源类型"
);
}
List
<
AuthorResource
>
recordList
=
new
ArrayList
<
AuthorResource
>();
List
<
ResourceRelation
>
recordList
=
new
ArrayList
<
ResourceRelation
>();
for
(
int
i
=
0
;
i
<
entity
.
getResourceIds
().
size
();
i
++)
{
List
<
AuthorResource
>
list
=
resource
Service
.
queryByid
(
entity
.
getId
(),
entity
.
getResourceIds
().
get
(
i
));
List
<
ResourceRelation
>
list
=
resourceRelation
Service
.
queryByid
(
entity
.
getId
(),
entity
.
getResourceIds
().
get
(
i
));
if
(
list
.
size
()==
0
)
{
AuthorResource
e
=
new
AuthorResource
();
ResourceRelation
e
=
new
ResourceRelation
();
e
.
setObjectId
(
entity
.
getId
());
e
.
setResourceId
(
entity
.
getResourceIds
().
get
(
i
));
e
.
setCreateTime
(
new
Date
());
e
.
setResourceType
(
entity
.
getResourceType
());
Integer
maxOrderNum
=
resource
Service
.
getMaxOrderNum
(
);
Integer
maxOrderNum
=
resource
RelationService
.
getMaxOrderNum
(
entity
.
getId
()
);
if
(
maxOrderNum
!=
null
){
e
.
setSort
(
maxOrderNum
+
1
);
}
else
{
...
...
@@ -246,7 +248,7 @@ public class AuthorLibraryController {
recordList
.
add
(
e
);
}
}
return
CallBack
.
success
(
resourceService
.
insertList
(
recordList
));
return
CallBack
.
success
(
resource
Relation
Service
.
insertList
(
recordList
));
}
@ApiOperation
(
value
=
"批量删除关联资源"
,
notes
=
"批量删除"
)
...
...
@@ -255,11 +257,10 @@ public class AuthorLibraryController {
if
(
ids
.
size
()
==
0
)
{
throw
new
BaseException
(-
7
,
"没有选中任何数据,请重新选择"
);
}
Example
example
=
resourceService
.
createExample
();
example
.
createCriteria
().
andIn
(
"id"
,
ids
);
List
<
AuthorResource
>
list
=
resourceService
.
selectByExample
(
example
);
for
(
AuthorResource
entity
:
list
)
{
resourceService
.
deleteByPrimaryKey
(
entity
);
Example
example
=
resourceRelationService
.
createExample
();
example
.
and
().
andIn
(
"id"
,
ids
);
if
(!
resourceRelationService
.
deleteByExample
(
example
))
{
throw
new
BusinessValidateException
(
"操作失败"
);
}
return
CallBack
.
success
();
}
...
...
@@ -269,9 +270,9 @@ public class AuthorLibraryController {
if
(
form
.
getId
()
==
null
)
{
throw
new
ParameterValidateException
(
"分类不能为空"
);
}
AuthorResource
resource
=
resource
Service
.
selectByPrimaryKey
(
form
.
getId
());
ResourceRelation
resource
=
resourceRelation
Service
.
selectByPrimaryKey
(
form
.
getId
());
resource
.
setSort
(
form
.
getSort
());
resourceService
.
updateByPrimaryKeySelective
(
resource
);
resource
Relation
Service
.
updateByPrimaryKeySelective
(
resource
);
return
CallBack
.
success
();
}
@ApiOperation
(
value
=
"科室列表"
,
notes
=
"科室列表"
)
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/ebook/EbookController.java
浏览文件 @
9fc3bcbd
package
com
.
zrqx
.
resource
.
bg
.
controller
.
ebook
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Date
;
...
...
@@ -16,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
tk.mybatis.mapper.entity.Example
;
import
com.zrqx.core.constant.BaseRequestPath
;
import
com.zrqx.core.constant.resource.ResourceRequestPath
;
import
com.zrqx.core.enums.AllResourceTypeEnum
;
...
...
@@ -35,6 +40,7 @@ import com.zrqx.core.form.resource.bg.ebook.QueryEbookInfoForm;
import
com.zrqx.core.form.resource.bg.ebook.SaveUpdateEbookForm
;
import
com.zrqx.core.form.resource.bg.ebook.UpdateEbookForm
;
import
com.zrqx.core.form.resource.bg.ebook.UpdateEbookRelationForm
;
import
com.zrqx.core.model.resource.ResourceRelation
;
import
com.zrqx.core.model.resource.articlelibrary.ArticleLibrary
;
import
com.zrqx.core.model.resource.articlelibrary.ArticleLibraryDiyType
;
import
com.zrqx.core.model.resource.ebook.Book
;
...
...
@@ -61,14 +67,9 @@ import com.zrqx.resource.bg.service.ebook.EbookResourceService;
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
;
import
io.swagger.annotations.ApiOperation
;
import
tk.mybatis.mapper.entity.Example
;
/**
* 电子书管理-controller
*
...
...
@@ -98,8 +99,8 @@ public class EbookController {
private
ImageLibraryService
ilService
;
@Autowired
private
ImageLibraryDiyTypeRelationService
ildtrService
;
@Autowired
private
EbookResourceService
resourceService
;
//
@Autowired
//
private EbookResourceService resourceService;
@Autowired
private
ResourceRelationService
resourceRelationService
;
@Autowired
...
...
@@ -235,7 +236,7 @@ public class EbookController {
// ----推荐位内容
recommendResourceService
.
delectByResourceIds
(
ids
,
AllResourceTypeEnum
.
TUSHU
.
getCode
());
//
resourceService
.
delectByResourceIds
(
ids
,
AllResourceTypeEnum
.
TUSHU
.
getCode
());
resource
Relation
Service
.
delectByResourceIds
(
ids
,
AllResourceTypeEnum
.
TUSHU
.
getCode
());
// 删除文章
Example
example
=
alservice
.
createExample
();
example
.
createCriteria
().
andIn
(
"bookId"
,
ids
);
...
...
@@ -287,7 +288,7 @@ public class EbookController {
if
(
pageParam
.
getOrderBy
()==
null
)
{
pageParam
.
setOrderBy
(
"sort desc"
);
}
List
<
ResourceRelationVo
>
list
=
resourceService
.
queryByIdAndResourceType
(
entity
,
pageParam
);
List
<
ResourceRelationVo
>
list
=
resource
Relation
Service
.
queryByIdAndResourceType
(
entity
,
pageParam
);
if
(
list
==
null
||
list
.
size
()
==
0
)
{
return
CallBack
.
success
(
new
PageInfo
<
ResourceRelationVo
>(
list
));
}
...
...
@@ -301,16 +302,16 @@ public class EbookController {
throw
new
ParameterValidateException
(
ResponseCodeEnum
.
MISS_EXCEPTION
.
getCode
(),
"必须指定id、被关联的resourceId、资源类型"
);
}
for
(
int
i
=
0
;
i
<
entity
.
getResourceIds
().
size
();
i
++)
{
List
<
EbookResource
>
list
=
resource
Service
.
queryByid
(
entity
.
getId
(),
entity
.
getResourceIds
().
get
(
i
));
List
<
ResourceRelation
>
list
=
resourceRelation
Service
.
queryByid
(
entity
.
getId
(),
entity
.
getResourceIds
().
get
(
i
));
if
(
list
==
null
||
list
.
size
()==
0
)
{
EbookResource
e
=
new
EbookResource
();
ResourceRelation
e
=
new
ResourceRelation
();
e
.
setObjectId
(
entity
.
getId
());
e
.
setResourceId
(
entity
.
getResourceIds
().
get
(
i
));
e
.
setCreateTime
(
new
Date
());
e
.
setResourceType
(
entity
.
getResourceType
());
Integer
maxOrderNum
=
resource
Service
.
getMaxOrderNum
(
);
Integer
maxOrderNum
=
resource
RelationService
.
getMaxOrderNum
(
entity
.
getId
()
);
e
.
setSort
(
maxOrderNum
+
1
);
resourceService
.
insert
(
e
);
resource
Relation
Service
.
insert
(
e
);
}
}
return
CallBack
.
success
();
...
...
@@ -322,11 +323,10 @@ public class EbookController {
if
(
ids
.
size
()
==
0
)
{
throw
new
BaseException
(-
7
,
"没有选中任何数据,请重新选择"
);
}
Example
example
=
resourceService
.
createExample
();
example
.
createCriteria
().
andIn
(
"id"
,
ids
);
List
<
EbookResource
>
list
=
resourceService
.
selectByExample
(
example
);
for
(
EbookResource
entity
:
list
)
{
resourceService
.
deleteByPrimaryKey
(
entity
);
Example
example
=
resourceRelationService
.
createExample
();
example
.
and
().
andIn
(
"id"
,
ids
);
if
(!
resourceRelationService
.
deleteByExample
(
example
))
{
throw
new
BusinessValidateException
(
"操作失败"
);
}
return
CallBack
.
success
();
}
...
...
@@ -336,9 +336,9 @@ public class EbookController {
if
(
form
.
getId
()
==
null
)
{
throw
new
ParameterValidateException
(
"分类不能为空"
);
}
EbookResource
resource
=
resource
Service
.
selectByPrimaryKey
(
form
.
getId
());
ResourceRelation
resource
=
resourceRelation
Service
.
selectByPrimaryKey
(
form
.
getId
());
resource
.
setSort
(
form
.
getSort
());
resourceService
.
updateByPrimaryKeySelective
(
resource
);
resource
Relation
Service
.
updateByPrimaryKeySelective
(
resource
);
return
CallBack
.
success
();
}
/**
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/imagelibrary/ImageLibraryController.java
浏览文件 @
9fc3bcbd
...
...
@@ -20,23 +20,21 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.entity.Example.Criteria
;
import
com.zrqx.core.constant.resource.ResourceRequestPath
;
import
com.zrqx.core.enums.ResponseCodeEnum
;
import
com.zrqx.core.enums.resource.LibraryStatusEnum
;
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.QueryResourceRelationForm
;
import
com.zrqx.core.form.resource.bg.SaveResourceRelationForm
;
import
com.zrqx.core.form.resource.bg.imagelibrary.BatchUpdateImageLibraryForm
;
import
com.zrqx.core.form.resource.bg.imagelibrary.QueryImageLibraryForm
;
import
com.zrqx.core.form.resource.bg.imagelibrary.SaveImageLibraryForm
;
import
com.zrqx.core.form.resource.bg.imagelibrary.SaveUpdateImageLibraryForm
;
import
com.zrqx.core.model.resource.ResourceRelation
;
import
com.zrqx.core.model.resource.imagelibrary.ImageLibrary
;
import
com.zrqx.core.model.resource.imagelibrary.ImageLibraryDiyType
;
import
com.zrqx.core.model.resource.imagelibrary.ImageResource
;
import
com.zrqx.core.util.page.PageInfo
;
import
com.zrqx.core.util.page.PageParam
;
import
com.zrqx.core.util.response.CallBack
;
...
...
@@ -46,7 +44,6 @@ import com.zrqx.core.vo.resource.imagelibrary.ImageLibraryOneVO;
import
com.zrqx.resource.bg.service.ResourceRelationService
;
import
com.zrqx.resource.bg.service.imagelibrary.ImageLibraryDiyTypeRelationService
;
import
com.zrqx.resource.bg.service.imagelibrary.ImageLibraryService
;
import
com.zrqx.resource.bg.service.imagelibrary.ImageResourceService
;
/**
* 图片库Controller
...
...
@@ -60,8 +57,8 @@ public class ImageLibraryController {
private
ImageLibraryService
service
;
@Autowired
private
ImageLibraryDiyTypeRelationService
idrService
;
@Autowired
private
ImageResourceService
resourceService
;
//
@Autowired
//
private ImageResourceService resourceService;
@Autowired
private
ResourceRelationService
resourceRelationService
;
...
...
@@ -189,18 +186,18 @@ public class ImageLibraryController {
if
(
entity
==
null
||
entity
.
getId
()
==
null
)
{
throw
new
ParameterValidateException
(
ResponseCodeEnum
.
MISS_EXCEPTION
.
getCode
(),
"资源id不能为空!"
);
}
List
<
ResourceRelationVo
>
list
=
resourceService
.
queryByIdAndResourceType
(
entity
,
pageParam
);
List
<
ResourceRelationVo
>
list
=
resource
Relation
Service
.
queryByIdAndResourceType
(
entity
,
pageParam
);
if
(
list
==
null
||
list
.
size
()
==
0
)
{
return
CallBack
.
success
(
null
);
}
return
CallBack
.
success
(
new
PageInfo
<
ResourceRelationVo
>(
resourceRelationService
.
queryRelationList
(
list
)));
}
@ApiOperation
(
value
=
"选择弹窗中的列表"
,
notes
=
"查询选择弹窗中的列表"
)
/*
@ApiOperation(value = "选择弹窗中的列表" , notes ="查询选择弹窗中的列表")
@GetMapping(value = ResourceRequestPath.RELATION_RESOURCE + ResourceRequestPath.POPPAGE)
public CallBack<PageInfo<ImageLibraryListVO>> page(QueryResourceForPoPForm form, PageParam pageParam){
return CallBack.success(service.pageByTitleAndDiyType(form, pageParam));
}
}
*/
@ApiOperation
(
value
=
"保存相关资源"
,
notes
=
"保存相关资源"
)
@PostMapping
(
value
=
ResourceRequestPath
.
RELATION_RESOURCE
+
ResourceRequestPath
.
SAVE
)
...
...
@@ -208,15 +205,15 @@ public class ImageLibraryController {
if
(
entity
.
getId
()
==
null
||
entity
.
getResourceIds
()
==
null
||
entity
.
getResourceType
()
==
null
||
entity
.
getResourceIds
().
size
()
==
0
){
throw
new
ParameterValidateException
(
ResponseCodeEnum
.
MISS_EXCEPTION
.
getCode
(),
"必须指定id、被关联的resourceId、资源类型"
);
}
List
<
ImageResource
>
recordList
=
new
ArrayList
<
ImageResource
>();
Arrays
.
asList
(
entity
.
getResourceIds
()
).
forEach
(
resourceId
->
{
ImageResource
e
=
new
ImageResource
();
/*e.setId(entity.getId());*/
//
e.setResourceId(resourceId);
List
<
ResourceRelation
>
recordList
=
new
ArrayList
<
ResourceRelation
>();
entity
.
getResourceIds
(
).
forEach
(
resourceId
->
{
ResourceRelation
e
=
new
ResourceRelation
();
e
.
setObjectId
(
entity
.
getId
());
e
.
setResourceId
(
resourceId
);
e
.
setCreateTime
(
new
Date
());
e
.
setResourceType
(
entity
.
getResourceType
());
recordList
.
add
(
e
);
});
return
CallBack
.
success
(
resourceService
.
insertList
(
recordList
));
return
CallBack
.
success
(
resource
Relation
Service
.
insertList
(
recordList
));
}
}
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/mapper/ResourceRelationMapper.java
0 → 100644
浏览文件 @
9fc3bcbd
package
com
.
zrqx
.
resource
.
bg
.
mapper
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Delete
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Select
;
import
com.zrqx.core.form.resource.bg.QueryResourceRelationForm
;
import
com.zrqx.core.mapper.BaseMapper
;
import
com.zrqx.core.model.resource.ResourceRelation
;
import
com.zrqx.core.vo.resource.ResourceRelationVo
;
import
feign.Param
;
@Mapper
public
interface
ResourceRelationMapper
extends
BaseMapper
<
ResourceRelation
>
{
@Select
(
"<script>"
+
"select id ,resourceId,resourceType,createTime,sort "
+
"from res_resource_relation "
+
"where objectId = #{id} "
+
"<if test='resourceType != null'> and resourceType = #{resourceType}</if>"
+
"</script>"
)
List
<
ResourceRelationVo
>
queryByIdAndResourceType
(
QueryResourceRelationForm
entity
);
@Delete
(
"<script>"
+
"delete from res_resource_relation "
+
"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 ( objectId 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
);
/**
* 查询排序号最大值
* @return
*/
@Select
(
"select sort from res_resource_relation where objectId = #{objectId} "
)
Integer
getMaxOrderNum
(
@Param
(
"objectId"
)
String
objectId
);
@Select
(
"<script>"
+
"select * from res_resource_relation "
+
"where objectId = #{objectId} and resourceId = #{resourceId}"
+
"</script>"
)
List
<
ResourceRelation
>
queryByid
(
@Param
(
"objectId"
)
String
objectId
,
@Param
(
"resourceId"
)
String
resourceId
);
}
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/mapper/ebook/EbookMapper.java
浏览文件 @
9fc3bcbd
...
...
@@ -46,10 +46,10 @@ public interface EbookMapper extends BaseMapper<Ebook>{
+
" WHERE 1 = 1 and bb.isDelete = 1 "
+
"</if>"
+
"<if test='option==1'>"
+
" AND
bb.author is null
"
+
" AND
(bb.author is null or bb.author = '')
"
+
"</if>"
+
"<if test='option==2'>"
+
" AND
be.bookCover is null
"
+
" AND
(be.bookCover is null or be.bookCover = '')
"
+
"</if>"
+
"<if test='option==3'>"
+
" AND be.summary is null "
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/service/ResourceRelationService.java
浏览文件 @
9fc3bcbd
...
...
@@ -2,9 +2,35 @@ package com.zrqx.resource.bg.service;
import
java.util.List
;
import
com.zrqx.core.form.resource.bg.QueryResourceRelationForm
;
import
com.zrqx.core.model.resource.ResourceRelation
;
import
com.zrqx.core.service.BaseService
;
import
com.zrqx.core.util.page.PageParam
;
import
com.zrqx.core.vo.resource.ResourceRelationVo
;
public
interface
ResourceRelationService
{
public
interface
ResourceRelationService
extends
BaseService
<
ResourceRelation
,
Integer
>
{
/**
* 获取相关资源列表
* @param entity
* @param pageParam
* @return
*/
List
<
ResourceRelationVo
>
queryByIdAndResourceType
(
QueryResourceRelationForm
entity
,
PageParam
pageParam
);
/**
* 根据类型和资源id集合删除关联内容
* @param ids
* @param type
* @return
* @author ycw
* @date: 2019年8月25日 上午10:25:20
*/
boolean
delectByResourceIds
(
List
<
String
>
ids
,
Integer
type
);
Integer
getMaxOrderNum
(
String
objectId
);
List
<
ResourceRelation
>
queryByid
(
String
objectId
,
String
resourceId
);
List
<
ResourceRelationVo
>
queryRelationList
(
List
<
ResourceRelationVo
>
list
);
}
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/service/ResourceRelationServiceImpl.java
浏览文件 @
9fc3bcbd
...
...
@@ -2,31 +2,37 @@ package com.zrqx.resource.bg.service;
import
java.util.List
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.github.pagehelper.PageHelper
;
import
com.zrqx.core.enums.ResourceTypeEnum
;
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.ResourceRelation
;
import
com.zrqx.core.model.resource.articlelibrary.ArticleLibrary
;
import
com.zrqx.core.model.resource.audiolibrary.AudioLibrary
;
import
com.zrqx.core.model.resource.authorLibrary.AuthorLibrary
;
import
com.zrqx.core.model.resource.coursewarelibrary.CoursewareLibrary
;
import
com.zrqx.core.model.resource.ebook.Book
;
import
com.zrqx.core.model.resource.ebook.Ebook
;
import
com.zrqx.core.
model.resource.imagelibrary.ImageLibrary
;
import
com.zrqx.core.
model.resource.videolibrary.VideoLibrary
;
import
com.zrqx.core.
service.BaseServiceImpl
;
import
com.zrqx.core.
util.page.PageParam
;
import
com.zrqx.core.vo.resource.ResourceRelationVo
;
import
com.zrqx.resource.bg.client.periodical.PeriodicalClient
;
import
com.zrqx.resource.bg.mapper.ResourceRelationMapper
;
import
com.zrqx.resource.bg.mapper.articlelibrary.ArticleLibraryMapper
;
import
com.zrqx.resource.bg.mapper.audiolibrary.AudioLibraryMapper
;
import
com.zrqx.resource.bg.mapper.authorLibrary.AuthorLibraryMapper
;
import
com.zrqx.resource.bg.mapper.coursewarelibrary.CoursewareLibraryMapper
;
import
com.zrqx.resource.bg.mapper.ebook.BookMapper
;
import
com.zrqx.resource.bg.mapper.ebook.EbookMapper
;
import
com.zrqx.resource.bg.mapper.imagelibrary.ImageLibraryMapper
;
import
com.zrqx.resource.bg.mapper.videolibrary.VideoLibraryMapper
;
@Service
public
class
ResourceRelationServiceImpl
implements
ResourceRelationService
{
public
class
ResourceRelationServiceImpl
extends
BaseServiceImpl
<
ResourceRelation
,
Integer
>
implements
ResourceRelationService
{
@Autowired
private
ResourceRelationMapper
mapper
;
@Autowired
private
ArticleLibraryMapper
articleLibraryMapper
;
@Autowired
...
...
@@ -43,7 +49,56 @@ public class ResourceRelationServiceImpl implements ResourceRelationService {
private
BookMapper
bookMapper
;
@Autowired
private
EbookMapper
ebookMapper
;
@Override
public
BaseMapper
<
ResourceRelation
>
getMapper
()
{
return
mapper
;
}
/**
* 获取相关资源列表
*/
@Override
public
List
<
ResourceRelationVo
>
queryByIdAndResourceType
(
QueryResourceRelationForm
entity
,
PageParam
pageParam
)
{
if
(
null
!=
pageParam
&&
StringUtils
.
isBlank
(
pageParam
.
getOrderBy
())){
pageParam
.
setOrderBy
(
"sort asc"
);
}
PageHelper
.
startPage
(
pageParam
);
return
mapper
.
queryByIdAndResourceType
(
entity
);
}
/**
* 根据类型和资源id集合删除推荐内容
* @param ids
* @param type
* @return
* @author ycw
* @date: 2019年8月6日 上午10:25:20
*/
@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
mapper
.
delectByResourceIds
(
ids
,
type
);
}
@Override
public
Integer
getMaxOrderNum
(
String
objectId
)
{
PageHelper
.
startPage
(
1
,
1
,
"sort desc"
);
Integer
maxOrderNum
=
mapper
.
getMaxOrderNum
(
objectId
);
return
maxOrderNum
==
null
?
0
:
maxOrderNum
;
}
@Override
public
List
<
ResourceRelation
>
queryByid
(
String
objectId
,
String
resourceId
)
{
return
mapper
.
queryByid
(
objectId
,
resourceId
);
}
@Override
public
List
<
ResourceRelationVo
>
queryRelationList
(
List
<
ResourceRelationVo
>
list
)
{
list
.
forEach
(
e
->
{
if
(
e
.
getResourceType
()
!=
null
)
{
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/service/articlelibrary/ArticleLibrarySerivceImpl.java
浏览文件 @
9fc3bcbd
...
...
@@ -8,6 +8,8 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
tk.mybatis.mapper.entity.Example
;
import
com.zrqx.core.enums.ArticleTypeEnum
;
import
com.zrqx.core.enums.ResponseCodeEnum
;
import
com.zrqx.core.enums.resource.LibraryStatusEnum
;
...
...
@@ -24,17 +26,15 @@ import com.zrqx.core.util.page.PageInfo;
import
com.zrqx.core.util.page.PageParam
;
import
com.zrqx.core.vo.resource.ResourceRelationListVo
;
import
com.zrqx.core.vo.resource.articlelibrary.ArticleLibraryListVO
;
import
com.zrqx.resource.bg.mapper.ResourceRelationMapper
;
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
;
/**
* 文章库
*/
...
...
@@ -53,8 +53,10 @@ public class ArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,St
private
PdfLibraryMapper
pdfLibraryMapper
;
@Autowired
private
VideoLibraryMapper
videoLibraryMapper
;
//@Autowired
//private ArticleResourceMapper arMapper;
@Autowired
private
ArticleResourceMapper
ar
Mapper
;
private
ResourceRelationMapper
resourceRelation
Mapper
;
@Autowired
private
RecommendResourceMapper
recommendResourceMapper
;
...
...
@@ -118,7 +120,7 @@ public class ArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,St
alcdMapper
.
deleteByExample
(
example
);
// 删除推荐位,促销,关联资源
recommendResourceMapper
.
delectByResourceIds
(
ids
,
null
);
ar
Mapper
.
delectByResourceIds
(
ids
,
null
);
resourceRelation
Mapper
.
delectByResourceIds
(
ids
,
null
);
return
true
;
}
@Override
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/service/articlelibrary/ArticleResourceServiceImpl.java
浏览文件 @
9fc3bcbd
...
...
@@ -2,6 +2,7 @@ package com.zrqx.resource.bg.service.articlelibrary;
import
java.util.List
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -34,7 +35,9 @@ public class ArticleResourceServiceImpl extends BaseServiceImpl<ArticleResource,
*/
@Override
public
List
<
ResourceRelationVo
>
queryByIdAndResourceType
(
QueryResourceRelationForm
entity
,
PageParam
pageParam
)
{
PageHelper
.
startPage
(
pageParam
);
if
(
null
!=
pageParam
&&
StringUtils
.
isBlank
(
pageParam
.
getOrderBy
())){
pageParam
.
setOrderBy
(
"sort asc"
);
}
return
articleResourceMapper
.
queryByIdAndResourceType
(
entity
);
}
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/service/authorLibrary/AuthorResourceServiceImpl.java
浏览文件 @
9fc3bcbd
...
...
@@ -2,6 +2,7 @@ package com.zrqx.resource.bg.service.authorLibrary;
import
java.util.List
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -34,6 +35,9 @@ public class AuthorResourceServiceImpl extends BaseServiceImpl<AuthorResource, I
*/
@Override
public
List
<
ResourceRelationVo
>
queryByIdAndResourceType
(
QueryResourceRelationForm
entity
,
PageParam
pageParam
)
{
if
(
null
!=
pageParam
&&
StringUtils
.
isBlank
(
pageParam
.
getOrderBy
())){
pageParam
.
setOrderBy
(
"sort asc"
);
}
PageHelper
.
startPage
(
pageParam
);
return
authorResourceMapper
.
queryByIdAndResourceType
(
entity
);
}
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/service/imagelibrary/ImageLibrarySerivceImpl.java
浏览文件 @
9fc3bcbd
...
...
@@ -118,15 +118,6 @@ public class ImageLibrarySerivceImpl extends BaseServiceImpl<ImageLibrary,Intege
}
Example
example
=
createExample
();
example
.
createCriteria
().
andIn
(
"id"
,
ids
);
List
<
ImageLibrary
>
list
=
mapper
.
selectByExample
(
example
);
for
(
ImageLibrary
entity
:
list
)
{
if
(
entity
.
getBookId
()
!=
null
){
throw
new
BusinessValidateException
(
"图书内拆分出来的图片不支持单独上、下架、删除操作"
);
}
if
(
entity
.
getStatus
()
==
LibraryStatusEnum
.
STATUS_1
.
getCode
())
{
throw
new
BusinessValidateException
(
"不能删除已上架的资源"
);
}
}
mapper
.
deleteByExample
(
example
);
//还需删除与自定义分类关系
example
=
new
Example
(
ImageLibraryDiyType
.
class
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论