Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
R
rtjl
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
rtjl
Commits
83dbe07f
提交
83dbe07f
authored
12月 16, 2019
作者:
liupengfei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
81e0ef36
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
335 行增加
和
1 行删除
+335
-1
ResourceRelationMapper.java
...a/com/zrqx/resource/bg/mapper/ResourceRelationMapper.java
+57
-1
ArticleLibraryDiyTypeMapper.java
...bg/mapper/articlelibrary/ArticleLibraryDiyTypeMapper.java
+10
-0
ArticleLibraryMapper.java
...source/bg/mapper/articlelibrary/ArticleLibraryMapper.java
+36
-0
ArticleLibraryDiyTypeSerivceImpl.java
...vice/articlelibrary/ArticleLibraryDiyTypeSerivceImpl.java
+23
-0
ArticleLibraryDiyTypeService.java
.../service/articlelibrary/ArticleLibraryDiyTypeService.java
+10
-0
ArticleLibrarySerivceImpl.java
.../bg/service/articlelibrary/ArticleLibrarySerivceImpl.java
+160
-0
ArticleLibraryService.java
...urce/bg/service/articlelibrary/ArticleLibraryService.java
+39
-0
没有找到文件。
app/resource/src/main/java/com/zrqx/resource/bg/mapper/ResourceRelationMapper.java
浏览文件 @
83dbe07f
...
@@ -15,8 +15,20 @@ import com.zrqx.resource.commons.vo.bg.ResourceRelationVo;
...
@@ -15,8 +15,20 @@ import com.zrqx.resource.commons.vo.bg.ResourceRelationVo;
@Mapper
@Mapper
public
interface
ResourceRelationMapper
extends
BaseMapper
<
ResourceRelation
>
{
public
interface
ResourceRelationMapper
extends
BaseMapper
<
ResourceRelation
>
{
String
NOT_BLANK
=
"@com.zrqx.core.util.datatype.StringUtils@isNotBlank"
;
/**
* 日期查询条件
*/
String
DATETIME_QUERY_CONDITIONS
=
" <if test = '"
+
NOT_BLANK
+
"(beginTime)'> "
+
" and a.uploadTime >= concat(#{beginTime}, ' 00:00:00' ) "
+
" </if> "
+
" <if test = '"
+
NOT_BLANK
+
"(endTime)'> "
+
" and a.uploadTime <= concat(#{endTime}, ' 23:59:59') "
+
" </if> "
;
@Select
(
"<script>"
@Select
(
"<script>"
+
"select id ,resourceId,resourceType,createTime,sort "
+
"select id ,resourceId,resourceType,createTime,sort
,isTop
"
+
"from res_resource_relation "
+
"from res_resource_relation "
+
"where objectId = #{id} "
+
"where objectId = #{id} "
+
"<if test='resourceType != null'> "
+
"<if test='resourceType != null'> "
...
@@ -59,4 +71,48 @@ public interface ResourceRelationMapper extends BaseMapper<ResourceRelation> {
...
@@ -59,4 +71,48 @@ public interface ResourceRelationMapper extends BaseMapper<ResourceRelation> {
*/
*/
@Select
(
"SELECT MAX(sort) FROM res_annex_resource where objectType = #{resourceType}"
)
@Select
(
"SELECT MAX(sort) FROM res_annex_resource where objectType = #{resourceType}"
)
Integer
getMaxSort
(
@Param
(
"resourceType"
)
Integer
resourceType
);
Integer
getMaxSort
(
@Param
(
"resourceType"
)
Integer
resourceType
);
/**
* 查找相关文章
* @param entity
* @return
*/
@Select
(
"<script>"
+
"select b.id ,b.resourceId,b.resourceType,b.sort,b.isTop,"
+
"a.name,a.author,a.keywords,a.uploadTime,a.status "
+
"from res_resource_relation b left join res_article_library a on b.resourceId = a.id "
+
"where b.objectId = #{id} "
+
"<if test='resourceType != null'> "
+
" and b.resourceType = #{resourceType} "
+
"</if>"
+
"<if test='"
+
NOTBLANK
+
"(name)'>"
+
" AND (a.name like concat('%',#{name},'%') OR a.author like concat('%',#{name},'%')) "
+
"</if>"
+
DATETIME_QUERY_CONDITIONS
+
"<if test='status != null'> "
+
" and a.status = #{status} "
+
"</if>"
+
" order by b.isTop desc,sort asc "
+
"</script>"
)
List
<
ResourceRelationVo
>
queryArticleByIdAndResourceType
(
QueryResourceRelationForm
entity
);
/**
* 查找相关视频
* @param entity
* @return
*/
@Select
(
"<script>"
+
"select b.id ,b.resourceId,b.resourceType,b.sort,b.isTop,"
+
"a.name,a.author,a.uploadTime,a.status "
+
"from res_resource_relation b left join res_video_library a on b.resourceId = a.id "
+
"where b.objectId = #{id} "
+
"<if test='resourceType != null'> "
+
" and b.resourceType = #{resourceType} "
+
"</if>"
+
"<if test='"
+
NOTBLANK
+
"(name)'>"
+
" AND (a.name like concat('%',#{name},'%') OR a.author like concat('%',#{name},'%')) "
+
"</if>"
+
" order by b.isTop desc,sort asc "
+
"</script>"
)
List
<
ResourceRelationVo
>
queryVideoByIdAndResourceType
(
QueryResourceRelationForm
entity
);
}
}
app/resource/src/main/java/com/zrqx/resource/bg/mapper/articlelibrary/ArticleLibraryDiyTypeMapper.java
0 → 100644
浏览文件 @
83dbe07f
package
com
.
zrqx
.
resource
.
bg
.
mapper
.
articlelibrary
;
import
com.zrqx.core.mapper.BaseMapper
;
import
com.zrqx.resource.commons.model.articlelibrary.ArticleLibraryDiyType
;
/**
* 文章库和自定义分类
*/
public
interface
ArticleLibraryDiyTypeMapper
extends
BaseMapper
<
ArticleLibraryDiyType
>
{
}
app/resource/src/main/java/com/zrqx/resource/bg/mapper/articlelibrary/ArticleLibraryMapper.java
0 → 100644
浏览文件 @
83dbe07f
package
com
.
zrqx
.
resource
.
bg
.
mapper
.
articlelibrary
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
com.zrqx.core.mapper.BaseMapper
;
import
com.zrqx.resource.bg.mapper.MapperConstants
;
import
com.zrqx.resource.commons.form.bg.articlelibrary.QueryArticleLibraryForm
;
import
com.zrqx.resource.commons.model.articlelibrary.ArticleLibrary
;
import
com.zrqx.resource.commons.vo.bg.articlelibrary.ArticleLibraryListVO
;
/**
* 文章库
*/
public
interface
ArticleLibraryMapper
extends
BaseMapper
<
ArticleLibrary
>
{
/**
* 分页查询
* @param form
* @return
*/
@Select
(
"<script>"
+
"select * "
+
"from res_article_Library a left join res_Video_Library_Diy_Type ad "
+
"on a.id = ad.vlid "
+
"where 1=1 "
+
"<if test='"
+
NOTBLANK
+
"(form.name)'>"
+
" AND (a.name like concat('%',#{form.name},'%') OR a.author like concat('%',#{form.name},'%')) "
+
"</if>"
+
MapperConstants
.
DATETIME_QUERY_CONDITION
+
" order by a.uploadTime desc "
+
"</script>"
)
List
<
ArticleLibraryListVO
>
query
(
@Param
(
"form"
)
QueryArticleLibraryForm
form
);
}
app/resource/src/main/java/com/zrqx/resource/bg/service/articlelibrary/ArticleLibraryDiyTypeSerivceImpl.java
0 → 100644
浏览文件 @
83dbe07f
package
com
.
zrqx
.
resource
.
bg
.
service
.
articlelibrary
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.zrqx.core.mapper.BaseMapper
;
import
com.zrqx.core.service.BaseServiceImpl
;
import
com.zrqx.resource.bg.mapper.articlelibrary.ArticleLibraryDiyTypeMapper
;
import
com.zrqx.resource.commons.model.articlelibrary.ArticleLibraryDiyType
;
/**
* 文章库和自定义分类
*/
@Service
public
class
ArticleLibraryDiyTypeSerivceImpl
extends
BaseServiceImpl
<
ArticleLibraryDiyType
,
Integer
>
implements
ArticleLibraryDiyTypeService
{
@Autowired
private
ArticleLibraryDiyTypeMapper
mapper
;
@Override
public
BaseMapper
<
ArticleLibraryDiyType
>
getMapper
()
{
return
mapper
;
}
}
app/resource/src/main/java/com/zrqx/resource/bg/service/articlelibrary/ArticleLibraryDiyTypeService.java
0 → 100644
浏览文件 @
83dbe07f
package
com
.
zrqx
.
resource
.
bg
.
service
.
articlelibrary
;
import
com.zrqx.core.service.BaseService
;
import
com.zrqx.resource.commons.model.articlelibrary.ArticleLibraryDiyType
;
/**
* 文章库和自定义分类
*/
public
interface
ArticleLibraryDiyTypeService
extends
BaseService
<
ArticleLibraryDiyType
,
Integer
>{
}
app/resource/src/main/java/com/zrqx/resource/bg/service/articlelibrary/ArticleLibrarySerivceImpl.java
0 → 100644
浏览文件 @
83dbe07f
package
com
.
zrqx
.
resource
.
bg
.
service
.
articlelibrary
;
import
java.util.Date
;
import
java.util.List
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.zrqx.core.commons.redis.Redis
;
import
com.zrqx.core.enums.resource.LibraryStatusEnum
;
import
com.zrqx.core.enums.resource.ResourceTypeEnum
;
import
com.zrqx.core.exception.BaseException
;
import
com.zrqx.core.mapper.BaseMapper
;
import
com.zrqx.core.service.BaseServiceImpl
;
import
com.zrqx.core.util.bean.BeanUtils
;
import
com.zrqx.core.util.page.PageInfo
;
import
com.zrqx.core.util.page.PageParam
;
import
com.zrqx.resource.bg.mapper.ResourceRelationMapper
;
import
com.zrqx.resource.bg.mapper.articlelibrary.ArticleLibraryDiyTypeMapper
;
import
com.zrqx.resource.bg.mapper.articlelibrary.ArticleLibraryMapper
;
import
com.zrqx.resource.bg.mapper.videolibrary.VideoLibraryMapper
;
import
com.zrqx.resource.commons.form.bg.articlelibrary.QueryArticleLibraryForm
;
import
com.zrqx.resource.commons.form.bg.articlelibrary.SaveUpdateArticleLibraryForm
;
import
com.zrqx.resource.commons.model.acupointlibrary.AcupointLibrary
;
import
com.zrqx.resource.commons.model.acupointlibrary.AcupointLibraryDiyType
;
import
com.zrqx.resource.commons.model.articlelibrary.ArticleLibrary
;
import
com.zrqx.resource.commons.model.articlelibrary.ArticleLibraryDiyType
;
import
com.zrqx.resource.commons.model.resourcerelation.ResourceRelation
;
import
com.zrqx.resource.commons.model.videolibrary.VideoLibrary
;
import
com.zrqx.resource.commons.vo.bg.articlelibrary.ArticleLibraryListVO
;
import
tk.mybatis.mapper.entity.Example
;
/**
* 文章库
*/
@Service
public
class
ArticleLibrarySerivceImpl
extends
BaseServiceImpl
<
ArticleLibrary
,
String
>
implements
ArticleLibraryService
{
@Autowired
private
ArticleLibraryMapper
mapper
;
@Autowired
private
ArticleLibraryDiyTypeMapper
diyTypeMapper
;
@Autowired
private
ResourceRelationMapper
resourceRelationMapper
;
@Autowired
private
VideoLibraryMapper
videoLibraryMapper
;
@Autowired
private
Redis
redis
;
@Override
public
BaseMapper
<
ArticleLibrary
>
getMapper
()
{
return
mapper
;
}
@Override
public
boolean
saveOrUpdate
(
SaveUpdateArticleLibraryForm
form
)
{
ArticleLibrary
entity
=
new
ArticleLibrary
();
BeanUtils
.
copyProperties
(
form
,
entity
);
if
(
entity
.
getId
()
==
null
)
{
//添加
entity
.
setEditor
(
redis
.
getUser
().
getUserName
());
entity
.
setEditorId
(
redis
.
getUser
().
getUserId
());
entity
.
setUploadTime
(
new
Date
());
entity
.
setResourceType
(
ResourceTypeEnum
.
ARTICLE_LIBRARY
.
getCode
());
mapper
.
insert
(
entity
);
if
(
StringUtils
.
isNotBlank
(
form
.
getObjectId
()))
{
ResourceRelation
resourceRelation
=
new
ResourceRelation
();
resourceRelation
.
setCreateTime
(
new
Date
());
resourceRelation
.
setObjectId
(
form
.
getObjectId
());
resourceRelation
.
setResourceId
(
entity
.
getId
());
resourceRelation
.
setResourceType
(
ResourceTypeEnum
.
ARTICLE_LIBRARY
.
getCode
());
resourceRelation
.
setIsTop
(
form
.
getIsTop
());
resourceRelation
.
setSort
(
form
.
getSort
());
resourceRelationMapper
.
insert
(
resourceRelation
);
}
}
else
{
//修改
entity
.
setEditor
(
redis
.
getUser
().
getUserName
());
entity
.
setEditorId
(
redis
.
getUser
().
getUserId
());
entity
.
setUploadTime
(
new
Date
());
mapper
.
updateByPrimaryKeySelective
(
entity
);
ArticleLibraryDiyType
diyType
=
new
ArticleLibraryDiyType
();
diyType
.
setArticleId
(
entity
.
getId
());
diyTypeMapper
.
delete
(
diyType
);
}
//添加当前对象与自定义关系
if
(
form
.
getDiyType
()
!=
null
&&
form
.
getDiyType
().
size
()
>
0
){
List
<
ArticleLibraryDiyType
>
list
=
form
.
getDiyType
();
list
.
forEach
(
li
->
li
.
setArticleId
(
entity
.
getId
()));
diyTypeMapper
.
insertList
(
list
);
}
if
(
form
.
getVideoType
()
!=
null
&&
form
.
getVideoType
()
==
1
&&
StringUtils
.
isNotBlank
(
form
.
getTimeLength
()))
{
String
videoId
=
saveVideo
(
form
);
ArticleLibrary
articleLibrary
=
new
ArticleLibrary
();
articleLibrary
.
setId
(
entity
.
getId
());
articleLibrary
.
setVideoId
(
videoId
);
mapper
.
updateByPrimaryKeySelective
(
articleLibrary
);
}
return
true
;
}
/**
* 保存视频
* @param form
* @return
* @author yzg
* @date: 2018年11月22日 下午2:38:56
*/
public
String
saveVideo
(
SaveUpdateArticleLibraryForm
form
)
{
VideoLibrary
entity
=
new
VideoLibrary
();
entity
.
setName
(
form
.
getVideoName
());
entity
.
setVideo
(
form
.
getVideo
());
entity
.
setSize
(
form
.
getSize
());
entity
.
setTimeLength
(
form
.
getTimeLength
());
entity
.
setStatus
(
LibraryStatusEnum
.
STATUS_1
.
getCode
());
entity
.
setUploadTime
(
new
Date
());
entity
.
setResourceType
(
ResourceTypeEnum
.
VIDEO_LIBRARY
.
getCode
());
entity
.
setBrowseNum
(
50
);
entity
.
setReadTextPower
(
1
);
entity
.
setClickNum
(
50
);
entity
.
setSalesNum
(
0
);
videoLibraryMapper
.
insert
(
entity
);
return
entity
.
getId
();
}
/**
* 批量删除
*/
@Override
public
boolean
batchDelete
(
List
<
String
>
ids
)
{
if
(
ids
.
size
()
==
0
)
{
throw
new
BaseException
(
"没有选中任何数据,请重新选择"
);
}
Example
example
=
new
Example
(
AcupointLibrary
.
class
);
example
.
createCriteria
().
andIn
(
"id"
,
ids
);
mapper
.
deleteByExample
(
example
);
//还需删除与自定义分类关系
example
=
new
Example
(
AcupointLibraryDiyType
.
class
);
example
.
createCriteria
().
andIn
(
"articleId"
,
ids
);
diyTypeMapper
.
deleteByExample
(
example
);
//----关联资源
example
=
new
Example
(
ResourceRelation
.
class
);
example
.
createCriteria
().
andIn
(
"objectId"
,
ids
).
orIn
(
"resourceId"
,
ids
);
resourceRelationMapper
.
deleteByExample
(
example
);
return
true
;
}
@Override
public
PageInfo
<
ArticleLibraryListVO
>
page
(
QueryArticleLibraryForm
form
,
PageParam
pageParam
)
{
startPage
(
pageParam
);
return
new
PageInfo
<
ArticleLibraryListVO
>(
mapper
.
query
(
form
));
}
}
app/resource/src/main/java/com/zrqx/resource/bg/service/articlelibrary/ArticleLibraryService.java
0 → 100644
浏览文件 @
83dbe07f
package
com
.
zrqx
.
resource
.
bg
.
service
.
articlelibrary
;
import
java.util.List
;
import
com.zrqx.core.service.BaseService
;
import
com.zrqx.core.util.page.PageInfo
;
import
com.zrqx.core.util.page.PageParam
;
import
com.zrqx.resource.commons.form.bg.articlelibrary.QueryArticleLibraryForm
;
import
com.zrqx.resource.commons.form.bg.articlelibrary.SaveUpdateArticleLibraryForm
;
import
com.zrqx.resource.commons.model.articlelibrary.ArticleLibrary
;
import
com.zrqx.resource.commons.vo.bg.articlelibrary.ArticleLibraryListVO
;
/**
* 文章库
*/
public
interface
ArticleLibraryService
extends
BaseService
<
ArticleLibrary
,
String
>{
/**
* 添加或修改文章
* @param form
* @return
*/
boolean
saveOrUpdate
(
SaveUpdateArticleLibraryForm
form
);
/**
* 批量删除
* @param ids
* @return
*/
boolean
batchDelete
(
List
<
String
>
ids
);
/**
* 分页查询
* @param form
* @param pageParam
* @return
*/
PageInfo
<
ArticleLibraryListVO
>
page
(
QueryArticleLibraryForm
form
,
PageParam
pageParam
);
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论