Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cust-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李伟
cust-api
Commits
b7c0a691
Commit
b7c0a691
authored
Mar 05, 2025
by
liwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了动态评论接口
parent
cc6c0e71
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
90 additions
and
20 deletions
+90
-20
AppOpmArticleController.java
...ft/app/appArticle/controller/AppOpmArticleController.java
+1
-1
OpmArticleController.java
.../business/opmArticle/controller/OpmArticleController.java
+1
-1
OpmArticleRepository.java
...rcisoft/business/opmArticle/dao/OpmArticleRepository.java
+7
-1
ArticleCommentDTO.java
...rcisoft/business/opmArticle/entity/ArticleCommentDTO.java
+2
-0
OpmArticleService.java
...cisoft/business/opmArticle/service/OpmArticleService.java
+1
-1
OpmArticleServiceImpl.java
...siness/opmArticle/service/impl/OpmArticleServiceImpl.java
+43
-15
OpmArticleMapper.xml
...es/mapper/business/opmArticle/mapper/OpmArticleMapper.xml
+35
-1
No files found.
src/main/java/org/rcisoft/app/appArticle/controller/AppOpmArticleController.java
View file @
b7c0a691
...
...
@@ -112,7 +112,7 @@ public class AppOpmArticleController extends CyPaginationController<OpmArticle>
return
CyResultGenUtil
.
builder
(
new
CyPersistModel
(
1
),
CyMessCons
.
MESSAGE_ALERT_SUCCESS
,
CyMessCons
.
MESSAGE_ALERT_ERROR
,
opmArticleServiceImpl
.
findById
(
businessId
));
opmArticleServiceImpl
.
findById
(
businessId
,
"app"
));
}
/**
...
...
src/main/java/org/rcisoft/business/opmArticle/controller/OpmArticleController.java
View file @
b7c0a691
...
...
@@ -103,7 +103,7 @@ public class OpmArticleController extends CyPaginationController<OpmArticle> {
return
CyResultGenUtil
.
builder
(
new
CyPersistModel
(
1
),
CyMessCons
.
MESSAGE_ALERT_SUCCESS
,
CyMessCons
.
MESSAGE_ALERT_ERROR
,
opmArticleServiceImpl
.
findById
(
businessId
));
opmArticleServiceImpl
.
findById
(
businessId
,
"web"
));
}
@PreAuthorize
(
"@cyPerm.hasPerm('cms:opmArticle:query')"
)
...
...
src/main/java/org/rcisoft/business/opmArticle/dao/OpmArticleRepository.java
View file @
b7c0a691
...
...
@@ -37,9 +37,12 @@ public interface OpmArticleRepository extends CyBaseMapper<OpmArticle> {
OpmArticle
selectArticleDetail
(
@Param
(
"articleId"
)
Integer
articleId
,
@Param
(
"loginUserId"
)
String
loginUserId
);
//查询评论
//
web
查询评论
List
<
ArticleCommentVO
>
selectArticleComment
(
@Param
(
"articleId"
)
Integer
articleId
,
@Param
(
"loginUserId"
)
String
loginUserId
);
//app查询评论
List
<
ArticleCommentVO
>
appSelectArticleComment
(
@Param
(
"articleId"
)
Integer
articleId
,
@Param
(
"loginUserId"
)
String
loginUserId
);
//查询评论下的子评论
List
<
ArticleCommentVO
>
selectArticleChildrenComment
(
@Param
(
"articleId"
)
Integer
articleId
,
@Param
(
"parentId"
)
Integer
parentId
,
@Param
(
"loginUserId"
)
String
loginUserId
);
...
...
@@ -75,5 +78,8 @@ public interface OpmArticleRepository extends CyBaseMapper<OpmArticle> {
//查询某个人的动态列表
IPage
<
OpmArticle
>
queryUserArticlePaged
(
CyPageInfo
cyPageInfo
,
@Param
(
"entity"
)
OpmArticle
opmArticle
);
//根据id查询评论信息
ArticleCommentDTO
findCommentById
(
Integer
businessId
);
}
src/main/java/org/rcisoft/business/opmArticle/entity/ArticleCommentDTO.java
View file @
b7c0a691
...
...
@@ -28,4 +28,6 @@ public class ArticleCommentDTO {
private
String
examStatus
;
//备注
private
String
remarks
;
//评论id
private
Integer
commentId
;
}
src/main/java/org/rcisoft/business/opmArticle/service/OpmArticleService.java
View file @
b7c0a691
...
...
@@ -48,7 +48,7 @@ public interface OpmArticleService {
* @param id
* @return
*/
OpmArticle
findById
(
Integer
id
);
OpmArticle
findById
(
Integer
id
,
String
type
);
/**
* 分页查询 opmArticle管理
...
...
src/main/java/org/rcisoft/business/opmArticle/service/impl/OpmArticleServiceImpl.java
View file @
b7c0a691
...
...
@@ -247,19 +247,34 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
* @return
*/
@Override
public
OpmArticle
findById
(
Integer
articleId
){
String
loginUserId
=
CyUserUtil
.
getAuthenBusinessId
();
//根据动态id 查询动态详情
OpmArticle
opmArticle
=
baseMapper
.
selectArticleDetail
(
articleId
,
loginUserId
);
//查询该动态的评论
List
<
ArticleCommentVO
>
list
=
baseMapper
.
selectArticleComment
(
opmArticle
.
getBusinessId
(),
loginUserId
);
list
.
forEach
(
item
->
{
//查询该条评论下的子评论
List
<
ArticleCommentVO
>
childrenCommentList
=
baseMapper
.
selectArticleChildrenComment
(
opmArticle
.
getBusinessId
(),
item
.
getBusinessId
(),
loginUserId
);
item
.
setChildrenCommentList
(
childrenCommentList
);
});
opmArticle
.
setArticleCommentVOList
(
list
);
return
opmArticle
;
public
OpmArticle
findById
(
Integer
articleId
,
String
type
){
if
(
type
.
equals
(
"app"
)){
String
loginUserId
=
CyUserUtil
.
getAuthenBusinessId
();
//根据动态id 查询动态详情
OpmArticle
opmArticle
=
baseMapper
.
selectArticleDetail
(
articleId
,
loginUserId
);
//查询该动态的评论
List
<
ArticleCommentVO
>
list
=
baseMapper
.
appSelectArticleComment
(
opmArticle
.
getBusinessId
(),
loginUserId
);
list
.
forEach
(
item
->
{
//查询该条评论下的子评论
List
<
ArticleCommentVO
>
childrenCommentList
=
baseMapper
.
selectArticleChildrenComment
(
opmArticle
.
getBusinessId
(),
item
.
getBusinessId
(),
loginUserId
);
item
.
setChildrenCommentList
(
childrenCommentList
);
});
opmArticle
.
setArticleCommentVOList
(
list
);
return
opmArticle
;
}
else
{
String
loginUserId
=
CyUserUtil
.
getAuthenBusinessId
();
//根据动态id 查询动态详情
OpmArticle
opmArticle
=
baseMapper
.
selectArticleDetail
(
articleId
,
loginUserId
);
//查询该动态的评论
List
<
ArticleCommentVO
>
list
=
baseMapper
.
selectArticleComment
(
opmArticle
.
getBusinessId
(),
loginUserId
);
list
.
forEach
(
item
->
{
//查询该条评论下的子评论
List
<
ArticleCommentVO
>
childrenCommentList
=
baseMapper
.
selectArticleChildrenComment
(
opmArticle
.
getBusinessId
(),
item
.
getBusinessId
(),
loginUserId
);
item
.
setChildrenCommentList
(
childrenCommentList
);
});
opmArticle
.
setArticleCommentVOList
(
list
);
return
opmArticle
;
}
}
/**
...
...
@@ -504,7 +519,18 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
String
nowDate
=
now
.
format
(
formatter
);
//获取动态创建时间
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
createDate
=
sdf
.
format
(
dto
.
getCreateDate
());
//根据parentId查询需要回复的评论信息
ArticleCommentDTO
comment
=
baseMapper
.
findCommentById
(
dto
.
getCommentId
());
String
createDate
=
""
;
//动态创建时间
Integer
commentedUserId
=
null
;
//被评论人id
if
(
comment
==
null
){
//发的是第一级评论
createDate
=
sdf
.
format
(
new
Date
());
commentedUserId
=
Integer
.
valueOf
(
userId
);
}
else
{
createDate
=
String
.
valueOf
(
comment
.
getCreateDate
());
commentedUserId
=
comment
.
getCreateBy
();
}
try
{
//计算当前时间和动态创建时间的秒数差
long
timeSeconds
=
TimeUtil
.
getTimeSecond
(
createDate
,
nowDate
);
...
...
@@ -535,9 +561,11 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
dto
.
setExamStatus
(
"3"
);
dto
.
setRemarks
(
msg
.
toString
());
}
}
else
{
dto
.
setExamStatus
(
"0"
);
}
//4、校验通过 进行插入评论数据
dto
.
setCommentedUserId
(
Integer
.
valueOf
(
CyUserUtil
.
getAuthenBusinessId
())
);
dto
.
setCommentedUserId
(
commentedUserId
);
dto
.
setCreateDate
(
new
Date
());
dto
.
setUpdateDate
(
new
Date
());
dto
.
setCreateBy
(
Integer
.
valueOf
(
CyUserUtil
.
getAuthenBusinessId
()));
...
...
src/main/resources/mapper/business/opmArticle/mapper/OpmArticleMapper.xml
View file @
b7c0a691
...
...
@@ -392,13 +392,41 @@
AND opc.del_flag = '0'
AND opc.parent_id is null
AND opc.article_id = #{articleId}
and opc.exam_status = '1'
AND NOT EXISTS (
SELECT 1 FROM opm_black_list obl
WHERE (obl.user_id = #{loginUserId} AND obl.target_id = opc.user_id)
OR (obl.user_id = opc.user_id AND obl.target_id = #{loginUserId})
)
</select>
<select
id=
"appSelectArticleComment"
resultType=
"org.rcisoft.business.opmArticle.entity.ArticleCommentVO"
>
SELECT opc.business_id,
opc.content,
opc.parent_id,
opc.create_date,
opc.like_count,
opc.comment_count,
opc.create_by AS userId,
opc.user_id AS commentedUserId,
mi.mem_code as memCode,
mi.mem_nick_name as memNickName,
mi.avatar as avatarId,
CASE
WHEN oal.business_id IS NOT NULL THEN 1 ELSE 0
END AS isLike
FROM opm_article_comment opc
LEFT JOIN mem_info mi ON mi.user_id = opc.create_by
LEFT JOIN opm_article_like oal on oal.comment_id = opc.business_id and oal.user_id = #{loginUserId}
WHERE 1 = 1
AND opc.del_flag = '0'
AND opc.parent_id is null
AND opc.article_id = #{articleId}
and opc.exam_status = '1'
AND NOT EXISTS (
SELECT 1 FROM opm_black_list obl
WHERE (obl.user_id = #{loginUserId} AND obl.target_id = opc.user_id)
OR (obl.user_id = opc.user_id AND obl.target_id = #{loginUserId})
)
</select>
<select
id=
"selectArticleChildrenComment"
resultType=
"org.rcisoft.business.opmArticle.entity.ArticleCommentVO"
>
SELECT
opc.business_id,
...
...
@@ -431,6 +459,12 @@
OR (obl.user_id = opc.user_id AND obl.target_id = #{loginUserId})
)
</select>
<select
id=
"findCommentById"
resultType=
"org.rcisoft.business.opmArticle.entity.ArticleCommentDTO"
>
select *
from opm_article_comment
where 1=1
and business_id = #{businessId}
</select>
<delete
id=
"deleteComment"
>
update opm_article_comment set del_flag = '1' where business_id = #{businessId}
and del_flag = '0'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment