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
d3cd8262
Commit
d3cd8262
authored
Mar 07, 2025
by
罗林杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改评论审核
parent
0db01793
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
8 deletions
+66
-8
OpmArticleController.java
.../business/opmArticle/controller/OpmArticleController.java
+1
-1
OpmArticleRepository.java
...rcisoft/business/opmArticle/dao/OpmArticleRepository.java
+3
-0
OpmArticleServiceImpl.java
...siness/opmArticle/service/impl/OpmArticleServiceImpl.java
+25
-2
OpmArticleMapper.xml
...es/mapper/business/opmArticle/mapper/OpmArticleMapper.xml
+37
-5
No files found.
src/main/java/org/rcisoft/business/opmArticle/controller/OpmArticleController.java
View file @
d3cd8262
...
@@ -146,7 +146,7 @@ public class OpmArticleController extends CyPaginationController<OpmArticle> {
...
@@ -146,7 +146,7 @@ public class OpmArticleController extends CyPaginationController<OpmArticle> {
*/
*/
@PreAuthorize
(
"@cyPerm.hasPerm('cms:opmArticle:delete')"
)
@PreAuthorize
(
"@cyPerm.hasPerm('cms:opmArticle:delete')"
)
@DeleteMapping
(
"/deleteComment/{businessId:\\w+}"
)
@DeleteMapping
(
"/deleteComment/{businessId:\\w+}"
)
public
CyResult
deleteComment
(
@PathVariable
String
businessId
,
ArticleCommentDTO
dto
)
{
public
CyResult
deleteComment
(
@PathVariable
String
businessId
,
@RequestBody
ArticleCommentDTO
dto
)
{
dto
.
setBusinessId
(
Integer
.
valueOf
(
businessId
));
dto
.
setBusinessId
(
Integer
.
valueOf
(
businessId
));
CyPersistModel
data
=
opmArticleServiceImpl
.
removeComment
(
dto
,
"web"
);
CyPersistModel
data
=
opmArticleServiceImpl
.
removeComment
(
dto
,
"web"
);
return
CyResultGenUtil
.
builder
(
data
,
return
CyResultGenUtil
.
builder
(
data
,
...
...
src/main/java/org/rcisoft/business/opmArticle/dao/OpmArticleRepository.java
View file @
d3cd8262
...
@@ -46,6 +46,9 @@ public interface OpmArticleRepository extends CyBaseMapper<OpmArticle> {
...
@@ -46,6 +46,9 @@ public interface OpmArticleRepository extends CyBaseMapper<OpmArticle> {
//app查询评论
//app查询评论
List
<
ArticleCommentVO
>
appSelectArticleComment
(
@Param
(
"articleId"
)
Integer
articleId
,
@Param
(
"loginUserId"
)
String
loginUserId
);
List
<
ArticleCommentVO
>
appSelectArticleComment
(
@Param
(
"articleId"
)
Integer
articleId
,
@Param
(
"loginUserId"
)
String
loginUserId
);
//查询评论下的子评论
List
<
ArticleCommentVO
>
appSelectArticleChildrenComment
(
@Param
(
"articleId"
)
Integer
articleId
,
@Param
(
"parentId"
)
Integer
parentId
,
@Param
(
"loginUserId"
)
String
loginUserId
);
//查询评论下的子评论
//查询评论下的子评论
List
<
ArticleCommentVO
>
selectArticleChildrenComment
(
@Param
(
"articleId"
)
Integer
articleId
,
@Param
(
"parentId"
)
Integer
parentId
,
@Param
(
"loginUserId"
)
String
loginUserId
);
List
<
ArticleCommentVO
>
selectArticleChildrenComment
(
@Param
(
"articleId"
)
Integer
articleId
,
@Param
(
"parentId"
)
Integer
parentId
,
@Param
(
"loginUserId"
)
String
loginUserId
);
...
...
src/main/java/org/rcisoft/business/opmArticle/service/impl/OpmArticleServiceImpl.java
View file @
d3cd8262
...
@@ -322,7 +322,7 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
...
@@ -322,7 +322,7 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
List
<
ArticleCommentVO
>
list
=
baseMapper
.
appSelectArticleComment
(
opmArticle
.
getBusinessId
(),
loginUserId
);
List
<
ArticleCommentVO
>
list
=
baseMapper
.
appSelectArticleComment
(
opmArticle
.
getBusinessId
(),
loginUserId
);
list
.
forEach
(
item
->
{
list
.
forEach
(
item
->
{
//查询该条评论下的子评论
//查询该条评论下的子评论
List
<
ArticleCommentVO
>
childrenCommentList
=
baseMapper
.
s
electArticleChildrenComment
(
opmArticle
.
getBusinessId
(),
item
.
getBusinessId
(),
loginUserId
);
List
<
ArticleCommentVO
>
childrenCommentList
=
baseMapper
.
appS
electArticleChildrenComment
(
opmArticle
.
getBusinessId
(),
item
.
getBusinessId
(),
loginUserId
);
item
.
setChildrenCommentList
(
childrenCommentList
);
item
.
setChildrenCommentList
(
childrenCommentList
);
});
});
opmArticle
.
setArticleCommentVOList
(
list
);
opmArticle
.
setArticleCommentVOList
(
list
);
...
@@ -527,8 +527,31 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
...
@@ -527,8 +527,31 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
return
new
CyPersistModel
(
1
);
return
new
CyPersistModel
(
1
);
}
else
{
}
else
{
//web端
//web端
dto
.
setDelFlag
(
"1"
);
ArticleCommentVO
comment
=
baseMapper
.
selectCommentById
(
dto
.
getBusinessId
());
//删除评论
int
line
=
baseMapper
.
deleteComment
(
dto
);
int
line
=
baseMapper
.
deleteComment
(
dto
);
int
childrenCommentCount
=
0
;
OpmArticle
article
=
new
OpmArticle
();
article
.
setBusinessId
(
dto
.
getArticleId
());
if
(
dto
.
getParentId
()
!=
null
){
if
(
comment
.
getExamStatus
().
equals
(
"1"
)){
//删除的子评论 需要减掉父评论的数量
baseMapper
.
reduceCommentCount
(
dto
.
getParentId
());
article
.
setCommentCount
(
1
);
}
}
else
{
if
(
comment
.
getExamStatus
().
equals
(
"1"
)){
//删除的是父评论 要查父评论下的子评论数量
ArticleCommentVO
vo
=
new
ArticleCommentVO
();
vo
.
setParentId
(
dto
.
getBusinessId
());
Integer
count
=
baseMapper
.
selectArticleChildrenCommentCount
(
vo
);
childrenCommentCount
=
count
;
article
.
setCommentCount
(
childrenCommentCount
+
1
);
}
}
if
(
comment
.
getExamStatus
().
equals
(
"1"
)){
baseMapper
.
updateArticleCommentCountById
(
article
);
}
return
new
CyPersistModel
(
1
);
return
new
CyPersistModel
(
1
);
}
}
}
}
...
...
src/main/resources/mapper/business/opmArticle/mapper/OpmArticleMapper.xml
View file @
d3cd8262
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
<update
id=
"updateCommentById"
>
<update
id=
"updateCommentById"
>
UPDATE opm_article_comment
UPDATE opm_article_comment
SET comment_count = #{entity.commentCount}
SET comment_count = #{entity.commentCount}
WHERE business_id = #{entity.
business
Id};
WHERE business_id = #{entity.
parent
Id};
</update>
</update>
<update
id=
"updateArticleCommentCountById"
>
<update
id=
"updateArticleCommentCountById"
>
UPDATE opm_article
UPDATE opm_article
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
WHERE 1=1
WHERE 1=1
and opa.del_flag = '0'
and opa.del_flag = '0'
and opa.flag = '1'
and opa.flag = '1'
and opa.exam_status
= '1'
and opa.exam_status
in ('1', '4')
and opa.is_article = '1'
and opa.is_article = '1'
and opa.create_by not in (
and opa.create_by not in (
select obl.target_id
select obl.target_id
...
@@ -345,7 +345,7 @@
...
@@ -345,7 +345,7 @@
WHERE 1=1
WHERE 1=1
and opa.del_flag = '0'
and opa.del_flag = '0'
and opa.flag = '1'
and opa.flag = '1'
and opa.exam_status
= '1'
and opa.exam_status
in ('1', '4')
and opa.create_by not in (
and opa.create_by not in (
select obl.target_id
select obl.target_id
from opm_black_list obl
from opm_black_list obl
...
@@ -401,7 +401,7 @@
...
@@ -401,7 +401,7 @@
WHERE 1=1
WHERE 1=1
and opa.del_flag = '0'
and opa.del_flag = '0'
and opa.flag = '1'
and opa.flag = '1'
and opa.exam_status
= '1'
and opa.exam_status
in ('1', '4')
and opa.is_article = '0'
and opa.is_article = '0'
and opa.create_by not in (
and opa.create_by not in (
select obl.target_id
select obl.target_id
...
@@ -665,7 +665,7 @@
...
@@ -665,7 +665,7 @@
AND opc.create_by = #{loginUserId}
AND opc.create_by = #{loginUserId}
)
)
</select>
</select>
<select
id=
"
s
electArticleChildrenComment"
resultType=
"org.rcisoft.business.opmArticle.entity.ArticleCommentVO"
>
<select
id=
"
appS
electArticleChildrenComment"
resultType=
"org.rcisoft.business.opmArticle.entity.ArticleCommentVO"
>
SELECT
SELECT
opc.business_id,
opc.business_id,
opc.content,
opc.content,
...
@@ -727,6 +727,38 @@
...
@@ -727,6 +727,38 @@
and opc.create_by = #{loginUserId}
and opc.create_by = #{loginUserId}
)
)
</select>
</select>
<select
id=
"selectArticleChildrenComment"
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,
mi2.mem_code as commentedMemCode,
mi2.mem_nick_name as commentedMemNickName,
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 mem_info mi2 ON mi2.user_id = opc.user_id
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.article_id = #{articleId}
and opc.parent_id = #{parentId}
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=
"findCommentById"
resultType=
"org.rcisoft.business.opmArticle.entity.ArticleCommentDTO"
>
<select
id=
"findCommentById"
resultType=
"org.rcisoft.business.opmArticle.entity.ArticleCommentDTO"
>
select *
select *
from opm_article_comment
from opm_article_comment
...
...
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